From 51508fc5907312e221db5ccc69032eca35dcda6b Mon Sep 17 00:00:00 2001 From: nxqbao Date: Thu, 20 Apr 2023 15:31:51 +0700 Subject: [PATCH 01/10] remove cooldown when undelegate for renouncing candidate --- contracts/ronin/staking/DelegatorStaking.sol | 10 +++++++++- test/staking/Staking.test.ts | 16 ++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/contracts/ronin/staking/DelegatorStaking.sol b/contracts/ronin/staking/DelegatorStaking.sol index becd47c12..37e6d3fc5 100644 --- a/contracts/ronin/staking/DelegatorStaking.sol +++ b/contracts/ronin/staking/DelegatorStaking.sol @@ -150,7 +150,15 @@ abstract contract DelegatorStaking is BaseStaking, IDelegatorStaking { ) private notPoolAdmin(_pool, _delegator) { if (_amount == 0) revert ErrUndelegateZeroAmount(); if (_pool.delegatingAmount[_delegator] < _amount) revert ErrInsufficientDelegatingAmount(); - if (_pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp) { + + bool _candidateRenounced; + if (_validatorContract.isValidatorCandidate(_pool.addr)) { + _candidateRenounced = _validatorContract.getCandidateInfo(_pool.addr).revokingTimestamp != 0; + } + + if ( + !_candidateRenounced && _pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp + ) { revert ErrUndelegateTooEarly(); } diff --git a/test/staking/Staking.test.ts b/test/staking/Staking.test.ts index b26556470..ed5f8b7e7 100644 --- a/test/staking/Staking.test.ts +++ b/test/staking/Staking.test.ts @@ -498,5 +498,21 @@ describe('Staking test', () => { ) ).eql([0, 1].map(BigNumber.from)); }); + + it('Should be able to delegate for a renouncing candidate', async () => { + await stakingContract.connect(poolAddrSet.poolAdmin).requestRenounce(poolAddrSet.consensusAddr.address); + await stakingContract.connect(userA).delegate(poolAddrSet.consensusAddr.address, { value: 2 }); + expect(await stakingContract.getStakingAmount(poolAddrSet.consensusAddr.address, userA.address)).eq(2); + }); + + it('Should be able to undelegate for a renouncing candidate without waiting for cooldown', async () => { + let tx = await stakingContract.connect(userA).undelegate(poolAddrSet.consensusAddr.address, 1); + await expect(tx).not.revertedWithCustomError(stakingContract, 'ErrUndelegateTooEarly'); + expect(await stakingContract.getStakingAmount(poolAddrSet.consensusAddr.address, userA.address)).eq(1); + + await network.provider.send('evm_increaseTime', [cooldownSecsToUndelegate + 1]); + await stakingContract.connect(userA).undelegate(poolAddrSet.consensusAddr.address, 1); + expect(await stakingContract.getStakingAmount(poolAddrSet.consensusAddr.address, userA.address)).eq(0); + }); }); }); From b2aef22944165b391cc3f39805166027e46c851c Mon Sep 17 00:00:00 2001 From: nxqbao Date: Fri, 21 Apr 2023 12:31:42 +0700 Subject: [PATCH 02/10] fix maintenance elapsed check --- contracts/ronin/Maintenance.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/ronin/Maintenance.sol b/contracts/ronin/Maintenance.sol index e429af0dc..1c62c68e6 100644 --- a/contracts/ronin/Maintenance.sol +++ b/contracts/ronin/Maintenance.sol @@ -98,9 +98,9 @@ contract Maintenance is IMaintenance, HasValidatorContract, Initializable { "Maintenance: start block is out of offset" ); require(_startedAtBlock < _endedAtBlock, "Maintenance: start block must be less than end block"); - uint256 _blockPeriod = _endedAtBlock - _startedAtBlock; + uint256 _maintenanceElapsed = _endedAtBlock - _startedAtBlock + 1; require( - _blockPeriod.inRange(minMaintenanceDurationInBlock, maxMaintenanceDurationInBlock), + _maintenanceElapsed.inRange(minMaintenanceDurationInBlock, maxMaintenanceDurationInBlock), "Maintenance: invalid maintenance duration" ); require(_validator.epochEndingAt(_startedAtBlock - 1), "Maintenance: start block is not at the start of an epoch"); From 741d97834dd722653b7415f5ab116046651cdddd Mon Sep 17 00:00:00 2001 From: nxqbao Date: Fri, 21 Apr 2023 12:33:08 +0700 Subject: [PATCH 03/10] fix test --- test/maintainance/Maintenance.test.ts | 50 ++++++++++++++++++++------- 1 file changed, 37 insertions(+), 13 deletions(-) diff --git a/test/maintainance/Maintenance.test.ts b/test/maintainance/Maintenance.test.ts index 47d4d1d31..e2dc7054e 100644 --- a/test/maintainance/Maintenance.test.ts +++ b/test/maintainance/Maintenance.test.ts @@ -44,7 +44,7 @@ let snapshotId: string; const unavailabilityTier1Threshold = 50; const unavailabilityTier2Threshold = 150; const maxValidatorNumber = 4; -const numberOfBlocksInEpoch = 600; +const numberOfBlocksInEpoch = 50; const minValidatorStakingAmount = BigNumber.from(100); const minMaintenanceDurationInBlock = 100; const maxMaintenanceDurationInBlock = 1000; @@ -154,7 +154,7 @@ describe('Maintenance test', () => { currentBlock = (await ethers.provider.getBlockNumber()) + 1; }); - it('Should be not able to schedule maintenance with invalid start block', async () => { + it('Should not be able to schedule maintenance with invalid start block', async () => { startedAtBlock = 0; endedAtBlock = 100; expect(startedAtBlock - currentBlock).lt(minOffsetToStartSchedule); @@ -183,7 +183,7 @@ describe('Maintenance test', () => { ).revertedWith('Maintenance: start block is out of offset'); }); - it('Should be not able to schedule maintenance in case of: start block >= end block', async () => { + it('Should not be able to schedule maintenance in case of: start block >= end block', async () => { startedAtBlock = currentBlock + minOffsetToStartSchedule; endedAtBlock = currentBlock; expect(endedAtBlock).lte(startedAtBlock); @@ -202,7 +202,7 @@ describe('Maintenance test', () => { ).revertedWith('Maintenance: start block must be less than end block'); }); - it('Should be not able to schedule maintenance when the maintenance period is too small or large', async () => { + it('Should not be able to schedule maintenance when the maintenance period is too small or large', async () => { endedAtBlock = BigNumber.from(startedAtBlock).add(1); expect(endedAtBlock.sub(startedAtBlock)).lt(minMaintenanceDurationInBlock); await expect( @@ -220,7 +220,7 @@ describe('Maintenance test', () => { ).revertedWith('Maintenance: invalid maintenance duration'); }); - it('Should be not able to schedule maintenance when the start block is not at the start of an epoch', async () => { + it('Should not be able to schedule maintenance when the start block is not at the start of an epoch', async () => { startedAtBlock = localEpochController.calculateStartOfEpoch(currentBlock).add(1); endedAtBlock = localEpochController.calculateEndOfEpoch(startedAtBlock.add(minMaintenanceDurationInBlock)); @@ -233,7 +233,7 @@ describe('Maintenance test', () => { ).revertedWith('Maintenance: start block is not at the start of an epoch'); }); - it('Should be not able to schedule maintenance when the end block is not at the end of an epoch', async () => { + it('Should not be able to schedule maintenance when the end block is not at the end of an epoch', async () => { currentBlock = (await ethers.provider.getBlockNumber()) + 1; startedAtBlock = localEpochController.calculateStartOfEpoch(currentBlock); endedAtBlock = localEpochController.calculateEndOfEpoch(startedAtBlock.add(minMaintenanceDurationInBlock)).add(1); @@ -264,9 +264,11 @@ describe('Maintenance test', () => { it('Should be able to schedule maintenance using validator admin account', async () => { currentBlock = (await ethers.provider.getBlockNumber()) + 1; startedAtBlock = localEpochController.calculateStartOfEpoch(currentBlock).add(numberOfBlocksInEpoch); - endedAtBlock = localEpochController.calculateEndOfEpoch( - BigNumber.from(startedAtBlock).add(minMaintenanceDurationInBlock) - ); + endedAtBlock = localEpochController + .calculateEndOfEpoch(BigNumber.from(startedAtBlock)) + .add( + BigNumber.from(minMaintenanceDurationInBlock).div(numberOfBlocksInEpoch).sub(1).mul(numberOfBlocksInEpoch) + ); const tx = await maintenanceContract .connect(validatorCandidates[0].candidateAdmin) @@ -277,6 +279,10 @@ describe('Maintenance test', () => { expect(await maintenanceContract.checkScheduled(validatorCandidates[0].consensusAddr.address)).true; }); + it('Should the maintenance elapsed blocks equal to min maintenance duration', async () => { + expect(BigNumber.from(endedAtBlock).sub(startedAtBlock).add(1)).eq(minMaintenanceDurationInBlock); + }); + it('Should not be able to schedule maintenance again', async () => { await expect( maintenanceContract @@ -302,12 +308,18 @@ describe('Maintenance test', () => { it('Should the validator still appear in the block producer list since it is not maintenance time yet', async () => { await localEpochController.mineToBeforeEndOfEpoch(); let tx = await validatorContract.connect(coinbase).wrapUpEpoch(); + + currentBlock = (await ethers.provider.getBlockNumber()) + 1; expect(await validatorContract.getBlockProducers()).eql(validatorCandidates.map((_) => _.consensusAddr.address)); }); it('Should the validator not appear in the block producer list since the maintenance is started', async () => { - await localEpochController.mineToBeforeEndOfEpoch(); + await localEpochController.mineToBeforeEndOfEpoch( + BigNumber.from(minOffsetToStartSchedule).div(numberOfBlocksInEpoch).add(1) + ); let tx = await validatorContract.connect(coinbase).wrapUpEpoch(); + + currentBlock = (await ethers.provider.getBlockNumber()) + 1; let expectingBlockProducerSet = validatorCandidates.slice(2).map((_) => _.consensusAddr.address); await ValidatorSetExpects.emitBlockProducerSetUpdatedEvent( tx!, @@ -328,7 +340,9 @@ describe('Maintenance test', () => { }); it('Should the validator appear in the block producer list since the maintenance time is ended', async () => { - await localEpochController.mineToBeforeEndOfEpoch(); + await localEpochController.mineToBeforeEndOfEpoch( + BigNumber.from(minMaintenanceDurationInBlock).div(numberOfBlocksInEpoch) + ); let tx = await validatorContract.connect(coinbase).wrapUpEpoch(); let expectingBlockProducerSet = validatorCandidates.map((_) => _.consensusAddr.address); await ValidatorSetExpects.emitBlockProducerSetUpdatedEvent( @@ -360,11 +374,19 @@ describe('Maintenance test', () => { currentBlock = (await ethers.provider.getBlockNumber()) + 1; startedAtBlock = localEpochController.calculateStartOfEpoch(currentBlock); - endedAtBlock = localEpochController.calculateEndOfEpoch(startedAtBlock); + endedAtBlock = localEpochController + .calculateEndOfEpoch(BigNumber.from(startedAtBlock)) + .add( + BigNumber.from(maxMaintenanceDurationInBlock).div(numberOfBlocksInEpoch).sub(1).mul(numberOfBlocksInEpoch) + ); await maintenanceContract .connect(validatorCandidates[0].candidateAdmin) .schedule(validatorCandidates[0].consensusAddr.address, startedAtBlock, endedAtBlock); }); + + it('Should the maintenance elapsed blocks equal to max maintenance duration', async () => { + expect(BigNumber.from(endedAtBlock).sub(startedAtBlock).add(1)).eq(maxMaintenanceDurationInBlock); + }); }); describe('Cancel schedule test', () => { @@ -378,7 +400,9 @@ describe('Maintenance test', () => { it('Should the admin not be able to cancel the schedule when maintenance starts', async () => { snapshotId = await network.provider.send('evm_snapshot'); - await localEpochController.mineToBeforeEndOfEpoch(); + await localEpochController.mineToBeforeEndOfEpoch( + BigNumber.from(minOffsetToStartSchedule).div(numberOfBlocksInEpoch).add(1) + ); await validatorContract.connect(coinbase).wrapUpEpoch(); await expect( From 933bed051b237d620919bc136bd234f1c516f769 Mon Sep 17 00:00:00 2001 From: nxqbao Date: Fri, 21 Apr 2023 15:06:32 +0700 Subject: [PATCH 04/10] fix assertion: remove cooldown on non-candidate --- contracts/ronin/staking/DelegatorStaking.sol | 13 ++++-------- test/staking/Staking.test.ts | 22 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 9 deletions(-) diff --git a/contracts/ronin/staking/DelegatorStaking.sol b/contracts/ronin/staking/DelegatorStaking.sol index 37e6d3fc5..08eab5cb9 100644 --- a/contracts/ronin/staking/DelegatorStaking.sol +++ b/contracts/ronin/staking/DelegatorStaking.sol @@ -151,16 +151,11 @@ abstract contract DelegatorStaking is BaseStaking, IDelegatorStaking { if (_amount == 0) revert ErrUndelegateZeroAmount(); if (_pool.delegatingAmount[_delegator] < _amount) revert ErrInsufficientDelegatingAmount(); - bool _candidateRenounced; - if (_validatorContract.isValidatorCandidate(_pool.addr)) { - _candidateRenounced = _validatorContract.getCandidateInfo(_pool.addr).revokingTimestamp != 0; - } - if ( - !_candidateRenounced && _pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp - ) { - revert ErrUndelegateTooEarly(); - } + _validatorContract.isValidatorCandidate(_pool.addr) && + _validatorContract.getCandidateInfo(_pool.addr).revokingTimestamp == 0 && // if candidate is not on renunciation + _pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp // delegator is still in cooldown + ) revert ErrUndelegateTooEarly(); _changeDelegatingAmount( _pool, diff --git a/test/staking/Staking.test.ts b/test/staking/Staking.test.ts index ed5f8b7e7..03b6273a0 100644 --- a/test/staking/Staking.test.ts +++ b/test/staking/Staking.test.ts @@ -353,6 +353,7 @@ describe('Staking test', () => { }); describe('Delegator test', () => { + let increaseTimeOffset: number; before(() => { otherPoolAddrSet = validatorCandidates[1]; anotherActivePoolSet = validatorCandidates[2]; @@ -514,5 +515,26 @@ describe('Staking test', () => { await stakingContract.connect(userA).undelegate(poolAddrSet.consensusAddr.address, 1); expect(await stakingContract.getStakingAmount(poolAddrSet.consensusAddr.address, userA.address)).eq(0); }); + + it('Should be able to delegate for a renouncing candidate #2', async () => { + increaseTimeOffset = 86400; + await network.provider.send('evm_increaseTime', [ + waitingSecsToRevoke - (cooldownSecsToUndelegate + 1) - increaseTimeOffset, + ]); // wrap up epoch before revoking time + await validatorContract.wrapUpEpoch(); + expect(await validatorContract.isValidatorCandidate(poolAddrSet.consensusAddr.address)).eq(true); + + await stakingContract.connect(userB).delegate(poolAddrSet.consensusAddr.address, { value: 2 }); + expect(await stakingContract.getStakingAmount(poolAddrSet.consensusAddr.address, userB.address)).eq(3); + }); + + it('Should be able to undelegate for revoked candidate without waiting for cooldown', async () => { + await network.provider.send('evm_increaseTime', [increaseTimeOffset]); // wrap up after before revoking time + await validatorContract.wrapUpEpoch(); + expect(await validatorContract.isValidatorCandidate(poolAddrSet.consensusAddr.address)).eq(false); + + await stakingContract.connect(userB).undelegate(poolAddrSet.consensusAddr.address, 2); + expect(await stakingContract.getStakingAmount(poolAddrSet.consensusAddr.address, userB.address)).eq(1); + }); }); }); From e599ce9db0232fa52851a1a6e31f84b1967005b1 Mon Sep 17 00:00:00 2001 From: Duc Tho Tran Date: Mon, 15 May 2023 08:03:44 +0700 Subject: [PATCH 05/10] [Validator|Staking] Add min commission rate (#215) * [Validator|Staking] Add min commission rate * [Staking] Check condition * remove resetEmergency * [Staking] add test case for min commission rate * [Staking] recover min conmission rate to 0 at the end of test case * [staking] remove at staking test case * [RoninValidatorSet-Candidate] Add test case to check min commission rate for apply validator candidate function --------- Co-authored-by: nxqbao Co-authored-by: Huy Huynh <19127420@student.hcmus.edu.vn> --- .gitignore | 1 + .../interfaces/staking/ICandidateStaking.sol | 14 ++--- contracts/ronin/gateway/PauseEnforcer.sol | 11 ---- contracts/ronin/staking/CandidateStaking.sol | 25 ++++---- contracts/ronin/staking/Staking.sol | 2 +- .../ronin/validator/CoinbaseExecution.sol | 4 +- test/staking/Staking.test.ts | 35 ++++++++++- .../RoninValidatorSet-Candidate.test.ts | 60 ++++++++++++++++++- 8 files changed, 114 insertions(+), 38 deletions(-) diff --git a/.gitignore b/.gitignore index 7b1e7d27e..3d0d2c057 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ refs/ .vscode remix-compiler.config.js foundry +.npmrc diff --git a/contracts/interfaces/staking/ICandidateStaking.sol b/contracts/interfaces/staking/ICandidateStaking.sol index e84247b40..7b7bd08f1 100644 --- a/contracts/interfaces/staking/ICandidateStaking.sol +++ b/contracts/interfaces/staking/ICandidateStaking.sol @@ -7,8 +7,8 @@ import "./IRewardPool.sol"; interface ICandidateStaking is IRewardPool { /// @dev Emitted when the minimum staking amount for being a validator is updated. event MinValidatorStakingAmountUpdated(uint256 threshold); - /// @dev Emitted when the max commission rate is updated. - event MaxCommissionRateUpdated(uint256 maxRate); + /// @dev Emitted when the commission rate range is updated. + event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate); /// @dev Emitted when the pool admin staked for themself. event Staked(address indexed consensuAddr, uint256 amount); @@ -57,9 +57,9 @@ interface ICandidateStaking is IRewardPool { function minValidatorStakingAmount() external view returns (uint256); /** - * @dev Returns the max commission rate that the candidate can set. + * @dev Returns the commission rate range that the candidate can set. */ - function maxCommissionRate() external view returns (uint256); + function getCommissionRateRange() external view returns (uint256 _minRange, uint256 _maxRange); /** * @dev Sets the minimum threshold for being a validator candidate. @@ -73,15 +73,15 @@ interface ICandidateStaking is IRewardPool { function setMinValidatorStakingAmount(uint256) external; /** - * @dev Sets the max commission rate that a candidate can set. + * @dev Sets the commission rate range that a candidate can set. * * Requirements: * - The method caller is admin. * - * Emits the `MaxCommissionRateUpdated` event. + * Emits the `CommissionRateRangeUpdated` event. * */ - function setMaxCommissionRate(uint256 _maxRate) external; + function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external; /** * @dev Proposes a candidate to become a validator. diff --git a/contracts/ronin/gateway/PauseEnforcer.sol b/contracts/ronin/gateway/PauseEnforcer.sol index d53da0a16..c3f09e7ae 100644 --- a/contracts/ronin/gateway/PauseEnforcer.sol +++ b/contracts/ronin/gateway/PauseEnforcer.sol @@ -87,17 +87,6 @@ contract PauseEnforcer is AccessControlEnumerable { emit EmergencyUnpaused(msg.sender); } - /** - * @dev Helper function to reset emergency status. - */ - function resetEmergency() external { - require( - hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(SENTRY_ROLE, msg.sender), - "PauseEnforcer: Unauthorized reset" - ); - emergency = false; - } - /** * @dev Setter for `target`. * diff --git a/contracts/ronin/staking/CandidateStaking.sol b/contracts/ronin/staking/CandidateStaking.sol index a33ac96fe..a2342c79f 100644 --- a/contracts/ronin/staking/CandidateStaking.sol +++ b/contracts/ronin/staking/CandidateStaking.sol @@ -14,12 +14,14 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf /// @dev The max commission rate that the validator can set (in range of [0;100_00] means [0-100%]) uint256 internal _maxCommissionRate; + /// @dev The min commission rate that the validator can set (in range of [0;100_00] means [0-100%]) + uint256 internal _minCommissionRate; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. */ - uint256[49] ______gap; + uint256[48] ______gap; /** * @inheritdoc ICandidateStaking @@ -31,8 +33,8 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf /** * @inheritdoc ICandidateStaking */ - function maxCommissionRate() external view override returns (uint256) { - return _maxCommissionRate; + function getCommissionRateRange() external view override returns (uint256, uint256) { + return (_minCommissionRate, _maxCommissionRate); } /** @@ -45,8 +47,8 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf /** * @inheritdoc ICandidateStaking */ - function setMaxCommissionRate(uint256 _maxRate) external override onlyAdmin { - _setMaxCommissionRate(_maxRate); + function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external override onlyAdmin { + _setCommissionRateRange(_minRate, _maxRate); } /** @@ -60,7 +62,7 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf uint256 _commissionRate ) external payable override nonReentrant { if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender); - if (_commissionRate > _maxCommissionRate) revert ErrInvalidCommissionRate(); + if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate(); uint256 _amount = msg.value; address payable _poolAdmin = payable(msg.sender); @@ -91,7 +93,7 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf uint256 _effectiveDaysOnwards, uint256 _commissionRate ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) { - if (_commissionRate > _maxCommissionRate) revert ErrInvalidCommissionRate(); + if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate(); _validatorContract.execRequestUpdateCommissionRate(_consensusAddr, _effectiveDaysOnwards, _commissionRate); } @@ -192,8 +194,6 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf if (!_unsafeSendRON(_poolAdmin, 0)) revert ErrCannotInitTransferRON(_poolAdmin, "pool admin"); if (!_unsafeSendRON(_treasuryAddr, 0)) revert ErrCannotInitTransferRON(_treasuryAddr, "treasury"); if (_amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount(); - if (_commissionRate > _maxCommissionRate) revert ErrInvalidCommissionRate(); - if (_poolAdmin != _candidateAdmin || _candidateAdmin != _treasuryAddr) revert ErrThreeInteractionAddrsNotEqual(); address[] memory _diffAddrs = new address[](3); @@ -269,9 +269,10 @@ abstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConf * Emits the `MaxCommissionRateUpdated` event. * */ - function _setMaxCommissionRate(uint256 _maxRate) internal { - if (_maxRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate(); + function _setCommissionRateRange(uint256 _minRate, uint256 _maxRate) internal { + if (_maxRate > _MAX_PERCENTAGE || _minRate > _maxRate) revert ErrInvalidCommissionRate(); _maxCommissionRate = _maxRate; - emit MaxCommissionRateUpdated(_maxRate); + _minCommissionRate = _minRate; + emit CommissionRateRangeUpdated(_minRate, _maxRate); } } diff --git a/contracts/ronin/staking/Staking.sol b/contracts/ronin/staking/Staking.sol index 14cfa5d40..7743345cd 100644 --- a/contracts/ronin/staking/Staking.sol +++ b/contracts/ronin/staking/Staking.sol @@ -30,7 +30,7 @@ contract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable ) external initializer { _setValidatorContract(__validatorContract); _setMinValidatorStakingAmount(__minValidatorStakingAmount); - _setMaxCommissionRate(__maxCommissionRate); + _setCommissionRateRange(0, __maxCommissionRate); _setCooldownSecsToUndelegate(__cooldownSecsToUndelegate); _setWaitingSecsToRevoke(__waitingSecsToRevoke); } diff --git a/contracts/ronin/validator/CoinbaseExecution.sol b/contracts/ronin/validator/CoinbaseExecution.sol index 7e3f0d764..0b4d7755e 100644 --- a/contracts/ronin/validator/CoinbaseExecution.sol +++ b/contracts/ronin/validator/CoinbaseExecution.sol @@ -80,8 +80,8 @@ abstract contract CoinbaseExecution is } _reward -= _cutOffReward; - uint256 _maxRate = _stakingContract.maxCommissionRate(); - uint256 _rate = Math.min(_candidateInfo[msg.sender].commissionRate, _maxRate); + (uint256 _minRate, uint256 _maxRate) = _stakingContract.getCommissionRateRange(); + uint256 _rate = Math.max(Math.min(_candidateInfo[msg.sender].commissionRate, _maxRate), _minRate); uint256 _miningAmount = (_rate * _reward) / _MAX_PERCENTAGE; _miningReward[msg.sender] += _miningAmount; diff --git a/test/staking/Staking.test.ts b/test/staking/Staking.test.ts index 03b6273a0..bdcd93652 100644 --- a/test/staking/Staking.test.ts +++ b/test/staking/Staking.test.ts @@ -4,7 +4,12 @@ import { expect } from 'chai'; import { BigNumber, BigNumberish, ContractTransaction } from 'ethers'; import { ethers, network } from 'hardhat'; -import { Staking, Staking__factory, TransparentUpgradeableProxyV2__factory } from '../../src/types'; +import { + Staking, + Staking__factory, + TransparentUpgradeableProxyV2, + TransparentUpgradeableProxyV2__factory, +} from '../../src/types'; import { MockValidatorSet__factory } from '../../src/types/factories/MockValidatorSet__factory'; import { StakingVesting__factory } from '../../src/types/factories/StakingVesting__factory'; import { MockValidatorSet } from '../../src/types/MockValidatorSet'; @@ -22,6 +27,7 @@ let otherPoolAddrSet: ValidatorCandidateAddressSet; let anotherActivePoolSet: ValidatorCandidateAddressSet; let sparePoolAddrSet: ValidatorCandidateAddressSet; +let proxyContract: TransparentUpgradeableProxyV2; let validatorContract: MockValidatorSet; let stakingContract: Staking; let signers: SignerWithAddress[]; @@ -35,6 +41,7 @@ const numberOfBlocksInEpoch = 2; const cooldownSecsToUndelegate = 3 * 86400; const waitingSecsToRevoke = 7 * 86400; const maxCommissionRate = 30_00; +const defaultMinCommissionRate = 0; const minEffectiveDaysOnwards = 7; const numberOfCandidate = 4; @@ -58,7 +65,7 @@ describe('Staking test', () => { await validatorContract.deployed(); const logicContract = await new Staking__factory(deployer).deploy(); await logicContract.deployed(); - const proxyContract = await new TransparentUpgradeableProxyV2__factory(deployer).deploy( + proxyContract = await new TransparentUpgradeableProxyV2__factory(deployer).deploy( logicContract.address, proxyAdmin.address, logicContract.interface.encodeFunctionData('initialize', [ @@ -236,6 +243,29 @@ describe('Staking test', () => { ) ).revertedWithCustomError(validatorContract, 'ErrInvalidCommissionRate'); }); + it('Should the pool admin not be able to request updating the commission rate lower than min rate allowed', async () => { + const minCommissionRate = 10_00; + let data = stakingContract.interface.encodeFunctionData('setCommissionRateRange', [ + minCommissionRate, + maxCommissionRate, + ]); + await proxyContract.connect(proxyAdmin).functionDelegateCall(data); + + await expect( + stakingContract + .connect(poolAddrSet.poolAdmin) + .requestUpdateCommissionRate( + poolAddrSet.consensusAddr.address, + minEffectiveDaysOnwards, + minCommissionRate - 1 + ) + ).revertedWithCustomError(stakingContract, 'ErrInvalidCommissionRate'); + data = stakingContract.interface.encodeFunctionData('setCommissionRateRange', [ + defaultMinCommissionRate, + maxCommissionRate, + ]); + await proxyContract.connect(proxyAdmin).functionDelegateCall(data); + }); it('Should the pool admin not be able to request updating the commission rate exceeding max rate', async () => { await expect( @@ -320,7 +350,6 @@ describe('Staking test', () => { await expect(tx) .emit(stakingContract, 'PoolApproved') .withArgs(poolAddrSet.consensusAddr.address, poolAddrSet.poolAdmin.address); - expect( await stakingContract.getStakingAmount(poolAddrSet.consensusAddr.address, poolAddrSet.candidateAdmin.address) ).eq(minValidatorStakingAmount.mul(2)); diff --git a/test/validator/RoninValidatorSet-Candidate.test.ts b/test/validator/RoninValidatorSet-Candidate.test.ts index 0d8b768e5..cff4fdd34 100644 --- a/test/validator/RoninValidatorSet-Candidate.test.ts +++ b/test/validator/RoninValidatorSet-Candidate.test.ts @@ -14,10 +14,11 @@ import { RoninGovernanceAdmin, StakingVesting__factory, StakingVesting, + TransparentUpgradeableProxyV2__factory, } from '../../src/types'; import * as RoninValidatorSet from '../helpers/ronin-validator-set'; -import { mineBatchTxs } from '../helpers/utils'; -import { initTest } from '../helpers/fixture'; +import { getLastBlockTimestamp, mineBatchTxs } from '../helpers/utils'; +import { defaultTestConfig, initTest } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../src/script/governance-admin-interface'; import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; import { @@ -29,6 +30,7 @@ import { WhitelistedCandidateAddressSet, } from '../helpers/address-set-types'; import { anyValue } from '@nomicfoundation/hardhat-chai-matchers/withArgs'; +import { VoteType } from '../../src/script/proposal'; let roninValidatorSet: MockRoninValidatorSetExtended; let stakingVesting: StakingVesting; @@ -66,6 +68,7 @@ const zeroTopUpAmount = 0; const topUpAmount = BigNumber.from(100_000_000_000); const slashDoubleSignAmount = BigNumber.from(2000); const maxCommissionRate = 30_00; // 30% +const defaultMinCommissionRate = 0; describe('Ronin Validator Set: candidate test', () => { before(async () => { @@ -314,6 +317,59 @@ describe('Ronin Validator Set: candidate test', () => { await expect(tx).revertedWithCustomError(stakingContract, 'ErrInvalidCommissionRate'); }); + it('Should not be able to apply for candidate role with commission rate lower than allowed', async () => { + const minCommissionRate = 10_00; + const proposalChanging = await governanceAdminInterface.createProposal( + (await getLastBlockTimestamp()) + + BigNumber.from(defaultTestConfig.governanceAdminArguments?.proposalExpiryDuration).toNumber(), + stakingContract.address, + 0, + governanceAdminInterface.interface.encodeFunctionData('functionDelegateCall', [ + stakingContract.interface.encodeFunctionData('setCommissionRateRange', [ + minCommissionRate, + maxCommissionRate, + ]), + ]), + 500_000 + ); + const signaturesOfChangingProposal = await governanceAdminInterface.generateSignatures(proposalChanging); + const supportsOfSignatureChanging = signaturesOfChangingProposal.map(() => VoteType.For); + await governanceAdmin + .connect(trustedOrgs[0].governor) + .proposeProposalStructAndCastVotes(proposalChanging, supportsOfSignatureChanging, signaturesOfChangingProposal); + let tx = stakingContract + .connect(validatorCandidates[5].poolAdmin) + .applyValidatorCandidate( + validatorCandidates[5].candidateAdmin.address, + validatorCandidates[5].consensusAddr.address, + validatorCandidates[5].treasuryAddr.address, + validatorCandidates[5].bridgeOperator.address, + minCommissionRate - 1, + { + value: minValidatorStakingAmount, + } + ); + + await expect(tx).revertedWithCustomError(stakingContract, 'ErrInvalidCommissionRate'); + const proposalRecover = await governanceAdminInterface.createProposal( + (await getLastBlockTimestamp()) + + BigNumber.from(defaultTestConfig.governanceAdminArguments?.proposalExpiryDuration).toNumber(), + stakingContract.address, + 0, + governanceAdminInterface.interface.encodeFunctionData('functionDelegateCall', [ + stakingContract.interface.encodeFunctionData('setCommissionRateRange', [ + defaultMinCommissionRate, + maxCommissionRate, + ]), + ]), + 500_000 + ); + const signaturesOfRecoverProposal = await governanceAdminInterface.generateSignatures(proposalRecover); + const supportsOfSignaturesRecover = signaturesOfRecoverProposal.map(() => VoteType.For); + await governanceAdmin + .connect(trustedOrgs[0].governor) + .proposeProposalStructAndCastVotes(proposalRecover, supportsOfSignaturesRecover, signaturesOfRecoverProposal); + }); }); describe('Renounce candidate', async () => { From a9222def196c5410f2c7732ab3e95f9993977162 Mon Sep 17 00:00:00 2001 From: minh-bq <97180373+minh-bq@users.noreply.github.com> Date: Mon, 15 May 2023 12:57:45 +0700 Subject: [PATCH 06/10] [Deploy] Add deployment artifacts for testnet (#219) Deployed commit: e599ce9db0232fa52851a1a6e31f84b1967005b1 --- .../ronin-testnet/BridgeTrackingLogic.json | 164 ++-- .../ronin-testnet/BridgeTrackingProxy.json | 76 +- .../ronin-testnet/MaintenanceLogic.json | 72 +- .../RoninGatewayPauseEnforcer.json | 718 ++++++++++++++++++ .../ronin-testnet/RoninGatewayV2Logic.json | 626 ++++++++++----- .../ronin-testnet/RoninGovernanceAdmin.json | 311 ++++---- .../RoninTrustedOrganizationLogic.json | 48 +- .../ronin-testnet/RoninValidatorSetLogic.json | 322 +++++--- .../ronin-testnet/SlashIndicatorLogic.json | 116 +-- deployments/ronin-testnet/StakingLogic.json | 276 ++++--- .../ronin-testnet/StakingVestingLogic.json | 48 +- .../2a8db5de0d3bfe0cb40ba15ae8460f16.json | 525 +++++++++++++ .../85b953b22882c536a643bf4b61b3153b.json | 525 +++++++++++++ 13 files changed, 2998 insertions(+), 829 deletions(-) create mode 100644 deployments/ronin-testnet/RoninGatewayPauseEnforcer.json create mode 100644 deployments/ronin-testnet/solcInputs/2a8db5de0d3bfe0cb40ba15ae8460f16.json create mode 100644 deployments/ronin-testnet/solcInputs/85b953b22882c536a643bf4b61b3153b.json diff --git a/deployments/ronin-testnet/BridgeTrackingLogic.json b/deployments/ronin-testnet/BridgeTrackingLogic.json index f933e57df..d1e687910 100644 --- a/deployments/ronin-testnet/BridgeTrackingLogic.json +++ b/deployments/ronin-testnet/BridgeTrackingLogic.json @@ -1,5 +1,5 @@ { - "address": "0xA90e5F51Dd8C7b85c1396b1faD4A03c0935F9629", + "address": "0xCb47Efa4212d95AE8Fb7942bbEd4AA47083886eA", "abi": [ { "inputs": [], @@ -276,41 +276,41 @@ "type": "function" } ], - "transactionHash": "0x580dce3f9db334fd29eca4143567ce2b322646e9f1a0d2c81f276e370b2c4f7b", + "transactionHash": "0x235ce818ec5ed92c843da1126c2c58c288734a09dce3645c4cea72a48fcbcb80", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0xA90e5F51Dd8C7b85c1396b1faD4A03c0935F9629", + "contractAddress": "0xCb47Efa4212d95AE8Fb7942bbEd4AA47083886eA", "transactionIndex": 0, - "gasUsed": "1108962", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xe8ca66b7d340a364267e5e49bab7c349b1b0cbb70d3ff0625d14c54fe3c7790e", - "transactionHash": "0x580dce3f9db334fd29eca4143567ce2b322646e9f1a0d2c81f276e370b2c4f7b", + "gasUsed": "1106178", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x4ef0be79da38220157d3956be2de0ab9df1d23b5dc74f9cdc3877fecb00d2d94", + "transactionHash": "0x235ce818ec5ed92c843da1126c2c58c288734a09dce3645c4cea72a48fcbcb80", "logs": [ { "transactionIndex": 0, - "blockNumber": 14861148, - "transactionHash": "0x580dce3f9db334fd29eca4143567ce2b322646e9f1a0d2c81f276e370b2c4f7b", - "address": "0xA90e5F51Dd8C7b85c1396b1faD4A03c0935F9629", + "blockNumber": 16817327, + "transactionHash": "0x235ce818ec5ed92c843da1126c2c58c288734a09dce3645c4cea72a48fcbcb80", + "address": "0xCb47Efa4212d95AE8Fb7942bbEd4AA47083886eA", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", "logIndex": 0, - "blockHash": "0xe8ca66b7d340a364267e5e49bab7c349b1b0cbb70d3ff0625d14c54fe3c7790e" + "blockHash": "0x4ef0be79da38220157d3956be2de0ab9df1d23b5dc74f9cdc3877fecb00d2d94" } ], - "blockNumber": 14861148, - "cumulativeGasUsed": "1108962", + "blockNumber": 16817327, + "cumulativeGasUsed": "1106178", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 5, - "solcInputHash": "496d5ba113d6511f02e611e47b8a6065", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeBridgeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"BridgeContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"bridgeContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_bridgeOperators\",\"type\":\"address[]\"}],\"name\":\"getManyTotalBallots\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_res\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum IBridgeTracking.VoteKind\",\"name\":\"_kind\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"name\":\"handleVoteApproved\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bridgeContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startedAtBlock\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum IBridgeTracking.VoteKind\",\"name\":\"_kind\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"recordVote\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setBridgeContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startedAtBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"totalBallots\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalBallots\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_bridgeOperator\",\"type\":\"address\"}],\"name\":\"totalBallotsOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"totalVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalVotes\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallerMustBeBridgeContract()\":[{\"details\":\"Error of method caller must be bridge contract.\"}],\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"bridgeContract()\":{\"details\":\"Returns the bridge contract.\"},\"getManyTotalBallots(uint256,address[])\":{\"details\":\"Returns the total number of ballots of bridge operators at the specific period `_period`.\"},\"handleVoteApproved(uint8,uint256)\":{\"details\":\"Handles the request once it is approved. Requirements: - The method caller is the bridge contract.\"},\"initialize(address,address,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"recordVote(uint8,uint256,address)\":{\"details\":\"Records vote for a receipt and a operator. Requirements: - The method caller is the bridge contract.\"},\"setBridgeContract(address)\":{\"details\":\"Sets the bridge contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `BridgeContractUpdated`.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"totalBallots(uint256)\":{\"details\":\"Returns the total number of ballots at the specific period `_period`.\"},\"totalBallotsOf(uint256,address)\":{\"details\":\"Returns the total number of ballots of a bridge operator at the specific period `_period`.\"},\"totalVotes(uint256)\":{\"details\":\"Returns the total number of votes at the specific period `_period`.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"}},\"stateVariables\":{\"_bufferMetric\":{\"details\":\"The temporary info of votes and ballots\"},\"_periodMetric\":{\"details\":\"Mapping from period number => vote stats based on period\"},\"_receiptTrackingInfo\":{\"details\":\"Mapping from vote kind => receipt id => receipt stats\"},\"startedAtBlock\":{\"details\":\"The block that the contract allows incoming mutable calls.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/BridgeTracking.sol\":\"BridgeTracking\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasBridgeContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasBridgeContract.sol\\\";\\nimport \\\"../../interfaces/IBridge.sol\\\";\\n\\ncontract HasBridgeContract is IHasBridgeContract, HasProxyAdmin {\\n IBridge internal _bridgeContract;\\n\\n modifier onlyBridgeContract() {\\n if (bridgeContract() != msg.sender) revert ErrCallerMustBeBridgeContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeContract\\n */\\n function bridgeContract() public view override returns (address) {\\n return address(_bridgeContract);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeContract\\n */\\n function setBridgeContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length <= 0) revert ErrZeroCodeContract();\\n _setBridgeContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the bridge contract.\\n *\\n * Emits the event `BridgeContractUpdated`.\\n *\\n */\\n function _setBridgeContract(address _addr) internal {\\n _bridgeContract = IBridge(_addr);\\n emit BridgeContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x6fabd1a69eb4391793a28f0d5449f4662b7e7eaf3d9ca87554ccbc77e2b099f9\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/interfaces/IBridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBridge {\\n /**\\n * @dev Replaces the old bridge operator list by the new one.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emitted the event `BridgeOperatorsReplaced`.\\n *\\n */\\n function replaceBridgeOperators(address[] calldata) external;\\n\\n /**\\n * @dev Returns the bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n}\\n\",\"keccak256\":\"0x614db701e54383b7d0a749bc9b0d2da95d42652cd673499bf71e25096548b96e\",\"license\":\"MIT\"},\"contracts/interfaces/IBridgeTracking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBridgeTracking {\\n struct Request {\\n VoteKind kind;\\n uint256 id;\\n }\\n\\n enum VoteKind {\\n Deposit,\\n Withdrawal,\\n MainchainWithdrawal\\n }\\n\\n /**\\n * @dev Returns the total number of votes at the specific period `_period`.\\n */\\n function totalVotes(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots at the specific period `_period`.\\n */\\n function totalBallots(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\\n */\\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\\n */\\n function totalBallotsOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\\n\\n /**\\n * @dev Handles the request once it is approved.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\\n\\n /**\\n * @dev Records vote for a receipt and a operator.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function recordVote(\\n VoteKind _kind,\\n uint256 _requestId,\\n address _operator\\n ) external;\\n}\\n\",\"keccak256\":\"0x6066ff36c2ad0494a676dfeb4289c3cbe48d0d70266e8ec0930014a41f2a39a3\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasBridgeContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasBridgeContract is IHasContract {\\n /// @dev Emitted when the bridge contract is updated.\\n event BridgeContractUpdated(address);\\n\\n /// @dev Error of method caller must be bridge contract.\\n error ErrCallerMustBeBridgeContract();\\n\\n /**\\n * @dev Returns the bridge contract.\\n */\\n function bridgeContract() external view returns (address);\\n\\n /**\\n * @dev Sets the bridge contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `BridgeContractUpdated`.\\n *\\n */\\n function setBridgeContract(address) external;\\n}\\n\",\"keccak256\":\"0xf3ab1830ba7797cb3b8011512af3a5e38a316549f62140b0c10e0b4dcb67f773\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0xe4060b7e3b04a0043bd334011fe4ba67c990b0484dad52d7f14b35040989b6ab\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n // Error thrown when receives RON from neither staking vesting contract nor staking contract\\\"\\n error ErrUnauthorizedReceiveRON();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0x4e81a61359a3f8bcc9d452615e3df7b0d0201823ce88f763530ddd4f00c2fc48\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address[] calldata _blockProducers) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address[] calldata _blockProducers, uint256 _period)\\n external\\n view\\n returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the current period.\\n */\\n\\n function checkBridgeRewardDeprecated(address _consensusAddr) external view returns (bool _result);\\n}\\n\",\"keccak256\":\"0x853e7d0ac33ad868721733fc2ab4b78f2e613973a579eb0ea485cbdaa750e057\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator or not.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0xbd10b0207a749e3a7a2aadcb6e93784cb17343a5266d056a3d0b79acb7c5c93d\",\"license\":\"MIT\"},\"contracts/ronin/BridgeTracking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../extensions/collections/HasBridgeContract.sol\\\";\\nimport \\\"../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../interfaces/IBridgeTracking.sol\\\";\\n\\ncontract BridgeTracking is HasBridgeContract, HasValidatorContract, Initializable, IBridgeTracking {\\n struct PeriodVotingMetric {\\n /// @dev Total requests that are tracked in the period. This value is 0 until the {_bufferMetric.requests[]} gets added into a period metric.\\n uint256 totalRequests;\\n uint256 totalBallots;\\n mapping(address => uint256) totalBallotsOf;\\n address[] voters;\\n }\\n\\n struct PeriodVotingMetricTimeWrapper {\\n uint256 lastEpoch;\\n Request[] requests;\\n PeriodVotingMetric data;\\n }\\n\\n struct ReceiptTrackingInfo {\\n /// @dev The period that the receipt is approved. Value 0 means the receipt is not approved yet.\\n uint256 approvedPeriod;\\n /// @dev The address list of voters\\n address[] voters;\\n /// @dev Mapping from voter => flag indicating the voter casts vote for this receipt\\n mapping(address => bool) voted;\\n /// @dev The period that the receipt is tracked, i.e. the metric is transferred from buffer to the period. Value 0 means the receipt is currently in buffer or not tracked yet.\\n uint256 trackedPeriod;\\n }\\n\\n /// @dev The block that the contract allows incoming mutable calls.\\n uint256 public startedAtBlock;\\n\\n /// @dev The temporary info of votes and ballots\\n PeriodVotingMetricTimeWrapper internal _bufferMetric;\\n /// @dev Mapping from period number => vote stats based on period\\n mapping(uint256 => PeriodVotingMetric) internal _periodMetric;\\n /// @dev Mapping from vote kind => receipt id => receipt stats\\n mapping(VoteKind => mapping(uint256 => ReceiptTrackingInfo)) internal _receiptTrackingInfo;\\n\\n modifier skipOnUnstarted() {\\n if (block.number < startedAtBlock) {\\n return;\\n }\\n _;\\n }\\n\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address _bridgeContract,\\n address _validatorContract,\\n uint256 _startedAtBlock\\n ) external initializer {\\n _setBridgeContract(_bridgeContract);\\n _setValidatorContract(_validatorContract);\\n startedAtBlock = _startedAtBlock;\\n }\\n\\n /**\\n * @inheritdoc IBridgeTracking\\n */\\n function totalVotes(uint256 _period) external view override returns (uint256 _totalVotes) {\\n _totalVotes = _periodMetric[_period].totalRequests;\\n if (_isBufferCountedForPeriod(_period)) {\\n _totalVotes += _bufferMetric.requests.length;\\n }\\n }\\n\\n /**\\n * @inheritdoc IBridgeTracking\\n */\\n function totalBallots(uint256 _period) external view override returns (uint256 _totalBallots) {\\n _totalBallots = _periodMetric[_period].totalBallots;\\n if (_isBufferCountedForPeriod(_period)) {\\n _totalBallots += _bufferMetric.data.totalBallots;\\n }\\n }\\n\\n /**\\n * @inheritdoc IBridgeTracking\\n */\\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\\n external\\n view\\n override\\n returns (uint256[] memory _res)\\n {\\n _res = new uint256[](_bridgeOperators.length);\\n bool _isBufferCounted = _isBufferCountedForPeriod(_period);\\n for (uint _i = 0; _i < _bridgeOperators.length; _i++) {\\n _res[_i] = _totalBallotsOf(_period, _bridgeOperators[_i], _isBufferCounted);\\n }\\n }\\n\\n /**\\n * @inheritdoc IBridgeTracking\\n */\\n function totalBallotsOf(uint256 _period, address _bridgeOperator) public view override returns (uint256) {\\n return _totalBallotsOf(_period, _bridgeOperator, _isBufferCountedForPeriod(_period));\\n }\\n\\n /**\\n * @inheritdoc IBridgeTracking\\n */\\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external override onlyBridgeContract skipOnUnstarted {\\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\\n\\n // Only records for the receipt which not approved\\n if (_receiptInfo.approvedPeriod == 0) {\\n _trySyncBuffer();\\n uint256 _currentPeriod = _validatorContract.currentPeriod();\\n _receiptInfo.approvedPeriod = _currentPeriod;\\n\\n Request storage _bufferRequest = _bufferMetric.requests.push();\\n _bufferRequest.kind = _kind;\\n _bufferRequest.id = _requestId;\\n\\n address[] storage _voters = _receiptInfo.voters;\\n for (uint _i = 0; _i < _voters.length; _i++) {\\n _increaseBallot(_kind, _requestId, _voters[_i], _currentPeriod);\\n }\\n\\n delete _receiptInfo.voters;\\n }\\n }\\n\\n /**\\n * @inheritdoc IBridgeTracking\\n */\\n function recordVote(\\n VoteKind _kind,\\n uint256 _requestId,\\n address _operator\\n ) external override onlyBridgeContract skipOnUnstarted {\\n uint256 _period = _validatorContract.currentPeriod();\\n _trySyncBuffer();\\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\\n\\n // When the vote is not approved yet, the voters are saved in the receipt info, and not increase ballot metric.\\n // The ballot metric will be increased later in the {handleVoteApproved} method.\\n if (_receiptInfo.approvedPeriod == 0) {\\n _receiptInfo.voters.push(_operator);\\n return;\\n }\\n\\n _increaseBallot(_kind, _requestId, _operator, _period);\\n }\\n\\n /**\\n * @dev Increases the ballot for the operator at a period.\\n */\\n function _increaseBallot(\\n VoteKind _kind,\\n uint256 _requestId,\\n address _operator,\\n uint256 _currentPeriod\\n ) internal {\\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\\n if (_receiptInfo.voted[_operator]) {\\n return;\\n }\\n\\n _receiptInfo.voted[_operator] = true;\\n\\n uint256 _trackedPeriod = _receiptInfo.trackedPeriod;\\n\\n // Do not increase ballot for receipt that is neither in the buffer, nor in the most current tracked period.\\n // If the receipt is not tracked in a period, increase metric in buffer.\\n if (_trackedPeriod == 0) {\\n if (_bufferMetric.data.totalBallotsOf[_operator] == 0) {\\n _bufferMetric.data.voters.push(_operator);\\n }\\n _bufferMetric.data.totalBallots++;\\n _bufferMetric.data.totalBallotsOf[_operator]++;\\n }\\n // If the receipt is tracked in the most current tracked period, increase metric in the period.\\n else if (_trackedPeriod == _currentPeriod) {\\n PeriodVotingMetric storage _metric = _periodMetric[_trackedPeriod];\\n _metric.totalBallots++;\\n _metric.totalBallotsOf[_operator]++;\\n }\\n }\\n\\n /**\\n * @dev See `totalBallotsOf`.\\n */\\n function _totalBallotsOf(\\n uint256 _period,\\n address _bridgeOperator,\\n bool _mustCountLastStats\\n ) internal view returns (uint256 _totalBallots) {\\n _totalBallots = _periodMetric[_period].totalBallotsOf[_bridgeOperator];\\n if (_mustCountLastStats) {\\n _totalBallots += _bufferMetric.data.totalBallotsOf[_bridgeOperator];\\n }\\n }\\n\\n /**\\n * @dev Syncs period stats. Move all data from the buffer metric to the period metric.\\n *\\n * Requirements:\\n * - The epoch after the buffer epoch is wrapped up.\\n */\\n function _trySyncBuffer() internal {\\n uint256 _currentEpoch = _validatorContract.epochOf(block.number);\\n if (_bufferMetric.lastEpoch < _currentEpoch) {\\n (, uint256 _trackedPeriod) = _validatorContract.tryGetPeriodOfEpoch(_bufferMetric.lastEpoch + 1);\\n _bufferMetric.lastEpoch = _currentEpoch;\\n\\n // Copy numbers of totals\\n PeriodVotingMetric storage _metric = _periodMetric[_trackedPeriod];\\n _metric.totalRequests += _bufferMetric.requests.length;\\n _metric.totalBallots += _bufferMetric.data.totalBallots;\\n\\n // Copy voters info and voters' ballot\\n for (uint _i = 0; _i < _bufferMetric.data.voters.length; _i++) {\\n address _voter = _bufferMetric.data.voters[_i];\\n _metric.totalBallotsOf[_voter] += _bufferMetric.data.totalBallotsOf[_voter];\\n delete _bufferMetric.data.totalBallotsOf[_voter]; // need to manually delete each element, due to mapping\\n }\\n\\n // Mark all receipts in the buffer as tracked. Keep total number of receipts and delete receipt details.\\n for (uint _i = 0; _i < _bufferMetric.requests.length; _i++) {\\n Request storage _bufferRequest = _bufferMetric.requests[_i];\\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_bufferRequest.kind][_bufferRequest.id];\\n _receiptInfo.trackedPeriod = _trackedPeriod;\\n }\\n\\n delete _bufferMetric.requests;\\n delete _bufferMetric.data;\\n }\\n }\\n\\n /**\\n * @dev Returns whether the buffer stats must be counted or not.\\n */\\n function _isBufferCountedForPeriod(uint256 _queriedPeriod) internal view returns (bool) {\\n uint256 _currentEpoch = _validatorContract.epochOf(block.number);\\n (bool _filled, uint256 _periodOfNextTemporaryEpoch) = _validatorContract.tryGetPeriodOfEpoch(\\n _bufferMetric.lastEpoch + 1\\n );\\n return _filled && _queriedPeriod == _periodOfNextTemporaryEpoch && _bufferMetric.lastEpoch < _currentEpoch;\\n }\\n}\\n\",\"keccak256\":\"0x9223dfc14c81bdbdd5272fe11a6382c9d717ffb5c3a469145400092c059f2558\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100eb565b600154600160a81b900460ff161561008c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60015460ff600160a01b909104811610156100e9576001805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61129d806100fa6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c806399439089116100715780639943908914610140578063c7c4fea914610165578063cd59658314610178578063cdf64a7614610189578063f67e81521461019c578063f84bd121146101bc57600080fd5b806304375dcf146100b95780630b26cf66146100df5780631794bb3c146100f457806319e6e15814610107578063229f88ea1461011a578063889998ef1461012d575b600080fd5b6100cc6100c7366004610f81565b6101c5565b6040519081526020015b60405180910390f35b6100f26100ed366004610fad565b6101e3565b005b6100f2610102366004610fc8565b61026c565b6100cc610115366004611004565b6103a6565b6100f261012836600461102c565b6103d8565b6100cc61013b366004611004565b6105bb565b6001546001600160a01b03165b6040516001600160a01b0390911681526020016100d6565b6100f2610173366004611056565b6105e8565b6000546001600160a01b031661014d565b6100f2610197366004610fad565b610740565b6101af6101aa366004611092565b6107bd565b6040516100d69190611111565b6100cc60025481565b60006101da83836101d586610885565b6109a4565b90505b92915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031633146102355760405162461bcd60e51b815260040161022c90611155565b60405180910390fd5b6000816001600160a01b03163b1161026057604051637bcd509160e01b815260040160405180910390fd5b610269816109fd565b50565b600154600160a81b900460ff1615808015610292575060018054600160a01b900460ff16105b806102b25750303b1580156102b2575060018054600160a01b900460ff16145b6103155760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161022c565b6001805460ff60a01b1916600160a01b1790558015610342576001805460ff60a81b1916600160a81b1790555b61034b846109fd565b61035483610a52565b600282905580156103a0576001805460ff60a81b191681556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b6000818152600960205260409020546103be82610885565b156103d3576004546103d090826111ad565b90505b919050565b336103eb6000546001600160a01b031690565b6001600160a01b03161461041257604051631812f26f60e11b815260040160405180910390fd5b60025443106105b7576000600a6000846002811115610433576104336111c0565b6002811115610444576104446111c0565b81526020019081526020016000206000838152602001908152602001600020905080600001546000036105b557610479610aa0565b6001546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa1580156104c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e691906111d6565b808355600480546001818101835560009290925260029081027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b018054939450928792849260ff19909216918490811115610543576105436111c0565b02179055506001808201859055830160005b81548110156105a2576105908787848481548110610575576105756111ef565b6000918252602090912001546001600160a01b031687610d47565b8061059a81611205565b915050610555565b506105b1600185016000610ef2565b5050505b505b5050565b6000818152600960205260409020600101546105d682610885565b156103d3576006546103d090826111ad565b336105fb6000546001600160a01b031690565b6001600160a01b03161461062257604051631812f26f60e11b815260040160405180910390fd5b60025443106105b5576001546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa158015610674573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069891906111d6565b90506106a2610aa0565b6000600a60008660028111156106ba576106ba6111c0565b60028111156106cb576106cb6111c0565b815260200190815260200160002060008581526020019081526020016000209050806000015460000361072d576001908101805491820181556000908152602090200180546001600160a01b0319166001600160a01b038416179055506105b5565b61073985858585610d47565b5050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031633146107895760405162461bcd60e51b815260040161022c90611155565b806001600160a01b03163b6000036107b457604051637bcd509160e01b815260040160405180910390fd5b61026981610a52565b60608167ffffffffffffffff8111156107d8576107d861121e565b604051908082528060200260200182016040528015610801578160200160208202803683370190505b509050600061080f85610885565b905060005b8381101561087c5761084d86868684818110610832576108326111ef565b90506020020160208101906108479190610fad565b846109a4565b83828151811061085f5761085f6111ef565b60209081029190910101528061087481611205565b915050610814565b50509392505050565b60015460405163a3d545f560e01b815243600482015260009182916001600160a01b039091169063a3d545f590602401602060405180830381865afa1580156108d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f691906111d6565b6001805460035492935060009283926001600160a01b039092169163468c96ae91610920916111ad565b6040518263ffffffff1660e01b815260040161093e91815260200190565b6040805180830381865afa15801561095a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097e9190611234565b9150915081801561098e57508085145b801561099b575060035483115b95945050505050565b60008381526009602090815260408083206001600160a01b038616845260020190915290205481156109f6576001600160a01b0383166000908152600760205260409020546109f390826111ad565b90505b9392505050565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527f5cbd8a0bb00196365d5eb3457c6734e7f06666c3c78e5469b4c9deec7edae048906020015b60405180910390a150565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990602001610a47565b60015460405163a3d545f560e01b81524360048201526000916001600160a01b03169063a3d545f590602401602060405180830381865afa158015610ae9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0d91906111d6565b905080600360000154101561026957600180546003546000926001600160a01b039092169163468c96ae91610b41916111ad565b6040518263ffffffff1660e01b8152600401610b5f91815260200190565b6040805180830381865afa158015610b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9f9190611234565b60038490556000818152600960205260408120600454815493955090935091839190610bcc9084906111ad565b9091555050600654600182018054600090610be89084906111ad565b90915550600090505b600854811015610c8257600880546000919083908110610c1357610c136111ef565b60009182526020808320909101546001600160a01b0316808352600782526040808420546002880190935283208054919450919290610c539084906111ad565b90915550506001600160a01b031660009081526007602052604081205580610c7a81611205565b915050610bf1565b5060005b600454811015610d2257600060036001018281548110610ca857610ca86111ef565b6000918252602082206002918202018054909350600a91839160ff1690811115610cd457610cd46111c0565b6002811115610ce557610ce56111c0565b8152602080820192909252604090810160009081206001909501548152939091529091206003018490555080610d1a81611205565b915050610c86565b50610d2f60046000610f10565b60006005818155600682905590610739600882610ef2565b6000600a6000866002811115610d5f57610d5f6111c0565b6002811115610d7057610d706111c0565b81526020808201929092526040908101600090812087825283528181206001600160a01b038716825260028101909352205490915060ff1615610db357506103a0565b6001600160a01b03831660009081526002820160205260408120805460ff19166001179055600382015490819003610e93576001600160a01b0384166000908152600760205260408120549003610e5057600880546001810182556000919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319166001600160a01b0386161790555b60068054906000610e6083611205565b90915550506001600160a01b0384166000908152600760205260408120805491610e8983611205565b91905055506105b1565b8281036105b15760008181526009602052604081206001810180549192610eb983611205565b90915550506001600160a01b03851660009081526002820160205260408120805491610ee483611205565b919050555050505050505050565b50805460008255906000526020600020908101906102699190610f31565b50805460008255600202906000526020600020908101906102699190610f4a565b5b80821115610f465760008155600101610f32565b5090565b5b80821115610f4657805460ff1916815560006001820155600201610f4b565b80356001600160a01b03811681146103d357600080fd5b60008060408385031215610f9457600080fd5b82359150610fa460208401610f6a565b90509250929050565b600060208284031215610fbf57600080fd5b6101da82610f6a565b600080600060608486031215610fdd57600080fd5b610fe684610f6a565b9250610ff460208501610f6a565b9150604084013590509250925092565b60006020828403121561101657600080fd5b5035919050565b8035600381106103d357600080fd5b6000806040838503121561103f57600080fd5b6110488361101d565b946020939093013593505050565b60008060006060848603121561106b57600080fd5b6110748461101d565b92506020840135915061108960408501610f6a565b90509250925092565b6000806000604084860312156110a757600080fd5b83359250602084013567ffffffffffffffff808211156110c657600080fd5b818601915086601f8301126110da57600080fd5b8135818111156110e957600080fd5b8760208260051b85010111156110fe57600080fd5b6020830194508093505050509250925092565b6020808252825182820181905260009190848201906040850190845b818110156111495783518352928401929184019160010161112d565b50909695505050505050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b808201808211156101dd576101dd611197565b634e487b7160e01b600052602160045260246000fd5b6000602082840312156111e857600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60006001820161121757611217611197565b5060010190565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561124757600080fd5b8251801515811461125757600080fd5b602093909301519294929350505056fea26469706673582212200d85d94342bf1c7424f8cd094a2000a5fc6a506643837c28ef8ff9a909f7d8c564736f6c63430008110033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c806399439089116100715780639943908914610140578063c7c4fea914610165578063cd59658314610178578063cdf64a7614610189578063f67e81521461019c578063f84bd121146101bc57600080fd5b806304375dcf146100b95780630b26cf66146100df5780631794bb3c146100f457806319e6e15814610107578063229f88ea1461011a578063889998ef1461012d575b600080fd5b6100cc6100c7366004610f81565b6101c5565b6040519081526020015b60405180910390f35b6100f26100ed366004610fad565b6101e3565b005b6100f2610102366004610fc8565b61026c565b6100cc610115366004611004565b6103a6565b6100f261012836600461102c565b6103d8565b6100cc61013b366004611004565b6105bb565b6001546001600160a01b03165b6040516001600160a01b0390911681526020016100d6565b6100f2610173366004611056565b6105e8565b6000546001600160a01b031661014d565b6100f2610197366004610fad565b610740565b6101af6101aa366004611092565b6107bd565b6040516100d69190611111565b6100cc60025481565b60006101da83836101d586610885565b6109a4565b90505b92915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031633146102355760405162461bcd60e51b815260040161022c90611155565b60405180910390fd5b6000816001600160a01b03163b1161026057604051637bcd509160e01b815260040160405180910390fd5b610269816109fd565b50565b600154600160a81b900460ff1615808015610292575060018054600160a01b900460ff16105b806102b25750303b1580156102b2575060018054600160a01b900460ff16145b6103155760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161022c565b6001805460ff60a01b1916600160a01b1790558015610342576001805460ff60a81b1916600160a81b1790555b61034b846109fd565b61035483610a52565b600282905580156103a0576001805460ff60a81b191681556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b6000818152600960205260409020546103be82610885565b156103d3576004546103d090826111ad565b90505b919050565b336103eb6000546001600160a01b031690565b6001600160a01b03161461041257604051631812f26f60e11b815260040160405180910390fd5b60025443106105b7576000600a6000846002811115610433576104336111c0565b6002811115610444576104446111c0565b81526020019081526020016000206000838152602001908152602001600020905080600001546000036105b557610479610aa0565b6001546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa1580156104c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104e691906111d6565b808355600480546001818101835560009290925260029081027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b018054939450928792849260ff19909216918490811115610543576105436111c0565b02179055506001808201859055830160005b81548110156105a2576105908787848481548110610575576105756111ef565b6000918252602090912001546001600160a01b031687610d47565b8061059a81611205565b915050610555565b506105b1600185016000610ef2565b5050505b505b5050565b6000818152600960205260409020600101546105d682610885565b156103d3576006546103d090826111ad565b336105fb6000546001600160a01b031690565b6001600160a01b03161461062257604051631812f26f60e11b815260040160405180910390fd5b60025443106105b5576001546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa158015610674573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061069891906111d6565b90506106a2610aa0565b6000600a60008660028111156106ba576106ba6111c0565b60028111156106cb576106cb6111c0565b815260200190815260200160002060008581526020019081526020016000209050806000015460000361072d576001908101805491820181556000908152602090200180546001600160a01b0319166001600160a01b038416179055506105b5565b61073985858585610d47565b5050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031633146107895760405162461bcd60e51b815260040161022c90611155565b806001600160a01b03163b6000036107b457604051637bcd509160e01b815260040160405180910390fd5b61026981610a52565b60608167ffffffffffffffff8111156107d8576107d861121e565b604051908082528060200260200182016040528015610801578160200160208202803683370190505b509050600061080f85610885565b905060005b8381101561087c5761084d86868684818110610832576108326111ef565b90506020020160208101906108479190610fad565b846109a4565b83828151811061085f5761085f6111ef565b60209081029190910101528061087481611205565b915050610814565b50509392505050565b60015460405163a3d545f560e01b815243600482015260009182916001600160a01b039091169063a3d545f590602401602060405180830381865afa1580156108d2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108f691906111d6565b6001805460035492935060009283926001600160a01b039092169163468c96ae91610920916111ad565b6040518263ffffffff1660e01b815260040161093e91815260200190565b6040805180830381865afa15801561095a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061097e9190611234565b9150915081801561098e57508085145b801561099b575060035483115b95945050505050565b60008381526009602090815260408083206001600160a01b038616845260020190915290205481156109f6576001600160a01b0383166000908152600760205260409020546109f390826111ad565b90505b9392505050565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527f5cbd8a0bb00196365d5eb3457c6734e7f06666c3c78e5469b4c9deec7edae048906020015b60405180910390a150565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990602001610a47565b60015460405163a3d545f560e01b81524360048201526000916001600160a01b03169063a3d545f590602401602060405180830381865afa158015610ae9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0d91906111d6565b905080600360000154101561026957600180546003546000926001600160a01b039092169163468c96ae91610b41916111ad565b6040518263ffffffff1660e01b8152600401610b5f91815260200190565b6040805180830381865afa158015610b7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b9f9190611234565b60038490556000818152600960205260408120600454815493955090935091839190610bcc9084906111ad565b9091555050600654600182018054600090610be89084906111ad565b90915550600090505b600854811015610c8257600880546000919083908110610c1357610c136111ef565b60009182526020808320909101546001600160a01b0316808352600782526040808420546002880190935283208054919450919290610c539084906111ad565b90915550506001600160a01b031660009081526007602052604081205580610c7a81611205565b915050610bf1565b5060005b600454811015610d2257600060036001018281548110610ca857610ca86111ef565b6000918252602082206002918202018054909350600a91839160ff1690811115610cd457610cd46111c0565b6002811115610ce557610ce56111c0565b8152602080820192909252604090810160009081206001909501548152939091529091206003018490555080610d1a81611205565b915050610c86565b50610d2f60046000610f10565b60006005818155600682905590610739600882610ef2565b6000600a6000866002811115610d5f57610d5f6111c0565b6002811115610d7057610d706111c0565b81526020808201929092526040908101600090812087825283528181206001600160a01b038716825260028101909352205490915060ff1615610db357506103a0565b6001600160a01b03831660009081526002820160205260408120805460ff19166001179055600382015490819003610e93576001600160a01b0384166000908152600760205260408120549003610e5057600880546001810182556000919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319166001600160a01b0386161790555b60068054906000610e6083611205565b90915550506001600160a01b0384166000908152600760205260408120805491610e8983611205565b91905055506105b1565b8281036105b15760008181526009602052604081206001810180549192610eb983611205565b90915550506001600160a01b03851660009081526002820160205260408120805491610ee483611205565b919050555050505050505050565b50805460008255906000526020600020908101906102699190610f31565b50805460008255600202906000526020600020908101906102699190610f4a565b5b80821115610f465760008155600101610f32565b5090565b5b80821115610f4657805460ff1916815560006001820155600201610f4b565b80356001600160a01b03811681146103d357600080fd5b60008060408385031215610f9457600080fd5b82359150610fa460208401610f6a565b90509250929050565b600060208284031215610fbf57600080fd5b6101da82610f6a565b600080600060608486031215610fdd57600080fd5b610fe684610f6a565b9250610ff460208501610f6a565b9150604084013590509250925092565b60006020828403121561101657600080fd5b5035919050565b8035600381106103d357600080fd5b6000806040838503121561103f57600080fd5b6110488361101d565b946020939093013593505050565b60008060006060848603121561106b57600080fd5b6110748461101d565b92506020840135915061108960408501610f6a565b90509250925092565b6000806000604084860312156110a757600080fd5b83359250602084013567ffffffffffffffff808211156110c657600080fd5b818601915086601f8301126110da57600080fd5b8135818111156110e957600080fd5b8760208260051b85010111156110fe57600080fd5b6020830194508093505050509250925092565b6020808252825182820181905260009190848201906040850190845b818110156111495783518352928401929184019160010161112d565b50909695505050505050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b808201808211156101dd576101dd611197565b634e487b7160e01b600052602160045260246000fd5b6000602082840312156111e857600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60006001820161121757611217611197565b5060010190565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561124757600080fd5b8251801515811461125757600080fd5b602093909301519294929350505056fea26469706673582212200d85d94342bf1c7424f8cd094a2000a5fc6a506643837c28ef8ff9a909f7d8c564736f6c63430008110033", + "numDeployments": 6, + "solcInputHash": "2a8db5de0d3bfe0cb40ba15ae8460f16", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeBridgeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"BridgeContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"bridgeContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_bridgeOperators\",\"type\":\"address[]\"}],\"name\":\"getManyTotalBallots\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_res\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum IBridgeTracking.VoteKind\",\"name\":\"_kind\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"}],\"name\":\"handleVoteApproved\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bridgeContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startedAtBlock\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"enum IBridgeTracking.VoteKind\",\"name\":\"_kind\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"_requestId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_operator\",\"type\":\"address\"}],\"name\":\"recordVote\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setBridgeContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"startedAtBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"totalBallots\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalBallots\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_bridgeOperator\",\"type\":\"address\"}],\"name\":\"totalBallotsOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"totalVotes\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_totalVotes\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallerMustBeBridgeContract()\":[{\"details\":\"Error of method caller must be bridge contract.\"}],\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"bridgeContract()\":{\"details\":\"Returns the bridge contract.\"},\"getManyTotalBallots(uint256,address[])\":{\"details\":\"Returns the total number of ballots of bridge operators at the specific period `_period`.\"},\"handleVoteApproved(uint8,uint256)\":{\"details\":\"Handles the request once it is approved. Requirements: - The method caller is the bridge contract.\"},\"initialize(address,address,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"recordVote(uint8,uint256,address)\":{\"details\":\"Records vote for a receipt and a operator. Requirements: - The method caller is the bridge contract.\"},\"setBridgeContract(address)\":{\"details\":\"Sets the bridge contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `BridgeContractUpdated`.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"totalBallots(uint256)\":{\"details\":\"Returns the total number of ballots at the specific period `_period`.\"},\"totalBallotsOf(uint256,address)\":{\"details\":\"Returns the total number of ballots of a bridge operator at the specific period `_period`.\"},\"totalVotes(uint256)\":{\"details\":\"Returns the total number of votes at the specific period `_period`.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"}},\"stateVariables\":{\"_bufferMetric\":{\"details\":\"The temporary info of votes and ballots\"},\"_periodMetric\":{\"details\":\"Mapping from period number => vote stats based on period\"},\"_receiptTrackingInfo\":{\"details\":\"Mapping from vote kind => receipt id => receipt stats\"},\"startedAtBlock\":{\"details\":\"The block that the contract allows incoming mutable calls.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/gateway/BridgeTracking.sol\":\"BridgeTracking\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":0},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasBridgeContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasBridgeContract.sol\\\";\\nimport \\\"../../interfaces/IBridge.sol\\\";\\n\\ncontract HasBridgeContract is IHasBridgeContract, HasProxyAdmin {\\n IBridge internal _bridgeContract;\\n\\n modifier onlyBridgeContract() {\\n if (bridgeContract() != msg.sender) revert ErrCallerMustBeBridgeContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeContract\\n */\\n function bridgeContract() public view override returns (address) {\\n return address(_bridgeContract);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeContract\\n */\\n function setBridgeContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length <= 0) revert ErrZeroCodeContract();\\n _setBridgeContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the bridge contract.\\n *\\n * Emits the event `BridgeContractUpdated`.\\n *\\n */\\n function _setBridgeContract(address _addr) internal {\\n _bridgeContract = IBridge(_addr);\\n emit BridgeContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x6fabd1a69eb4391793a28f0d5449f4662b7e7eaf3d9ca87554ccbc77e2b099f9\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/interfaces/IBridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBridge {\\n /**\\n * @dev Replaces the old bridge operator list by the new one.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emitted the event `BridgeOperatorsReplaced`.\\n *\\n */\\n function replaceBridgeOperators(address[] calldata) external;\\n\\n /**\\n * @dev Returns the bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n}\\n\",\"keccak256\":\"0x614db701e54383b7d0a749bc9b0d2da95d42652cd673499bf71e25096548b96e\",\"license\":\"MIT\"},\"contracts/interfaces/IBridgeTracking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBridgeTracking {\\n struct Request {\\n VoteKind kind;\\n uint256 id;\\n }\\n\\n enum VoteKind {\\n Deposit,\\n Withdrawal,\\n MainchainWithdrawal\\n }\\n\\n /**\\n * @dev Returns the total number of votes at the specific period `_period`.\\n */\\n function totalVotes(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots at the specific period `_period`.\\n */\\n function totalBallots(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\\n */\\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\\n */\\n function totalBallotsOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\\n\\n /**\\n * @dev Handles the request once it is approved.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\\n\\n /**\\n * @dev Records vote for a receipt and a operator.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function recordVote(\\n VoteKind _kind,\\n uint256 _requestId,\\n address _operator\\n ) external;\\n}\\n\",\"keccak256\":\"0x6066ff36c2ad0494a676dfeb4289c3cbe48d0d70266e8ec0930014a41f2a39a3\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasBridgeContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasBridgeContract is IHasContract {\\n /// @dev Emitted when the bridge contract is updated.\\n event BridgeContractUpdated(address);\\n\\n /// @dev Error of method caller must be bridge contract.\\n error ErrCallerMustBeBridgeContract();\\n\\n /**\\n * @dev Returns the bridge contract.\\n */\\n function bridgeContract() external view returns (address);\\n\\n /**\\n * @dev Sets the bridge contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `BridgeContractUpdated`.\\n *\\n */\\n function setBridgeContract(address) external;\\n}\\n\",\"keccak256\":\"0xf3ab1830ba7797cb3b8011512af3a5e38a316549f62140b0c10e0b4dcb67f773\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/ronin/gateway/BridgeTracking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../extensions/collections/HasBridgeContract.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/IBridgeTracking.sol\\\";\\n\\ncontract BridgeTracking is HasBridgeContract, HasValidatorContract, Initializable, IBridgeTracking {\\n struct PeriodVotingMetric {\\n /// @dev Total requests that are tracked in the period. This value is 0 until the {_bufferMetric.requests[]} gets added into a period metric.\\n uint256 totalRequests;\\n uint256 totalBallots;\\n mapping(address => uint256) totalBallotsOf;\\n address[] voters;\\n }\\n\\n struct PeriodVotingMetricTimeWrapper {\\n uint256 lastEpoch;\\n Request[] requests;\\n PeriodVotingMetric data;\\n }\\n\\n struct ReceiptTrackingInfo {\\n /// @dev The period that the receipt is approved. Value 0 means the receipt is not approved yet.\\n uint256 approvedPeriod;\\n /// @dev The address list of voters\\n address[] voters;\\n /// @dev Mapping from voter => flag indicating the voter casts vote for this receipt\\n mapping(address => bool) voted;\\n /// @dev The period that the receipt is tracked, i.e. the metric is transferred from buffer to the period. Value 0 means the receipt is currently in buffer or not tracked yet.\\n uint256 trackedPeriod;\\n }\\n\\n /// @dev The block that the contract allows incoming mutable calls.\\n uint256 public startedAtBlock;\\n\\n /// @dev The temporary info of votes and ballots\\n PeriodVotingMetricTimeWrapper internal _bufferMetric;\\n /// @dev Mapping from period number => vote stats based on period\\n mapping(uint256 => PeriodVotingMetric) internal _periodMetric;\\n /// @dev Mapping from vote kind => receipt id => receipt stats\\n mapping(VoteKind => mapping(uint256 => ReceiptTrackingInfo)) internal _receiptTrackingInfo;\\n\\n modifier skipOnUnstarted() {\\n if (block.number < startedAtBlock) {\\n return;\\n }\\n _;\\n }\\n\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address _bridgeContract,\\n address _validatorContract,\\n uint256 _startedAtBlock\\n ) external initializer {\\n _setBridgeContract(_bridgeContract);\\n _setValidatorContract(_validatorContract);\\n startedAtBlock = _startedAtBlock;\\n }\\n\\n /**\\n * @inheritdoc IBridgeTracking\\n */\\n function totalVotes(uint256 _period) external view override returns (uint256 _totalVotes) {\\n _totalVotes = _periodMetric[_period].totalRequests;\\n if (_isBufferCountedForPeriod(_period)) {\\n _totalVotes += _bufferMetric.requests.length;\\n }\\n }\\n\\n /**\\n * @inheritdoc IBridgeTracking\\n */\\n function totalBallots(uint256 _period) external view override returns (uint256 _totalBallots) {\\n _totalBallots = _periodMetric[_period].totalBallots;\\n if (_isBufferCountedForPeriod(_period)) {\\n _totalBallots += _bufferMetric.data.totalBallots;\\n }\\n }\\n\\n /**\\n * @inheritdoc IBridgeTracking\\n */\\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\\n external\\n view\\n override\\n returns (uint256[] memory _res)\\n {\\n _res = new uint256[](_bridgeOperators.length);\\n bool _isBufferCounted = _isBufferCountedForPeriod(_period);\\n for (uint _i = 0; _i < _bridgeOperators.length; _i++) {\\n _res[_i] = _totalBallotsOf(_period, _bridgeOperators[_i], _isBufferCounted);\\n }\\n }\\n\\n /**\\n * @inheritdoc IBridgeTracking\\n */\\n function totalBallotsOf(uint256 _period, address _bridgeOperator) public view override returns (uint256) {\\n return _totalBallotsOf(_period, _bridgeOperator, _isBufferCountedForPeriod(_period));\\n }\\n\\n /**\\n * @inheritdoc IBridgeTracking\\n */\\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external override onlyBridgeContract skipOnUnstarted {\\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\\n\\n // Only records for the receipt which not approved\\n if (_receiptInfo.approvedPeriod == 0) {\\n _trySyncBuffer();\\n uint256 _currentPeriod = _validatorContract.currentPeriod();\\n _receiptInfo.approvedPeriod = _currentPeriod;\\n\\n Request storage _bufferRequest = _bufferMetric.requests.push();\\n _bufferRequest.kind = _kind;\\n _bufferRequest.id = _requestId;\\n\\n address[] storage _voters = _receiptInfo.voters;\\n for (uint _i = 0; _i < _voters.length; _i++) {\\n _increaseBallot(_kind, _requestId, _voters[_i], _currentPeriod);\\n }\\n\\n delete _receiptInfo.voters;\\n }\\n }\\n\\n /**\\n * @inheritdoc IBridgeTracking\\n */\\n function recordVote(\\n VoteKind _kind,\\n uint256 _requestId,\\n address _operator\\n ) external override onlyBridgeContract skipOnUnstarted {\\n uint256 _period = _validatorContract.currentPeriod();\\n _trySyncBuffer();\\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\\n\\n // When the vote is not approved yet, the voters are saved in the receipt info, and not increase ballot metric.\\n // The ballot metric will be increased later in the {handleVoteApproved} method.\\n if (_receiptInfo.approvedPeriod == 0) {\\n _receiptInfo.voters.push(_operator);\\n return;\\n }\\n\\n _increaseBallot(_kind, _requestId, _operator, _period);\\n }\\n\\n /**\\n * @dev Increases the ballot for the operator at a period.\\n */\\n function _increaseBallot(\\n VoteKind _kind,\\n uint256 _requestId,\\n address _operator,\\n uint256 _currentPeriod\\n ) internal {\\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\\n if (_receiptInfo.voted[_operator]) {\\n return;\\n }\\n\\n _receiptInfo.voted[_operator] = true;\\n\\n uint256 _trackedPeriod = _receiptInfo.trackedPeriod;\\n\\n // Do not increase ballot for receipt that is neither in the buffer, nor in the most current tracked period.\\n // If the receipt is not tracked in a period, increase metric in buffer.\\n if (_trackedPeriod == 0) {\\n if (_bufferMetric.data.totalBallotsOf[_operator] == 0) {\\n _bufferMetric.data.voters.push(_operator);\\n }\\n _bufferMetric.data.totalBallots++;\\n _bufferMetric.data.totalBallotsOf[_operator]++;\\n }\\n // If the receipt is tracked in the most current tracked period, increase metric in the period.\\n else if (_trackedPeriod == _currentPeriod) {\\n PeriodVotingMetric storage _metric = _periodMetric[_trackedPeriod];\\n _metric.totalBallots++;\\n _metric.totalBallotsOf[_operator]++;\\n }\\n }\\n\\n /**\\n * @dev See `totalBallotsOf`.\\n */\\n function _totalBallotsOf(\\n uint256 _period,\\n address _bridgeOperator,\\n bool _mustCountLastStats\\n ) internal view returns (uint256 _totalBallots) {\\n _totalBallots = _periodMetric[_period].totalBallotsOf[_bridgeOperator];\\n if (_mustCountLastStats) {\\n _totalBallots += _bufferMetric.data.totalBallotsOf[_bridgeOperator];\\n }\\n }\\n\\n /**\\n * @dev Syncs period stats. Move all data from the buffer metric to the period metric.\\n *\\n * Requirements:\\n * - The epoch after the buffer epoch is wrapped up.\\n */\\n function _trySyncBuffer() internal {\\n uint256 _currentEpoch = _validatorContract.epochOf(block.number);\\n if (_bufferMetric.lastEpoch < _currentEpoch) {\\n (, uint256 _trackedPeriod) = _validatorContract.tryGetPeriodOfEpoch(_bufferMetric.lastEpoch + 1);\\n _bufferMetric.lastEpoch = _currentEpoch;\\n\\n // Copy numbers of totals\\n PeriodVotingMetric storage _metric = _periodMetric[_trackedPeriod];\\n _metric.totalRequests += _bufferMetric.requests.length;\\n _metric.totalBallots += _bufferMetric.data.totalBallots;\\n\\n // Copy voters info and voters' ballot\\n for (uint _i = 0; _i < _bufferMetric.data.voters.length; _i++) {\\n address _voter = _bufferMetric.data.voters[_i];\\n _metric.totalBallotsOf[_voter] += _bufferMetric.data.totalBallotsOf[_voter];\\n delete _bufferMetric.data.totalBallotsOf[_voter]; // need to manually delete each element, due to mapping\\n }\\n\\n // Mark all receipts in the buffer as tracked. Keep total number of receipts and delete receipt details.\\n for (uint _i = 0; _i < _bufferMetric.requests.length; _i++) {\\n Request storage _bufferRequest = _bufferMetric.requests[_i];\\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_bufferRequest.kind][_bufferRequest.id];\\n _receiptInfo.trackedPeriod = _trackedPeriod;\\n }\\n\\n delete _bufferMetric.requests;\\n delete _bufferMetric.data;\\n }\\n }\\n\\n /**\\n * @dev Returns whether the buffer stats must be counted or not.\\n */\\n function _isBufferCountedForPeriod(uint256 _queriedPeriod) internal view returns (bool) {\\n uint256 _currentEpoch = _validatorContract.epochOf(block.number);\\n (bool _filled, uint256 _periodOfNextTemporaryEpoch) = _validatorContract.tryGetPeriodOfEpoch(\\n _bufferMetric.lastEpoch + 1\\n );\\n return _filled && _queriedPeriod == _periodOfNextTemporaryEpoch && _bufferMetric.lastEpoch < _currentEpoch;\\n }\\n}\\n\",\"keccak256\":\"0xc739580bbdc7a2adc1bb9e3c952c0b858fd25a7d92be1d774f57c76183de5581\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100eb565b600154600160a81b900460ff161561008c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60015460ff600160a01b909104811610156100e9576001805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b611290806100fa6000396000f3fe608060405234801561001057600080fd5b50600436106100a45760003560e01c806304375dcf146100a95780630b26cf66146100cf5780631794bb3c146100e457806319e6e158146100f7578063229f88ea1461010a578063889998ef1461011d5780639943908914610130578063c7c4fea91461014a578063cd5965831461015d578063cdf64a7614610165578063f67e815214610178578063f84bd12114610198575b600080fd5b6100bc6100b7366004610f61565b6101a1565b6040519081526020015b60405180910390f35b6100e26100dd366004610f8d565b6101bf565b005b6100e26100f2366004610fa8565b610237565b6100bc610105366004610fe4565b610371565b6100e261011836600461100c565b6103a3565b6100bc61012b366004610fe4565b61057c565b6001546001600160a01b03165b6040516100c69190611036565b6100e261015836600461104a565b6105a9565b61013d6106f7565b6100e2610173366004610f8d565b610706565b61018b610186366004611086565b610772565b6040516100c69190611104565b6100bc60025481565b60006101b683836101b186610839565b610958565b90505b92915050565b6101c76109b1565b6001600160a01b0316336001600160a01b0316146102005760405162461bcd60e51b81526004016101f790611148565b60405180910390fd5b6000816001600160a01b03163b1161022b57604051637bcd509160e01b815260040160405180910390fd5b610234816109df565b50565b600154600160a81b900460ff161580801561025d575060018054600160a01b900460ff16105b8061027d5750303b15801561027d575060018054600160a01b900460ff16145b6102e05760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016101f7565b6001805460ff60a01b1916600160a01b179055801561030d576001805460ff60a81b1916600160a81b1790555b610316846109df565b61031f83610a35565b6002829055801561036b576001805460ff60a81b191681556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60008181526009602052604090205461038982610839565b1561039e5760045461039b90826111a0565b90505b919050565b336103ac6106f7565b6001600160a01b0316146103d357604051631812f26f60e11b815260040160405180910390fd5b6002544310610578576000600a60008460028111156103f4576103f46111b3565b6002811115610405576104056111b3565b81526020019081526020016000206000838152602001908152602001600020905080600001546000036105765761043a610a80565b6001546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa158015610483573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a791906111c9565b808355600480546001818101835560009290925260029081027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b018054939450928792849260ff19909216918490811115610504576105046111b3565b02179055506001808201859055830160005b8154811015610563576105518787848481548110610536576105366111e2565b6000918252602090912001546001600160a01b031687610d27565b8061055b816111f8565b915050610516565b50610572600185016000610ed2565b5050505b505b5050565b60008181526009602052604090206001015461059782610839565b1561039e5760065461039b90826111a0565b336105b26106f7565b6001600160a01b0316146105d957604051631812f26f60e11b815260040160405180910390fd5b6002544310610576576001546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa15801561062b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064f91906111c9565b9050610659610a80565b6000600a6000866002811115610671576106716111b3565b6002811115610682576106826111b3565b81526020019081526020016000206000858152602001908152602001600020905080600001546000036106e4576001908101805491820181556000908152602090200180546001600160a01b0319166001600160a01b03841617905550610576565b6106f085858585610d27565b5050505050565b6000546001600160a01b031690565b61070e6109b1565b6001600160a01b0316336001600160a01b03161461073e5760405162461bcd60e51b81526004016101f790611148565b806001600160a01b03163b60000361076957604051637bcd509160e01b815260040160405180910390fd5b61023481610a35565b6060816001600160401b0381111561078c5761078c611211565b6040519080825280602002602001820160405280156107b5578160200160208202803683370190505b50905060006107c385610839565b905060005b8381101561083057610801868686848181106107e6576107e66111e2565b90506020020160208101906107fb9190610f8d565b84610958565b838281518110610813576108136111e2565b602090810291909101015280610828816111f8565b9150506107c8565b50509392505050565b60015460405163a3d545f560e01b815243600482015260009182916001600160a01b039091169063a3d545f590602401602060405180830381865afa158015610886573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108aa91906111c9565b6001805460035492935060009283926001600160a01b039092169163468c96ae916108d4916111a0565b6040518263ffffffff1660e01b81526004016108f291815260200190565b6040805180830381865afa15801561090e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109329190611227565b9150915081801561094257508085145b801561094f575060035483115b95945050505050565b60008381526009602090815260408083206001600160a01b038616845260020190915290205481156109aa576001600160a01b0383166000908152600760205260409020546109a790826111a0565b90505b9392505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b600080546001600160a01b0319166001600160a01b0383161790556040517f5cbd8a0bb00196365d5eb3457c6734e7f06666c3c78e5469b4c9deec7edae04890610a2a908390611036565b60405180910390a150565b600180546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990610a2a908390611036565b60015460405163a3d545f560e01b81524360048201526000916001600160a01b03169063a3d545f590602401602060405180830381865afa158015610ac9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aed91906111c9565b905080600360000154101561023457600180546003546000926001600160a01b039092169163468c96ae91610b21916111a0565b6040518263ffffffff1660e01b8152600401610b3f91815260200190565b6040805180830381865afa158015610b5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7f9190611227565b60038490556000818152600960205260408120600454815493955090935091839190610bac9084906111a0565b9091555050600654600182018054600090610bc89084906111a0565b90915550600090505b600854811015610c6257600880546000919083908110610bf357610bf36111e2565b60009182526020808320909101546001600160a01b0316808352600782526040808420546002880190935283208054919450919290610c339084906111a0565b90915550506001600160a01b031660009081526007602052604081205580610c5a816111f8565b915050610bd1565b5060005b600454811015610d0257600060036001018281548110610c8857610c886111e2565b6000918252602082206002918202018054909350600a91839160ff1690811115610cb457610cb46111b3565b6002811115610cc557610cc56111b3565b8152602080820192909252604090810160009081206001909501548152939091529091206003018490555080610cfa816111f8565b915050610c66565b50610d0f60046000610ef0565b600060058181556006829055906106f0600882610ed2565b6000600a6000866002811115610d3f57610d3f6111b3565b6002811115610d5057610d506111b3565b81526020808201929092526040908101600090812087825283528181206001600160a01b038716825260028101909352205490915060ff1615610d93575061036b565b6001600160a01b03831660009081526002820160205260408120805460ff19166001179055600382015490819003610e73576001600160a01b0384166000908152600760205260408120549003610e3057600880546001810182556000919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319166001600160a01b0386161790555b60068054906000610e40836111f8565b90915550506001600160a01b0384166000908152600760205260408120805491610e69836111f8565b9190505550610572565b8281036105725760008181526009602052604081206001810180549192610e99836111f8565b90915550506001600160a01b03851660009081526002820160205260408120805491610ec4836111f8565b919050555050505050505050565b50805460008255906000526020600020908101906102349190610f11565b50805460008255600202906000526020600020908101906102349190610f2a565b5b80821115610f265760008155600101610f12565b5090565b5b80821115610f2657805460ff1916815560006001820155600201610f2b565b80356001600160a01b038116811461039e57600080fd5b60008060408385031215610f7457600080fd5b82359150610f8460208401610f4a565b90509250929050565b600060208284031215610f9f57600080fd5b6101b682610f4a565b600080600060608486031215610fbd57600080fd5b610fc684610f4a565b9250610fd460208501610f4a565b9150604084013590509250925092565b600060208284031215610ff657600080fd5b5035919050565b80356003811061039e57600080fd5b6000806040838503121561101f57600080fd5b61102883610ffd565b946020939093013593505050565b6001600160a01b0391909116815260200190565b60008060006060848603121561105f57600080fd5b61106884610ffd565b92506020840135915061107d60408501610f4a565b90509250925092565b60008060006040848603121561109b57600080fd5b8335925060208401356001600160401b03808211156110b957600080fd5b818601915086601f8301126110cd57600080fd5b8135818111156110dc57600080fd5b8760208260051b85010111156110f157600080fd5b6020830194508093505050509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561113c57835183529284019291840191600101611120565b50909695505050505050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b808201808211156101b9576101b961118a565b634e487b7160e01b600052602160045260246000fd5b6000602082840312156111db57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60006001820161120a5761120a61118a565b5060010190565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561123a57600080fd5b8251801515811461124a57600080fd5b602093909301519294929350505056fea264697066735822122022921d73a729b636012f19e59da68f098ee3e90169fe2832ab2bf0d9444f1df364736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a45760003560e01c806304375dcf146100a95780630b26cf66146100cf5780631794bb3c146100e457806319e6e158146100f7578063229f88ea1461010a578063889998ef1461011d5780639943908914610130578063c7c4fea91461014a578063cd5965831461015d578063cdf64a7614610165578063f67e815214610178578063f84bd12114610198575b600080fd5b6100bc6100b7366004610f61565b6101a1565b6040519081526020015b60405180910390f35b6100e26100dd366004610f8d565b6101bf565b005b6100e26100f2366004610fa8565b610237565b6100bc610105366004610fe4565b610371565b6100e261011836600461100c565b6103a3565b6100bc61012b366004610fe4565b61057c565b6001546001600160a01b03165b6040516100c69190611036565b6100e261015836600461104a565b6105a9565b61013d6106f7565b6100e2610173366004610f8d565b610706565b61018b610186366004611086565b610772565b6040516100c69190611104565b6100bc60025481565b60006101b683836101b186610839565b610958565b90505b92915050565b6101c76109b1565b6001600160a01b0316336001600160a01b0316146102005760405162461bcd60e51b81526004016101f790611148565b60405180910390fd5b6000816001600160a01b03163b1161022b57604051637bcd509160e01b815260040160405180910390fd5b610234816109df565b50565b600154600160a81b900460ff161580801561025d575060018054600160a01b900460ff16105b8061027d5750303b15801561027d575060018054600160a01b900460ff16145b6102e05760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016101f7565b6001805460ff60a01b1916600160a01b179055801561030d576001805460ff60a81b1916600160a81b1790555b610316846109df565b61031f83610a35565b6002829055801561036b576001805460ff60a81b191681556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b60008181526009602052604090205461038982610839565b1561039e5760045461039b90826111a0565b90505b919050565b336103ac6106f7565b6001600160a01b0316146103d357604051631812f26f60e11b815260040160405180910390fd5b6002544310610578576000600a60008460028111156103f4576103f46111b3565b6002811115610405576104056111b3565b81526020019081526020016000206000838152602001908152602001600020905080600001546000036105765761043a610a80565b6001546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa158015610483573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104a791906111c9565b808355600480546001818101835560009290925260029081027f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b018054939450928792849260ff19909216918490811115610504576105046111b3565b02179055506001808201859055830160005b8154811015610563576105518787848481548110610536576105366111e2565b6000918252602090912001546001600160a01b031687610d27565b8061055b816111f8565b915050610516565b50610572600185016000610ed2565b5050505b505b5050565b60008181526009602052604090206001015461059782610839565b1561039e5760065461039b90826111a0565b336105b26106f7565b6001600160a01b0316146105d957604051631812f26f60e11b815260040160405180910390fd5b6002544310610576576001546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa15801561062b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061064f91906111c9565b9050610659610a80565b6000600a6000866002811115610671576106716111b3565b6002811115610682576106826111b3565b81526020019081526020016000206000858152602001908152602001600020905080600001546000036106e4576001908101805491820181556000908152602090200180546001600160a01b0319166001600160a01b03841617905550610576565b6106f085858585610d27565b5050505050565b6000546001600160a01b031690565b61070e6109b1565b6001600160a01b0316336001600160a01b03161461073e5760405162461bcd60e51b81526004016101f790611148565b806001600160a01b03163b60000361076957604051637bcd509160e01b815260040160405180910390fd5b61023481610a35565b6060816001600160401b0381111561078c5761078c611211565b6040519080825280602002602001820160405280156107b5578160200160208202803683370190505b50905060006107c385610839565b905060005b8381101561083057610801868686848181106107e6576107e66111e2565b90506020020160208101906107fb9190610f8d565b84610958565b838281518110610813576108136111e2565b602090810291909101015280610828816111f8565b9150506107c8565b50509392505050565b60015460405163a3d545f560e01b815243600482015260009182916001600160a01b039091169063a3d545f590602401602060405180830381865afa158015610886573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108aa91906111c9565b6001805460035492935060009283926001600160a01b039092169163468c96ae916108d4916111a0565b6040518263ffffffff1660e01b81526004016108f291815260200190565b6040805180830381865afa15801561090e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109329190611227565b9150915081801561094257508085145b801561094f575060035483115b95945050505050565b60008381526009602090815260408083206001600160a01b038616845260020190915290205481156109aa576001600160a01b0383166000908152600760205260409020546109a790826111a0565b90505b9392505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b600080546001600160a01b0319166001600160a01b0383161790556040517f5cbd8a0bb00196365d5eb3457c6734e7f06666c3c78e5469b4c9deec7edae04890610a2a908390611036565b60405180910390a150565b600180546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990610a2a908390611036565b60015460405163a3d545f560e01b81524360048201526000916001600160a01b03169063a3d545f590602401602060405180830381865afa158015610ac9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aed91906111c9565b905080600360000154101561023457600180546003546000926001600160a01b039092169163468c96ae91610b21916111a0565b6040518263ffffffff1660e01b8152600401610b3f91815260200190565b6040805180830381865afa158015610b5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b7f9190611227565b60038490556000818152600960205260408120600454815493955090935091839190610bac9084906111a0565b9091555050600654600182018054600090610bc89084906111a0565b90915550600090505b600854811015610c6257600880546000919083908110610bf357610bf36111e2565b60009182526020808320909101546001600160a01b0316808352600782526040808420546002880190935283208054919450919290610c339084906111a0565b90915550506001600160a01b031660009081526007602052604081205580610c5a816111f8565b915050610bd1565b5060005b600454811015610d0257600060036001018281548110610c8857610c886111e2565b6000918252602082206002918202018054909350600a91839160ff1690811115610cb457610cb46111b3565b6002811115610cc557610cc56111b3565b8152602080820192909252604090810160009081206001909501548152939091529091206003018490555080610cfa816111f8565b915050610c66565b50610d0f60046000610ef0565b600060058181556006829055906106f0600882610ed2565b6000600a6000866002811115610d3f57610d3f6111b3565b6002811115610d5057610d506111b3565b81526020808201929092526040908101600090812087825283528181206001600160a01b038716825260028101909352205490915060ff1615610d93575061036b565b6001600160a01b03831660009081526002820160205260408120805460ff19166001179055600382015490819003610e73576001600160a01b0384166000908152600760205260408120549003610e3057600880546001810182556000919091527ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee30180546001600160a01b0319166001600160a01b0386161790555b60068054906000610e40836111f8565b90915550506001600160a01b0384166000908152600760205260408120805491610e69836111f8565b9190505550610572565b8281036105725760008181526009602052604081206001810180549192610e99836111f8565b90915550506001600160a01b03851660009081526002820160205260408120805491610ec4836111f8565b919050555050505050505050565b50805460008255906000526020600020908101906102349190610f11565b50805460008255600202906000526020600020908101906102349190610f2a565b5b80821115610f265760008155600101610f12565b5090565b5b80821115610f2657805460ff1916815560006001820155600201610f2b565b80356001600160a01b038116811461039e57600080fd5b60008060408385031215610f7457600080fd5b82359150610f8460208401610f4a565b90509250929050565b600060208284031215610f9f57600080fd5b6101b682610f4a565b600080600060608486031215610fbd57600080fd5b610fc684610f4a565b9250610fd460208501610f4a565b9150604084013590509250925092565b600060208284031215610ff657600080fd5b5035919050565b80356003811061039e57600080fd5b6000806040838503121561101f57600080fd5b61102883610ffd565b946020939093013593505050565b6001600160a01b0391909116815260200190565b60008060006060848603121561105f57600080fd5b61106884610ffd565b92506020840135915061107d60408501610f4a565b90509250925092565b60008060006040848603121561109b57600080fd5b8335925060208401356001600160401b03808211156110b957600080fd5b818601915086601f8301126110cd57600080fd5b8135818111156110dc57600080fd5b8760208260051b85010111156110f157600080fd5b6020830194508093505050509250925092565b6020808252825182820181905260009190848201906040850190845b8181101561113c57835183529284019291840191600101611120565b50909695505050505050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b808201808211156101b9576101b961118a565b634e487b7160e01b600052602160045260246000fd5b6000602082840312156111db57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b60006001820161120a5761120a61118a565b5060010190565b634e487b7160e01b600052604160045260246000fd5b6000806040838503121561123a57600080fd5b8251801515811461124a57600080fd5b602093909301519294929350505056fea264697066735822122022921d73a729b636012f19e59da68f098ee3e90169fe2832ab2bf0d9444f1df364736f6c63430008110033", "devdoc": { "errors": { "ErrCallerMustBeBridgeContract()": [ @@ -389,24 +389,24 @@ "storageLayout": { "storage": [ { - "astId": 5797, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 6386, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "_bridgeContract", "offset": 0, "slot": "0", - "type": "t_contract(IBridge)9270" + "type": "t_contract(IBridge)9212" }, { - "astId": 6462, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 7051, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "_validatorContract", "offset": 0, "slot": "1", - "type": "t_contract(IRoninValidatorSet)11984" + "type": "t_contract(IRoninValidatorSet)11973" }, { "astId": 1373, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "_initialized", "offset": 20, "slot": "1", @@ -414,43 +414,43 @@ }, { "astId": 1376, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "_initializing", "offset": 21, "slot": "1", "type": "t_bool" }, { - "astId": 20487, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23106, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "startedAtBlock", "offset": 0, "slot": "2", "type": "t_uint256" }, { - "astId": 20491, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23110, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "_bufferMetric", "offset": 0, "slot": "3", - "type": "t_struct(PeriodVotingMetricTimeWrapper)20468_storage" + "type": "t_struct(PeriodVotingMetricTimeWrapper)23087_storage" }, { - "astId": 20497, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23116, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "_periodMetric", "offset": 0, "slot": "9", - "type": "t_mapping(t_uint256,t_struct(PeriodVotingMetric)20458_storage)" + "type": "t_mapping(t_uint256,t_struct(PeriodVotingMetric)23077_storage)" }, { - "astId": 20506, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23125, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "_receiptTrackingInfo", "offset": 0, "slot": "10", - "type": "t_mapping(t_enum(VoteKind)9282,t_mapping(t_uint256,t_struct(ReceiptTrackingInfo)20484_storage))" + "type": "t_mapping(t_enum(VoteKind)9224,t_mapping(t_uint256,t_struct(ReceiptTrackingInfo)23103_storage))" } ], "types": { @@ -465,8 +465,8 @@ "label": "address[]", "numberOfBytes": "32" }, - "t_array(t_struct(Request)9278_storage)dyn_storage": { - "base": "t_struct(Request)9278_storage", + "t_array(t_struct(Request)9220_storage)dyn_storage": { + "base": "t_struct(Request)9220_storage", "encoding": "dynamic_array", "label": "struct IBridgeTracking.Request[]", "numberOfBytes": "32" @@ -476,17 +476,17 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(IBridge)9270": { + "t_contract(IBridge)9212": { "encoding": "inplace", "label": "contract IBridge", "numberOfBytes": "20" }, - "t_contract(IRoninValidatorSet)11984": { + "t_contract(IRoninValidatorSet)11973": { "encoding": "inplace", "label": "contract IRoninValidatorSet", "numberOfBytes": "20" }, - "t_enum(VoteKind)9282": { + "t_enum(VoteKind)9224": { "encoding": "inplace", "label": "enum IBridgeTracking.VoteKind", "numberOfBytes": "1" @@ -505,58 +505,58 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_mapping(t_enum(VoteKind)9282,t_mapping(t_uint256,t_struct(ReceiptTrackingInfo)20484_storage))": { + "t_mapping(t_enum(VoteKind)9224,t_mapping(t_uint256,t_struct(ReceiptTrackingInfo)23103_storage))": { "encoding": "mapping", - "key": "t_enum(VoteKind)9282", + "key": "t_enum(VoteKind)9224", "label": "mapping(enum IBridgeTracking.VoteKind => mapping(uint256 => struct BridgeTracking.ReceiptTrackingInfo))", "numberOfBytes": "32", - "value": "t_mapping(t_uint256,t_struct(ReceiptTrackingInfo)20484_storage)" + "value": "t_mapping(t_uint256,t_struct(ReceiptTrackingInfo)23103_storage)" }, - "t_mapping(t_uint256,t_struct(PeriodVotingMetric)20458_storage)": { + "t_mapping(t_uint256,t_struct(PeriodVotingMetric)23077_storage)": { "encoding": "mapping", "key": "t_uint256", "label": "mapping(uint256 => struct BridgeTracking.PeriodVotingMetric)", "numberOfBytes": "32", - "value": "t_struct(PeriodVotingMetric)20458_storage" + "value": "t_struct(PeriodVotingMetric)23077_storage" }, - "t_mapping(t_uint256,t_struct(ReceiptTrackingInfo)20484_storage)": { + "t_mapping(t_uint256,t_struct(ReceiptTrackingInfo)23103_storage)": { "encoding": "mapping", "key": "t_uint256", "label": "mapping(uint256 => struct BridgeTracking.ReceiptTrackingInfo)", "numberOfBytes": "32", - "value": "t_struct(ReceiptTrackingInfo)20484_storage" + "value": "t_struct(ReceiptTrackingInfo)23103_storage" }, - "t_struct(PeriodVotingMetric)20458_storage": { + "t_struct(PeriodVotingMetric)23077_storage": { "encoding": "inplace", "label": "struct BridgeTracking.PeriodVotingMetric", "members": [ { - "astId": 20448, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23067, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "totalRequests", "offset": 0, "slot": "0", "type": "t_uint256" }, { - "astId": 20450, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23069, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "totalBallots", "offset": 0, "slot": "1", "type": "t_uint256" }, { - "astId": 20454, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23073, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "totalBallotsOf", "offset": 0, "slot": "2", "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 20457, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23076, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "voters", "offset": 0, "slot": "3", @@ -565,68 +565,68 @@ ], "numberOfBytes": "128" }, - "t_struct(PeriodVotingMetricTimeWrapper)20468_storage": { + "t_struct(PeriodVotingMetricTimeWrapper)23087_storage": { "encoding": "inplace", "label": "struct BridgeTracking.PeriodVotingMetricTimeWrapper", "members": [ { - "astId": 20460, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23079, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "lastEpoch", "offset": 0, "slot": "0", "type": "t_uint256" }, { - "astId": 20464, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23083, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "requests", "offset": 0, "slot": "1", - "type": "t_array(t_struct(Request)9278_storage)dyn_storage" + "type": "t_array(t_struct(Request)9220_storage)dyn_storage" }, { - "astId": 20467, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23086, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "data", "offset": 0, "slot": "2", - "type": "t_struct(PeriodVotingMetric)20458_storage" + "type": "t_struct(PeriodVotingMetric)23077_storage" } ], "numberOfBytes": "192" }, - "t_struct(ReceiptTrackingInfo)20484_storage": { + "t_struct(ReceiptTrackingInfo)23103_storage": { "encoding": "inplace", "label": "struct BridgeTracking.ReceiptTrackingInfo", "members": [ { - "astId": 20471, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23090, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "approvedPeriod", "offset": 0, "slot": "0", "type": "t_uint256" }, { - "astId": 20475, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23094, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "voters", "offset": 0, "slot": "1", "type": "t_array(t_address)dyn_storage" }, { - "astId": 20480, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23099, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "voted", "offset": 0, "slot": "2", "type": "t_mapping(t_address,t_bool)" }, { - "astId": 20483, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 23102, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "trackedPeriod", "offset": 0, "slot": "3", @@ -635,21 +635,21 @@ ], "numberOfBytes": "128" }, - "t_struct(Request)9278_storage": { + "t_struct(Request)9220_storage": { "encoding": "inplace", "label": "struct IBridgeTracking.Request", "members": [ { - "astId": 9275, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 9217, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "kind", "offset": 0, "slot": "0", - "type": "t_enum(VoteKind)9282" + "type": "t_enum(VoteKind)9224" }, { - "astId": 9277, - "contract": "contracts/ronin/BridgeTracking.sol:BridgeTracking", + "astId": 9219, + "contract": "contracts/ronin/gateway/BridgeTracking.sol:BridgeTracking", "label": "id", "offset": 0, "slot": "1", diff --git a/deployments/ronin-testnet/BridgeTrackingProxy.json b/deployments/ronin-testnet/BridgeTrackingProxy.json index bf4bb06b5..3621be1c6 100644 --- a/deployments/ronin-testnet/BridgeTrackingProxy.json +++ b/deployments/ronin-testnet/BridgeTrackingProxy.json @@ -1,5 +1,5 @@ { - "address": "0x17E4fef1C437d27E013C83E4d2f5fc352CB22bcd", + "address": "0x874ad3ACb2801733c3fbE31a555d430Ce3A138Ed", "abi": [ { "inputs": [ @@ -159,94 +159,94 @@ "type": "receive" } ], - "transactionHash": "0x88fa7987cd245c0c2e7e49213737a42294362ce8e504a768cdb53b7170308763", + "transactionHash": "0x0a89857e1c810f56c5cf1166d10ca2c627a99b8308d0cdbeec815757d2e5e45b", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0x17E4fef1C437d27E013C83E4d2f5fc352CB22bcd", + "contractAddress": "0x874ad3ACb2801733c3fbE31a555d430Ce3A138Ed", "transactionIndex": 0, - "gasUsed": "693828", - "logsBloom": "0x00000000000000000000010000000000400200000000000000000000000000000000000010002000000000000000000000000000000000000000000000000000040000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000010000000000000000000400000800000000040000000000000000000000000080000000000000800000000000000000000010000000000400000000000000000000000000000000000000000020800000000000000000040000000000000400000000000000000000000000000000000000000000000000000000000000000000000000004000000000", - "blockHash": "0xd9a3fda002a328eb645ec351019708c25d194361a0e56030a2fba5fdbcce5905", - "transactionHash": "0x88fa7987cd245c0c2e7e49213737a42294362ce8e504a768cdb53b7170308763", + "gasUsed": "690837", + "logsBloom": "0x00000000000000000000010000000000400000000000000000000000800000000000000010002000000000000000000000000800000000000000000000000000040000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000080000000000000000000000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020800000000400000000040000000010000400000000000000000000000000000000000000000000000000000000000000000000000000024000000000", + "blockHash": "0x25b7686ced1d0030a7c39de8d8f22abe817fb51a133eb30a005e4b4b046bb395", + "transactionHash": "0x0a89857e1c810f56c5cf1166d10ca2c627a99b8308d0cdbeec815757d2e5e45b", "logs": [ { "transactionIndex": 0, - "blockNumber": 14864662, - "transactionHash": "0x88fa7987cd245c0c2e7e49213737a42294362ce8e504a768cdb53b7170308763", - "address": "0x17E4fef1C437d27E013C83E4d2f5fc352CB22bcd", + "blockNumber": 16817403, + "transactionHash": "0x0a89857e1c810f56c5cf1166d10ca2c627a99b8308d0cdbeec815757d2e5e45b", + "address": "0x874ad3ACb2801733c3fbE31a555d430Ce3A138Ed", "topics": [ "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", - "0x000000000000000000000000a90e5f51dd8c7b85c1396b1fad4a03c0935f9629" + "0x000000000000000000000000cb47efa4212d95ae8fb7942bbed4aa47083886ea" ], "data": "0x", "logIndex": 0, - "blockHash": "0xd9a3fda002a328eb645ec351019708c25d194361a0e56030a2fba5fdbcce5905" + "blockHash": "0x25b7686ced1d0030a7c39de8d8f22abe817fb51a133eb30a005e4b4b046bb395" }, { "transactionIndex": 0, - "blockNumber": 14864662, - "transactionHash": "0x88fa7987cd245c0c2e7e49213737a42294362ce8e504a768cdb53b7170308763", - "address": "0x17E4fef1C437d27E013C83E4d2f5fc352CB22bcd", + "blockNumber": 16817403, + "transactionHash": "0x0a89857e1c810f56c5cf1166d10ca2c627a99b8308d0cdbeec815757d2e5e45b", + "address": "0x874ad3ACb2801733c3fbE31a555d430Ce3A138Ed", "topics": [ "0x5cbd8a0bb00196365d5eb3457c6734e7f06666c3c78e5469b4c9deec7edae048" ], "data": "0x000000000000000000000000cee681c9108c42c710c6a8a949307d5f13c9f3ca", "logIndex": 1, - "blockHash": "0xd9a3fda002a328eb645ec351019708c25d194361a0e56030a2fba5fdbcce5905" + "blockHash": "0x25b7686ced1d0030a7c39de8d8f22abe817fb51a133eb30a005e4b4b046bb395" }, { "transactionIndex": 0, - "blockNumber": 14864662, - "transactionHash": "0x88fa7987cd245c0c2e7e49213737a42294362ce8e504a768cdb53b7170308763", - "address": "0x17E4fef1C437d27E013C83E4d2f5fc352CB22bcd", + "blockNumber": 16817403, + "transactionHash": "0x0a89857e1c810f56c5cf1166d10ca2c627a99b8308d0cdbeec815757d2e5e45b", + "address": "0x874ad3ACb2801733c3fbE31a555d430Ce3A138Ed", "topics": [ "0xef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169" ], "data": "0x00000000000000000000000054b3ac74a90e64e8dde60671b6fe8f8ddf18ec9d", "logIndex": 2, - "blockHash": "0xd9a3fda002a328eb645ec351019708c25d194361a0e56030a2fba5fdbcce5905" + "blockHash": "0x25b7686ced1d0030a7c39de8d8f22abe817fb51a133eb30a005e4b4b046bb395" }, { "transactionIndex": 0, - "blockNumber": 14864662, - "transactionHash": "0x88fa7987cd245c0c2e7e49213737a42294362ce8e504a768cdb53b7170308763", - "address": "0x17E4fef1C437d27E013C83E4d2f5fc352CB22bcd", + "blockNumber": 16817403, + "transactionHash": "0x0a89857e1c810f56c5cf1166d10ca2c627a99b8308d0cdbeec815757d2e5e45b", + "address": "0x874ad3ACb2801733c3fbE31a555d430Ce3A138Ed", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x0000000000000000000000000000000000000000000000000000000000000001", "logIndex": 3, - "blockHash": "0xd9a3fda002a328eb645ec351019708c25d194361a0e56030a2fba5fdbcce5905" + "blockHash": "0x25b7686ced1d0030a7c39de8d8f22abe817fb51a133eb30a005e4b4b046bb395" }, { "transactionIndex": 0, - "blockNumber": 14864662, - "transactionHash": "0x88fa7987cd245c0c2e7e49213737a42294362ce8e504a768cdb53b7170308763", - "address": "0x17E4fef1C437d27E013C83E4d2f5fc352CB22bcd", + "blockNumber": 16817403, + "transactionHash": "0x0a89857e1c810f56c5cf1166d10ca2c627a99b8308d0cdbeec815757d2e5e45b", + "address": "0x874ad3ACb2801733c3fbE31a555d430Ce3A138Ed", "topics": [ "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" ], - "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a1de8d3f62114bc1666655ae1719be26ae26ee36", + "data": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000003faa6bf89df69cc36675ddbee53f440564ea9c7a", "logIndex": 4, - "blockHash": "0xd9a3fda002a328eb645ec351019708c25d194361a0e56030a2fba5fdbcce5905" + "blockHash": "0x25b7686ced1d0030a7c39de8d8f22abe817fb51a133eb30a005e4b4b046bb395" } ], - "blockNumber": 14864662, - "cumulativeGasUsed": "693828", + "blockNumber": 16817403, + "cumulativeGasUsed": "690837", "status": 1, "byzantium": true }, "args": [ - "0xA90e5F51Dd8C7b85c1396b1faD4A03c0935F9629", - "0xA1DE8d3F62114Bc1666655Ae1719bE26Ae26Ee36", + "0xCb47Efa4212d95AE8Fb7942bbEd4AA47083886eA", + "0x3Faa6bf89dF69Cc36675dDBEe53f440564EA9C7A", "0x1794bb3c000000000000000000000000cee681c9108c42c710c6a8a949307d5f13c9f3ca00000000000000000000000054b3ac74a90e64e8dde60671b6fe8f8ddf18ec9d0000000000000000000000000000000000000000000000000000000000000000" ], - "numDeployments": 1, - "solcInputHash": "496d5ba113d6511f02e611e47b8a6065", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"functionDelegateCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"functionDelegateCall(bytes)\":{\"details\":\"Calls a function from the current implementation as specified by `_data`, which should be an encoded function call. Requirements: - Only the admin can call this function. Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider reviewing the encoded data `_data` and the method which is called before using this.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":\"TransparentUpgradeableProxyV2\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\\n\\n /**\\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\\n *\\n * Requirements:\\n * - Only the admin can call this function.\\n *\\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\\n * reviewing the encoded data `_data` and the method which is called before using this.\\n *\\n */\\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\\n address _addr = _implementation();\\n assembly {\\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\\n returndatacopy(0, 0, returndatasize())\\n switch _result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6609392ea7d3174439b5715100bee82528fe6e4aff28927d48c27db8475e88c5\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405260405162000f5f38038062000f5f83398101604081905262000026916200048d565b8282828281620000398282600062000053565b506200004790508262000090565b505050505050620005c0565b6200005e83620000eb565b6000825111806200006c5750805b156200008b576200008983836200012d60201b620002911760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f620000bb6200015c565b604080516001600160a01b03928316815291841660208301520160405180910390a1620000e88162000195565b50565b620000f6816200024a565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606062000155838360405180606001604052806027815260200162000f3860279139620002fe565b9392505050565b60006200018660008051602062000f1883398151915260001b620003e460201b6200024d1760201c565b546001600160a01b0316919050565b6001600160a01b038116620002005760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b806200022960008051602062000f1883398151915260001b620003e460201b6200024d1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6200026081620003e760201b620002bd1760201c565b620002c45760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401620001f7565b80620002297f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b620003e460201b6200024d1760201c565b60606001600160a01b0384163b620003685760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401620001f7565b600080856001600160a01b0316856040516200038591906200056d565b600060405180830381855af49150503d8060008114620003c2576040519150601f19603f3d011682016040523d82523d6000602084013e620003c7565b606091505b509092509050620003da828286620003f6565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200040757508162000155565b825115620004185782518084602001fd5b8160405162461bcd60e51b8152600401620001f791906200058b565b80516001600160a01b03811681146200044c57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004845781810151838201526020016200046a565b50506000910152565b600080600060608486031215620004a357600080fd5b620004ae8462000434565b9250620004be6020850162000434565b60408501519092506001600160401b0380821115620004dc57600080fd5b818601915086601f830112620004f157600080fd5b81518181111562000506576200050662000451565b604051601f8201601f19908116603f0116810190838211818310171562000531576200053162000451565b816040528281528960208487010111156200054b57600080fd5b6200055e83602083016020880162000467565b80955050505050509250925092565b600082516200058181846020870162000467565b9190910192915050565b6020815260008251806020840152620005ac81604085016020870162000467565b601f01601f19169190910160400192915050565b61094880620005d06000396000f3fe6080604052600436106100595760003560e01c80633659cfe6146100705780634bb5274a146100905780634f1ef286146100a35780635c60da1b146100b65780638f283970146100e7578063f851a4401461010757610068565b366100685761006661011c565b005b61006661011c565b34801561007c57600080fd5b5061006661008b366004610713565b610136565b61006661009e366004610744565b610173565b6100666100b13660046107f5565b6101b8565b3480156100c257600080fd5b506100cb61021f565b6040516001600160a01b03909116815260200160405180910390f35b3480156100f357600080fd5b50610066610102366004610713565b610250565b34801561011357600080fd5b506100cb610270565b6101246102cc565b61013461012f610361565b61036b565b565b61013e61038a565b6001600160a01b0316330361016b57610168816040518060200160405280600081525060006103bd565b50565b61016861011c565b61017b61038a565b6001600160a01b0316330361016b576000610194610361565b9050600080835160208501845af43d6000803e8080156101b3573d6000f35b3d6000fd5b6101c061038a565b6001600160a01b03163303610217576102128383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103bd915050565b505050565b61021261011c565b600061022961038a565b6001600160a01b0316330361024557610240610361565b905090565b61024d61011c565b90565b61025861038a565b6001600160a01b0316330361016b57610168816103e8565b600061027a61038a565b6001600160a01b031633036102455761024061038a565b60606102b683836040518060600160405280602781526020016108ec6027913961043c565b9392505050565b6001600160a01b03163b151590565b6102d461038a565b6001600160a01b031633036101345760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b6000610240610519565b3660008037600080366000845af43d6000803e8080156101b3573d6000f35b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b6103c683610541565b6000825111806103d35750805b15610212576103e28383610291565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61041161038a565b604080516001600160a01b03928316815291841660208301520160405180910390a161016881610581565b60606001600160a01b0384163b6104a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610358565b600080856001600160a01b0316856040516104bf919061089c565b600060405180830381855af49150503d80600081146104fa576040519150601f19603f3d011682016040523d82523d6000602084013e6104ff565b606091505b509150915061050f82828661062a565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103ae565b61054a81610663565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105e65760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610358565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b606083156106395750816102b6565b8251156106495782518084602001fd5b8160405162461bcd60e51b815260040161035891906108b8565b6001600160a01b0381163b6106d05760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610358565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610609565b80356001600160a01b038116811461070e57600080fd5b919050565b60006020828403121561072557600080fd5b6102b6826106f7565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561075657600080fd5b813567ffffffffffffffff8082111561076e57600080fd5b818401915084601f83011261078257600080fd5b8135818111156107945761079461072e565b604051601f8201601f19908116603f011681019083821181831017156107bc576107bc61072e565b816040528281528760208487010111156107d557600080fd5b826020860160208301376000928101602001929092525095945050505050565b60008060006040848603121561080a57600080fd5b610813846106f7565b9250602084013567ffffffffffffffff8082111561083057600080fd5b818601915086601f83011261084457600080fd5b81358181111561085357600080fd5b87602082850101111561086557600080fd5b6020830194508093505050509250925092565b60005b8381101561089357818101518382015260200161087b565b50506000910152565b600082516108ae818460208701610878565b9190910192915050565b60208152600082518060208401526108d7816040850160208701610878565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220bebb3300d99b476bd2f64bbccc422fc4bd31a9389ff1c675d867f0aac8101a5664736f6c63430008110033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", - "deployedBytecode": "0x6080604052600436106100595760003560e01c80633659cfe6146100705780634bb5274a146100905780634f1ef286146100a35780635c60da1b146100b65780638f283970146100e7578063f851a4401461010757610068565b366100685761006661011c565b005b61006661011c565b34801561007c57600080fd5b5061006661008b366004610713565b610136565b61006661009e366004610744565b610173565b6100666100b13660046107f5565b6101b8565b3480156100c257600080fd5b506100cb61021f565b6040516001600160a01b03909116815260200160405180910390f35b3480156100f357600080fd5b50610066610102366004610713565b610250565b34801561011357600080fd5b506100cb610270565b6101246102cc565b61013461012f610361565b61036b565b565b61013e61038a565b6001600160a01b0316330361016b57610168816040518060200160405280600081525060006103bd565b50565b61016861011c565b61017b61038a565b6001600160a01b0316330361016b576000610194610361565b9050600080835160208501845af43d6000803e8080156101b3573d6000f35b3d6000fd5b6101c061038a565b6001600160a01b03163303610217576102128383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103bd915050565b505050565b61021261011c565b600061022961038a565b6001600160a01b0316330361024557610240610361565b905090565b61024d61011c565b90565b61025861038a565b6001600160a01b0316330361016b57610168816103e8565b600061027a61038a565b6001600160a01b031633036102455761024061038a565b60606102b683836040518060600160405280602781526020016108ec6027913961043c565b9392505050565b6001600160a01b03163b151590565b6102d461038a565b6001600160a01b031633036101345760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b6000610240610519565b3660008037600080366000845af43d6000803e8080156101b3573d6000f35b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b546001600160a01b0316919050565b6103c683610541565b6000825111806103d35750805b15610212576103e28383610291565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61041161038a565b604080516001600160a01b03928316815291841660208301520160405180910390a161016881610581565b60606001600160a01b0384163b6104a45760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610358565b600080856001600160a01b0316856040516104bf919061089c565b600060405180830381855af49150503d80600081146104fa576040519150601f19603f3d011682016040523d82523d6000602084013e6104ff565b606091505b509150915061050f82828661062a565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103ae565b61054a81610663565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105e65760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610358565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80546001600160a01b0319166001600160a01b039290921691909117905550565b606083156106395750816102b6565b8251156106495782518084602001fd5b8160405162461bcd60e51b815260040161035891906108b8565b6001600160a01b0381163b6106d05760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610358565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610609565b80356001600160a01b038116811461070e57600080fd5b919050565b60006020828403121561072557600080fd5b6102b6826106f7565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561075657600080fd5b813567ffffffffffffffff8082111561076e57600080fd5b818401915084601f83011261078257600080fd5b8135818111156107945761079461072e565b604051601f8201601f19908116603f011681019083821181831017156107bc576107bc61072e565b816040528281528760208487010111156107d557600080fd5b826020860160208301376000928101602001929092525095945050505050565b60008060006040848603121561080a57600080fd5b610813846106f7565b9250602084013567ffffffffffffffff8082111561083057600080fd5b818601915086601f83011261084457600080fd5b81358181111561085357600080fd5b87602082850101111561086557600080fd5b6020830194508093505050509250925092565b60005b8381101561089357818101518382015260200161087b565b50506000910152565b600082516108ae818460208701610878565b9190910192915050565b60208152600082518060208401526108d7816040850160208701610878565b601f01601f1916919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220bebb3300d99b476bd2f64bbccc422fc4bd31a9389ff1c675d867f0aac8101a5664736f6c63430008110033", + "numDeployments": 2, + "solcInputHash": "2a8db5de0d3bfe0cb40ba15ae8460f16", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"name\":\"functionDelegateCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"functionDelegateCall(bytes)\":{\"details\":\"Calls a function from the current implementation as specified by `_data`, which should be an encoded function call. Requirements: - Only the admin can call this function. Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider reviewing the encoded data `_data` and the method which is called before using this.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":\"TransparentUpgradeableProxyV2\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":0},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin.\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xa6a787e7a901af6511e19aa53e1a00352db215a011d2c7a438d0582dd5da76f9\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/TransparentUpgradeableProxyV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\\\";\\n\\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\\n\\n /**\\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\\n *\\n * Requirements:\\n * - Only the admin can call this function.\\n *\\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\\n * reviewing the encoded data `_data` and the method which is called before using this.\\n *\\n */\\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\\n address _addr = _implementation();\\n assembly {\\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\\n returndatacopy(0, 0, returndatasize())\\n switch _result\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x6609392ea7d3174439b5715100bee82528fe6e4aff28927d48c27db8475e88c5\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405260405162000f5138038062000f5183398101604081905262000026916200048d565b8282828281620000398282600062000053565b506200004790508262000090565b505050505050620005c0565b6200005e83620000eb565b6000825111806200006c5750805b156200008b576200008983836200012d60201b620002911760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f620000bb6200015c565b604080516001600160a01b03928316815291841660208301520160405180910390a1620000e88162000195565b50565b620000f6816200024a565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b606062000155838360405180606001604052806027815260200162000f2a60279139620002fe565b9392505050565b60006200018660008051602062000f0a83398151915260001b620003e460201b6200024d1760201c565b546001600160a01b0316919050565b6001600160a01b038116620002005760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b806200022960008051602062000f0a83398151915260001b620003e460201b6200024d1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b6200026081620003e760201b620002bd1760201c565b620002c45760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401620001f7565b80620002297f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b620003e460201b6200024d1760201c565b60606200030b84620003e7565b620003685760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401620001f7565b600080856001600160a01b0316856040516200038591906200056d565b600060405180830381855af49150503d8060008114620003c2576040519150601f19603f3d011682016040523d82523d6000602084013e620003c7565b606091505b509092509050620003da828286620003f6565b9695505050505050565b90565b6001600160a01b03163b151590565b606083156200040757508162000155565b825115620004185782518084602001fd5b8160405162461bcd60e51b8152600401620001f791906200058b565b80516001600160a01b03811681146200044c57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004845781810151838201526020016200046a565b50506000910152565b600080600060608486031215620004a357600080fd5b620004ae8462000434565b9250620004be6020850162000434565b60408501519092506001600160401b0380821115620004dc57600080fd5b818601915086601f830112620004f157600080fd5b81518181111562000506576200050662000451565b604051601f8201601f19908116603f0116810190838211818310171562000531576200053162000451565b816040528281528960208487010111156200054b57600080fd5b6200055e83602083016020880162000467565b80955050505050509250925092565b600082516200058181846020870162000467565b9190910192915050565b6020815260008251806020840152620005ac81604085016020870162000467565b601f01601f19169190910160400192915050565b61093a80620005d06000396000f3fe6080604052600436106100595760003560e01c80633659cfe6146100705780634bb5274a146100905780634f1ef286146100a35780635c60da1b146100b65780638f283970146100e7578063f851a4401461010757610068565b366100685761006661011c565b005b61006661011c565b34801561007c57600080fd5b5061006661008b3660046106c7565b610136565b61006661009e3660046106f8565b610173565b6100666100b13660046107a8565b6101b8565b3480156100c257600080fd5b506100cb61021f565b6040516001600160a01b03909116815260200160405180910390f35b3480156100f357600080fd5b506100666101023660046106c7565b610250565b34801561011357600080fd5b506100cb610270565b6101246102cc565b61013461012f610361565b61036b565b565b61013e61038a565b6001600160a01b0316330361016b57610168816040518060200160405280600081525060006103ab565b50565b61016861011c565b61017b61038a565b6001600160a01b0316330361016b576000610194610361565b9050600080835160208501845af43d6000803e8080156101b3573d6000f35b3d6000fd5b6101c061038a565b6001600160a01b03163303610217576102128383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103ab915050565b505050565b61021261011c565b600061022961038a565b6001600160a01b0316330361024557610240610361565b905090565b61024d61011c565b90565b61025861038a565b6001600160a01b0316330361016b57610168816103d6565b600061027a61038a565b6001600160a01b031633036102455761024061038a565b60606102b683836040518060600160405280602781526020016108de6027913961042a565b9392505050565b6001600160a01b03163b151590565b6102d461038a565b6001600160a01b031633036101345760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b6000610240610505565b3660008037600080366000845af43d6000803e8080156101b3573d6000f35b600060008051602061089e8339815191525b546001600160a01b0316919050565b6103b48361051b565b6000825111806103c15750805b15610212576103d08383610291565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103ff61038a565b604080516001600160a01b03928316815291841660208301520160405180910390a16101688161055b565b6060610435846102bd565b6104905760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610358565b600080856001600160a01b0316856040516104ab919061084e565b600060405180830381855af49150503d80600081146104e6576040519150601f19603f3d011682016040523d82523d6000602084013e6104eb565b606091505b50915091506104fb8282866105f2565b9695505050505050565b60006000805160206108be83398151915261039c565b6105248161062b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105c05760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610358565b8060008051602061089e8339815191525b80546001600160a01b0319166001600160a01b039290921691909117905550565b606083156106015750816102b6565b8251156106115782518084602001fd5b8160405162461bcd60e51b8152600401610358919061086a565b610634816102bd565b6106965760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610358565b806000805160206108be8339815191526105d1565b80356001600160a01b03811681146106c257600080fd5b919050565b6000602082840312156106d957600080fd5b6102b6826106ab565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561070a57600080fd5b81356001600160401b038082111561072157600080fd5b818401915084601f83011261073557600080fd5b813581811115610747576107476106e2565b604051601f8201601f19908116603f0116810190838211818310171561076f5761076f6106e2565b8160405282815287602084870101111561078857600080fd5b826020860160208301376000928101602001929092525095945050505050565b6000806000604084860312156107bd57600080fd5b6107c6846106ab565b925060208401356001600160401b03808211156107e257600080fd5b818601915086601f8301126107f657600080fd5b81358181111561080557600080fd5b87602082850101111561081757600080fd5b6020830194508093505050509250925092565b60005b8381101561084557818101518382015260200161082d565b50506000910152565b6000825161086081846020870161082a565b9190910192915050565b602081526000825180602084015261088981604085016020870161082a565b601f01601f1916919091016040019291505056feb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208acadd7d33a2cd98d091ead660393e8ee94eff2e6777cbb743b0ef67fdf6ac3464736f6c63430008110033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x6080604052600436106100595760003560e01c80633659cfe6146100705780634bb5274a146100905780634f1ef286146100a35780635c60da1b146100b65780638f283970146100e7578063f851a4401461010757610068565b366100685761006661011c565b005b61006661011c565b34801561007c57600080fd5b5061006661008b3660046106c7565b610136565b61006661009e3660046106f8565b610173565b6100666100b13660046107a8565b6101b8565b3480156100c257600080fd5b506100cb61021f565b6040516001600160a01b03909116815260200160405180910390f35b3480156100f357600080fd5b506100666101023660046106c7565b610250565b34801561011357600080fd5b506100cb610270565b6101246102cc565b61013461012f610361565b61036b565b565b61013e61038a565b6001600160a01b0316330361016b57610168816040518060200160405280600081525060006103ab565b50565b61016861011c565b61017b61038a565b6001600160a01b0316330361016b576000610194610361565b9050600080835160208501845af43d6000803e8080156101b3573d6000f35b3d6000fd5b6101c061038a565b6001600160a01b03163303610217576102128383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250600192506103ab915050565b505050565b61021261011c565b600061022961038a565b6001600160a01b0316330361024557610240610361565b905090565b61024d61011c565b90565b61025861038a565b6001600160a01b0316330361016b57610168816103d6565b600061027a61038a565b6001600160a01b031633036102455761024061038a565b60606102b683836040518060600160405280602781526020016108de6027913961042a565b9392505050565b6001600160a01b03163b151590565b6102d461038a565b6001600160a01b031633036101345760405162461bcd60e51b815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f78792074617267606482015261195d60f21b608482015260a4015b60405180910390fd5b6000610240610505565b3660008037600080366000845af43d6000803e8080156101b3573d6000f35b600060008051602061089e8339815191525b546001600160a01b0316919050565b6103b48361051b565b6000825111806103c15750805b15610212576103d08383610291565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f6103ff61038a565b604080516001600160a01b03928316815291841660208301520160405180910390a16101688161055b565b6060610435846102bd565b6104905760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610358565b600080856001600160a01b0316856040516104ab919061084e565b600060405180830381855af49150503d80600081146104e6576040519150601f19603f3d011682016040523d82523d6000602084013e6104eb565b606091505b50915091506104fb8282866105f2565b9695505050505050565b60006000805160206108be83398151915261039c565b6105248161062b565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b6001600160a01b0381166105c05760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b6064820152608401610358565b8060008051602061089e8339815191525b80546001600160a01b0319166001600160a01b039290921691909117905550565b606083156106015750816102b6565b8251156106115782518084602001fd5b8160405162461bcd60e51b8152600401610358919061086a565b610634816102bd565b6106965760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610358565b806000805160206108be8339815191526105d1565b80356001600160a01b03811681146106c257600080fd5b919050565b6000602082840312156106d957600080fd5b6102b6826106ab565b634e487b7160e01b600052604160045260246000fd5b60006020828403121561070a57600080fd5b81356001600160401b038082111561072157600080fd5b818401915084601f83011261073557600080fd5b813581811115610747576107476106e2565b604051601f8201601f19908116603f0116810190838211818310171561076f5761076f6106e2565b8160405282815287602084870101111561078857600080fd5b826020860160208301376000928101602001929092525095945050505050565b6000806000604084860312156107bd57600080fd5b6107c6846106ab565b925060208401356001600160401b03808211156107e257600080fd5b818601915086601f8301126107f657600080fd5b81358181111561080557600080fd5b87602082850101111561081757600080fd5b6020830194508093505050509250925092565b60005b8381101561084557818101518382015260200161082d565b50506000910152565b6000825161086081846020870161082a565b9190910192915050565b602081526000825180602084015261088981604085016020870161082a565b601f01601f1916919091016040019291505056feb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212208acadd7d33a2cd98d091ead660393e8ee94eff2e6777cbb743b0ef67fdf6ac3464736f6c63430008110033", "devdoc": { "kind": "dev", "methods": { diff --git a/deployments/ronin-testnet/MaintenanceLogic.json b/deployments/ronin-testnet/MaintenanceLogic.json index 8ddac3cce..f216ab740 100644 --- a/deployments/ronin-testnet/MaintenanceLogic.json +++ b/deployments/ronin-testnet/MaintenanceLogic.json @@ -1,5 +1,5 @@ { - "address": "0x7A66d951d4fdb5d1f77C7AAEc026a61AF7Dc5Cc6", + "address": "0x4bb446b1523fA26fdBe06c4AE907AabBdBCaB7EE", "abi": [ { "inputs": [], @@ -559,41 +559,41 @@ "type": "function" } ], - "transactionHash": "0xd5e4913f95f457096a384942938cbdd72484ea33003bf707242a6f9341bfc7a5", + "transactionHash": "0x0e73323bd5926ceeba5bf933892862cced7e483565f4b029937cbe16405b59b1", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0x7A66d951d4fdb5d1f77C7AAEc026a61AF7Dc5Cc6", + "contractAddress": "0x4bb446b1523fA26fdBe06c4AE907AabBdBCaB7EE", "transactionIndex": 0, - "gasUsed": "1362636", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000018000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xc65aa8807342cc040f38bda2a80fbddb62458a22cb5e9c1d24d55fd3f0c379db", - "transactionHash": "0xd5e4913f95f457096a384942938cbdd72484ea33003bf707242a6f9341bfc7a5", + "gasUsed": "1410539", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400100100000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000", + "blockHash": "0xf0f4b61afc58321e17ffe90ab62159346deee5b547d7bdb0b1499ee55843d185", + "transactionHash": "0x0e73323bd5926ceeba5bf933892862cced7e483565f4b029937cbe16405b59b1", "logs": [ { "transactionIndex": 0, - "blockNumber": 14747609, - "transactionHash": "0xd5e4913f95f457096a384942938cbdd72484ea33003bf707242a6f9341bfc7a5", - "address": "0x7A66d951d4fdb5d1f77C7AAEc026a61AF7Dc5Cc6", + "blockNumber": 16816853, + "transactionHash": "0x0e73323bd5926ceeba5bf933892862cced7e483565f4b029937cbe16405b59b1", + "address": "0x4bb446b1523fA26fdBe06c4AE907AabBdBCaB7EE", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", "logIndex": 0, - "blockHash": "0xc65aa8807342cc040f38bda2a80fbddb62458a22cb5e9c1d24d55fd3f0c379db" + "blockHash": "0xf0f4b61afc58321e17ffe90ab62159346deee5b547d7bdb0b1499ee55843d185" } ], - "blockNumber": 14747609, - "cumulativeGasUsed": "1362636", + "blockNumber": 16816853, + "cumulativeGasUsed": "1410539", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 4, - "solcInputHash": "3c352db0d062e062f7c0c18610e9070b", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxSchedules\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"MaintenanceConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"MaintenanceScheduleCancelled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"from\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"to\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdatedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestTimestamp\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IMaintenance.Schedule\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"MaintenanceScheduled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"cancelSchedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkCooldownEnds\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"checkMaintained\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_toBlock\",\"type\":\"uint256\"}],\"name\":\"checkMaintainedInBlockRange\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintained\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_resList\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_toBlock\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintainedInBlockRange\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_resList\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkScheduled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownSecsToMaintain\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getSchedule\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"from\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"to\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdatedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestTimestamp\",\"type\":\"uint256\"}],\"internalType\":\"struct IMaintenance.Schedule\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxSchedules\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxMaintenanceDurationInBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxOffsetToStartSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxSchedules\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minMaintenanceDurationInBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minOffsetToStartSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startedAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endedAtBlock\",\"type\":\"uint256\"}],\"name\":\"schedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxSchedules\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"setMaintenanceConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSchedules\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"cancelSchedule(address)\":{\"details\":\"Cancel the schedule of maintenance for the `_consensusAddr`. Requirements: - The candidate `_consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `_consensusAddr`. - A schedule for the `_consensusAddr` must be existent and not executed yet. Emits the event `MaintenanceScheduleCancelled`.\"},\"checkCooldownEnds(address)\":{\"details\":\"Returns whether the validator `_consensusAddr`\"},\"checkMaintained(address,uint256)\":{\"details\":\"Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\"},\"checkMaintainedInBlockRange(address,uint256,uint256)\":{\"details\":\"Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\"},\"checkManyMaintained(address[],uint256)\":{\"details\":\"Returns the bool array indicating the validators maintained at block number `_block` or not.\"},\"checkManyMaintainedInBlockRange(address[],uint256,uint256)\":{\"details\":\"Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\"},\"checkScheduled(address)\":{\"details\":\"Returns whether the validator `_consensusAddr` has scheduled.\"},\"getSchedule(address)\":{\"details\":\"Returns the detailed schedule of the validator `_consensusAddr`.\"},\"initialize(address,uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"schedule(address,uint256,uint256)\":{\"details\":\"Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`. Requirements: - The candidate `_consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `_consensusAddr`. - The candidate `_consensusAddr` has no schedule yet or the previous is done. - The total number of schedules is not larger than `maxSchedules()`. - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block. - The end block is larger than the start block. - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`. - The start block is at the start of an epoch. - The end block is at the end of an epoch. Emits the event `MaintenanceScheduled`.\"},\"setMaintenanceConfig(uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the duration restriction, start time restriction, and max allowed for maintenance. Requirements: - The method caller is admin. - The max duration is larger than the min duration. - The max offset is larger than the min offset. Emits the event `MaintenanceConfigUpdated`.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"totalSchedules()\":{\"details\":\"Returns the total of current schedules.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"}},\"stateVariables\":{\"_schedule\":{\"details\":\"Mapping from consensus address => maintenance schedule.\"},\"cooldownSecsToMaintain\":{\"details\":\"The cooldown time to request new schedule.\"},\"maxMaintenanceDurationInBlock\":{\"details\":\"The max duration to maintenance in blocks.\"},\"maxOffsetToStartSchedule\":{\"details\":\"The offset to the max block number that the schedule can start.\"},\"maxSchedules\":{\"details\":\"The max number of scheduled maintenances.\"},\"minMaintenanceDurationInBlock\":{\"details\":\"The min duration to maintenance in blocks.\"},\"minOffsetToStartSchedule\":{\"details\":\"The offset to the min block number that the schedule can start.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/Maintenance.sol\":\"Maintenance\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IMaintenance {\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\\n */\\n function checkScheduled(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr`\\n */\\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\\n */\\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedules() external view returns (uint256 _count);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedules() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4f06c8f3ad7ec8b863882c655ddf443675d557272445e51d8a1e1f3454089d09\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0xe4060b7e3b04a0043bd334011fe4ba67c990b0484dad52d7f14b35040989b6ab\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n // Error thrown when receives RON from neither staking vesting contract nor staking contract\\\"\\n error ErrUnauthorizedReceiveRON();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0x4e81a61359a3f8bcc9d452615e3df7b0d0201823ce88f763530ddd4f00c2fc48\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address[] calldata _blockProducers) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address[] calldata _blockProducers, uint256 _period)\\n external\\n view\\n returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the current period.\\n */\\n\\n function checkBridgeRewardDeprecated(address _consensusAddr) external view returns (bool _result);\\n}\\n\",\"keccak256\":\"0x853e7d0ac33ad868721733fc2ab4b78f2e613973a579eb0ea485cbdaa750e057\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator or not.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0xbd10b0207a749e3a7a2aadcb6e93784cb17343a5266d056a3d0b79acb7c5c93d\",\"license\":\"MIT\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - min(a, b);\\n }\\n}\\n\",\"keccak256\":\"0xa9e2a3ad43d7999a3cdbfb040b0f2dec282eae91ff8fe6ad26fdd19087121ce7\",\"license\":\"UNLICENSED\"},\"contracts/ronin/Maintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../interfaces/IMaintenance.sol\\\";\\nimport \\\"../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../libraries/Math.sol\\\";\\n\\ncontract Maintenance is IMaintenance, HasValidatorContract, Initializable {\\n using Math for uint256;\\n\\n /// @dev Mapping from consensus address => maintenance schedule.\\n mapping(address => Schedule) internal _schedule;\\n\\n /// @dev The min duration to maintenance in blocks.\\n uint256 public minMaintenanceDurationInBlock;\\n /// @dev The max duration to maintenance in blocks.\\n uint256 public maxMaintenanceDurationInBlock;\\n /// @dev The offset to the min block number that the schedule can start.\\n uint256 public minOffsetToStartSchedule;\\n /// @dev The offset to the max block number that the schedule can start.\\n uint256 public maxOffsetToStartSchedule;\\n /// @dev The max number of scheduled maintenances.\\n uint256 public maxSchedules;\\n /// @dev The cooldown time to request new schedule.\\n uint256 public cooldownSecsToMaintain;\\n\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external initializer {\\n _setValidatorContract(__validatorContract);\\n _setMaintenanceConfig(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external onlyAdmin {\\n _setMaintenanceConfig(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external override {\\n IRoninValidatorSet _validator = _validatorContract;\\n\\n require(_validator.isBlockProducer(_consensusAddr), \\\"Maintenance: consensus address must be a block producer\\\");\\n require(\\n _validator.isCandidateAdmin(_consensusAddr, msg.sender),\\n \\\"Maintenance: method caller must be a candidate admin\\\"\\n );\\n require(!checkScheduled(_consensusAddr), \\\"Maintenance: already scheduled\\\");\\n require(checkCooldownEnds(_consensusAddr), \\\"Maintainance: cooldown time not end\\\");\\n require(totalSchedules() < maxSchedules, \\\"Maintenance: exceeds total of schedules\\\");\\n require(\\n _startedAtBlock.inRange(block.number + minOffsetToStartSchedule, block.number + maxOffsetToStartSchedule),\\n \\\"Maintenance: start block is out of offset\\\"\\n );\\n require(_startedAtBlock < _endedAtBlock, \\\"Maintenance: start block must be less than end block\\\");\\n uint256 _blockPeriod = _endedAtBlock - _startedAtBlock;\\n require(\\n _blockPeriod.inRange(minMaintenanceDurationInBlock, maxMaintenanceDurationInBlock),\\n \\\"Maintenance: invalid maintenance duration\\\"\\n );\\n require(_validator.epochEndingAt(_startedAtBlock - 1), \\\"Maintenance: start block is not at the start of an epoch\\\");\\n require(_validator.epochEndingAt(_endedAtBlock), \\\"Maintenance: end block is not at the end of an epoch\\\");\\n\\n Schedule storage _sSchedule = _schedule[_consensusAddr];\\n _sSchedule.from = _startedAtBlock;\\n _sSchedule.to = _endedAtBlock;\\n _sSchedule.lastUpdatedBlock = block.number;\\n _sSchedule.requestTimestamp = block.timestamp;\\n emit MaintenanceScheduled(_consensusAddr, _sSchedule);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function cancelSchedule(address _consensusAddr) external override {\\n require(\\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\\n \\\"Maintenance: method caller must be the candidate admin\\\"\\n );\\n require(checkScheduled(_consensusAddr), \\\"Maintenance: no schedule exists\\\");\\n require(!checkMaintained(_consensusAddr, block.number), \\\"Maintenance: already on maintenance\\\");\\n Schedule storage _sSchedule = _schedule[_consensusAddr];\\n delete _sSchedule.from;\\n delete _sSchedule.to;\\n _sSchedule.lastUpdatedBlock = block.number;\\n emit MaintenanceScheduleCancelled(_consensusAddr);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function getSchedule(address _consensusAddr) external view override returns (Schedule memory) {\\n return _schedule[_consensusAddr];\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block)\\n external\\n view\\n override\\n returns (bool[] memory _resList)\\n {\\n _resList = new bool[](_addrList.length);\\n for (uint _i = 0; _i < _addrList.length; _i++) {\\n _resList[_i] = checkMaintained(_addrList[_i], _block);\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view override returns (bool[] memory _resList) {\\n _resList = new bool[](_addrList.length);\\n for (uint _i = 0; _i < _addrList.length; _i++) {\\n _resList[_i] = _maintainingInBlockRange(_addrList[_i], _fromBlock, _toBlock);\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function totalSchedules() public view override returns (uint256 _count) {\\n address[] memory _validators = _validatorContract.getValidators();\\n for (uint _i = 0; _i < _validators.length; _i++) {\\n if (checkScheduled(_validators[_i])) {\\n _count++;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) public view override returns (bool) {\\n Schedule storage _s = _schedule[_consensusAddr];\\n return _s.from <= _block && _block <= _s.to;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) public view override returns (bool) {\\n return _maintainingInBlockRange(_consensusAddr, _fromBlock, _toBlock);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkScheduled(address _consensusAddr) public view override returns (bool) {\\n return block.number <= _schedule[_consensusAddr].to;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkCooldownEnds(address _consensusAddr) public view override returns (bool) {\\n return block.timestamp > _schedule[_consensusAddr].requestTimestamp + cooldownSecsToMaintain;\\n }\\n\\n /**\\n * @dev Sets the min block period and max block period to maintenance.\\n *\\n * Requirements:\\n * - The max period is larger than the min period.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function _setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) internal {\\n require(\\n _minMaintenanceDurationInBlock < _maxMaintenanceDurationInBlock,\\n \\\"Maintenance: invalid maintenance duration configs\\\"\\n );\\n require(\\n _minOffsetToStartSchedule < _maxOffsetToStartSchedule,\\n \\\"Maintenance: invalid offset to start schedule configs\\\"\\n );\\n minMaintenanceDurationInBlock = _minMaintenanceDurationInBlock;\\n maxMaintenanceDurationInBlock = _maxMaintenanceDurationInBlock;\\n minOffsetToStartSchedule = _minOffsetToStartSchedule;\\n maxOffsetToStartSchedule = _maxOffsetToStartSchedule;\\n maxSchedules = _maxSchedules;\\n cooldownSecsToMaintain = _cooldownSecsToMaintain;\\n emit MaintenanceConfigUpdated(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @dev Check if the validator was maintaining in the current period.\\n *\\n * Note: This method should be called at the end of the period.\\n */\\n function _maintainingInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) private view returns (bool) {\\n Schedule storage _s = _schedule[_consensusAddr];\\n return Math.twoRangeOverlap(_fromBlock, _toBlock, _s.from, _s.to);\\n }\\n}\\n\",\"keccak256\":\"0x190de49f9e5b25f9bbf15a9ba2afafdfd473238d65f70ca28c70daffad4ba4c7\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100eb565b600054600160a81b900460ff161561008c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff600160a01b909104811610156100e9576000805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b611731806100fa6000396000f3fe608060405234801561001057600080fd5b506004361061012c5760003560e01c8063ba303755116100ad578063cdf64a7611610071578063cdf64a761461024b578063d39fee341461025e578063dec36284146102a4578063f0caaafb146102ad578063fdadda81146102c057600080fd5b8063ba303755146101fd578063bc1710e91461021d578063bfa89b9b14610226578063c09fe4601461022f578063c44cb2331461024257600080fd5b80637a50802d116100f45780637a50802d146101ab5780638142951a146101b4578063965720af146101c757806399439089146101cf578063b59f403e146101ea57600080fd5b8063088e8de71461013157806309e34c38146101595780630fbeb37f146101705780632d538c2c146101835780632ddc08a214610198575b600080fd5b61014461013f3660046112f5565b6102d3565b60405190151581526020015b60405180910390f35b61016260025481565b604051908152602001610150565b61014461017e36600461132a565b6102e8565b6101966101913660046112f5565b61031f565b005b6101446101a6366004611356565b6109b3565b61016260055481565b6101966101c236600461137a565b6109d5565b610162610b17565b6000546040516001600160a01b039091168152602001610150565b6101446101f8366004611356565b610be2565b61021061020b36600461141b565b610c14565b604051610150919061146c565b61016260045481565b61016260035481565b61019661023d3660046114b2565b610cd4565b61016260065481565b610196610259366004611356565b610d33565b61027161026c366004611356565b610db3565b60405161015091908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b61016260075481565b6101966102bb366004611356565b610e2b565b6102106102ce3660046114f5565b611017565b60006102e08484846110d5565b949350505050565b6001600160a01b038216600090815260016020526040812080548310801590610315575080600101548311155b9150505b92915050565b600054604051633292276760e11b81526001600160a01b0385811660048301529091169081906365244ece90602401602060405180830381865afa15801561036b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038f9190611541565b6104065760405162461bcd60e51b815260206004820152603760248201527f4d61696e74656e616e63653a20636f6e73656e7375732061646472657373206d60448201527f757374206265206120626c6f636b2070726f647563657200000000000000000060648201526084015b60405180910390fd5b6040516304d971ab60e01b81526001600160a01b0385811660048301523360248301528216906304d971ab90604401602060405180830381865afa158015610452573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104769190611541565b6104df5760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a206d6574686f642063616c6c6572206d75737420604482015273313290309031b0b73234b230ba329030b236b4b760611b60648201526084016103fd565b6104e8846109b3565b156105355760405162461bcd60e51b815260206004820152601e60248201527f4d61696e74656e616e63653a20616c7265616479207363686564756c6564000060448201526064016103fd565b61053e84610be2565b6105965760405162461bcd60e51b815260206004820152602360248201527f4d61696e7461696e616e63653a20636f6f6c646f776e2074696d65206e6f7420604482015262195b9960ea1b60648201526084016103fd565b6006546105a1610b17565b106105fe5760405162461bcd60e51b815260206004820152602760248201527f4d61696e74656e616e63653a206578636565647320746f74616c206f66207363604482015266686564756c657360c81b60648201526084016103fd565b6106246004544361060f9190611579565b60055461061c9043611579565b85919061110d565b6106825760405162461bcd60e51b815260206004820152602960248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206f7574206044820152681bd9881bd9999cd95d60ba1b60648201526084016103fd565b8183106106ee5760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20737461727420626c6f636b206d757374206265604482015273206c657373207468616e20656e6420626c6f636b60601b60648201526084016103fd565b60006106fa848461158c565b90506107156002546003548361110d9092919063ffffffff16565b6107735760405162461bcd60e51b815260206004820152602960248201527f4d61696e74656e616e63653a20696e76616c6964206d61696e74656e616e636560448201526810323ab930ba34b7b760b91b60648201526084016103fd565b6001600160a01b038216637593ff7161078d60018761158c565b6040518263ffffffff1660e01b81526004016107ab91815260200190565b602060405180830381865afa1580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec9190611541565b61085e5760405162461bcd60e51b815260206004820152603860248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206e6f742060448201527f617420746865207374617274206f6620616e2065706f6368000000000000000060648201526084016103fd565b604051637593ff7160e01b8152600481018490526001600160a01b03831690637593ff7190602401602060405180830381865afa1580156108a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c79190611541565b6109305760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20656e6420626c6f636b206973206e6f74206174604482015273040e8d0ca40cadcc840decc40c2dc40cae0dec6d60631b60648201526084016103fd565b6001600160a01b0385166000818152600160208181526040928390208881559182018790554360028301819055426003840181905584518a815292830189905293820152606081019290925291907f48e8b2f7348b1ec693bbb999258a8d6bd514732a19c6057b6e2a56a4c405253b9060800160405180910390a2505050505050565b6001600160a01b03166000908152600160208190526040909120015443111590565b600054600160a81b900460ff16158080156109fd57506000546001600160a01b90910460ff16105b80610a1e5750303b158015610a1e5750600054600160a01b900460ff166001145b610a815760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103fd565b6000805460ff60a01b1916600160a01b1790558015610aae576000805460ff60a81b1916600160a81b1790555b610ab788611124565b610ac5878787878787611178565b8015610b0d576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600080546040805163b7ab4db560e01b8152905183926001600160a01b03169163b7ab4db591600480830192869291908290030181865afa158015610b60573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b8891908101906115c5565b905060005b8151811015610bdd57610bb8828281518110610bab57610bab61168a565b60200260200101516109b3565b15610bcb5782610bc7816116a0565b9350505b80610bd5816116a0565b915050610b8d565b505090565b6007546001600160a01b0382166000908152600160205260408120600301549091610c0c91611579565b421192915050565b60608367ffffffffffffffff811115610c2f57610c2f61159f565b604051908082528060200260200182016040528015610c58578160200160208202803683370190505b50905060005b84811015610ccb57610c97868683818110610c7b57610c7b61168a565b9050602002016020810190610c909190611356565b85856110d5565b828281518110610ca957610ca961168a565b9115156020928302919091019091015280610cc3816116a0565b915050610c5e565b50949350505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314610d1d5760405162461bcd60e51b81526004016103fd906116b9565b610d2b868686868686611178565b505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314610d7c5760405162461bcd60e51b81526004016103fd906116b9565b806001600160a01b03163b600003610da757604051637bcd509160e01b815260040160405180910390fd5b610db081611124565b50565b610dde6040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b03166000908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b6000546040516304d971ab60e01b81526001600160a01b038381166004830152336024830152909116906304d971ab90604401602060405180830381865afa158015610e7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9f9190611541565b610f0a5760405162461bcd60e51b815260206004820152603660248201527f4d61696e74656e616e63653a206d6574686f642063616c6c6572206d757374206044820152753132903a34329031b0b73234b230ba329030b236b4b760511b60648201526084016103fd565b610f13816109b3565b610f5f5760405162461bcd60e51b815260206004820152601f60248201527f4d61696e74656e616e63653a206e6f207363686564756c65206578697374730060448201526064016103fd565b610f6981436102e8565b15610fc25760405162461bcd60e51b815260206004820152602360248201527f4d61696e74656e616e63653a20616c7265616479206f6e206d61696e74656e616044820152626e636560e81b60648201526084016103fd565b6001600160a01b0381166000818152600160208190526040808320838155918201839055436002830155519092917f72720a31deb222f77bbf95b88a540154648466770e5f41328ee1e25e5050737791a25050565b60608267ffffffffffffffff8111156110325761103261159f565b60405190808252806020026020018201604052801561105b578160200160208202803683370190505b50905060005b838110156110cd5761109985858381811061107e5761107e61168a565b90506020020160208101906110939190611356565b846102e8565b8282815181106110ab576110ab61168a565b91151560209283029190910190910152806110c5816116a0565b915050611061565b509392505050565b6001600160a01b03831660009081526001602081905260408220805491810154909161110491869186916112ca565b95945050505050565b60008383111580156102e057505090911115919050565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b68361699060200160405180910390a150565b8486106111e15760405162461bcd60e51b815260206004820152603160248201527f4d61696e74656e616e63653a20696e76616c6964206d61696e74656e616e6365604482015270206475726174696f6e20636f6e6669677360781b60648201526084016103fd565b82841061124e5760405162461bcd60e51b815260206004820152603560248201527f4d61696e74656e616e63653a20696e76616c6964206f666673657420746f207360448201527474617274207363686564756c6520636f6e6669677360581b60648201526084016103fd565b6002869055600385905560048490556005839055600682905560078190556040805187815260208101879052908101859052606081018490526080810183905260a081018290527f4edb6adef66a4b8e1ffbc8c67640d4f244ce904193fd65e5cc316bbb74b2e59b9060c00160405180910390a1505050505050565b6000818511158015611104575050501115919050565b6001600160a01b0381168114610db057600080fd5b60008060006060848603121561130a57600080fd5b8335611315816112e0565b95602085013595506040909401359392505050565b6000806040838503121561133d57600080fd5b8235611348816112e0565b946020939093013593505050565b60006020828403121561136857600080fd5b8135611373816112e0565b9392505050565b600080600080600080600060e0888a03121561139557600080fd5b87356113a0816112e0565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b60008083601f8401126113e157600080fd5b50813567ffffffffffffffff8111156113f957600080fd5b6020830191508360208260051b850101111561141457600080fd5b9250929050565b6000806000806060858703121561143157600080fd5b843567ffffffffffffffff81111561144857600080fd5b611454878288016113cf565b90989097506020870135966040013595509350505050565b6020808252825182820181905260009190848201906040850190845b818110156114a6578351151583529284019291840191600101611488565b50909695505050505050565b60008060008060008060c087890312156114cb57600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b60008060006040848603121561150a57600080fd5b833567ffffffffffffffff81111561152157600080fd5b61152d868287016113cf565b909790965060209590950135949350505050565b60006020828403121561155357600080fd5b8151801515811461137357600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561031957610319611563565b8181038181111561031957610319611563565b634e487b7160e01b600052604160045260246000fd5b80516115c0816112e0565b919050565b600060208083850312156115d857600080fd5b825167ffffffffffffffff808211156115f057600080fd5b818501915085601f83011261160457600080fd5b8151818111156116165761161661159f565b8060051b604051601f19603f8301168101818110858211171561163b5761163b61159f565b60405291825284820192508381018501918883111561165957600080fd5b938501935b8285101561167e5761166f856115b5565b8452938501939285019261165e565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b6000600182016116b2576116b2611563565b5060010190565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b60608201526080019056fea264697066735822122049b5a810cdc523ab28bef51dcc59c38208a898f06f4991141db28107ac7bbbda64736f6c63430008110033", - "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061012c5760003560e01c8063ba303755116100ad578063cdf64a7611610071578063cdf64a761461024b578063d39fee341461025e578063dec36284146102a4578063f0caaafb146102ad578063fdadda81146102c057600080fd5b8063ba303755146101fd578063bc1710e91461021d578063bfa89b9b14610226578063c09fe4601461022f578063c44cb2331461024257600080fd5b80637a50802d116100f45780637a50802d146101ab5780638142951a146101b4578063965720af146101c757806399439089146101cf578063b59f403e146101ea57600080fd5b8063088e8de71461013157806309e34c38146101595780630fbeb37f146101705780632d538c2c146101835780632ddc08a214610198575b600080fd5b61014461013f3660046112f5565b6102d3565b60405190151581526020015b60405180910390f35b61016260025481565b604051908152602001610150565b61014461017e36600461132a565b6102e8565b6101966101913660046112f5565b61031f565b005b6101446101a6366004611356565b6109b3565b61016260055481565b6101966101c236600461137a565b6109d5565b610162610b17565b6000546040516001600160a01b039091168152602001610150565b6101446101f8366004611356565b610be2565b61021061020b36600461141b565b610c14565b604051610150919061146c565b61016260045481565b61016260035481565b61019661023d3660046114b2565b610cd4565b61016260065481565b610196610259366004611356565b610d33565b61027161026c366004611356565b610db3565b60405161015091908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b61016260075481565b6101966102bb366004611356565b610e2b565b6102106102ce3660046114f5565b611017565b60006102e08484846110d5565b949350505050565b6001600160a01b038216600090815260016020526040812080548310801590610315575080600101548311155b9150505b92915050565b600054604051633292276760e11b81526001600160a01b0385811660048301529091169081906365244ece90602401602060405180830381865afa15801561036b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061038f9190611541565b6104065760405162461bcd60e51b815260206004820152603760248201527f4d61696e74656e616e63653a20636f6e73656e7375732061646472657373206d60448201527f757374206265206120626c6f636b2070726f647563657200000000000000000060648201526084015b60405180910390fd5b6040516304d971ab60e01b81526001600160a01b0385811660048301523360248301528216906304d971ab90604401602060405180830381865afa158015610452573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104769190611541565b6104df5760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a206d6574686f642063616c6c6572206d75737420604482015273313290309031b0b73234b230ba329030b236b4b760611b60648201526084016103fd565b6104e8846109b3565b156105355760405162461bcd60e51b815260206004820152601e60248201527f4d61696e74656e616e63653a20616c7265616479207363686564756c6564000060448201526064016103fd565b61053e84610be2565b6105965760405162461bcd60e51b815260206004820152602360248201527f4d61696e7461696e616e63653a20636f6f6c646f776e2074696d65206e6f7420604482015262195b9960ea1b60648201526084016103fd565b6006546105a1610b17565b106105fe5760405162461bcd60e51b815260206004820152602760248201527f4d61696e74656e616e63653a206578636565647320746f74616c206f66207363604482015266686564756c657360c81b60648201526084016103fd565b6106246004544361060f9190611579565b60055461061c9043611579565b85919061110d565b6106825760405162461bcd60e51b815260206004820152602960248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206f7574206044820152681bd9881bd9999cd95d60ba1b60648201526084016103fd565b8183106106ee5760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20737461727420626c6f636b206d757374206265604482015273206c657373207468616e20656e6420626c6f636b60601b60648201526084016103fd565b60006106fa848461158c565b90506107156002546003548361110d9092919063ffffffff16565b6107735760405162461bcd60e51b815260206004820152602960248201527f4d61696e74656e616e63653a20696e76616c6964206d61696e74656e616e636560448201526810323ab930ba34b7b760b91b60648201526084016103fd565b6001600160a01b038216637593ff7161078d60018761158c565b6040518263ffffffff1660e01b81526004016107ab91815260200190565b602060405180830381865afa1580156107c8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107ec9190611541565b61085e5760405162461bcd60e51b815260206004820152603860248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206e6f742060448201527f617420746865207374617274206f6620616e2065706f6368000000000000000060648201526084016103fd565b604051637593ff7160e01b8152600481018490526001600160a01b03831690637593ff7190602401602060405180830381865afa1580156108a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c79190611541565b6109305760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20656e6420626c6f636b206973206e6f74206174604482015273040e8d0ca40cadcc840decc40c2dc40cae0dec6d60631b60648201526084016103fd565b6001600160a01b0385166000818152600160208181526040928390208881559182018790554360028301819055426003840181905584518a815292830189905293820152606081019290925291907f48e8b2f7348b1ec693bbb999258a8d6bd514732a19c6057b6e2a56a4c405253b9060800160405180910390a2505050505050565b6001600160a01b03166000908152600160208190526040909120015443111590565b600054600160a81b900460ff16158080156109fd57506000546001600160a01b90910460ff16105b80610a1e5750303b158015610a1e5750600054600160a01b900460ff166001145b610a815760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103fd565b6000805460ff60a01b1916600160a01b1790558015610aae576000805460ff60a81b1916600160a81b1790555b610ab788611124565b610ac5878787878787611178565b8015610b0d576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600080546040805163b7ab4db560e01b8152905183926001600160a01b03169163b7ab4db591600480830192869291908290030181865afa158015610b60573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b8891908101906115c5565b905060005b8151811015610bdd57610bb8828281518110610bab57610bab61168a565b60200260200101516109b3565b15610bcb5782610bc7816116a0565b9350505b80610bd5816116a0565b915050610b8d565b505090565b6007546001600160a01b0382166000908152600160205260408120600301549091610c0c91611579565b421192915050565b60608367ffffffffffffffff811115610c2f57610c2f61159f565b604051908082528060200260200182016040528015610c58578160200160208202803683370190505b50905060005b84811015610ccb57610c97868683818110610c7b57610c7b61168a565b9050602002016020810190610c909190611356565b85856110d5565b828281518110610ca957610ca961168a565b9115156020928302919091019091015280610cc3816116a0565b915050610c5e565b50949350505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314610d1d5760405162461bcd60e51b81526004016103fd906116b9565b610d2b868686868686611178565b505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b03163314610d7c5760405162461bcd60e51b81526004016103fd906116b9565b806001600160a01b03163b600003610da757604051637bcd509160e01b815260040160405180910390fd5b610db081611124565b50565b610dde6040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b03166000908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b6000546040516304d971ab60e01b81526001600160a01b038381166004830152336024830152909116906304d971ab90604401602060405180830381865afa158015610e7b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e9f9190611541565b610f0a5760405162461bcd60e51b815260206004820152603660248201527f4d61696e74656e616e63653a206d6574686f642063616c6c6572206d757374206044820152753132903a34329031b0b73234b230ba329030b236b4b760511b60648201526084016103fd565b610f13816109b3565b610f5f5760405162461bcd60e51b815260206004820152601f60248201527f4d61696e74656e616e63653a206e6f207363686564756c65206578697374730060448201526064016103fd565b610f6981436102e8565b15610fc25760405162461bcd60e51b815260206004820152602360248201527f4d61696e74656e616e63653a20616c7265616479206f6e206d61696e74656e616044820152626e636560e81b60648201526084016103fd565b6001600160a01b0381166000818152600160208190526040808320838155918201839055436002830155519092917f72720a31deb222f77bbf95b88a540154648466770e5f41328ee1e25e5050737791a25050565b60608267ffffffffffffffff8111156110325761103261159f565b60405190808252806020026020018201604052801561105b578160200160208202803683370190505b50905060005b838110156110cd5761109985858381811061107e5761107e61168a565b90506020020160208101906110939190611356565b846102e8565b8282815181106110ab576110ab61168a565b91151560209283029190910190910152806110c5816116a0565b915050611061565b509392505050565b6001600160a01b03831660009081526001602081905260408220805491810154909161110491869186916112ca565b95945050505050565b60008383111580156102e057505090911115919050565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b68361699060200160405180910390a150565b8486106111e15760405162461bcd60e51b815260206004820152603160248201527f4d61696e74656e616e63653a20696e76616c6964206d61696e74656e616e6365604482015270206475726174696f6e20636f6e6669677360781b60648201526084016103fd565b82841061124e5760405162461bcd60e51b815260206004820152603560248201527f4d61696e74656e616e63653a20696e76616c6964206f666673657420746f207360448201527474617274207363686564756c6520636f6e6669677360581b60648201526084016103fd565b6002869055600385905560048490556005839055600682905560078190556040805187815260208101879052908101859052606081018490526080810183905260a081018290527f4edb6adef66a4b8e1ffbc8c67640d4f244ce904193fd65e5cc316bbb74b2e59b9060c00160405180910390a1505050505050565b6000818511158015611104575050501115919050565b6001600160a01b0381168114610db057600080fd5b60008060006060848603121561130a57600080fd5b8335611315816112e0565b95602085013595506040909401359392505050565b6000806040838503121561133d57600080fd5b8235611348816112e0565b946020939093013593505050565b60006020828403121561136857600080fd5b8135611373816112e0565b9392505050565b600080600080600080600060e0888a03121561139557600080fd5b87356113a0816112e0565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b60008083601f8401126113e157600080fd5b50813567ffffffffffffffff8111156113f957600080fd5b6020830191508360208260051b850101111561141457600080fd5b9250929050565b6000806000806060858703121561143157600080fd5b843567ffffffffffffffff81111561144857600080fd5b611454878288016113cf565b90989097506020870135966040013595509350505050565b6020808252825182820181905260009190848201906040850190845b818110156114a6578351151583529284019291840191600101611488565b50909695505050505050565b60008060008060008060c087890312156114cb57600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b60008060006040848603121561150a57600080fd5b833567ffffffffffffffff81111561152157600080fd5b61152d868287016113cf565b909790965060209590950135949350505050565b60006020828403121561155357600080fd5b8151801515811461137357600080fd5b634e487b7160e01b600052601160045260246000fd5b8082018082111561031957610319611563565b8181038181111561031957610319611563565b634e487b7160e01b600052604160045260246000fd5b80516115c0816112e0565b919050565b600060208083850312156115d857600080fd5b825167ffffffffffffffff808211156115f057600080fd5b818501915085601f83011261160457600080fd5b8151818111156116165761161661159f565b8060051b604051601f19603f8301168101818110858211171561163b5761163b61159f565b60405291825284820192508381018501918883111561165957600080fd5b938501935b8285101561167e5761166f856115b5565b8452938501939285019261165e565b98975050505050505050565b634e487b7160e01b600052603260045260246000fd5b6000600182016116b2576116b2611563565b5060010190565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b60608201526080019056fea264697066735822122049b5a810cdc523ab28bef51dcc59c38208a898f06f4991141db28107ac7bbbda64736f6c63430008110033", + "numDeployments": 5, + "solcInputHash": "85b953b22882c536a643bf4b61b3153b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxSchedules\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"MaintenanceConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"MaintenanceScheduleCancelled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"from\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"to\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdatedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestTimestamp\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IMaintenance.Schedule\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"MaintenanceScheduled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"cancelSchedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkCooldownEnds\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"checkMaintained\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_toBlock\",\"type\":\"uint256\"}],\"name\":\"checkMaintainedInBlockRange\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintained\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_resList\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_toBlock\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintainedInBlockRange\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_resList\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkScheduled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownSecsToMaintain\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getSchedule\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"from\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"to\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdatedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestTimestamp\",\"type\":\"uint256\"}],\"internalType\":\"struct IMaintenance.Schedule\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxSchedules\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxMaintenanceDurationInBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxOffsetToStartSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxSchedules\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minMaintenanceDurationInBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minOffsetToStartSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startedAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endedAtBlock\",\"type\":\"uint256\"}],\"name\":\"schedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxSchedules\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"setMaintenanceConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSchedules\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"cancelSchedule(address)\":{\"details\":\"Cancel the schedule of maintenance for the `_consensusAddr`. Requirements: - The candidate `_consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `_consensusAddr`. - A schedule for the `_consensusAddr` must be existent and not executed yet. Emits the event `MaintenanceScheduleCancelled`.\"},\"checkCooldownEnds(address)\":{\"details\":\"Returns whether the validator `_consensusAddr`\"},\"checkMaintained(address,uint256)\":{\"details\":\"Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\"},\"checkMaintainedInBlockRange(address,uint256,uint256)\":{\"details\":\"Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\"},\"checkManyMaintained(address[],uint256)\":{\"details\":\"Returns the bool array indicating the validators maintained at block number `_block` or not.\"},\"checkManyMaintainedInBlockRange(address[],uint256,uint256)\":{\"details\":\"Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\"},\"checkScheduled(address)\":{\"details\":\"Returns whether the validator `_consensusAddr` has scheduled.\"},\"getSchedule(address)\":{\"details\":\"Returns the detailed schedule of the validator `_consensusAddr`.\"},\"initialize(address,uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"schedule(address,uint256,uint256)\":{\"details\":\"Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`. Requirements: - The candidate `_consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `_consensusAddr`. - The candidate `_consensusAddr` has no schedule yet or the previous is done. - The total number of schedules is not larger than `maxSchedules()`. - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block. - The end block is larger than the start block. - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`. - The start block is at the start of an epoch. - The end block is at the end of an epoch. Emits the event `MaintenanceScheduled`.\"},\"setMaintenanceConfig(uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the duration restriction, start time restriction, and max allowed for maintenance. Requirements: - The method caller is admin. - The max duration is larger than the min duration. - The max offset is larger than the min offset. Emits the event `MaintenanceConfigUpdated`.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"totalSchedules()\":{\"details\":\"Returns the total of current schedules.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"}},\"stateVariables\":{\"_schedule\":{\"details\":\"Mapping from consensus address => maintenance schedule.\"},\"cooldownSecsToMaintain\":{\"details\":\"The cooldown time to request new schedule.\"},\"maxMaintenanceDurationInBlock\":{\"details\":\"The max duration to maintenance in blocks.\"},\"maxOffsetToStartSchedule\":{\"details\":\"The offset to the max block number that the schedule can start.\"},\"maxSchedules\":{\"details\":\"The max number of scheduled maintenances.\"},\"minMaintenanceDurationInBlock\":{\"details\":\"The min duration to maintenance in blocks.\"},\"minOffsetToStartSchedule\":{\"details\":\"The offset to the min block number that the schedule can start.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/Maintenance.sol\":\"Maintenance\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IMaintenance {\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\\n */\\n function checkScheduled(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr`\\n */\\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\\n */\\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedules() external view returns (uint256 _count);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedules() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4f06c8f3ad7ec8b863882c655ddf443675d557272445e51d8a1e1f3454089d09\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xf719e74bc39be7aceb4e5cc455260f81b2b21e83aa693e0b50c390c9909e08c4\",\"license\":\"UNLICENSED\"},\"contracts/ronin/Maintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../interfaces/IMaintenance.sol\\\";\\nimport \\\"../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../libraries/Math.sol\\\";\\n\\ncontract Maintenance is IMaintenance, HasValidatorContract, Initializable {\\n using Math for uint256;\\n\\n /// @dev Mapping from consensus address => maintenance schedule.\\n mapping(address => Schedule) internal _schedule;\\n\\n /// @dev The min duration to maintenance in blocks.\\n uint256 public minMaintenanceDurationInBlock;\\n /// @dev The max duration to maintenance in blocks.\\n uint256 public maxMaintenanceDurationInBlock;\\n /// @dev The offset to the min block number that the schedule can start.\\n uint256 public minOffsetToStartSchedule;\\n /// @dev The offset to the max block number that the schedule can start.\\n uint256 public maxOffsetToStartSchedule;\\n /// @dev The max number of scheduled maintenances.\\n uint256 public maxSchedules;\\n /// @dev The cooldown time to request new schedule.\\n uint256 public cooldownSecsToMaintain;\\n\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external initializer {\\n _setValidatorContract(__validatorContract);\\n _setMaintenanceConfig(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external onlyAdmin {\\n _setMaintenanceConfig(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external override {\\n IRoninValidatorSet _validator = _validatorContract;\\n\\n require(_validator.isBlockProducer(_consensusAddr), \\\"Maintenance: consensus address must be a block producer\\\");\\n require(\\n _validator.isCandidateAdmin(_consensusAddr, msg.sender),\\n \\\"Maintenance: method caller must be a candidate admin\\\"\\n );\\n require(!checkScheduled(_consensusAddr), \\\"Maintenance: already scheduled\\\");\\n require(checkCooldownEnds(_consensusAddr), \\\"Maintainance: cooldown time not end\\\");\\n require(totalSchedules() < maxSchedules, \\\"Maintenance: exceeds total of schedules\\\");\\n require(\\n _startedAtBlock.inRange(block.number + minOffsetToStartSchedule, block.number + maxOffsetToStartSchedule),\\n \\\"Maintenance: start block is out of offset\\\"\\n );\\n require(_startedAtBlock < _endedAtBlock, \\\"Maintenance: start block must be less than end block\\\");\\n uint256 _maintenanceElapsed = _endedAtBlock - _startedAtBlock + 1;\\n require(\\n _maintenanceElapsed.inRange(minMaintenanceDurationInBlock, maxMaintenanceDurationInBlock),\\n \\\"Maintenance: invalid maintenance duration\\\"\\n );\\n require(_validator.epochEndingAt(_startedAtBlock - 1), \\\"Maintenance: start block is not at the start of an epoch\\\");\\n require(_validator.epochEndingAt(_endedAtBlock), \\\"Maintenance: end block is not at the end of an epoch\\\");\\n\\n Schedule storage _sSchedule = _schedule[_consensusAddr];\\n _sSchedule.from = _startedAtBlock;\\n _sSchedule.to = _endedAtBlock;\\n _sSchedule.lastUpdatedBlock = block.number;\\n _sSchedule.requestTimestamp = block.timestamp;\\n emit MaintenanceScheduled(_consensusAddr, _sSchedule);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function cancelSchedule(address _consensusAddr) external override {\\n require(\\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\\n \\\"Maintenance: method caller must be the candidate admin\\\"\\n );\\n require(checkScheduled(_consensusAddr), \\\"Maintenance: no schedule exists\\\");\\n require(!checkMaintained(_consensusAddr, block.number), \\\"Maintenance: already on maintenance\\\");\\n Schedule storage _sSchedule = _schedule[_consensusAddr];\\n delete _sSchedule.from;\\n delete _sSchedule.to;\\n _sSchedule.lastUpdatedBlock = block.number;\\n emit MaintenanceScheduleCancelled(_consensusAddr);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function getSchedule(address _consensusAddr) external view override returns (Schedule memory) {\\n return _schedule[_consensusAddr];\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block)\\n external\\n view\\n override\\n returns (bool[] memory _resList)\\n {\\n _resList = new bool[](_addrList.length);\\n for (uint _i = 0; _i < _addrList.length; _i++) {\\n _resList[_i] = checkMaintained(_addrList[_i], _block);\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view override returns (bool[] memory _resList) {\\n _resList = new bool[](_addrList.length);\\n for (uint _i = 0; _i < _addrList.length; _i++) {\\n _resList[_i] = _maintainingInBlockRange(_addrList[_i], _fromBlock, _toBlock);\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function totalSchedules() public view override returns (uint256 _count) {\\n (address[] memory _validators, , ) = _validatorContract.getValidators();\\n for (uint _i = 0; _i < _validators.length; _i++) {\\n if (checkScheduled(_validators[_i])) {\\n _count++;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) public view override returns (bool) {\\n Schedule storage _s = _schedule[_consensusAddr];\\n return _s.from <= _block && _block <= _s.to;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) public view override returns (bool) {\\n return _maintainingInBlockRange(_consensusAddr, _fromBlock, _toBlock);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkScheduled(address _consensusAddr) public view override returns (bool) {\\n return block.number <= _schedule[_consensusAddr].to;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkCooldownEnds(address _consensusAddr) public view override returns (bool) {\\n return block.timestamp > _schedule[_consensusAddr].requestTimestamp + cooldownSecsToMaintain;\\n }\\n\\n /**\\n * @dev Sets the min block period and max block period to maintenance.\\n *\\n * Requirements:\\n * - The max period is larger than the min period.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function _setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) internal {\\n require(\\n _minMaintenanceDurationInBlock < _maxMaintenanceDurationInBlock,\\n \\\"Maintenance: invalid maintenance duration configs\\\"\\n );\\n require(\\n _minOffsetToStartSchedule < _maxOffsetToStartSchedule,\\n \\\"Maintenance: invalid offset to start schedule configs\\\"\\n );\\n minMaintenanceDurationInBlock = _minMaintenanceDurationInBlock;\\n maxMaintenanceDurationInBlock = _maxMaintenanceDurationInBlock;\\n minOffsetToStartSchedule = _minOffsetToStartSchedule;\\n maxOffsetToStartSchedule = _maxOffsetToStartSchedule;\\n maxSchedules = _maxSchedules;\\n cooldownSecsToMaintain = _cooldownSecsToMaintain;\\n emit MaintenanceConfigUpdated(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @dev Check if the validator was maintaining in the current period.\\n *\\n * Note: This method should be called at the end of the period.\\n */\\n function _maintainingInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) private view returns (bool) {\\n Schedule storage _s = _schedule[_consensusAddr];\\n return Math.twoRangeOverlap(_fromBlock, _toBlock, _s.from, _s.to);\\n }\\n}\\n\",\"keccak256\":\"0xc7fc2e02a52063b981007e05eeb4db953b2e35fe4a6497f351a6e86dc38878c2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100eb565b600054600160a81b900460ff161561008c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff600160a01b909104811610156100e9576000805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61180e806100fa6000396000f3fe608060405234801561001057600080fd5b50600436106100fc5760003560e01c8063088e8de71461010157806309e34c38146101295780630fbeb37f146101405780632d538c2c146101535780632ddc08a2146101685780637a50802d1461017b5780638142951a14610184578063965720af14610197578063994390891461019f578063b59f403e146101b8578063ba303755146101cb578063bc1710e9146101eb578063bfa89b9b146101f4578063c09fe460146101fd578063c44cb23314610210578063cdf64a7614610219578063d39fee341461022c578063dec3628414610272578063f0caaafb1461027b578063fdadda811461028e575b600080fd5b61011461010f36600461128a565b6102a1565b60405190151581526020015b60405180910390f35b61013260025481565b604051908152602001610120565b61011461014e3660046112bf565b6102b6565b61016661016136600461128a565b6102ed565b005b6101146101763660046112eb565b61095f565b61013260055481565b61016661019236600461130f565b610981565b610132610ac3565b6000546001600160a01b03166040516101209190611364565b6101146101c63660046112eb565b610b90565b6101de6101d93660046113c3565b610bc2565b6040516101209190611413565b61013260045481565b61013260035481565b61016661020b366004611459565b610c81565b61013260065481565b6101666102273660046112eb565b610ccf565b61023f61023a3660046112eb565b610d3e565b60405161012091908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b61013260075481565b6101666102893660046112eb565b610db6565b6101de61029c36600461149c565b610f8f565b60006102ae84848461104c565b949350505050565b6001600160a01b0382166000908152600160205260408120805483108015906102e3575080600101548311155b9150505b92915050565b600054604051633292276760e11b81526001600160a01b039091169081906365244ece9061031f908790600401611364565b602060405180830381865afa15801561033c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036091906114e7565b6103d15760405162461bcd60e51b815260206004820152603760248201527f4d61696e74656e616e63653a20636f6e73656e7375732061646472657373206d6044820152763ab9ba103132903090313637b1b590383937b23ab1b2b960491b60648201526084015b60405180910390fd5b6040516304d971ab60e01b81526001600160a01b038216906304d971ab906103ff9087903390600401611509565b602060405180830381865afa15801561041c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044091906114e7565b6104975760405162461bcd60e51b81526020600482015260346024820152600080516020611799833981519152604482015273313290309031b0b73234b230ba329030b236b4b760611b60648201526084016103c8565b6104a08461095f565b156104ed5760405162461bcd60e51b815260206004820152601e60248201527f4d61696e74656e616e63653a20616c7265616479207363686564756c6564000060448201526064016103c8565b6104f684610b90565b61054e5760405162461bcd60e51b815260206004820152602360248201527f4d61696e7461696e616e63653a20636f6f6c646f776e2074696d65206e6f7420604482015262195b9960ea1b60648201526084016103c8565b600654610559610ac3565b106105b65760405162461bcd60e51b815260206004820152602760248201527f4d61696e74656e616e63653a206578636565647320746f74616c206f66207363604482015266686564756c657360c81b60648201526084016103c8565b6105dc600454436105c79190611539565b6005546105d49043611539565b859190611084565b61063a5760405162461bcd60e51b815260206004820152602960248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206f7574206044820152681bd9881bd9999cd95d60ba1b60648201526084016103c8565b8183106106a65760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20737461727420626c6f636b206d757374206265604482015273206c657373207468616e20656e6420626c6f636b60601b60648201526084016103c8565b60006106b2848461154c565b6106bd906001611539565b90506106d8600254600354836110849092919063ffffffff16565b6107245760405162461bcd60e51b815260206004820152602960248201526000805160206117b983398151915260448201526810323ab930ba34b7b760b91b60648201526084016103c8565b6001600160a01b038216637593ff7161073e60018761154c565b6040518263ffffffff1660e01b815260040161075c91815260200190565b602060405180830381865afa158015610779573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079d91906114e7565b61080a5760405162461bcd60e51b815260206004820152603860248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206e6f74206044820152770c2e840e8d0ca40e6e8c2e4e840decc40c2dc40cae0dec6d60431b60648201526084016103c8565b604051637593ff7160e01b8152600481018490526001600160a01b03831690637593ff7190602401602060405180830381865afa15801561084f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087391906114e7565b6108dc5760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20656e6420626c6f636b206973206e6f74206174604482015273040e8d0ca40cadcc840decc40c2dc40cae0dec6d60631b60648201526084016103c8565b6001600160a01b0385166000818152600160208181526040928390208881559182018790554360028301819055426003840181905584518a815292830189905293820152606081019290925291907f48e8b2f7348b1ec693bbb999258a8d6bd514732a19c6057b6e2a56a4c405253b9060800160405180910390a2505050505050565b6001600160a01b03166000908152600160208190526040909120015443111590565b600054600160a81b900460ff16158080156109a957506000546001600160a01b90910460ff16105b806109ca5750303b1580156109ca5750600054600160a01b900460ff166001145b610a2d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103c8565b6000805460ff60a01b1916600160a01b1790558015610a5a576000805460ff60a81b1916600160a81b1790555b610a638861109b565b610a718787878787876110f1565b8015610ab9576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600080546040805163b7ab4db560e01b8152905183926001600160a01b03169163b7ab4db591600480830192869291908290030181865afa158015610b0c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b34919081019061163c565b5050905060005b8151811015610b8b57610b66828281518110610b5957610b59611727565b602002602001015161095f565b15610b795782610b758161173d565b9350505b80610b838161173d565b915050610b3b565b505090565b6007546001600160a01b0382166000908152600160205260408120600301549091610bba91611539565b421192915050565b6060836001600160401b03811115610bdc57610bdc61155f565b604051908082528060200260200182016040528015610c05578160200160208202803683370190505b50905060005b84811015610c7857610c44868683818110610c2857610c28611727565b9050602002016020810190610c3d91906112eb565b858561104c565b828281518110610c5657610c56611727565b9115156020928302919091019091015280610c708161173d565b915050610c0b565b50949350505050565b610c89611231565b6001600160a01b0316336001600160a01b031614610cb95760405162461bcd60e51b81526004016103c890611756565b610cc78686868686866110f1565b505050505050565b610cd7611231565b6001600160a01b0316336001600160a01b031614610d075760405162461bcd60e51b81526004016103c890611756565b806001600160a01b03163b600003610d3257604051637bcd509160e01b815260040160405180910390fd5b610d3b8161109b565b50565b610d696040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b03166000908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b6000546040516304d971ab60e01b81526001600160a01b03909116906304d971ab90610de89084903390600401611509565b602060405180830381865afa158015610e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2991906114e7565b610e825760405162461bcd60e51b815260206004820152603660248201526000805160206117998339815191526044820152753132903a34329031b0b73234b230ba329030b236b4b760511b60648201526084016103c8565b610e8b8161095f565b610ed75760405162461bcd60e51b815260206004820152601f60248201527f4d61696e74656e616e63653a206e6f207363686564756c65206578697374730060448201526064016103c8565b610ee181436102b6565b15610f3a5760405162461bcd60e51b815260206004820152602360248201527f4d61696e74656e616e63653a20616c7265616479206f6e206d61696e74656e616044820152626e636560e81b60648201526084016103c8565b6001600160a01b0381166000818152600160208190526040808320838155918201839055436002830155519092917f72720a31deb222f77bbf95b88a540154648466770e5f41328ee1e25e5050737791a25050565b6060826001600160401b03811115610fa957610fa961155f565b604051908082528060200260200182016040528015610fd2578160200160208202803683370190505b50905060005b8381101561104457611010858583818110610ff557610ff5611727565b905060200201602081019061100a91906112eb565b846102b6565b82828151811061102257611022611727565b911515602092830291909101909101528061103c8161173d565b915050610fd8565b509392505050565b6001600160a01b03831660009081526001602081905260408220805491810154909161107b918691869161125f565b95945050505050565b60008383111580156102ae57505090911115919050565b600080546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906110e6908390611364565b60405180910390a150565b8486106111485760405162461bcd60e51b815260206004820152603160248201526000805160206117b9833981519152604482015270206475726174696f6e20636f6e6669677360781b60648201526084016103c8565b8284106111b55760405162461bcd60e51b815260206004820152603560248201527f4d61696e74656e616e63653a20696e76616c6964206f666673657420746f207360448201527474617274207363686564756c6520636f6e6669677360581b60648201526084016103c8565b6002869055600385905560048490556005839055600682905560078190556040805187815260208101879052908101859052606081018490526080810183905260a081018290527f4edb6adef66a4b8e1ffbc8c67640d4f244ce904193fd65e5cc316bbb74b2e59b9060c00160405180910390a1505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b600081851115801561107b575050501115919050565b6001600160a01b0381168114610d3b57600080fd5b60008060006060848603121561129f57600080fd5b83356112aa81611275565b95602085013595506040909401359392505050565b600080604083850312156112d257600080fd5b82356112dd81611275565b946020939093013593505050565b6000602082840312156112fd57600080fd5b813561130881611275565b9392505050565b600080600080600080600060e0888a03121561132a57600080fd5b873561133581611275565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b6001600160a01b0391909116815260200190565b60008083601f84011261138a57600080fd5b5081356001600160401b038111156113a157600080fd5b6020830191508360208260051b85010111156113bc57600080fd5b9250929050565b600080600080606085870312156113d957600080fd5b84356001600160401b038111156113ef57600080fd5b6113fb87828801611378565b90989097506020870135966040013595509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561144d57835115158352928401929184019160010161142f565b50909695505050505050565b60008060008060008060c0878903121561147257600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6000806000604084860312156114b157600080fd5b83356001600160401b038111156114c757600080fd5b6114d386828701611378565b909790965060209590950135949350505050565b6000602082840312156114f957600080fd5b8151801515811461130857600080fd5b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611523565b818103818111156102e7576102e7611523565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561159d5761159d61155f565b604052919050565b60006001600160401b038211156115be576115be61155f565b5060051b60200190565b600082601f8301126115d957600080fd5b815160206115ee6115e9836115a5565b611575565b82815260059290921b8401810191818101908684111561160d57600080fd5b8286015b8481101561163157805161162481611275565b8352918301918301611611565b509695505050505050565b60008060006060848603121561165157600080fd5b83516001600160401b038082111561166857600080fd5b611674878388016115c8565b945060209150818601518181111561168b57600080fd5b611697888289016115c8565b9450506040860151818111156116ac57600080fd5b86019050601f810187136116bf57600080fd5b80516116cd6115e9826115a5565b81815260059190911b820183019083810190898311156116ec57600080fd5b928401925b82841015611718578351600481106117095760008081fd5b825292840192908401906116f1565b80955050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b60006001820161174f5761174f611523565b5060010190565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b60608201526080019056fe4d61696e74656e616e63653a206d6574686f642063616c6c6572206d757374204d61696e74656e616e63653a20696e76616c6964206d61696e74656e616e6365a264697066735822122020d6e85a401c7371df2c8089f2290dbc1b507fb37b62e12da5f11aacfead033d64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100fc5760003560e01c8063088e8de71461010157806309e34c38146101295780630fbeb37f146101405780632d538c2c146101535780632ddc08a2146101685780637a50802d1461017b5780638142951a14610184578063965720af14610197578063994390891461019f578063b59f403e146101b8578063ba303755146101cb578063bc1710e9146101eb578063bfa89b9b146101f4578063c09fe460146101fd578063c44cb23314610210578063cdf64a7614610219578063d39fee341461022c578063dec3628414610272578063f0caaafb1461027b578063fdadda811461028e575b600080fd5b61011461010f36600461128a565b6102a1565b60405190151581526020015b60405180910390f35b61013260025481565b604051908152602001610120565b61011461014e3660046112bf565b6102b6565b61016661016136600461128a565b6102ed565b005b6101146101763660046112eb565b61095f565b61013260055481565b61016661019236600461130f565b610981565b610132610ac3565b6000546001600160a01b03166040516101209190611364565b6101146101c63660046112eb565b610b90565b6101de6101d93660046113c3565b610bc2565b6040516101209190611413565b61013260045481565b61013260035481565b61016661020b366004611459565b610c81565b61013260065481565b6101666102273660046112eb565b610ccf565b61023f61023a3660046112eb565b610d3e565b60405161012091908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b61013260075481565b6101666102893660046112eb565b610db6565b6101de61029c36600461149c565b610f8f565b60006102ae84848461104c565b949350505050565b6001600160a01b0382166000908152600160205260408120805483108015906102e3575080600101548311155b9150505b92915050565b600054604051633292276760e11b81526001600160a01b039091169081906365244ece9061031f908790600401611364565b602060405180830381865afa15801561033c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036091906114e7565b6103d15760405162461bcd60e51b815260206004820152603760248201527f4d61696e74656e616e63653a20636f6e73656e7375732061646472657373206d6044820152763ab9ba103132903090313637b1b590383937b23ab1b2b960491b60648201526084015b60405180910390fd5b6040516304d971ab60e01b81526001600160a01b038216906304d971ab906103ff9087903390600401611509565b602060405180830381865afa15801561041c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044091906114e7565b6104975760405162461bcd60e51b81526020600482015260346024820152600080516020611799833981519152604482015273313290309031b0b73234b230ba329030b236b4b760611b60648201526084016103c8565b6104a08461095f565b156104ed5760405162461bcd60e51b815260206004820152601e60248201527f4d61696e74656e616e63653a20616c7265616479207363686564756c6564000060448201526064016103c8565b6104f684610b90565b61054e5760405162461bcd60e51b815260206004820152602360248201527f4d61696e7461696e616e63653a20636f6f6c646f776e2074696d65206e6f7420604482015262195b9960ea1b60648201526084016103c8565b600654610559610ac3565b106105b65760405162461bcd60e51b815260206004820152602760248201527f4d61696e74656e616e63653a206578636565647320746f74616c206f66207363604482015266686564756c657360c81b60648201526084016103c8565b6105dc600454436105c79190611539565b6005546105d49043611539565b859190611084565b61063a5760405162461bcd60e51b815260206004820152602960248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206f7574206044820152681bd9881bd9999cd95d60ba1b60648201526084016103c8565b8183106106a65760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20737461727420626c6f636b206d757374206265604482015273206c657373207468616e20656e6420626c6f636b60601b60648201526084016103c8565b60006106b2848461154c565b6106bd906001611539565b90506106d8600254600354836110849092919063ffffffff16565b6107245760405162461bcd60e51b815260206004820152602960248201526000805160206117b983398151915260448201526810323ab930ba34b7b760b91b60648201526084016103c8565b6001600160a01b038216637593ff7161073e60018761154c565b6040518263ffffffff1660e01b815260040161075c91815260200190565b602060405180830381865afa158015610779573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079d91906114e7565b61080a5760405162461bcd60e51b815260206004820152603860248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206e6f74206044820152770c2e840e8d0ca40e6e8c2e4e840decc40c2dc40cae0dec6d60431b60648201526084016103c8565b604051637593ff7160e01b8152600481018490526001600160a01b03831690637593ff7190602401602060405180830381865afa15801561084f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087391906114e7565b6108dc5760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20656e6420626c6f636b206973206e6f74206174604482015273040e8d0ca40cadcc840decc40c2dc40cae0dec6d60631b60648201526084016103c8565b6001600160a01b0385166000818152600160208181526040928390208881559182018790554360028301819055426003840181905584518a815292830189905293820152606081019290925291907f48e8b2f7348b1ec693bbb999258a8d6bd514732a19c6057b6e2a56a4c405253b9060800160405180910390a2505050505050565b6001600160a01b03166000908152600160208190526040909120015443111590565b600054600160a81b900460ff16158080156109a957506000546001600160a01b90910460ff16105b806109ca5750303b1580156109ca5750600054600160a01b900460ff166001145b610a2d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103c8565b6000805460ff60a01b1916600160a01b1790558015610a5a576000805460ff60a81b1916600160a81b1790555b610a638861109b565b610a718787878787876110f1565b8015610ab9576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600080546040805163b7ab4db560e01b8152905183926001600160a01b03169163b7ab4db591600480830192869291908290030181865afa158015610b0c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b34919081019061163c565b5050905060005b8151811015610b8b57610b66828281518110610b5957610b59611727565b602002602001015161095f565b15610b795782610b758161173d565b9350505b80610b838161173d565b915050610b3b565b505090565b6007546001600160a01b0382166000908152600160205260408120600301549091610bba91611539565b421192915050565b6060836001600160401b03811115610bdc57610bdc61155f565b604051908082528060200260200182016040528015610c05578160200160208202803683370190505b50905060005b84811015610c7857610c44868683818110610c2857610c28611727565b9050602002016020810190610c3d91906112eb565b858561104c565b828281518110610c5657610c56611727565b9115156020928302919091019091015280610c708161173d565b915050610c0b565b50949350505050565b610c89611231565b6001600160a01b0316336001600160a01b031614610cb95760405162461bcd60e51b81526004016103c890611756565b610cc78686868686866110f1565b505050505050565b610cd7611231565b6001600160a01b0316336001600160a01b031614610d075760405162461bcd60e51b81526004016103c890611756565b806001600160a01b03163b600003610d3257604051637bcd509160e01b815260040160405180910390fd5b610d3b8161109b565b50565b610d696040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b03166000908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b6000546040516304d971ab60e01b81526001600160a01b03909116906304d971ab90610de89084903390600401611509565b602060405180830381865afa158015610e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2991906114e7565b610e825760405162461bcd60e51b815260206004820152603660248201526000805160206117998339815191526044820152753132903a34329031b0b73234b230ba329030b236b4b760511b60648201526084016103c8565b610e8b8161095f565b610ed75760405162461bcd60e51b815260206004820152601f60248201527f4d61696e74656e616e63653a206e6f207363686564756c65206578697374730060448201526064016103c8565b610ee181436102b6565b15610f3a5760405162461bcd60e51b815260206004820152602360248201527f4d61696e74656e616e63653a20616c7265616479206f6e206d61696e74656e616044820152626e636560e81b60648201526084016103c8565b6001600160a01b0381166000818152600160208190526040808320838155918201839055436002830155519092917f72720a31deb222f77bbf95b88a540154648466770e5f41328ee1e25e5050737791a25050565b6060826001600160401b03811115610fa957610fa961155f565b604051908082528060200260200182016040528015610fd2578160200160208202803683370190505b50905060005b8381101561104457611010858583818110610ff557610ff5611727565b905060200201602081019061100a91906112eb565b846102b6565b82828151811061102257611022611727565b911515602092830291909101909101528061103c8161173d565b915050610fd8565b509392505050565b6001600160a01b03831660009081526001602081905260408220805491810154909161107b918691869161125f565b95945050505050565b60008383111580156102ae57505090911115919050565b600080546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906110e6908390611364565b60405180910390a150565b8486106111485760405162461bcd60e51b815260206004820152603160248201526000805160206117b9833981519152604482015270206475726174696f6e20636f6e6669677360781b60648201526084016103c8565b8284106111b55760405162461bcd60e51b815260206004820152603560248201527f4d61696e74656e616e63653a20696e76616c6964206f666673657420746f207360448201527474617274207363686564756c6520636f6e6669677360581b60648201526084016103c8565b6002869055600385905560048490556005839055600682905560078190556040805187815260208101879052908101859052606081018490526080810183905260a081018290527f4edb6adef66a4b8e1ffbc8c67640d4f244ce904193fd65e5cc316bbb74b2e59b9060c00160405180910390a1505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b600081851115801561107b575050501115919050565b6001600160a01b0381168114610d3b57600080fd5b60008060006060848603121561129f57600080fd5b83356112aa81611275565b95602085013595506040909401359392505050565b600080604083850312156112d257600080fd5b82356112dd81611275565b946020939093013593505050565b6000602082840312156112fd57600080fd5b813561130881611275565b9392505050565b600080600080600080600060e0888a03121561132a57600080fd5b873561133581611275565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b6001600160a01b0391909116815260200190565b60008083601f84011261138a57600080fd5b5081356001600160401b038111156113a157600080fd5b6020830191508360208260051b85010111156113bc57600080fd5b9250929050565b600080600080606085870312156113d957600080fd5b84356001600160401b038111156113ef57600080fd5b6113fb87828801611378565b90989097506020870135966040013595509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561144d57835115158352928401929184019160010161142f565b50909695505050505050565b60008060008060008060c0878903121561147257600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6000806000604084860312156114b157600080fd5b83356001600160401b038111156114c757600080fd5b6114d386828701611378565b909790965060209590950135949350505050565b6000602082840312156114f957600080fd5b8151801515811461130857600080fd5b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611523565b818103818111156102e7576102e7611523565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561159d5761159d61155f565b604052919050565b60006001600160401b038211156115be576115be61155f565b5060051b60200190565b600082601f8301126115d957600080fd5b815160206115ee6115e9836115a5565b611575565b82815260059290921b8401810191818101908684111561160d57600080fd5b8286015b8481101561163157805161162481611275565b8352918301918301611611565b509695505050505050565b60008060006060848603121561165157600080fd5b83516001600160401b038082111561166857600080fd5b611674878388016115c8565b945060209150818601518181111561168b57600080fd5b611697888289016115c8565b9450506040860151818111156116ac57600080fd5b86019050601f810187136116bf57600080fd5b80516116cd6115e9826115a5565b81815260059190911b820183019083810190898311156116ec57600080fd5b928401925b82841015611718578351600481106117095760008081fd5b825292840192908401906116f1565b80955050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b60006001820161174f5761174f611523565b5060010190565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b60608201526080019056fe4d61696e74656e616e63653a206d6574686f642063616c6c6572206d757374204d61696e74656e616e63653a20696e76616c6964206d61696e74656e616e6365a264697066735822122020d6e85a401c7371df2c8089f2290dbc1b507fb37b62e12da5f11aacfead033d64736f6c63430008110033", "devdoc": { "errors": { "ErrCallerMustBeValidatorContract()": [ @@ -685,12 +685,12 @@ "storageLayout": { "storage": [ { - "astId": 6462, + "astId": 7051, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "_validatorContract", "offset": 0, "slot": "0", - "type": "t_contract(IRoninValidatorSet)11978" + "type": "t_contract(IRoninValidatorSet)11973" }, { "astId": 1373, @@ -709,15 +709,15 @@ "type": "t_bool" }, { - "astId": 20980, + "astId": 20853, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "_schedule", "offset": 0, "slot": "1", - "type": "t_mapping(t_address,t_struct(Schedule)9539_storage)" + "type": "t_mapping(t_address,t_struct(Schedule)9487_storage)" }, { - "astId": 20983, + "astId": 20856, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "minMaintenanceDurationInBlock", "offset": 0, @@ -725,7 +725,7 @@ "type": "t_uint256" }, { - "astId": 20986, + "astId": 20859, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "maxMaintenanceDurationInBlock", "offset": 0, @@ -733,7 +733,7 @@ "type": "t_uint256" }, { - "astId": 20989, + "astId": 20862, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "minOffsetToStartSchedule", "offset": 0, @@ -741,7 +741,7 @@ "type": "t_uint256" }, { - "astId": 20992, + "astId": 20865, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "maxOffsetToStartSchedule", "offset": 0, @@ -749,7 +749,7 @@ "type": "t_uint256" }, { - "astId": 20995, + "astId": 20868, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "maxSchedules", "offset": 0, @@ -757,7 +757,7 @@ "type": "t_uint256" }, { - "astId": 20998, + "astId": 20871, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "cooldownSecsToMaintain", "offset": 0, @@ -776,24 +776,24 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(IRoninValidatorSet)11978": { + "t_contract(IRoninValidatorSet)11973": { "encoding": "inplace", "label": "contract IRoninValidatorSet", "numberOfBytes": "20" }, - "t_mapping(t_address,t_struct(Schedule)9539_storage)": { + "t_mapping(t_address,t_struct(Schedule)9487_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct IMaintenance.Schedule)", "numberOfBytes": "32", - "value": "t_struct(Schedule)9539_storage" + "value": "t_struct(Schedule)9487_storage" }, - "t_struct(Schedule)9539_storage": { + "t_struct(Schedule)9487_storage": { "encoding": "inplace", "label": "struct IMaintenance.Schedule", "members": [ { - "astId": 9532, + "astId": 9480, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "from", "offset": 0, @@ -801,7 +801,7 @@ "type": "t_uint256" }, { - "astId": 9534, + "astId": 9482, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "to", "offset": 0, @@ -809,7 +809,7 @@ "type": "t_uint256" }, { - "astId": 9536, + "astId": 9484, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "lastUpdatedBlock", "offset": 0, @@ -817,7 +817,7 @@ "type": "t_uint256" }, { - "astId": 9538, + "astId": 9486, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "requestTimestamp", "offset": 0, diff --git a/deployments/ronin-testnet/RoninGatewayPauseEnforcer.json b/deployments/ronin-testnet/RoninGatewayPauseEnforcer.json new file mode 100644 index 000000000..07cd45908 --- /dev/null +++ b/deployments/ronin-testnet/RoninGatewayPauseEnforcer.json @@ -0,0 +1,718 @@ +{ + "address": "0x51F44b52856d8E83692FCE53795eb848f410B950", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IPauseTarget", + "name": "_target", + "type": "address" + }, + { + "internalType": "address", + "name": "_admin", + "type": "address" + }, + { + "internalType": "address[]", + "name": "_sentries", + "type": "address[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "EmergencyPaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "EmergencyUnpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "previousAdminRole", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "bytes32", + "name": "newAdminRole", + "type": "bytes32" + } + ], + "name": "RoleAdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleGranted", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "RoleRevoked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "contract IPauseTarget", + "name": "target", + "type": "address" + } + ], + "name": "TargetChanged", + "type": "event" + }, + { + "inputs": [], + "name": "DEFAULT_ADMIN_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "SENTRY_ROLE", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IPauseTarget", + "name": "_target", + "type": "address" + } + ], + "name": "changeTarget", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "emergency", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleAdmin", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "getRoleMember", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + } + ], + "name": "getRoleMemberCount", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "grantRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_sentry", + "type": "address" + } + ], + "name": "grantSentry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "hasRole", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "renounceRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "role", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "revokeRole", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_sentry", + "type": "address" + } + ], + "name": "revokeSentry", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "target", + "outputs": [ + { + "internalType": "contract IPauseTarget", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "triggerPause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "triggerUnpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "transactionHash": "0xbe445c047d9585555de527221abcae2857883eaa05c5969dd69ecaa3176d3b82", + "receipt": { + "to": null, + "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", + "contractAddress": "0x51F44b52856d8E83692FCE53795eb848f410B950", + "transactionIndex": 0, + "gasUsed": "1196604", + "logsBloom": "0x00000004000000000000000000000000000000000000000000000000000000000000000000000200000000002000000000000000000000800000000000000000000000000000000000000000000000000000000000088000000000000000000000000000020000000000000000200800000000000000000000000000000000000004000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000080000000000000000001000000008000000000000000000000000000000000000000000000000000100000000000020400000000000000000000000000000002008001000020000000000000000000000", + "blockHash": "0x18d40c95e71fd06fdf7b3920c61d832394a31b930b798f0014cfd033152e52fe", + "transactionHash": "0xbe445c047d9585555de527221abcae2857883eaa05c5969dd69ecaa3176d3b82", + "logs": [ + { + "transactionIndex": 0, + "blockNumber": 16817714, + "transactionHash": "0xbe445c047d9585555de527221abcae2857883eaa05c5969dd69ecaa3176d3b82", + "address": "0x51F44b52856d8E83692FCE53795eb848f410B950", + "topics": [ + "0x7f8cffd58ac96898bdd25ab64868bd933141d15ad1cd4a0df228fd3fcba2a26d" + ], + "data": "0x000000000000000000000000cee681c9108c42c710c6a8a949307d5f13c9f3ca", + "logIndex": 0, + "blockHash": "0x18d40c95e71fd06fdf7b3920c61d832394a31b930b798f0014cfd033152e52fe" + }, + { + "transactionIndex": 0, + "blockNumber": 16817714, + "transactionHash": "0xbe445c047d9585555de527221abcae2857883eaa05c5969dd69ecaa3176d3b82", + "address": "0x51F44b52856d8E83692FCE53795eb848f410B950", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x0000000000000000000000000000000000000000000000000000000000000000", + "0x000000000000000000000000968d0cd7343f711216817e617d3f92a23dc91c07", + "0x000000000000000000000000968d0cd7343f711216817e617d3f92a23dc91c07" + ], + "data": "0x", + "logIndex": 1, + "blockHash": "0x18d40c95e71fd06fdf7b3920c61d832394a31b930b798f0014cfd033152e52fe" + }, + { + "transactionIndex": 0, + "blockNumber": 16817714, + "transactionHash": "0xbe445c047d9585555de527221abcae2857883eaa05c5969dd69ecaa3176d3b82", + "address": "0x51F44b52856d8E83692FCE53795eb848f410B950", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x5bea60102f2a7acc9e82b1af0e3bd4069661102bb5dd143a6051cd1980dded1c", + "0x000000000000000000000000968d0cd7343f711216817e617d3f92a23dc91c07", + "0x000000000000000000000000968d0cd7343f711216817e617d3f92a23dc91c07" + ], + "data": "0x", + "logIndex": 2, + "blockHash": "0x18d40c95e71fd06fdf7b3920c61d832394a31b930b798f0014cfd033152e52fe" + }, + { + "transactionIndex": 0, + "blockNumber": 16817714, + "transactionHash": "0xbe445c047d9585555de527221abcae2857883eaa05c5969dd69ecaa3176d3b82", + "address": "0x51F44b52856d8E83692FCE53795eb848f410B950", + "topics": [ + "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", + "0x5bea60102f2a7acc9e82b1af0e3bd4069661102bb5dd143a6051cd1980dded1c", + "0x000000000000000000000000951e5bf7883ec7f06a4f78f35f72128a71067176", + "0x000000000000000000000000968d0cd7343f711216817e617d3f92a23dc91c07" + ], + "data": "0x", + "logIndex": 3, + "blockHash": "0x18d40c95e71fd06fdf7b3920c61d832394a31b930b798f0014cfd033152e52fe" + } + ], + "blockNumber": 16817714, + "cumulativeGasUsed": "1196604", + "status": 1, + "byzantium": true + }, + "args": [ + "0xCee681C9108c42C710c6A8A949307D5F13C9F3ca", + "0x968d0cd7343f711216817e617d3f92a23dc91c07", + [ + "0x968D0Cd7343f711216817E617d3f92a23dC91c07", + "0x951e5BF7883eC7f06A4F78F35F72128a71067176" + ] + ], + "numDeployments": 1, + "solcInputHash": "2a8db5de0d3bfe0cb40ba15ae8460f16", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IPauseTarget\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_sentries\",\"type\":\"address[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"EmergencyPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"EmergencyUnpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IPauseTarget\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"TargetChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SENTRY_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IPauseTarget\",\"name\":\"_target\",\"type\":\"address\"}],\"name\":\"changeTarget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergency\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sentry\",\"type\":\"address\"}],\"name\":\"grantSentry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sentry\",\"type\":\"address\"}],\"name\":\"revokeSentry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"target\",\"outputs\":[{\"internalType\":\"contract IPauseTarget\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"triggerPause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"triggerUnpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"EmergencyPaused(address)\":{\"details\":\"Emitted when the emergency ppause is triggered by `account`.\"},\"EmergencyUnpaused(address)\":{\"details\":\"Emitted when the emergency unpause is triggered by `account`.\"},\"TargetChanged(address)\":{\"details\":\"Emitted when the target is changed.\"}},\"kind\":\"dev\",\"methods\":{\"changeTarget(address)\":{\"details\":\"Setter for `target`. Requirements: - Only admin can call this method.\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"grantSentry(address)\":{\"details\":\"Grants the SENTRY_ROLE to the specified address.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"revokeSentry(address)\":{\"details\":\"Revokes the SENTRY_ROLE from the specified address.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"triggerPause()\":{\"details\":\"Triggers a pause on the target contract. Requirements: - Only be called by accounts with the SENTRY_ROLE, - The target contract is not already paused.\"},\"triggerUnpause()\":{\"details\":\"Triggers an unpause on the target contract. Requirements: - Only be called by accounts with the SENTRY_ROLE, - The target contract is already paused. - The target contract is paused in emergency mode.\"}},\"stateVariables\":{\"emergency\":{\"details\":\"Indicating whether or not the target contract is paused in emergency mode.\"},\"target\":{\"details\":\"The contract that can be paused or unpaused by the SENTRY_ROLE.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/gateway/PauseEnforcer.sol\":\"PauseEnforcer\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":0},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(uint160(account), 20),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5b35d8e68aeaccc685239bd9dd79b9ba01a0357930f8a3307ab85511733d9724\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/AccessControlEnumerable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlEnumerable.sol\\\";\\nimport \\\"./AccessControl.sol\\\";\\nimport \\\"../utils/structs/EnumerableSet.sol\\\";\\n\\n/**\\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\\n */\\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\\n return _roleMembers[role].at(index);\\n }\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\\n return _roleMembers[role].length();\\n }\\n\\n /**\\n * @dev Overload {_grantRole} to track enumerable memberships\\n */\\n function _grantRole(bytes32 role, address account) internal virtual override {\\n super._grantRole(role, account);\\n _roleMembers[role].add(account);\\n }\\n\\n /**\\n * @dev Overload {_revokeRole} to track enumerable memberships\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual override {\\n super._revokeRole(role, account);\\n _roleMembers[role].remove(account);\\n }\\n}\\n\",\"keccak256\":\"0x13f5e15f2a0650c0b6aaee2ef19e89eaf4870d6e79662d572a393334c1397247\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControlEnumerable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\n\\n/**\\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\\n */\\ninterface IAccessControlEnumerable is IAccessControl {\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xba4459ab871dfa300f5212c6c30178b63898c03533a1ede28436f11546626676\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n return _values(set._inner);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x5050943b32b6a8f282573d166b2e9d87ab7eb4dbba4ab6acf36ecb54fe6995e4\",\"license\":\"MIT\"},\"contracts/interfaces/IPauseTarget.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IPauseTarget {\\n function pause() external;\\n\\n function unpause() external;\\n\\n function paused() external returns (bool);\\n}\\n\",\"keccak256\":\"0xc91073e61da572de0087b41018fd30b03661d58e0c5061e7b9d1c9235cd7c1c3\",\"license\":\"MIT\"},\"contracts/ronin/gateway/PauseEnforcer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/access/AccessControlEnumerable.sol\\\";\\nimport \\\"../../interfaces/IPauseTarget.sol\\\";\\n\\ncontract PauseEnforcer is AccessControlEnumerable {\\n bytes32 public constant SENTRY_ROLE = keccak256(\\\"SENTRY_ROLE\\\");\\n\\n /// @dev The contract that can be paused or unpaused by the SENTRY_ROLE.\\n IPauseTarget public target;\\n /// @dev Indicating whether or not the target contract is paused in emergency mode.\\n bool public emergency;\\n\\n /// @dev Emitted when the emergency ppause is triggered by `account`.\\n event EmergencyPaused(address account);\\n /// @dev Emitted when the emergency unpause is triggered by `account`.\\n event EmergencyUnpaused(address account);\\n /// @dev Emitted when the target is changed.\\n event TargetChanged(IPauseTarget target);\\n\\n modifier onEmergency() {\\n require(emergency, \\\"PauseEnforcer: not on emergency pause\\\");\\n _;\\n }\\n\\n modifier targetPaused() {\\n require(target.paused(), \\\"PauseEnforcer: target is on pause\\\");\\n _;\\n }\\n\\n modifier targetNotPaused() {\\n require(!target.paused(), \\\"PauseEnforcer: target is not on pause\\\");\\n _;\\n }\\n\\n constructor(\\n IPauseTarget _target,\\n address _admin,\\n address[] memory _sentries\\n ) {\\n _changeTarget(_target);\\n _setupRole(DEFAULT_ADMIN_ROLE, _admin);\\n for (uint _i; _i < _sentries.length; _i++) {\\n _grantRole(SENTRY_ROLE, _sentries[_i]);\\n }\\n }\\n\\n /**\\n * @dev Grants the SENTRY_ROLE to the specified address.\\n */\\n function grantSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _grantRole(SENTRY_ROLE, _sentry);\\n }\\n\\n /**\\n * @dev Revokes the SENTRY_ROLE from the specified address.\\n */\\n function revokeSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _revokeRole(SENTRY_ROLE, _sentry);\\n }\\n\\n /**\\n * @dev Triggers a pause on the target contract.\\n *\\n * Requirements:\\n * - Only be called by accounts with the SENTRY_ROLE,\\n * - The target contract is not already paused.\\n */\\n function triggerPause() external onlyRole(SENTRY_ROLE) targetNotPaused {\\n emergency = true;\\n target.pause();\\n emit EmergencyPaused(msg.sender);\\n }\\n\\n /**\\n * @dev Triggers an unpause on the target contract.\\n *\\n * Requirements:\\n * - Only be called by accounts with the SENTRY_ROLE,\\n * - The target contract is already paused.\\n * - The target contract is paused in emergency mode.\\n */\\n function triggerUnpause() external onlyRole(SENTRY_ROLE) onEmergency targetPaused {\\n emergency = false;\\n target.unpause();\\n emit EmergencyUnpaused(msg.sender);\\n }\\n\\n /**\\n * @dev Setter for `target`.\\n *\\n * Requirements:\\n * - Only admin can call this method.\\n */\\n function changeTarget(IPauseTarget _target) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _changeTarget(_target);\\n }\\n\\n /**\\n * @dev Internal helper for setting value to `target`.\\n */\\n function _changeTarget(IPauseTarget _target) internal {\\n target = _target;\\n emit TargetChanged(_target);\\n }\\n}\\n\",\"keccak256\":\"0x8ad7dac2cd63bb93695413825d318974511cbd8d840c0c80d98b38c3d66a9f2d\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620013a5380380620013a58339810160408190526200003491620002c0565b6200003f83620000c6565b6200004c6000836200011a565b60005b8151811015620000bc57620000a77f5bea60102f2a7acc9e82b1af0e3bd4069661102bb5dd143a6051cd1980dded1c838381518110620000935762000093620003c0565b60200260200101516200012a60201b60201c565b80620000b381620003d6565b9150506200004f565b50505050620003fe565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f7f8cffd58ac96898bdd25ab64868bd933141d15ad1cd4a0df228fd3fcba2a26d9060200160405180910390a150565b6200012682826200012a565b5050565b6200014182826200016d60201b6200076d1760201c565b600082815260016020908152604090912062000168918390620007f16200020d821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000126576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001c93390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600062000224836001600160a01b0384166200022d565b90505b92915050565b6000818152600183016020526040812054620002765750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000227565b50600062000227565b6001600160a01b03811681146200029557600080fd5b50565b8051620002a5816200027f565b919050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620002d657600080fd5b8351620002e3816200027f565b80935050602080850151620002f8816200027f565b60408601519093506001600160401b03808211156200031657600080fd5b818701915087601f8301126200032b57600080fd5b815181811115620003405762000340620002aa565b8060051b604051601f19603f83011681018181108582111715620003685762000368620002aa565b60405291825284820192508381018501918a8311156200038757600080fd5b938501935b82851015620003b057620003a08562000298565b845293850193928501926200038c565b8096505050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b600060018201620003f757634e487b7160e01b600052601160045260246000fd5b5060010190565b610f97806200040e6000396000f3fe608060405234801561001057600080fd5b50600436106100db5760003560e01c806301ffc9a7146100e0578063248a9ca3146101085780632f2ff15d1461012957806336568abe1461013e5780636833f60d146101515780637a9ad019146101595780637d4f7fc91461016e5780639010d07c1461018157806391d14854146101a1578063a217fddf146101b4578063b9f3163b146101bc578063ca15c873146101c4578063caa6fea4146101d7578063d4b83992146101eb578063d547741f146101fe578063dcf7bb5c14610211578063f82ec70b14610224575b600080fd5b6100f36100ee366004610cd2565b610237565b60405190151581526020015b60405180910390f35b61011b610116366004610cfc565b610262565b6040519081526020016100ff565b61013c610137366004610d2a565b610277565b005b61013c61014c366004610d2a565b610298565b61013c61031b565b61011b600080516020610f4283398151915281565b61013c61017c366004610d5a565b6104b1565b61019461018f366004610d77565b6104d4565b6040516100ff9190610d99565b6100f36101af366004610d2a565b6104f3565b61011b600081565b61013c61051c565b61011b6101d2366004610cfc565b610703565b6002546100f390600160a01b900460ff1681565b600254610194906001600160a01b031681565b61013c61020c366004610d2a565b61071a565b61013c61021f366004610d5a565b610736565b61013c610232366004610d5a565b61074a565b60006001600160e01b03198216635a05180f60e01b148061025c575061025c82610806565b92915050565b60009081526020819052604090206001015490565b61028082610262565b6102898161083b565b6102938383610848565b505050565b6001600160a01b038116331461030d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610317828261086a565b5050565b600080516020610f428339815191526103338161083b565b600260009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610388573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ac9190610dad565b156104075760405162461bcd60e51b815260206004820152602560248201527f5061757365456e666f726365723a20746172676574206973206e6f74206f6e20604482015264706175736560d81b6064820152608401610304565b6002805460ff60a01b198116600160a01b1790915560408051638456cb5960e01b815290516001600160a01b0390921691638456cb599160048082019260009290919082900301818387803b15801561045f57600080fd5b505af1158015610473573d6000803e3d6000fd5b505050507fb8fad2fa0ed7a383e747c309ef2c4391d7b65592a48893e57ccc1fab70791456336040516104a69190610d99565b60405180910390a150565b60006104bc8161083b565b610317600080516020610f4283398151915283610848565b60008281526001602052604081206104ec908361088c565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020610f428339815191526105348161083b565b600254600160a01b900460ff1661059b5760405162461bcd60e51b815260206004820152602560248201527f5061757365456e666f726365723a206e6f74206f6e20656d657267656e637920604482015264706175736560d81b6064820152608401610304565b600260009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156105f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106149190610dad565b61066a5760405162461bcd60e51b815260206004820152602160248201527f5061757365456e666f726365723a20746172676574206973206f6e20706175736044820152606560f81b6064820152608401610304565b6002805460ff60a01b19811690915560408051631fa5d41d60e11b815290516001600160a01b0390921691633f4ba83a9160048082019260009290919082900301818387803b1580156106bc57600080fd5b505af11580156106d0573d6000803e3d6000fd5b505050507ff5cbf596165cc457b2cd92e8d8450827ee314968160a5696402d75766fc52caf336040516104a69190610d99565b600081815260016020526040812061025c90610898565b61072382610262565b61072c8161083b565b610293838361086a565b60006107418161083b565b610317826108a2565b60006107558161083b565b610317600080516020610f428339815191528361086a565b61077782826104f3565b610317576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556107ad3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006104ec836001600160a01b0384166108ed565b60006001600160e01b03198216637965db0b60e01b148061025c57506301ffc9a760e01b6001600160e01b031983161461025c565b610845813361093c565b50565b610852828261076d565b600082815260016020526040902061029390826107f1565b61087482826109a0565b60008281526001602052604090206102939082610a05565b60006104ec8383610a1a565b600061025c825490565b600280546001600160a01b0319166001600160a01b0383161790556040517f7f8cffd58ac96898bdd25ab64868bd933141d15ad1cd4a0df228fd3fcba2a26d906104a6908390610d99565b60008181526001830160205260408120546109345750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561025c565b50600061025c565b61094682826104f3565b6103175761095e816001600160a01b03166014610a44565b610969836020610a44565b60405160200161097a929190610df3565b60408051601f198184030181529082905262461bcd60e51b825261030491600401610e62565b6109aa82826104f3565b15610317576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006104ec836001600160a01b038416610bdf565b6000826000018281548110610a3157610a31610e95565b9060005260206000200154905092915050565b60606000610a53836002610ec1565b610a5e906002610ed8565b6001600160401b03811115610a7557610a75610eeb565b6040519080825280601f01601f191660200182016040528015610a9f576020820181803683370190505b509050600360fc1b81600081518110610aba57610aba610e95565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610ae957610ae9610e95565b60200101906001600160f81b031916908160001a9053506000610b0d846002610ec1565b610b18906001610ed8565b90505b6001811115610b90576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610b4c57610b4c610e95565b1a60f81b828281518110610b6257610b62610e95565b60200101906001600160f81b031916908160001a90535060049490941c93610b8981610f01565b9050610b1b565b5083156104ec5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610304565b60008181526001830160205260408120548015610cc8576000610c03600183610f18565b8554909150600090610c1790600190610f18565b9050818114610c7c576000866000018281548110610c3757610c37610e95565b9060005260206000200154905080876000018481548110610c5a57610c5a610e95565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610c8d57610c8d610f2b565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061025c565b600091505061025c565b600060208284031215610ce457600080fd5b81356001600160e01b0319811681146104ec57600080fd5b600060208284031215610d0e57600080fd5b5035919050565b6001600160a01b038116811461084557600080fd5b60008060408385031215610d3d57600080fd5b823591506020830135610d4f81610d15565b809150509250929050565b600060208284031215610d6c57600080fd5b81356104ec81610d15565b60008060408385031215610d8a57600080fd5b50508035926020909101359150565b6001600160a01b0391909116815260200190565b600060208284031215610dbf57600080fd5b815180151581146104ec57600080fd5b60005b83811015610dea578181015183820152602001610dd2565b50506000910152565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351610e25816017850160208801610dcf565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351610e56816028840160208801610dcf565b01602801949350505050565b6020815260008251806020840152610e81816040850160208701610dcf565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761025c5761025c610eab565b8082018082111561025c5761025c610eab565b634e487b7160e01b600052604160045260246000fd5b600081610f1057610f10610eab565b506000190190565b8181038181111561025c5761025c610eab565b634e487b7160e01b600052603160045260246000fdfe5bea60102f2a7acc9e82b1af0e3bd4069661102bb5dd143a6051cd1980dded1ca2646970667358221220253540157307d98f95e4ac1c9a342dd924eba207637c01453f0158965276cde464736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100db5760003560e01c806301ffc9a7146100e0578063248a9ca3146101085780632f2ff15d1461012957806336568abe1461013e5780636833f60d146101515780637a9ad019146101595780637d4f7fc91461016e5780639010d07c1461018157806391d14854146101a1578063a217fddf146101b4578063b9f3163b146101bc578063ca15c873146101c4578063caa6fea4146101d7578063d4b83992146101eb578063d547741f146101fe578063dcf7bb5c14610211578063f82ec70b14610224575b600080fd5b6100f36100ee366004610cd2565b610237565b60405190151581526020015b60405180910390f35b61011b610116366004610cfc565b610262565b6040519081526020016100ff565b61013c610137366004610d2a565b610277565b005b61013c61014c366004610d2a565b610298565b61013c61031b565b61011b600080516020610f4283398151915281565b61013c61017c366004610d5a565b6104b1565b61019461018f366004610d77565b6104d4565b6040516100ff9190610d99565b6100f36101af366004610d2a565b6104f3565b61011b600081565b61013c61051c565b61011b6101d2366004610cfc565b610703565b6002546100f390600160a01b900460ff1681565b600254610194906001600160a01b031681565b61013c61020c366004610d2a565b61071a565b61013c61021f366004610d5a565b610736565b61013c610232366004610d5a565b61074a565b60006001600160e01b03198216635a05180f60e01b148061025c575061025c82610806565b92915050565b60009081526020819052604090206001015490565b61028082610262565b6102898161083b565b6102938383610848565b505050565b6001600160a01b038116331461030d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610317828261086a565b5050565b600080516020610f428339815191526103338161083b565b600260009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610388573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ac9190610dad565b156104075760405162461bcd60e51b815260206004820152602560248201527f5061757365456e666f726365723a20746172676574206973206e6f74206f6e20604482015264706175736560d81b6064820152608401610304565b6002805460ff60a01b198116600160a01b1790915560408051638456cb5960e01b815290516001600160a01b0390921691638456cb599160048082019260009290919082900301818387803b15801561045f57600080fd5b505af1158015610473573d6000803e3d6000fd5b505050507fb8fad2fa0ed7a383e747c309ef2c4391d7b65592a48893e57ccc1fab70791456336040516104a69190610d99565b60405180910390a150565b60006104bc8161083b565b610317600080516020610f4283398151915283610848565b60008281526001602052604081206104ec908361088c565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020610f428339815191526105348161083b565b600254600160a01b900460ff1661059b5760405162461bcd60e51b815260206004820152602560248201527f5061757365456e666f726365723a206e6f74206f6e20656d657267656e637920604482015264706175736560d81b6064820152608401610304565b600260009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156105f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106149190610dad565b61066a5760405162461bcd60e51b815260206004820152602160248201527f5061757365456e666f726365723a20746172676574206973206f6e20706175736044820152606560f81b6064820152608401610304565b6002805460ff60a01b19811690915560408051631fa5d41d60e11b815290516001600160a01b0390921691633f4ba83a9160048082019260009290919082900301818387803b1580156106bc57600080fd5b505af11580156106d0573d6000803e3d6000fd5b505050507ff5cbf596165cc457b2cd92e8d8450827ee314968160a5696402d75766fc52caf336040516104a69190610d99565b600081815260016020526040812061025c90610898565b61072382610262565b61072c8161083b565b610293838361086a565b60006107418161083b565b610317826108a2565b60006107558161083b565b610317600080516020610f428339815191528361086a565b61077782826104f3565b610317576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556107ad3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006104ec836001600160a01b0384166108ed565b60006001600160e01b03198216637965db0b60e01b148061025c57506301ffc9a760e01b6001600160e01b031983161461025c565b610845813361093c565b50565b610852828261076d565b600082815260016020526040902061029390826107f1565b61087482826109a0565b60008281526001602052604090206102939082610a05565b60006104ec8383610a1a565b600061025c825490565b600280546001600160a01b0319166001600160a01b0383161790556040517f7f8cffd58ac96898bdd25ab64868bd933141d15ad1cd4a0df228fd3fcba2a26d906104a6908390610d99565b60008181526001830160205260408120546109345750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561025c565b50600061025c565b61094682826104f3565b6103175761095e816001600160a01b03166014610a44565b610969836020610a44565b60405160200161097a929190610df3565b60408051601f198184030181529082905262461bcd60e51b825261030491600401610e62565b6109aa82826104f3565b15610317576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006104ec836001600160a01b038416610bdf565b6000826000018281548110610a3157610a31610e95565b9060005260206000200154905092915050565b60606000610a53836002610ec1565b610a5e906002610ed8565b6001600160401b03811115610a7557610a75610eeb565b6040519080825280601f01601f191660200182016040528015610a9f576020820181803683370190505b509050600360fc1b81600081518110610aba57610aba610e95565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610ae957610ae9610e95565b60200101906001600160f81b031916908160001a9053506000610b0d846002610ec1565b610b18906001610ed8565b90505b6001811115610b90576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610b4c57610b4c610e95565b1a60f81b828281518110610b6257610b62610e95565b60200101906001600160f81b031916908160001a90535060049490941c93610b8981610f01565b9050610b1b565b5083156104ec5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610304565b60008181526001830160205260408120548015610cc8576000610c03600183610f18565b8554909150600090610c1790600190610f18565b9050818114610c7c576000866000018281548110610c3757610c37610e95565b9060005260206000200154905080876000018481548110610c5a57610c5a610e95565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610c8d57610c8d610f2b565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061025c565b600091505061025c565b600060208284031215610ce457600080fd5b81356001600160e01b0319811681146104ec57600080fd5b600060208284031215610d0e57600080fd5b5035919050565b6001600160a01b038116811461084557600080fd5b60008060408385031215610d3d57600080fd5b823591506020830135610d4f81610d15565b809150509250929050565b600060208284031215610d6c57600080fd5b81356104ec81610d15565b60008060408385031215610d8a57600080fd5b50508035926020909101359150565b6001600160a01b0391909116815260200190565b600060208284031215610dbf57600080fd5b815180151581146104ec57600080fd5b60005b83811015610dea578181015183820152602001610dd2565b50506000910152565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351610e25816017850160208801610dcf565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351610e56816028840160208801610dcf565b01602801949350505050565b6020815260008251806020840152610e81816040850160208701610dcf565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761025c5761025c610eab565b8082018082111561025c5761025c610eab565b634e487b7160e01b600052604160045260246000fd5b600081610f1057610f10610eab565b506000190190565b8181038181111561025c5761025c610eab565b634e487b7160e01b600052603160045260246000fdfe5bea60102f2a7acc9e82b1af0e3bd4069661102bb5dd143a6051cd1980dded1ca2646970667358221220253540157307d98f95e4ac1c9a342dd924eba207637c01453f0158965276cde464736f6c63430008110033", + "devdoc": { + "events": { + "EmergencyPaused(address)": { + "details": "Emitted when the emergency ppause is triggered by `account`." + }, + "EmergencyUnpaused(address)": { + "details": "Emitted when the emergency unpause is triggered by `account`." + }, + "TargetChanged(address)": { + "details": "Emitted when the target is changed." + } + }, + "kind": "dev", + "methods": { + "changeTarget(address)": { + "details": "Setter for `target`. Requirements: - Only admin can call this method." + }, + "getRoleAdmin(bytes32)": { + "details": "Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}." + }, + "getRoleMember(bytes32,uint256)": { + "details": "Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information." + }, + "getRoleMemberCount(bytes32)": { + "details": "Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role." + }, + "grantRole(bytes32,address)": { + "details": "Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event." + }, + "grantSentry(address)": { + "details": "Grants the SENTRY_ROLE to the specified address." + }, + "hasRole(bytes32,address)": { + "details": "Returns `true` if `account` has been granted `role`." + }, + "renounceRole(bytes32,address)": { + "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event." + }, + "revokeRole(bytes32,address)": { + "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event." + }, + "revokeSentry(address)": { + "details": "Revokes the SENTRY_ROLE from the specified address." + }, + "supportsInterface(bytes4)": { + "details": "See {IERC165-supportsInterface}." + }, + "triggerPause()": { + "details": "Triggers a pause on the target contract. Requirements: - Only be called by accounts with the SENTRY_ROLE, - The target contract is not already paused." + }, + "triggerUnpause()": { + "details": "Triggers an unpause on the target contract. Requirements: - Only be called by accounts with the SENTRY_ROLE, - The target contract is already paused. - The target contract is paused in emergency mode." + } + }, + "stateVariables": { + "emergency": { + "details": "Indicating whether or not the target contract is paused in emergency mode." + }, + "target": { + "details": "The contract that can be paused or unpaused by the SENTRY_ROLE." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 24, + "contract": "contracts/ronin/gateway/PauseEnforcer.sol:PauseEnforcer", + "label": "_roles", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_bytes32,t_struct(RoleData)19_storage)" + }, + { + "astId": 338, + "contract": "contracts/ronin/gateway/PauseEnforcer.sol:PauseEnforcer", + "label": "_roleMembers", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_struct(AddressSet)4026_storage)" + }, + { + "astId": 23797, + "contract": "contracts/ronin/gateway/PauseEnforcer.sol:PauseEnforcer", + "label": "target", + "offset": 0, + "slot": "2", + "type": "t_contract(IPauseTarget)9671" + }, + { + "astId": 23800, + "contract": "contracts/ronin/gateway/PauseEnforcer.sol:PauseEnforcer", + "label": "emergency", + "offset": 20, + "slot": "2", + "type": "t_bool" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_bytes32)dyn_storage": { + "base": "t_bytes32", + "encoding": "dynamic_array", + "label": "bytes32[]", + "numberOfBytes": "32" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_bytes32": { + "encoding": "inplace", + "label": "bytes32", + "numberOfBytes": "32" + }, + "t_contract(IPauseTarget)9671": { + "encoding": "inplace", + "label": "contract IPauseTarget", + "numberOfBytes": "20" + }, + "t_mapping(t_address,t_bool)": { + "encoding": "mapping", + "key": "t_address", + "label": "mapping(address => bool)", + "numberOfBytes": "32", + "value": "t_bool" + }, + "t_mapping(t_bytes32,t_struct(AddressSet)4026_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct EnumerableSet.AddressSet)", + "numberOfBytes": "32", + "value": "t_struct(AddressSet)4026_storage" + }, + "t_mapping(t_bytes32,t_struct(RoleData)19_storage)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => struct AccessControl.RoleData)", + "numberOfBytes": "32", + "value": "t_struct(RoleData)19_storage" + }, + "t_mapping(t_bytes32,t_uint256)": { + "encoding": "mapping", + "key": "t_bytes32", + "label": "mapping(bytes32 => uint256)", + "numberOfBytes": "32", + "value": "t_uint256" + }, + "t_struct(AddressSet)4026_storage": { + "encoding": "inplace", + "label": "struct EnumerableSet.AddressSet", + "members": [ + { + "astId": 4025, + "contract": "contracts/ronin/gateway/PauseEnforcer.sol:PauseEnforcer", + "label": "_inner", + "offset": 0, + "slot": "0", + "type": "t_struct(Set)3725_storage" + } + ], + "numberOfBytes": "64" + }, + "t_struct(RoleData)19_storage": { + "encoding": "inplace", + "label": "struct AccessControl.RoleData", + "members": [ + { + "astId": 16, + "contract": "contracts/ronin/gateway/PauseEnforcer.sol:PauseEnforcer", + "label": "members", + "offset": 0, + "slot": "0", + "type": "t_mapping(t_address,t_bool)" + }, + { + "astId": 18, + "contract": "contracts/ronin/gateway/PauseEnforcer.sol:PauseEnforcer", + "label": "adminRole", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + } + ], + "numberOfBytes": "64" + }, + "t_struct(Set)3725_storage": { + "encoding": "inplace", + "label": "struct EnumerableSet.Set", + "members": [ + { + "astId": 3720, + "contract": "contracts/ronin/gateway/PauseEnforcer.sol:PauseEnforcer", + "label": "_values", + "offset": 0, + "slot": "0", + "type": "t_array(t_bytes32)dyn_storage" + }, + { + "astId": 3724, + "contract": "contracts/ronin/gateway/PauseEnforcer.sol:PauseEnforcer", + "label": "_indexes", + "offset": 0, + "slot": "1", + "type": "t_mapping(t_bytes32,t_uint256)" + } + ], + "numberOfBytes": "64" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + } + } + } +} \ No newline at end of file diff --git a/deployments/ronin-testnet/RoninGatewayV2Logic.json b/deployments/ronin-testnet/RoninGatewayV2Logic.json index 3c0220168..bfc96de0e 100644 --- a/deployments/ronin-testnet/RoninGatewayV2Logic.json +++ b/deployments/ronin-testnet/RoninGatewayV2Logic.json @@ -1,11 +1,16 @@ { - "address": "0x7937cd66D0B7b6fa2D042fc0279EC78ef3d7cC9b", + "address": "0x7Af8885fbB78df207ADb8B3a01316642779442Fe", "abi": [ { "inputs": [], "name": "ErrCallerMustBeBridgeTrackingContract", "type": "error" }, + { + "inputs": [], + "name": "ErrCallerMustBeRoninTrustedOrgContract", + "type": "error" + }, { "inputs": [], "name": "ErrCallerMustBeValidatorContract", @@ -29,6 +34,37 @@ "name": "BridgeTrackingContractUpdated", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "bridgeOperator", + "type": "address" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "chainId", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "receiptHash", + "type": "bytes32" + } + ], + "name": "DepositVoted", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -343,6 +379,19 @@ "name": "RoleRevoked", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "RoninTrustedOrganizationContractUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -411,6 +460,43 @@ "name": "TokenMapped", "type": "event" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "nonce", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "numerator", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "denominator", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousNumerator", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousDenominator", + "type": "uint256" + } + ], + "name": "TrustedThresholdUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -922,6 +1008,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "emergencyPauser", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -1038,6 +1137,24 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "getTrustedThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "trustedNum_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "trustedDenom_", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -1121,6 +1238,16 @@ "name": "_denominator", "type": "uint256" }, + { + "internalType": "uint256", + "name": "_trustedNumerator", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_trustedDenominator", + "type": "uint256" + }, { "internalType": "address[]", "name": "_withdrawalMigrators", @@ -1330,6 +1457,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "minimumTrustedVoteWeight", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "minimumVoteWeight", @@ -1477,6 +1617,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [], + "name": "roninTrustedOrganizationContract", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -1490,6 +1643,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "name": "setEmergencyPauser", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1508,6 +1674,19 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_addr", + "type": "address" + } + ], + "name": "setRoninTrustedOrganizationContract", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1537,6 +1716,35 @@ "stateMutability": "nonpayable", "type": "function" }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_trustedNumerator", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_trustedDenominator", + "type": "uint256" + } + ], + "name": "setTrustedThreshold", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -1860,28 +2068,28 @@ "type": "receive" } ], - "transactionHash": "0x224a6fdc59ee6fd4ab15616db752c14025fc20a5099baced052e6cb9dd4befc3", + "transactionHash": "0x08534943aa86e1acb3c20e39793997cddf6a206034308aa461928dd3ff2bb80d", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0x7937cd66D0B7b6fa2D042fc0279EC78ef3d7cC9b", + "contractAddress": "0x7Af8885fbB78df207ADb8B3a01316642779442Fe", "transactionIndex": 0, - "gasUsed": "4574236", + "gasUsed": "5168558", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x6624f5be99493e130a47809a4b1bd2fbca6551f9e3d2f7c8415ec7ac5a143261", - "transactionHash": "0x224a6fdc59ee6fd4ab15616db752c14025fc20a5099baced052e6cb9dd4befc3", + "blockHash": "0x653ac6df7912a45853fe45d200e7fe6657dc601030752589a162d064216c8731", + "transactionHash": "0x08534943aa86e1acb3c20e39793997cddf6a206034308aa461928dd3ff2bb80d", "logs": [], - "blockNumber": 14747615, - "cumulativeGasUsed": "4574236", + "blockNumber": 16816857, + "cumulativeGasUsed": "5168558", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 3, - "solcInputHash": "3c352db0d062e062f7c0c18610e9070b", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ErrCallerMustBeBridgeTrackingContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"BridgeTrackingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"receiptHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"struct Transfer.Receipt\",\"name\":\"receipt\",\"type\":\"tuple\"}],\"name\":\"Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"receiptHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"struct Transfer.Receipt\",\"name\":\"receipt\",\"type\":\"tuple\"}],\"name\":\"MainchainWithdrew\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"threshold\",\"type\":\"uint256[]\"}],\"name\":\"MinimumThresholdsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"numerator\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"denominator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousNumerator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousDenominator\",\"type\":\"uint256\"}],\"name\":\"ThresholdUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"roninTokens\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"mainchainTokens\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"chainIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"enum Token.Standard[]\",\"name\":\"standards\",\"type\":\"uint8[]\"}],\"name\":\"TokenMapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"receiptHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"struct Transfer.Receipt\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"WithdrawalRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"receiptHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"struct Transfer.Receipt\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"WithdrawalSignaturesRequested\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WITHDRAWAL_MIGRATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bridgeTrackingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"internalType\":\"struct Transfer.Request[]\",\"name\":\"_requests\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"}],\"name\":\"bulkRequestWithdrawalFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_withdrawals\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_signatures\",\"type\":\"bytes[]\"}],\"name\":\"bulkSubmitWithdrawalSignatures\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_voteWeight\",\"type\":\"uint256\"}],\"name\":\"checkThreshold\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"internalType\":\"struct Transfer.Receipt\",\"name\":\"_receipt\",\"type\":\"tuple\"}],\"name\":\"depositFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"depositVote\",\"outputs\":[{\"internalType\":\"enum VoteStatusConsumer.VoteStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"finalHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"expiredAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_depositId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"depositVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_roninToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"}],\"name\":\"getMainchainToken\",\"outputs\":[{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"}],\"internalType\":\"struct MappedTokenConsumer.MappedToken\",\"name\":\"_token\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"num_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"denom_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawalId\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_validators\",\"type\":\"address[]\"}],\"name\":\"getWithdrawalSignatures\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_signatures\",\"type\":\"bytes[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_roleSetter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_numerator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_denominator\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_withdrawalMigrators\",\"type\":\"address[]\"},{\"internalType\":\"address[][2]\",\"name\":\"_packedAddresses\",\"type\":\"address[][2]\"},{\"internalType\":\"uint256[][2]\",\"name\":\"_packedNumbers\",\"type\":\"uint256[][2]\"},{\"internalType\":\"enum Token.Standard[]\",\"name\":\"_standards\",\"type\":\"uint8[]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawalId\",\"type\":\"uint256\"}],\"name\":\"mainchainWithdrew\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"mainchainWithdrewVote\",\"outputs\":[{\"internalType\":\"enum VoteStatusConsumer.VoteStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"finalHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"expiredAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawalId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"mainchainWithdrewVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_roninTokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_mainchainTokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_chainIds\",\"type\":\"uint256[]\"},{\"internalType\":\"enum Token.Standard[]\",\"name\":\"_standards\",\"type\":\"uint8[]\"}],\"name\":\"mapTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"markWithdrawalMigrated\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"internalType\":\"struct Transfer.Request[]\",\"name\":\"_requests\",\"type\":\"tuple[]\"},{\"internalType\":\"address[]\",\"name\":\"_requesters\",\"type\":\"address[]\"}],\"name\":\"migrateWithdrawals\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"minimumThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minimumVoteWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"internalType\":\"struct Transfer.Request\",\"name\":\"_request\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawalFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawalId\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawalSignatures\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setBridgeTrackingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_thresholds\",\"type\":\"uint256[]\"}],\"name\":\"setMinimumThresholds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numerator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_denominator\",\"type\":\"uint256\"}],\"name\":\"setThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_withdrawalIds\",\"type\":\"uint256[]\"}],\"name\":\"tryBulkAcknowledgeMainchainWithdrew\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_executedReceipts\",\"type\":\"bool[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"internalType\":\"struct Transfer.Receipt[]\",\"name\":\"_receipts\",\"type\":\"tuple[]\"}],\"name\":\"tryBulkDepositFor\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_executedReceipts\",\"type\":\"bool[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"withdrawal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawalCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawalMigrated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"withdrawalStatVote\",\"outputs\":[{\"internalType\":\"enum VoteStatusConsumer.VoteStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"finalHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"expiredAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrCallerMustBeBridgeTrackingContract()\":[{\"details\":\"Error of method caller must be bridge tracking contract.\"}],\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"bridgeTrackingContract()\":{\"details\":\"Returns the bridge tracking contract.\"},\"bulkRequestWithdrawalFor((address,address,(uint8,uint256,uint256))[],uint256)\":{\"details\":\"Bulk requests withdrawals. Emits the `WithdrawalRequested` events.\"},\"bulkSubmitWithdrawalSignatures(uint256[],bytes[])\":{\"details\":\"Submits withdrawal signatures. Requirements: - The method caller is a validator.\"},\"checkThreshold(uint256)\":{\"details\":\"Checks whether the `_voteWeight` passes the threshold.\"},\"depositFor((uint256,uint8,(address,address,uint256),(address,address,uint256),(uint8,uint256,uint256)))\":{\"details\":\"Deposits based on the receipt. Requirements: - The method caller is a validator. Emits the `Deposited` once the assets are released.\"},\"depositVoted(uint256,uint256,address)\":{\"details\":\"Returns whether the deposit is casted by the voter.\"},\"getMainchainToken(address,uint256)\":{\"details\":\"Returns mainchain token address. Reverts for unsupported token.\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"getThreshold()\":{\"details\":\"Returns the threshold.\"},\"getWithdrawalSignatures(uint256,address[])\":{\"details\":\"Returns withdrawal signatures.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"initialize(address,uint256,uint256,address[],address[][2],uint256[][2],uint8[])\":{\"details\":\"Initializes contract storage.\"},\"mainchainWithdrew(uint256)\":{\"details\":\"Returns whether the withdrawal is done on mainchain.\"},\"mainchainWithdrewVoted(uint256,address)\":{\"details\":\"Returns whether the mainchain withdrew is casted by the voter.\"},\"mapTokens(address[],address[],uint256[],uint8[])\":{\"details\":\"Maps Ronin tokens to mainchain networks. Requirement: - The method caller is admin. - The arrays have the same length and its length larger than 0. Emits the `TokenMapped` event.\"},\"markWithdrawalMigrated()\":{\"details\":\"Mark the migration as done.\"},\"migrateWithdrawals((address,address,(uint8,uint256,uint256))[],address[])\":{\"details\":\"Migrates withdrawals. Requirements: - The method caller is the migrator. - The arrays have the same length and its length larger than 0.\"},\"minimumVoteWeight()\":{\"details\":\"Returns the minimum vote weight to pass the threshold.\"},\"pause()\":{\"details\":\"Triggers paused state.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"requestWithdrawalFor((address,address,(uint8,uint256,uint256)),uint256)\":{\"details\":\"Locks the assets and request withdrawal. Emits the `WithdrawalRequested` event.\"},\"requestWithdrawalSignatures(uint256)\":{\"details\":\"Requests withdrawal signatures for a specific withdrawal. Emits the `WithdrawalSignaturesRequested` event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"setBridgeTrackingContract(address)\":{\"details\":\"Sets the bridge tracking contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `BridgeTrackingContractUpdated`.\"},\"setMinimumThresholds(address[],uint256[])\":{\"details\":\"Sets the minimum thresholds to withdraw. Requirements: - The method caller is admin. - The arrays have the same length and its length larger than 0. Emits the `MinimumThresholdsUpdated` event.\"},\"setThreshold(uint256,uint256)\":{\"details\":\"Sets the threshold. Requirements: - The method caller is admin. Emits the `ThresholdUpdated` event.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"tryBulkAcknowledgeMainchainWithdrew(uint256[])\":{\"details\":\"Marks the withdrawals are done on mainchain and returns the boolean array indicating whether the withdrawal vote is already done before. Requirements: - The method caller is a validator. Emits the `MainchainWithdrew` once the valid call passes the quorum threshold.\"},\"tryBulkDepositFor((uint256,uint8,(address,address,uint256),(address,address,uint256),(uint8,uint256,uint256))[])\":{\"details\":\"Tries bulk deposits based on the receipts and returns the boolean array indicating whether the deposit vote is already done before. Reverts if the deposit is invalid or is voted by the validator again. Requirements: - The method caller is a validator. Emits the `Deposited` once the assets are released.\"},\"unpause()\":{\"details\":\"Triggers unpaused state.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"}},\"stateVariables\":{\"WITHDRAWAL_MIGRATOR\":{\"details\":\"Withdrawal unlocker role hash\"},\"_bridgeTrackingContract\":{\"details\":\"The bridge tracking contract\"},\"_mainchainToken\":{\"details\":\"Mapping from token address => chain id => mainchain token address\"},\"_validatorContract\":{\"details\":\"The ronin validator contract\"},\"_withdrawalSig\":{\"details\":\"Mapping from withdrawal id => validator address => signatures\"},\"depositVote\":{\"details\":\"Mapping from chain id => deposit id => deposit vote\"},\"mainchainWithdrewVote\":{\"details\":\"Mapping from withdrawal id => mainchain withdrew vote\"},\"withdrawal\":{\"details\":\"Mapping from withdrawal id => withdrawal receipt\"},\"withdrawalCount\":{\"details\":\"Total withdrawal\"},\"withdrawalMigrated\":{\"details\":\"Flag indicating whether the withdrawal migrate progress is done\"},\"withdrawalStatVote\":{\"details\":\"Mapping from withdrawal id => vote for recording withdrawal stats\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"depositFor((uint256,uint8,(address,address,uint256),(address,address,uint256),(uint8,uint256,uint256)))\":{\"notice\":\"The assets will be transferred whenever the valid call passes the quorum threshold.\"},\"tryBulkAcknowledgeMainchainWithdrew(uint256[])\":{\"notice\":\"Not reverting to avoid unnecessary failed transactions because the validators can send transactions at the same time.\"},\"tryBulkDepositFor((uint256,uint8,(address,address,uint256),(address,address,uint256),(uint8,uint256,uint256))[])\":{\"notice\":\"The assets will be transferred whenever the valid call for the receipt passes the quorum threshold. Not reverting to avoid unnecessary failed transactions because the validators can send transactions at the same time.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/RoninGatewayV2.sol\":\"RoninGatewayV2\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(uint160(account), 20),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5b35d8e68aeaccc685239bd9dd79b9ba01a0357930f8a3307ab85511733d9724\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/AccessControlEnumerable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlEnumerable.sol\\\";\\nimport \\\"./AccessControl.sol\\\";\\nimport \\\"../utils/structs/EnumerableSet.sol\\\";\\n\\n/**\\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\\n */\\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\\n return _roleMembers[role].at(index);\\n }\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\\n return _roleMembers[role].length();\\n }\\n\\n /**\\n * @dev Overload {_grantRole} to track enumerable memberships\\n */\\n function _grantRole(bytes32 role, address account) internal virtual override {\\n super._grantRole(role, account);\\n _roleMembers[role].add(account);\\n }\\n\\n /**\\n * @dev Overload {_revokeRole} to track enumerable memberships\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual override {\\n super._revokeRole(role, account);\\n _roleMembers[role].remove(account);\\n }\\n}\\n\",\"keccak256\":\"0x13f5e15f2a0650c0b6aaee2ef19e89eaf4870d6e79662d572a393334c1397247\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControlEnumerable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\n\\n/**\\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\\n */\\ninterface IAccessControlEnumerable is IAccessControl {\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xba4459ab871dfa300f5212c6c30178b63898c03533a1ede28436f11546626676\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n constructor() {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n _requireNotPaused();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n _requirePaused();\\n _;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Throws if the contract is paused.\\n */\\n function _requireNotPaused() internal view virtual {\\n require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0x0849d93b16c9940beb286a7864ed02724b248b93e0d80ef6355af5ef15c64773\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xdb7f5c28fc61cda0bd8ab60ce288e206b791643bcd3ba464a70cbec18895a2f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n return _values(set._inner);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x5050943b32b6a8f282573d166b2e9d87ab7eb4dbba4ab6acf36ecb54fe6995e4\",\"license\":\"MIT\"},\"contracts/extensions/GatewayV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport \\\"../interfaces/IQuorum.sol\\\";\\nimport \\\"./collections/HasProxyAdmin.sol\\\";\\n\\nabstract contract GatewayV2 is HasProxyAdmin, Pausable, IQuorum {\\n uint256 internal _num;\\n uint256 internal _denom;\\n\\n address private ______deprecated;\\n uint256 public nonce;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\\n return (_num, _denom);\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\\n return _voteWeight * _denom >= _num * _getTotalWeight();\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n virtual\\n onlyAdmin\\n returns (uint256, uint256)\\n {\\n return _setThreshold(_numerator, _denominator);\\n }\\n\\n /**\\n * @dev Triggers paused state.\\n */\\n function pause() external onlyAdmin {\\n _pause();\\n }\\n\\n /**\\n * @dev Triggers unpaused state.\\n */\\n function unpause() external onlyAdmin {\\n _unpause();\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function minimumVoteWeight() public view virtual returns (uint256) {\\n return _minimumVoteWeight(_getTotalWeight());\\n }\\n\\n /**\\n * @dev Sets threshold and returns the old one.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function _setThreshold(uint256 _numerator, uint256 _denominator)\\n internal\\n virtual\\n returns (uint256 _previousNum, uint256 _previousDenom)\\n {\\n require(_numerator <= _denominator, \\\"GatewayV2: invalid threshold\\\");\\n _previousNum = _num;\\n _previousDenom = _denom;\\n _num = _numerator;\\n _denom = _denominator;\\n emit ThresholdUpdated(nonce++, _numerator, _denominator, _previousNum, _previousDenom);\\n }\\n\\n /**\\n * @dev Returns minimum vote weight.\\n */\\n function _minimumVoteWeight(uint256 _totalWeight) internal view virtual returns (uint256) {\\n return (_num * _totalWeight + _denom - 1) / _denom;\\n }\\n\\n /**\\n * @dev Returns the total weight.\\n */\\n function _getTotalWeight() internal view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x037268c79f8e9bcd1f0b0b2b1a112c95f84247d92aeab302f10ea22e5ff5fb4f\",\"license\":\"MIT\"},\"contracts/extensions/MinimumWithdrawal.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./collections/HasProxyAdmin.sol\\\";\\nimport \\\"../libraries/Transfer.sol\\\";\\n\\nabstract contract MinimumWithdrawal is HasProxyAdmin {\\n /// @dev Emitted when the minimum thresholds are updated\\n event MinimumThresholdsUpdated(address[] tokens, uint256[] threshold);\\n\\n /// @dev Mapping from token address => minimum thresholds\\n mapping(address => uint256) public minimumThreshold;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @dev Sets the minimum thresholds to withdraw.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The arrays have the same length and its length larger than 0.\\n *\\n * Emits the `MinimumThresholdsUpdated` event.\\n *\\n */\\n function setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) external virtual onlyAdmin {\\n require(_tokens.length > 0, \\\"MinimumWithdrawal: invalid array length\\\");\\n _setMinimumThresholds(_tokens, _thresholds);\\n }\\n\\n /**\\n * @dev Sets minimum thresholds.\\n *\\n * Requirements:\\n * - The array lengths are equal.\\n *\\n * Emits the `MinimumThresholdsUpdated` event.\\n *\\n */\\n function _setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\\n require(_tokens.length == _thresholds.length, \\\"MinimumWithdrawal: invalid array length\\\");\\n for (uint256 _i; _i < _tokens.length; _i++) {\\n minimumThreshold[_tokens[_i]] = _thresholds[_i];\\n }\\n emit MinimumThresholdsUpdated(_tokens, _thresholds);\\n }\\n\\n /**\\n * @dev Checks whether the request is larger than or equal to the minimum threshold.\\n */\\n function _checkWithdrawal(Transfer.Request calldata _request) internal view {\\n require(\\n _request.info.erc != Token.Standard.ERC20 || _request.info.quantity >= minimumThreshold[_request.tokenAddr],\\n \\\"MinimumWithdrawal: query for too small quantity\\\"\\n );\\n }\\n}\\n\",\"keccak256\":\"0x42d7ddf9210512fa99143e976f8a7c9a33bb85e428c553040b1eca5b360dacb6\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/isolated-governance/IsolatedGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"../../interfaces/consumers/VoteStatusConsumer.sol\\\";\\n\\nabstract contract IsolatedGovernance is VoteStatusConsumer {\\n struct IsolatedVote {\\n VoteStatus status;\\n bytes32 finalHash;\\n /// @dev Mapping from voter => receipt hash\\n mapping(address => bytes32) voteHashOf;\\n /// @dev Mapping from receipt hash => vote weight\\n mapping(bytes32 => uint256) weight;\\n /// @dev The timestamp that voting is expired (no expiration=0)\\n uint256 expiredAt;\\n /// @dev The timestamp that voting is created\\n uint256 createdAt;\\n }\\n\\n /**\\n * @dev Casts vote for the receipt with the receipt hash `_hash`.\\n *\\n * Requirements:\\n * - The vote is not finalized.\\n * - The voter has not voted for the round.\\n *\\n */\\n function _castVote(\\n IsolatedVote storage _proposal,\\n address _voter,\\n uint256 _voterWeight,\\n uint256 _minimumVoteWeight,\\n bytes32 _hash\\n ) internal virtual returns (VoteStatus _status) {\\n if (_proposal.expiredAt > 0 && _proposal.expiredAt <= block.timestamp) {\\n _proposal.status = VoteStatus.Expired;\\n return _proposal.status;\\n }\\n\\n if (_voted(_proposal, _voter)) {\\n revert(\\n string(abi.encodePacked(\\\"IsolatedGovernance: \\\", Strings.toHexString(uint160(_voter), 20), \\\" already voted\\\"))\\n );\\n }\\n\\n // Record for voter\\n _proposal.voteHashOf[_voter] = _hash;\\n // Increase vote weight\\n uint256 _weight = _proposal.weight[_hash] += _voterWeight;\\n\\n if (_weight >= _minimumVoteWeight && _proposal.status == VoteStatus.Pending) {\\n _proposal.status = VoteStatus.Approved;\\n _proposal.finalHash = _hash;\\n }\\n\\n _status = _proposal.status;\\n }\\n\\n /**\\n * @dev Returns whether the voter casted for the proposal.\\n */\\n function _voted(IsolatedVote storage _proposal, address _voter) internal view virtual returns (bool) {\\n return _proposal.voteHashOf[_voter] != bytes32(0);\\n }\\n}\\n\",\"keccak256\":\"0xe2d3bd6a2dae71c371aca5e6db35dc20cb76621d62a747d445d0da616145866b\",\"license\":\"MIT\"},\"contracts/interfaces/IBridgeTracking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBridgeTracking {\\n enum VoteKind {\\n Deposit,\\n Withdrawal,\\n MainchainWithdrawal\\n }\\n\\n /**\\n * @dev Returns the total number of votes at the specific period `_period`.\\n */\\n function totalVotes(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots at the specific period `_period`.\\n */\\n function totalBallots(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\\n */\\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\\n */\\n function totalBallotsOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\\n\\n /**\\n * @dev Handles the request once it is approved.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\\n\\n /**\\n * @dev Records vote for a receipt and a operator.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function recordVote(\\n VoteKind _kind,\\n uint256 _requestId,\\n address _operator\\n ) external;\\n}\\n\",\"keccak256\":\"0xb2d5e9367c48a611f131c8b77f9034db8dd81df8c8bbb2c8e8d9a32286a5a8ae\",\"license\":\"MIT\"},\"contracts/interfaces/IERC20Mintable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.2;\\n\\ninterface IERC20Mintable {\\n function mint(address _to, uint256 _value) external returns (bool _success);\\n}\\n\",\"keccak256\":\"0x6632cb3345e581a0b7868d6ce9a883f55d107576f9557f500a042c8285e51005\",\"license\":\"MIT\"},\"contracts/interfaces/IERC721Mintable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IERC721Mintable {\\n function mint(address _to, uint256 _tokenId) external returns (bool);\\n}\\n\",\"keccak256\":\"0x4f001516a2596c79c205a9e28de092aa866eb440040e78b8be9027451028f169\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x10f3b360430e6d03773c9959f54cbed6fb0346069645c05b05ef50cfb19f3753\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninGatewayV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../libraries/Transfer.sol\\\";\\nimport \\\"./consumers/MappedTokenConsumer.sol\\\";\\n\\ninterface IRoninGatewayV2 is MappedTokenConsumer {\\n /// @dev Emitted when the assets are depositted\\n event Deposited(bytes32 receiptHash, Transfer.Receipt receipt);\\n /// @dev Emitted when the withdrawal is requested\\n event WithdrawalRequested(bytes32 receiptHash, Transfer.Receipt);\\n /// @dev Emitted when the assets are withdrawn on mainchain\\n event MainchainWithdrew(bytes32 receiptHash, Transfer.Receipt receipt);\\n /// @dev Emitted when the withdrawal signatures is requested\\n event WithdrawalSignaturesRequested(bytes32 receiptHash, Transfer.Receipt);\\n /// @dev Emitted when the tokens are mapped\\n event TokenMapped(address[] roninTokens, address[] mainchainTokens, uint256[] chainIds, Token.Standard[] standards);\\n\\n /**\\n * @dev Returns withdrawal count.\\n */\\n function withdrawalCount() external view returns (uint256);\\n\\n /**\\n * @dev Returns withdrawal signatures.\\n */\\n function getWithdrawalSignatures(uint256 _withdrawalId, address[] calldata _validators)\\n external\\n view\\n returns (bytes[] memory);\\n\\n /**\\n * @dev Deposits based on the receipt.\\n *\\n * Requirements:\\n * - The method caller is a validator.\\n *\\n * Emits the `Deposited` once the assets are released.\\n *\\n * @notice The assets will be transferred whenever the valid call passes the quorum threshold.\\n *\\n */\\n function depositFor(Transfer.Receipt calldata _receipt) external;\\n\\n /**\\n * @dev Marks the withdrawals are done on mainchain and returns the boolean array indicating whether the withdrawal\\n * vote is already done before.\\n *\\n * Requirements:\\n * - The method caller is a validator.\\n *\\n * Emits the `MainchainWithdrew` once the valid call passes the quorum threshold.\\n *\\n * @notice Not reverting to avoid unnecessary failed transactions because the validators can send transactions at the\\n * same time.\\n *\\n */\\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds) external returns (bool[] memory);\\n\\n /**\\n * @dev Tries bulk deposits based on the receipts and returns the boolean array indicating whether the deposit vote\\n * is already done before. Reverts if the deposit is invalid or is voted by the validator again.\\n *\\n * Requirements:\\n * - The method caller is a validator.\\n *\\n * Emits the `Deposited` once the assets are released.\\n *\\n * @notice The assets will be transferred whenever the valid call for the receipt passes the quorum threshold. Not\\n * reverting to avoid unnecessary failed transactions because the validators can send transactions at the same time.\\n *\\n */\\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts) external returns (bool[] memory);\\n\\n /**\\n * @dev Locks the assets and request withdrawal.\\n *\\n * Emits the `WithdrawalRequested` event.\\n *\\n */\\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external;\\n\\n /**\\n * @dev Bulk requests withdrawals.\\n *\\n * Emits the `WithdrawalRequested` events.\\n *\\n */\\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external;\\n\\n /**\\n * @dev Requests withdrawal signatures for a specific withdrawal.\\n *\\n * Emits the `WithdrawalSignaturesRequested` event.\\n *\\n */\\n function requestWithdrawalSignatures(uint256 _withdrawalId) external;\\n\\n /**\\n * @dev Submits withdrawal signatures.\\n *\\n * Requirements:\\n * - The method caller is a validator.\\n *\\n */\\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures) external;\\n\\n /**\\n * @dev Maps Ronin tokens to mainchain networks.\\n *\\n * Requirement:\\n * - The method caller is admin.\\n * - The arrays have the same length and its length larger than 0.\\n *\\n * Emits the `TokenMapped` event.\\n *\\n */\\n function mapTokens(\\n address[] calldata _roninTokens,\\n address[] calldata _mainchainTokens,\\n uint256[] calldata chainIds,\\n Token.Standard[] calldata _standards\\n ) external;\\n\\n /**\\n * @dev Returns whether the deposit is casted by the voter.\\n */\\n function depositVoted(\\n uint256 _chainId,\\n uint256 _depositId,\\n address _voter\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the mainchain withdrew is casted by the voter.\\n */\\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the withdrawal is done on mainchain.\\n */\\n function mainchainWithdrew(uint256 _withdrawalId) external view returns (bool);\\n\\n /**\\n * @dev Returns mainchain token address.\\n * Reverts for unsupported token.\\n */\\n function getMainchainToken(address _roninToken, uint256 _chainId) external view returns (MappedToken memory _token);\\n}\\n\",\"keccak256\":\"0xedd34fe7d268532703f5c2bed6255fc25a1d9920ecfbf9a092e53e513f6bae27\",\"license\":\"MIT\"},\"contracts/interfaces/IWETH.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IWETH {\\n function deposit() external payable;\\n\\n function withdraw(uint256 _wad) external;\\n\\n function balanceOf(address) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x8acead2ae4364dee80c9bc76d52cc04d3763105e1743728e67d237f816155142\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasBridgeTrackingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasBridgeTrackingContract is IHasContract {\\n /// @dev Emitted when the bridge tracking contract is updated.\\n event BridgeTrackingContractUpdated(address);\\n\\n /// @dev Error of method caller must be bridge tracking contract.\\n error ErrCallerMustBeBridgeTrackingContract();\\n\\n /**\\n * @dev Returns the bridge tracking contract.\\n */\\n function bridgeTrackingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the bridge tracking contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `BridgeTrackingContractUpdated`.\\n *\\n */\\n function setBridgeTrackingContract(address) external;\\n}\\n\",\"keccak256\":\"0x2d1b7e356826bfe1c2a3348137d828f46ca931f7c2f48197379ad987e713714b\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/MappedTokenConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../libraries/Token.sol\\\";\\n\\ninterface MappedTokenConsumer {\\n struct MappedToken {\\n Token.Standard erc;\\n address tokenAddr;\\n }\\n}\\n\",\"keccak256\":\"0xfa220e968221af9b789e6c1dc4133631e90600c4a2bd63b7f01e96cb01f13e9b\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/VoteStatusConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface VoteStatusConsumer {\\n enum VoteStatus {\\n Pending,\\n Approved,\\n Executed,\\n Rejected,\\n Expired\\n }\\n}\\n\",\"keccak256\":\"0xa5045232c0c053fcf31fb3fe71942344444159c48d5f1b2063dbb06b6a1c9752\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0xe4060b7e3b04a0043bd334011fe4ba67c990b0484dad52d7f14b35040989b6ab\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n // Error thrown when receives RON from neither staking vesting contract nor staking contract\\\"\\n error ErrUnauthorizedReceiveRON();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0x4e81a61359a3f8bcc9d452615e3df7b0d0201823ce88f763530ddd4f00c2fc48\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address[] calldata _blockProducers) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address[] calldata _blockProducers, uint256 _period)\\n external\\n view\\n returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the current period.\\n */\\n\\n function checkBridgeRewardDeprecated(address _consensusAddr) external view returns (bool _result);\\n}\\n\",\"keccak256\":\"0x853e7d0ac33ad868721733fc2ab4b78f2e613973a579eb0ea485cbdaa750e057\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator or not.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0xbd10b0207a749e3a7a2aadcb6e93784cb17343a5266d056a3d0b79acb7c5c93d\",\"license\":\"MIT\"},\"contracts/libraries/Token.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"../interfaces/IWETH.sol\\\";\\n\\nlibrary Token {\\n enum Standard {\\n ERC20,\\n ERC721\\n }\\n struct Info {\\n Standard erc;\\n // For ERC20: the id must be 0 and the quantity is larger than 0.\\n // For ERC721: the quantity must be 0.\\n uint256 id;\\n uint256 quantity;\\n }\\n\\n // keccak256(\\\"TokenInfo(uint8 erc,uint256 id,uint256 quantity)\\\");\\n bytes32 public constant INFO_TYPE_HASH = 0x1e2b74b2a792d5c0f0b6e59b037fa9d43d84fbb759337f0112fcc15ca414fc8d;\\n\\n /**\\n * @dev Returns token info struct hash.\\n */\\n function hash(Info memory _info) internal pure returns (bytes32) {\\n return keccak256(abi.encode(INFO_TYPE_HASH, _info.erc, _info.id, _info.quantity));\\n }\\n\\n /**\\n * @dev Validates the token info.\\n */\\n function validate(Info memory _info) internal pure {\\n require(\\n (_info.erc == Standard.ERC20 && _info.quantity > 0 && _info.id == 0) ||\\n (_info.erc == Standard.ERC721 && _info.quantity == 0),\\n \\\"Token: invalid info\\\"\\n );\\n }\\n\\n /**\\n * @dev Transfer asset from.\\n *\\n * Requirements:\\n * - The `_from` address must approve for the contract using this library.\\n *\\n */\\n function transferFrom(\\n Info memory _info,\\n address _from,\\n address _to,\\n address _token\\n ) internal {\\n bool _success;\\n bytes memory _data;\\n if (_info.erc == Standard.ERC20) {\\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, _from, _to, _info.quantity));\\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\\n } else if (_info.erc == Standard.ERC721) {\\n // bytes4(keccak256(\\\"transferFrom(address,address,uint256)\\\"))\\n (_success, ) = _token.call(abi.encodeWithSelector(0x23b872dd, _from, _to, _info.id));\\n } else {\\n revert(\\\"Token: unsupported token standard\\\");\\n }\\n\\n if (!_success) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"Token: could not transfer \\\",\\n toString(_info),\\n \\\" from \\\",\\n Strings.toHexString(uint160(_from), 20),\\n \\\" to \\\",\\n Strings.toHexString(uint160(_to), 20),\\n \\\" token \\\",\\n Strings.toHexString(uint160(_token), 20)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Transfers ERC721 token and returns the result.\\n */\\n function tryTransferERC721(\\n address _token,\\n address _to,\\n uint256 _id\\n ) internal returns (bool _success) {\\n (_success, ) = _token.call(abi.encodeWithSelector(IERC721.transferFrom.selector, address(this), _to, _id));\\n }\\n\\n /**\\n * @dev Transfers ERC20 token and returns the result.\\n */\\n function tryTransferERC20(\\n address _token,\\n address _to,\\n uint256 _quantity\\n ) internal returns (bool _success) {\\n bytes memory _data;\\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transfer.selector, _to, _quantity));\\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\\n }\\n\\n /**\\n * @dev Transfer assets from current address to `_to` address.\\n */\\n function transfer(\\n Info memory _info,\\n address _to,\\n address _token\\n ) internal {\\n bool _success;\\n if (_info.erc == Standard.ERC20) {\\n _success = tryTransferERC20(_token, _to, _info.quantity);\\n } else if (_info.erc == Standard.ERC721) {\\n _success = tryTransferERC721(_token, _to, _info.id);\\n } else {\\n revert(\\\"Token: unsupported token standard\\\");\\n }\\n\\n if (!_success) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"Token: could not transfer \\\",\\n toString(_info),\\n \\\" to \\\",\\n Strings.toHexString(uint160(_to), 20),\\n \\\" token \\\",\\n Strings.toHexString(uint160(_token), 20)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Tries minting and transfering assets.\\n *\\n * @notice Prioritizes transfer native token if the token is wrapped.\\n *\\n */\\n function handleAssetTransfer(\\n Info memory _info,\\n address payable _to,\\n address _token,\\n IWETH _wrappedNativeToken\\n ) internal {\\n bool _success;\\n if (_token == address(_wrappedNativeToken)) {\\n // Try sending the native token before transferring the wrapped token\\n if (!_to.send(_info.quantity)) {\\n _wrappedNativeToken.deposit{ value: _info.quantity }();\\n transfer(_info, _to, _token);\\n }\\n } else if (_info.erc == Token.Standard.ERC20) {\\n uint256 _balance = IERC20(_token).balanceOf(address(this));\\n\\n if (_balance < _info.quantity) {\\n // bytes4(keccak256(\\\"mint(address,uint256)\\\"))\\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, address(this), _info.quantity - _balance));\\n require(_success, \\\"Token: ERC20 minting failed\\\");\\n }\\n\\n transfer(_info, _to, _token);\\n } else if (_info.erc == Token.Standard.ERC721) {\\n if (!tryTransferERC721(_token, _to, _info.id)) {\\n // bytes4(keccak256(\\\"mint(address,uint256)\\\"))\\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, _to, _info.id));\\n require(_success, \\\"Token: ERC721 minting failed\\\");\\n }\\n } else {\\n revert(\\\"Token: unsupported token standard\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns readable string.\\n */\\n function toString(Info memory _info) internal pure returns (string memory) {\\n return\\n string(\\n abi.encodePacked(\\n \\\"TokenInfo(\\\",\\n Strings.toHexString(uint160(_info.erc), 1),\\n \\\",\\\",\\n Strings.toHexString(_info.id),\\n \\\",\\\",\\n Strings.toHexString(_info.quantity),\\n \\\")\\\"\\n )\\n );\\n }\\n\\n struct Owner {\\n address addr;\\n address tokenAddr;\\n uint256 chainId;\\n }\\n\\n // keccak256(\\\"TokenOwner(address addr,address tokenAddr,uint256 chainId)\\\");\\n bytes32 public constant OWNER_TYPE_HASH = 0x353bdd8d69b9e3185b3972e08b03845c0c14a21a390215302776a7a34b0e8764;\\n\\n /**\\n * @dev Returns ownership struct hash.\\n */\\n function hash(Owner memory _owner) internal pure returns (bytes32) {\\n return keccak256(abi.encode(OWNER_TYPE_HASH, _owner.addr, _owner.tokenAddr, _owner.chainId));\\n }\\n}\\n\",\"keccak256\":\"0xea68c5ccbd75695a7fb43bdbbec5636f63d1d3aabf36801b36a5ef0c43118c76\",\"license\":\"MIT\"},\"contracts/libraries/Transfer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"./Token.sol\\\";\\n\\nlibrary Transfer {\\n using ECDSA for bytes32;\\n\\n enum Kind {\\n Deposit,\\n Withdrawal\\n }\\n\\n struct Request {\\n // For deposit request: Recipient address on Ronin network\\n // For withdrawal request: Recipient address on mainchain network\\n address recipientAddr;\\n // Token address to deposit/withdraw\\n // Value 0: native token\\n address tokenAddr;\\n Token.Info info;\\n }\\n\\n /**\\n * @dev Converts the transfer request into the deposit receipt.\\n */\\n function into_deposit_receipt(\\n Request memory _request,\\n address _requester,\\n uint256 _id,\\n address _roninTokenAddr,\\n uint256 _roninChainId\\n ) internal view returns (Receipt memory _receipt) {\\n _receipt.id = _id;\\n _receipt.kind = Kind.Deposit;\\n _receipt.mainchain.addr = _requester;\\n _receipt.mainchain.tokenAddr = _request.tokenAddr;\\n _receipt.mainchain.chainId = block.chainid;\\n _receipt.ronin.addr = _request.recipientAddr;\\n _receipt.ronin.tokenAddr = _roninTokenAddr;\\n _receipt.ronin.chainId = _roninChainId;\\n _receipt.info = _request.info;\\n }\\n\\n /**\\n * @dev Converts the transfer request into the withdrawal receipt.\\n */\\n function into_withdrawal_receipt(\\n Request memory _request,\\n address _requester,\\n uint256 _id,\\n address _mainchainTokenAddr,\\n uint256 _mainchainId\\n ) internal view returns (Receipt memory _receipt) {\\n _receipt.id = _id;\\n _receipt.kind = Kind.Withdrawal;\\n _receipt.ronin.addr = _requester;\\n _receipt.ronin.tokenAddr = _request.tokenAddr;\\n _receipt.ronin.chainId = block.chainid;\\n _receipt.mainchain.addr = _request.recipientAddr;\\n _receipt.mainchain.tokenAddr = _mainchainTokenAddr;\\n _receipt.mainchain.chainId = _mainchainId;\\n _receipt.info = _request.info;\\n }\\n\\n struct Receipt {\\n uint256 id;\\n Kind kind;\\n Token.Owner mainchain;\\n Token.Owner ronin;\\n Token.Info info;\\n }\\n\\n // keccak256(\\\"Receipt(uint256 id,uint8 kind,TokenOwner mainchain,TokenOwner ronin,TokenInfo info)TokenInfo(uint8 erc,uint256 id,uint256 quantity)TokenOwner(address addr,address tokenAddr,uint256 chainId)\\\");\\n bytes32 public constant TYPE_HASH = 0xb9d1fe7c9deeec5dc90a2f47ff1684239519f2545b2228d3d91fb27df3189eea;\\n\\n /**\\n * @dev Returns token info struct hash.\\n */\\n function hash(Receipt memory _receipt) internal pure returns (bytes32) {\\n return\\n keccak256(\\n abi.encode(\\n TYPE_HASH,\\n _receipt.id,\\n _receipt.kind,\\n Token.hash(_receipt.mainchain),\\n Token.hash(_receipt.ronin),\\n Token.hash(_receipt.info)\\n )\\n );\\n }\\n\\n /**\\n * @dev Returns the receipt digest.\\n */\\n function receiptDigest(bytes32 _domainSeparator, bytes32 _receiptHash) internal pure returns (bytes32) {\\n return _domainSeparator.toTypedDataHash(_receiptHash);\\n }\\n}\\n\",\"keccak256\":\"0x377ec9931ffb0bc1a9b958aceb28c6afb735c5c04f961ee424ac7da5f2c30402\",\"license\":\"MIT\"},\"contracts/ronin/RoninGatewayV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/access/AccessControlEnumerable.sol\\\";\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../extensions/GatewayV2.sol\\\";\\nimport \\\"../extensions/isolated-governance/IsolatedGovernance.sol\\\";\\nimport \\\"../extensions/MinimumWithdrawal.sol\\\";\\nimport \\\"../interfaces/IERC20Mintable.sol\\\";\\nimport \\\"../interfaces/IERC721Mintable.sol\\\";\\nimport \\\"../interfaces/IRoninGatewayV2.sol\\\";\\nimport \\\"../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../interfaces/IBridgeTracking.sol\\\";\\nimport \\\"../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../interfaces/collections/IHasBridgeTrackingContract.sol\\\";\\n\\ncontract RoninGatewayV2 is\\n GatewayV2,\\n IsolatedGovernance,\\n Initializable,\\n MinimumWithdrawal,\\n AccessControlEnumerable,\\n IRoninGatewayV2,\\n IHasValidatorContract,\\n IHasBridgeTrackingContract\\n{\\n using Token for Token.Info;\\n using Transfer for Transfer.Request;\\n using Transfer for Transfer.Receipt;\\n\\n /// @dev Withdrawal unlocker role hash\\n bytes32 public constant WITHDRAWAL_MIGRATOR = keccak256(\\\"WITHDRAWAL_MIGRATOR\\\");\\n\\n /// @dev Flag indicating whether the withdrawal migrate progress is done\\n bool public withdrawalMigrated;\\n /// @dev Total withdrawal\\n uint256 public withdrawalCount;\\n /// @dev Mapping from chain id => deposit id => deposit vote\\n mapping(uint256 => mapping(uint256 => IsolatedVote)) public depositVote;\\n /// @dev Mapping from withdrawal id => mainchain withdrew vote\\n mapping(uint256 => IsolatedVote) public mainchainWithdrewVote;\\n /// @dev Mapping from withdrawal id => withdrawal receipt\\n mapping(uint256 => Transfer.Receipt) public withdrawal;\\n /// @dev Mapping from withdrawal id => validator address => signatures\\n mapping(uint256 => mapping(address => bytes)) internal _withdrawalSig;\\n /// @dev Mapping from token address => chain id => mainchain token address\\n mapping(address => mapping(uint256 => MappedToken)) internal _mainchainToken;\\n\\n /// @dev The ronin validator contract\\n IRoninValidatorSet internal _validatorContract;\\n /// @dev The bridge tracking contract\\n IBridgeTracking internal _bridgeTrackingContract;\\n\\n /// @dev Mapping from withdrawal id => vote for recording withdrawal stats\\n mapping(uint256 => IsolatedVote) public withdrawalStatVote;\\n\\n fallback() external payable {\\n _fallback();\\n }\\n\\n receive() external payable {\\n _fallback();\\n }\\n\\n /**\\n * @dev Initializes contract storage.\\n */\\n function initialize(\\n address _roleSetter,\\n uint256 _numerator,\\n uint256 _denominator,\\n address[] calldata _withdrawalMigrators,\\n // _packedAddresses[0]: roninTokens\\n // _packedAddresses[1]: mainchainTokens\\n address[][2] calldata _packedAddresses,\\n // _packedNumbers[0]: chainIds\\n // _packedNumbers[1]: minimumThresholds\\n uint256[][2] calldata _packedNumbers,\\n Token.Standard[] calldata _standards\\n ) external virtual initializer {\\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\\n _setThreshold(_numerator, _denominator);\\n if (_packedAddresses[0].length > 0) {\\n _mapTokens(_packedAddresses[0], _packedAddresses[1], _packedNumbers[0], _standards);\\n _setMinimumThresholds(_packedAddresses[0], _packedNumbers[1]);\\n }\\n\\n for (uint256 _i; _i < _withdrawalMigrators.length; _i++) {\\n _grantRole(WITHDRAWAL_MIGRATOR, _withdrawalMigrators[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() external view returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external override onlyAdmin {\\n require(_addr.code.length > 0, \\\"RoninGatewayV2: set to non-contract\\\");\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeTrackingContract\\n */\\n function bridgeTrackingContract() external view override returns (address) {\\n return address(_bridgeTrackingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeTrackingContract\\n */\\n function setBridgeTrackingContract(address _addr) external override onlyAdmin {\\n require(_addr.code.length > 0, \\\"RoninGatewayV2: set to non-contract\\\");\\n _setBridgeTrackingContract(_addr);\\n }\\n\\n /**\\n * @dev Migrates withdrawals.\\n *\\n * Requirements:\\n * - The method caller is the migrator.\\n * - The arrays have the same length and its length larger than 0.\\n *\\n */\\n function migrateWithdrawals(Transfer.Request[] calldata _requests, address[] calldata _requesters)\\n external\\n onlyRole(WITHDRAWAL_MIGRATOR)\\n {\\n require(!withdrawalMigrated, \\\"RoninGatewayV2: withdrawals migrated\\\");\\n require(_requesters.length == _requests.length && _requests.length > 0, \\\"RoninGatewayV2: invalid array lengths\\\");\\n for (uint256 _i; _i < _requests.length; _i++) {\\n MappedToken memory _token = getMainchainToken(_requests[_i].tokenAddr, 1);\\n require(_requests[_i].info.erc == _token.erc, \\\"RoninGatewayV2: invalid token standard\\\");\\n _storeAsReceipt(_requests[_i], 1, _requesters[_i], _token.tokenAddr);\\n }\\n }\\n\\n /**\\n * @dev Mark the migration as done.\\n */\\n function markWithdrawalMigrated() external {\\n require(\\n hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(WITHDRAWAL_MIGRATOR, msg.sender),\\n \\\"RoninGatewayV2: unauthorized sender\\\"\\n );\\n require(!withdrawalMigrated, \\\"RoninGatewayV2: withdrawals migrated\\\");\\n withdrawalMigrated = true;\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function getWithdrawalSignatures(uint256 _withdrawalId, address[] calldata _validators)\\n external\\n view\\n returns (bytes[] memory _signatures)\\n {\\n _signatures = new bytes[](_validators.length);\\n for (uint256 _i = 0; _i < _validators.length; _i++) {\\n _signatures[_i] = _withdrawalSig[_withdrawalId][_validators[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function depositFor(Transfer.Receipt calldata _receipt) external {\\n address _sender = msg.sender;\\n uint256 _weight = _getValidatorWeight(_sender);\\n _depositFor(_receipt, _sender, _weight, minimumVoteWeight());\\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds)\\n external\\n returns (bool[] memory _executedReceipts)\\n {\\n address _governor = msg.sender;\\n uint256 _weight = _getValidatorWeight(_governor);\\n uint256 _minVoteWeight = minimumVoteWeight();\\n\\n uint256 _withdrawalId;\\n _executedReceipts = new bool[](_withdrawalIds.length);\\n for (uint256 _i; _i < _withdrawalIds.length; _i++) {\\n _withdrawalId = _withdrawalIds[_i];\\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId, _governor);\\n if (mainchainWithdrew(_withdrawalId)) {\\n _executedReceipts[_i] = true;\\n } else {\\n IsolatedVote storage _proposal = mainchainWithdrewVote[_withdrawalId];\\n Transfer.Receipt memory _withdrawal = withdrawal[_withdrawalId];\\n bytes32 _hash = _withdrawal.hash();\\n VoteStatus _status = _castVote(_proposal, _governor, _weight, _minVoteWeight, _hash);\\n if (_status == VoteStatus.Approved) {\\n _proposal.status = VoteStatus.Executed;\\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId);\\n emit MainchainWithdrew(_hash, _withdrawal);\\n }\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts) external returns (bool[] memory _executedReceipts) {\\n address _sender = msg.sender;\\n uint256 _weight = _getValidatorWeight(_sender);\\n\\n Transfer.Receipt memory _receipt;\\n _executedReceipts = new bool[](_receipts.length);\\n uint256 _minVoteWeight = minimumVoteWeight();\\n for (uint256 _i; _i < _receipts.length; _i++) {\\n _receipt = _receipts[_i];\\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\\n if (depositVote[_receipt.mainchain.chainId][_receipt.id].status == VoteStatus.Executed) {\\n _executedReceipts[_i] = true;\\n } else {\\n _depositFor(_receipt, _sender, _weight, _minVoteWeight);\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external whenNotPaused {\\n _requestWithdrawalFor(_request, msg.sender, _chainId);\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external whenNotPaused {\\n require(_requests.length > 0, \\\"RoninGatewayV2: empty array\\\");\\n for (uint256 _i; _i < _requests.length; _i++) {\\n _requestWithdrawalFor(_requests[_i], msg.sender, _chainId);\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function requestWithdrawalSignatures(uint256 _withdrawalId) external whenNotPaused {\\n require(!mainchainWithdrew(_withdrawalId), \\\"RoninGatewayV2: withdrew on mainchain already\\\");\\n Transfer.Receipt memory _receipt = withdrawal[_withdrawalId];\\n require(_receipt.ronin.chainId == block.chainid, \\\"RoninGatewayV2: query for invalid withdrawal\\\");\\n emit WithdrawalSignaturesRequested(_receipt.hash(), _receipt);\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures) external {\\n address _validator = msg.sender;\\n // This checks method caller already\\n uint256 _weight = _getValidatorWeight(_validator);\\n uint256 _minVoteWeight = minimumVoteWeight();\\n\\n require(\\n _withdrawals.length > 0 && _withdrawals.length == _signatures.length,\\n \\\"RoninGatewayV2: invalid array length\\\"\\n );\\n\\n uint256 _id;\\n for (uint256 _i; _i < _withdrawals.length; _i++) {\\n _id = _withdrawals[_i];\\n _withdrawalSig[_id][_validator] = _signatures[_i];\\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Withdrawal, _id, _validator);\\n\\n IsolatedVote storage _proposal = withdrawalStatVote[_id];\\n VoteStatus _status = _castVote(_proposal, _validator, _weight, _minVoteWeight, bytes32(_id));\\n if (_status == VoteStatus.Approved) {\\n _proposal.status = VoteStatus.Executed;\\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Withdrawal, _id);\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function mapTokens(\\n address[] calldata _roninTokens,\\n address[] calldata _mainchainTokens,\\n uint256[] calldata _chainIds,\\n Token.Standard[] calldata _standards\\n ) external onlyAdmin {\\n require(_roninTokens.length > 0, \\\"RoninGatewayV2: invalid array length\\\");\\n _mapTokens(_roninTokens, _mainchainTokens, _chainIds, _standards);\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function depositVoted(\\n uint256 _chainId,\\n uint256 _depositId,\\n address _voter\\n ) external view returns (bool) {\\n return _voted(depositVote[_chainId][_depositId], _voter);\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool) {\\n return _voted(mainchainWithdrewVote[_withdrawalId], _voter);\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function mainchainWithdrew(uint256 _withdrawalId) public view returns (bool) {\\n return mainchainWithdrewVote[_withdrawalId].status == VoteStatus.Executed;\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function getMainchainToken(address _roninToken, uint256 _chainId) public view returns (MappedToken memory _token) {\\n _token = _mainchainToken[_roninToken][_chainId];\\n require(_token.tokenAddr != address(0), \\\"RoninGatewayV2: unsupported token\\\");\\n }\\n\\n /**\\n * @dev Maps Ronin tokens to mainchain networks.\\n *\\n * Requirement:\\n * - The arrays have the same length.\\n *\\n * Emits the `TokenMapped` event.\\n *\\n */\\n function _mapTokens(\\n address[] calldata _roninTokens,\\n address[] calldata _mainchainTokens,\\n uint256[] calldata _chainIds,\\n Token.Standard[] calldata _standards\\n ) internal {\\n require(\\n _roninTokens.length == _mainchainTokens.length && _roninTokens.length == _chainIds.length,\\n \\\"RoninGatewayV2: invalid array length\\\"\\n );\\n\\n for (uint256 _i; _i < _roninTokens.length; _i++) {\\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].tokenAddr = _mainchainTokens[_i];\\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].erc = _standards[_i];\\n }\\n\\n emit TokenMapped(_roninTokens, _mainchainTokens, _chainIds, _standards);\\n }\\n\\n /**\\n * @dev Deposits based on the receipt.\\n *\\n * Emits the `Deposited` once the assets are released.\\n *\\n */\\n function _depositFor(\\n Transfer.Receipt memory _receipt,\\n address _validator,\\n uint256 _weight,\\n uint256 _minVoteWeight\\n ) internal {\\n uint256 _id = _receipt.id;\\n _receipt.info.validate();\\n require(_receipt.kind == Transfer.Kind.Deposit, \\\"RoninGatewayV2: invalid receipt kind\\\");\\n require(_receipt.ronin.chainId == block.chainid, \\\"RoninGatewayV2: invalid chain id\\\");\\n MappedToken memory _token = getMainchainToken(_receipt.ronin.tokenAddr, _receipt.mainchain.chainId);\\n require(\\n _token.erc == _receipt.info.erc && _token.tokenAddr == _receipt.mainchain.tokenAddr,\\n \\\"RoninGatewayV2: invalid receipt\\\"\\n );\\n\\n IsolatedVote storage _proposal = depositVote[_receipt.mainchain.chainId][_id];\\n bytes32 _receiptHash = _receipt.hash();\\n VoteStatus _status = _castVote(_proposal, _validator, _weight, _minVoteWeight, _receiptHash);\\n if (_status == VoteStatus.Approved) {\\n _proposal.status = VoteStatus.Executed;\\n _receipt.info.handleAssetTransfer(payable(_receipt.ronin.addr), _receipt.ronin.tokenAddr, IWETH(address(0)));\\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Deposit, _receipt.id);\\n emit Deposited(_receiptHash, _receipt);\\n }\\n }\\n\\n /**\\n * @dev Returns the validator weight.\\n *\\n * Requirements:\\n * - The `_addr` weight is larger than 0.\\n *\\n */\\n function _getValidatorWeight(address _addr) internal view returns (uint256 _weight) {\\n _weight = _validatorContract.isBridgeOperator(_addr) ? 1 : 0;\\n require(_weight > 0, \\\"RoninGatewayV2: unauthorized sender\\\");\\n }\\n\\n /**\\n * @dev Locks the assets and request withdrawal.\\n *\\n * Requirements:\\n * - The token info is valid.\\n *\\n * Emits the `WithdrawalRequested` event.\\n *\\n */\\n function _requestWithdrawalFor(\\n Transfer.Request calldata _request,\\n address _requester,\\n uint256 _chainId\\n ) internal {\\n _request.info.validate();\\n _checkWithdrawal(_request);\\n MappedToken memory _token = getMainchainToken(_request.tokenAddr, _chainId);\\n require(_request.info.erc == _token.erc, \\\"RoninGatewayV2: invalid token standard\\\");\\n _request.info.transferFrom(_requester, address(this), _request.tokenAddr);\\n _storeAsReceipt(_request, _chainId, _requester, _token.tokenAddr);\\n }\\n\\n /**\\n * @dev Stores the withdrawal request as a receipt.\\n *\\n * Emits the `WithdrawalRequested` event.\\n *\\n */\\n function _storeAsReceipt(\\n Transfer.Request calldata _request,\\n uint256 _chainId,\\n address _requester,\\n address _mainchainTokenAddr\\n ) internal returns (uint256 _withdrawalId) {\\n _withdrawalId = withdrawalCount++;\\n Transfer.Receipt memory _receipt = _request.into_withdrawal_receipt(\\n _requester,\\n _withdrawalId,\\n _mainchainTokenAddr,\\n _chainId\\n );\\n withdrawal[_withdrawalId] = _receipt;\\n emit WithdrawalRequested(_receipt.hash(), _receipt);\\n }\\n\\n /**\\n * @dev Don't send me RON.\\n */\\n function _fallback() internal virtual {\\n revert(\\\"RoninGatewayV2: invalid request\\\");\\n }\\n\\n /**\\n * @inheritdoc GatewayV2\\n */\\n function _getTotalWeight() internal view virtual override returns (uint256) {\\n return _validatorContract.totalBridgeOperators();\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n\\n /**\\n * @dev Sets the bridge tracking contract.\\n *\\n * Emits the event `BridgeTrackingContractUpdated`.\\n *\\n */\\n function _setBridgeTrackingContract(address _addr) internal {\\n _bridgeTrackingContract = IBridgeTracking(_addr);\\n emit BridgeTrackingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xca6560694d339522025038ce22bde78c0f3eda37d76bb9850d95d89177bf6761\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506000805460ff191690556151be8061002a6000396000f3fe6080604052600436106102815760003560e01c806391d148541161014f578063ca15c873116100c1578063ecc836491161007a578063ecc836491461082e578063f0ce418e1461085b578063f668214a146108a1578063fa389659146108c1578063fc6574bc146108e1578063fe90d9c21461090157610290565b8063ca15c87314610776578063cdf64a7614610796578063d547741f146107b6578063dafae408146107d6578063dbd2ef6c146107f6578063e75235b81461081657610290565b8063affed0e011610113578063affed0e014610678578063b11b767e1461068e578063b9afa177146106ae578063b9c36209146106ce578063bc7f038614610703578063c28f78941461073057610290565b806391d14854146105e5578063931ec9871461060557806399439089146106255780639c8d98da14610643578063a217fddf1461066357610290565b806347b56b2c116101f357806364363f78116101ac57806364363f781461053457806371706cbe146105545780637de5dedd1461056a578063835fc6ca1461057f5780638456cb59146105b05780639010d07c146105c557610290565b806347b56b2c146104345780634d92c4f0146104545780634f2717c7146104b55780635a7dd06a146104cf5780635c975abb146104ef5780635d6a9a901461050757610290565b80632f2ff15d116102455780632f2ff15d1461037857806336568abe146103985780633b5afc22146103b85780633e4574ec146103cd5780633f4ba83a146103ed5780634493421e1461040257610290565b806301ffc9a7146102985780630b1ff17f146102cd578063109679ef146102ed57806317fa2ea11461030d578063248a9ca31461033a57610290565b366102905761028e610923565b005b61028e610923565b3480156102a457600080fd5b506102b86102b3366004613e0c565b610970565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b5061028e6102e8366004613e36565b61099b565b3480156102f957600080fd5b5061028e610308366004613e67565b6109b2565b34801561031957600080fd5b5061032d610328366004613ec4565b610a4e565b6040516102c49190613f05565b34801561034657600080fd5b5061036a610355366004613f4b565b6000908152606b602052604090206001015490565b6040519081526020016102c4565b34801561038457600080fd5b5061028e610393366004613f7b565b610d99565b3480156103a457600080fd5b5061028e6103b3366004613f7b565b610dc3565b3480156103c457600080fd5b5061028e610e3d565b3480156103d957600080fd5b506102b86103e8366004613f7b565b610eb4565b3480156103f957600080fd5b5061028e610ee4565b34801561040e57600080fd5b506075546001600160a01b03165b6040516001600160a01b0390911681526020016102c4565b34801561044057600080fd5b5061028e61044f366004613f4b565b610f26565b34801561046057600080fd5b506104a561046f366004613fa7565b606f602090815260009283526040808420909152908252902080546001820154600483015460059093015460ff90921692909184565b6040516102c49493929190613fdf565b3480156104c157600080fd5b50606d546102b89060ff1681565b3480156104db57600080fd5b5061028e6104ea366004614053565b611160565b3480156104fb57600080fd5b5060005460ff166102b8565b34801561051357600080fd5b5061052761052236600461409e565b6111fa565b6040516102c491906140d8565b34801561054057600080fd5b5061028e61054f366004614104565b6112d7565b34801561056057600080fd5b5061036a606e5481565b34801561057657600080fd5b5061036a611338565b34801561058b57600080fd5b5061059f61059a366004613f4b565b61134f565b6040516102c49594939291906141b8565b3480156105bc57600080fd5b5061028e611421565b3480156105d157600080fd5b5061041c6105e0366004613fa7565b611461565b3480156105f157600080fd5b506102b8610600366004613f7b565b611479565b34801561061157600080fd5b5061028e610620366004614201565b6114a4565b34801561063157600080fd5b506074546001600160a01b031661041c565b34801561064f57600080fd5b5061028e61065e36600461423a565b611662565b34801561066f57600080fd5b5061036a600081565b34801561068457600080fd5b5061036a60045481565b34801561069a57600080fd5b5061028e6106a9366004614266565b6116d0565b3480156106ba57600080fd5b5061032d6106c9366004614344565b6118b4565b3480156106da57600080fd5b506106ee6106e9366004613fa7565b611a44565b604080519283526020830191909152016102c4565b34801561070f57600080fd5b5061036a61071e36600461423a565b60386020526000908152604090205481565b34801561073c57600080fd5b506104a561074b366004613f4b565b607660205260009081526040902080546001820154600483015460059093015460ff90921692909184565b34801561078257600080fd5b5061036a610791366004613f4b565b611a95565b3480156107a257600080fd5b5061028e6107b136600461423a565b611aac565b3480156107c257600080fd5b5061028e6107d1366004613f7b565b611b17565b3480156107e257600080fd5b506102b86107f1366004613f4b565b611b3c565b34801561080257600080fd5b5061028e6108113660046143b9565b611b68565b34801561082257600080fd5b506001546002546106ee565b34801561083a57600080fd5b5061084e61084936600461447c565b611bd7565b6040516102c49190614517565b34801561086757600080fd5b506104a5610876366004613f4b565b607060205260009081526040902080546001820154600483015460059093015460ff90921692909184565b3480156108ad57600080fd5b506102b86108bc366004613f4b565b611d49565b3480156108cd57600080fd5b5061028e6108dc366004614104565b611d77565b3480156108ed57600080fd5b506102b86108fc366004614579565b611f64565b34801561090d57600080fd5b5061036a60008051602061516983398151915281565b60405162461bcd60e51b815260206004820152601f60248201527f526f6e696e4761746577617956323a20696e76616c696420726571756573740060448201526064015b60405180910390fd5b60006001600160e01b03198216635a05180f60e01b1480610995575061099582611f9d565b92915050565b6109a3611fd2565b6109ae823383612018565b5050565b3360006109be826120f0565b90506109e16109d236859003850185614686565b83836109dc611338565b612197565b60755460405163c7c4fea960e01b81526001600160a01b039091169063c7c4fea990610a17906000908735908790600401614727565b600060405180830381600087803b158015610a3157600080fd5b505af1158015610a45573d6000803e3d6000fd5b50505050505050565b6060336000610a5c826120f0565b90506000610a68611338565b90506000856001600160401b03811115610a8457610a846145ae565b604051908082528060200260200182016040528015610aad578160200160208202803683370190505b50945060005b86811015610d8e57878782818110610acd57610acd614754565b60755460405163c7c4fea960e01b81526020909202939093013594506001600160a01b039092169163c7c4fea99150610b0f9060029086908a90600401614727565b600060405180830381600087803b158015610b2957600080fd5b505af1158015610b3d573d6000803e3d6000fd5b50505050610b4a82611d49565b15610b78576001868281518110610b6357610b63614754565b91151560209283029190910190910152610d7c565b600082815260706020908152604080832060718352818420825160a081019093528054835260018082015492959491929184019160ff1690811115610bbf57610bbf613fc9565b6001811115610bd057610bd0613fc9565b8152604080516060808201835260028501546001600160a01b039081168352600386015481166020848101919091526004870154848601528086019390935283518083018552600587015482168152600687015490911692810192909252600785015482840152828401919091528151808201909252600884018054919093019290829060ff166001811115610c6857610c68613fc9565b6001811115610c7957610c79613fc9565b81526001820154602082015260029091015460409091015290525090506000610ca182612458565b90506000610cb2848a8a8a866124e1565b90506001816004811115610cc857610cc8613fc9565b03610d7757835460ff19166002908117855560755460405163114fc47560e11b81526001600160a01b039091169163229f88ea91610d0b91908a9060040161476a565b600060405180830381600087803b158015610d2557600080fd5b505af1158015610d39573d6000803e3d6000fd5b505050507f62520d049932cdee872e9b3c59c0f6073637147e5e9bc8b050b062430eaf5c9f8284604051610d6e929190614785565b60405180910390a15b505050505b80610d86816147fc565b915050610ab3565b505050505092915050565b6000828152606b6020526040902060010154610db481612610565b610dbe838361261a565b505050565b6001600160a01b0381163314610e335760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610967565b6109ae828261263c565b610e48600033611479565b80610e665750610e6660008051602061516983398151915233611479565b610e825760405162461bcd60e51b815260040161096790614815565b606d5460ff1615610ea55760405162461bcd60e51b815260040161096790614858565b606d805460ff19166001179055565b60008281526070602090815260408083206001600160a01b038516845260020190915281205415155b9392505050565b610eec61265e565b6001600160a01b0316336001600160a01b031614610f1c5760405162461bcd60e51b81526004016109679061489c565b610f2461268c565b565b610f2e611fd2565b610f3781611d49565b15610f9a5760405162461bcd60e51b815260206004820152602d60248201527f526f6e696e4761746577617956323a207769746864726577206f6e206d61696e60448201526c636861696e20616c726561647960981b6064820152608401610967565b6000818152607160209081526040808320815160a0810190925280548252600180820154929391929184019160ff1690811115610fd957610fd9613fc9565b6001811115610fea57610fea613fc9565b8152604080516060808201835260028501546001600160a01b039081168352600386015481166020848101919091526004870154848601528086019390935283518083018552600587015482168152600687015490911692810192909252600785015482840152828401919091528151808201909252600884018054919093019290829060ff16600181111561108257611082613fc9565b600181111561109357611093613fc9565b81526001820154602082015260029091015460409182015291526060830151015191925050461461111b5760405162461bcd60e51b815260206004820152602c60248201527f526f6e696e4761746577617956323a20717565727920666f7220696e76616c6960448201526b19081dda5d1a191c985dd85b60a21b6064820152608401610967565b7f04e8cbd836dea43a2dc7eb19de345cca3a8e6978a2ef5225d924775500f67c7c61114582612458565b82604051611154929190614785565b60405180910390a15050565b611168611fd2565b816111b55760405162461bcd60e51b815260206004820152601b60248201527f526f6e696e4761746577617956323a20656d70747920617272617900000000006044820152606401610967565b60005b828110156111f4576111e28484838181106111d5576111d5614754565b905060a002013384612018565b806111ec816147fc565b9150506111b8565b50505050565b604080518082018252600080825260208083018290526001600160a01b038616825260738152838220858352905282902082518084019093528054919291829060ff16600181111561124e5761124e613fc9565b600181111561125f5761125f613fc9565b815290546001600160a01b03610100909104811660209283015290820151919250166109955760405162461bcd60e51b815260206004820152602160248201527f526f6e696e4761746577617956323a20756e737570706f7274656420746f6b656044820152603760f91b6064820152608401610967565b6112df61265e565b6001600160a01b0316336001600160a01b03161461130f5760405162461bcd60e51b81526004016109679061489c565b8261132c5760405162461bcd60e51b8152600401610967906148de565b6111f4848484846126de565b600061134a6113456127bc565b61282a565b905090565b607160209081526000918252604091829020805460018083015485516060808201885260028601546001600160a01b03908116835260038701548116838901526004870154838a015288518083018a526005880154821681526006880154909116978101979097526007860154878901528751908101909752600885018054949760ff9384169792969295929490939192849216908111156113f3576113f3613fc9565b600181111561140457611404613fc9565b815260200160018201548152602001600282015481525050905085565b61142961265e565b6001600160a01b0316336001600160a01b0316146114595760405162461bcd60e51b81526004016109679061489c565b610f24612860565b6000828152606c60205260408120610edd908361289d565b6000918252606b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206151698339815191526114bc81612610565b606d5460ff16156114df5760405162461bcd60e51b815260040161096790614858565b81841480156114ed57508315155b6115475760405162461bcd60e51b815260206004820152602560248201527f526f6e696e4761746577617956323a20696e76616c6964206172726179206c656044820152646e6774687360d81b6064820152608401610967565b60005b8481101561165a57600061158887878481811061156957611569614754565b905060a002016020016020810190611581919061423a565b60016111fa565b8051909150600181111561159e5761159e613fc9565b8787848181106115b0576115b0614754565b6115c992606060a0909202019081019150604001614925565b60018111156115da576115da613fc9565b146115f75760405162461bcd60e51b815260040161096790614942565b61164587878481811061160c5761160c614754565b905060a00201600187878681811061162657611626614754565b905060200201602081019061163b919061423a565b84602001516128a9565b50508080611652906147fc565b91505061154a565b505050505050565b61166a61265e565b6001600160a01b0316336001600160a01b03161461169a5760405162461bcd60e51b81526004016109679061489c565b6000816001600160a01b03163b116116c45760405162461bcd60e51b815260040161096790614988565b6116cd81612a33565b50565b603754610100900460ff16158080156116f05750603754600160ff909116105b8061170a5750303b15801561170a575060375460ff166001145b61176d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610967565b6037805460ff191660011790558015611790576037805461ff0019166101001790555b61179b60008b612a88565b6117a58989612a92565b50600090506117b486806149cb565b90501115611806576117e76117c986806149cb565b6117d660208901896149cb565b6117e089806149cb565b8989612b51565b6118066117f486806149cb565b61180160208801886149cb565b6126de565b60005b868110156118615761184f60008051602061516983398151915289898481811061183557611835614754565b905060200201602081019061184a919061423a565b61261a565b80611859816147fc565b915050611809565b5080156118a8576037805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b60603360006118c2826120f0565b90506118cc613d9f565b846001600160401b038111156118e4576118e46145ae565b60405190808252806020026020018201604052801561190d578160200160208202803683370190505b509350600061191a611338565b905060005b86811015610d8e5787878281811061193957611939614754565b905061016002018036038101906119509190614686565b607554815160405163c7c4fea960e01b81529295506001600160a01b039091169163c7c4fea99161198991600091908a90600401614727565b600060405180830381600087803b1580156119a357600080fd5b505af11580156119b7573d6000803e3d6000fd5b50600292506119c4915050565b6040808501518101516000908152606f6020908152828220875183529052205460ff1660048111156119f8576119f8613fc9565b03611a26576001868281518110611a1157611a11614754565b91151560209283029190910190910152611a32565b611a3283868685612197565b80611a3c816147fc565b91505061191f565b600080611a4f61265e565b6001600160a01b0316336001600160a01b031614611a7f5760405162461bcd60e51b81526004016109679061489c565b611a898484612a92565b915091505b9250929050565b6000818152606c6020526040812061099590612d67565b611ab461265e565b6001600160a01b0316336001600160a01b031614611ae45760405162461bcd60e51b81526004016109679061489c565b6000816001600160a01b03163b11611b0e5760405162461bcd60e51b815260040161096790614988565b6116cd81612d71565b6000828152606b6020526040902060010154611b3281612610565b610dbe838361263c565b6000611b466127bc565b600154611b539190614a14565b600254611b609084614a14565b101592915050565b611b7061265e565b6001600160a01b0316336001600160a01b031614611ba05760405162461bcd60e51b81526004016109679061489c565b86611bbd5760405162461bcd60e51b815260040161096790614a2b565b611bcd8888888888888888612b51565b5050505050505050565b6060816001600160401b03811115611bf157611bf16145ae565b604051908082528060200260200182016040528015611c2457816020015b6060815260200190600190039081611c0f5790505b50905060005b82811015611d4157600085815260726020526040812090858584818110611c5357611c53614754565b9050602002016020810190611c68919061423a565b6001600160a01b03166001600160a01b031681526020019081526020016000208054611c9390614a6f565b80601f0160208091040260200160405190810160405280929190818152602001828054611cbf90614a6f565b8015611d0c5780601f10611ce157610100808354040283529160200191611d0c565b820191906000526020600020905b815481529060010190602001808311611cef57829003601f168201915b5050505050828281518110611d2357611d23614754565b60200260200101819052508080611d39906147fc565b915050611c2a565b509392505050565b6000600260008381526070602052604090205460ff166004811115611d7057611d70613fc9565b1492915050565b336000611d83826120f0565b90506000611d8f611338565b90508515801590611d9f57508584145b611dbb5760405162461bcd60e51b815260040161096790614a2b565b6000805b87811015611f5957888882818110611dd957611dd9614754565b905060200201359150868682818110611df457611df4614754565b9050602002810190611e069190614aa3565b60008481526072602090815260408083206001600160a01b038b168452909152902091611e34919083614b2f565b5060755460405163c7c4fea960e01b81526001600160a01b039091169063c7c4fea990611e6a9060019086908a90600401614727565b600060405180830381600087803b158015611e8457600080fd5b505af1158015611e98573d6000803e3d6000fd5b50505060008381526076602052604081209150611eb882888888886124e1565b90506001816004811115611ece57611ece613fc9565b03611f4457815460ff1916600217825560755460405163114fc47560e11b81526001600160a01b039091169063229f88ea90611f1190600190889060040161476a565b600060405180830381600087803b158015611f2b57600080fd5b505af1158015611f3f573d6000803e3d6000fd5b505050505b50508080611f51906147fc565b915050611dbf565b505050505050505050565b6000838152606f6020908152604080832085845282528083206001600160a01b038516845260020190915281205415155b949350505050565b60006001600160e01b03198216637965db0b60e01b148061099557506301ffc9a760e01b6001600160e01b0319831614610995565b60005460ff1615610f245760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610967565b61203261202d36859003850160408601614bee565b612dbf565b61203b83612e5f565b6000612056612050604086016020870161423a565b836111fa565b8051909150600181111561206c5761206c613fc9565b61207c6060860160408701614925565b600181111561208d5761208d613fc9565b146120aa5760405162461bcd60e51b815260040161096790614942565b6120d983306120bf604088016020890161423a565b6120d136899003890160408a01614bee565b929190612f24565b6120e984838584602001516128a9565b5050505050565b607454604051635a02d57960e11b81526001600160a01b038381166004830152600092169063b405aaf290602401602060405180830381865afa15801561213b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215f9190614c0a565b61216a57600061216d565b60015b60ff169050600081116121925760405162461bcd60e51b815260040161096790614815565b919050565b835160808501516121a790612dbf565b6000856020015160018111156121bf576121bf613fc9565b146122185760405162461bcd60e51b8152602060048201526024808201527f526f6e696e4761746577617956323a20696e76616c69642072656365697074206044820152631ada5b9960e21b6064820152608401610967565b468560600151604001511461226f5760405162461bcd60e51b815260206004820181905260248201527f526f6e696e4761746577617956323a20696e76616c696420636861696e2069646044820152606401610967565b600061228b8660600151602001518760400151604001516111fa565b60808701515190915060018111156122a5576122a5613fc9565b815160018111156122b8576122b8613fc9565b1480156122e257508560400151602001516001600160a01b031681602001516001600160a01b0316145b61232e5760405162461bcd60e51b815260206004820152601f60248201527f526f6e696e4761746577617956323a20696e76616c69642072656365697074006044820152606401610967565b6040808701518101516000908152606f602090815282822085835290529081209061235888612458565b9050600061236983898989866124e1565b9050600181600481111561237f5761237f613fc9565b03611f5957825460ff191660021783556060890151805160209091015160808b01516123ae9290916000613193565b607554895160405163114fc47560e11b81526001600160a01b039092169163229f88ea916123e2916000919060040161476a565b600060405180830381600087803b1580156123fc57600080fd5b505af1158015612410573d6000803e3d6000fd5b505050507f8d20d8121a34dded9035ff5b43e901c142824f7a22126392992c353c37890524828a604051612445929190614785565b60405180910390a1505050505050505050565b60007fb9d1fe7c9deeec5dc90a2f47ff1684239519f2545b2228d3d91fb27df3189eea60001b82600001518360200151612495856040015161350d565b6124a2866060015161350d565b6124af8760800151613570565b6040516020016124c496959493929190614c2c565b604051602081830303815290604052805190602001209050919050565b60008086600401541180156124fa575042866004015411155b156125125750845460ff191660049081178655612607565b6001600160a01b03851660009081526002870160205260409020541561257c57612546856001600160a01b031660146135b3565b6040516020016125569190614c66565b60408051601f198184030181529082905262461bcd60e51b825261096791600401614cba565b6001600160a01b03851660009081526002870160209081526040808320859055848352600389019091528120805486919083906125ba908490614ccd565b92505081905590508381101580156125e757506000875460ff1660048111156125e5576125e5613fc9565b145b156125ff57865460ff19166001908117885587018390555b5050845460ff165b95945050505050565b6116cd813361374e565b612624828261378c565b6000828152606c60205260409020610dbe9082613812565b6126468282613827565b6000828152606c60205260409020610dbe908261388e565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b6126946138a3565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b8281146126fd5760405162461bcd60e51b8152600401610967906148de565b60005b838110156127785782828281811061271a5761271a614754565b905060200201356038600087878581811061273757612737614754565b905060200201602081019061274c919061423a565b6001600160a01b0316815260208101919091526040016000205580612770816147fc565b915050612700565b507f6f52f53a938df83439fa4c6055c7df0a6906d621aa6dfa4708187037fdfc41da848484846040516127ae9493929190614d59565b60405180910390a150505050565b6074546040805163158b54c160e21b815290516000926001600160a01b03169163562d53049160048083019260209291908290030181865afa158015612806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134a9190614d8b565b60006002546001600254846001546128429190614a14565b61284c9190614ccd565b6128569190614da4565b6109959190614db7565b612868611fd2565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586126c13390565b6000610edd83836138ec565b606e8054600091826128ba836147fc565b90915550905060006128e1848385886128d8368c90038c018c614dd9565b93929190613916565b60008381526071602090815260409091208251815590820151600180830180549495508594909160ff1990911690838181111561292057612920613fc9565b021790555060408281015180516002840180546001600160a01b039283166001600160a01b03199182161790915560208084015160038701805491851691841691909117905592840151600486015560608601518051600587018054918516918416919091179055928301516006860180549190931691161790550151600782015560808201518051600883018054909190829060ff1916600183818111156129cb576129cb613fc9565b0217905550602082015181600101556040820151816002015550509050507ff313c253a5be72c29d0deb2c8768a9543744ac03d6b3cafd50cc976f1c2632fc612a1382612458565b82604051612a22929190614785565b60405180910390a150949350505050565b607580546001600160a01b0319166001600160a01b0383169081179091556040519081527f034c8da497df28467c79ddadbba1cc3cdd41f510ea73faae271e6f16a6111621906020015b60405180910390a150565b6109ae828261261a565b60008082841115612ae55760405162461bcd60e51b815260206004820152601c60248201527f4761746577617956323a20696e76616c6964207468726573686f6c64000000006044820152606401610967565b50506001805460028054928590558390556004805491929184918691906000612b0d836147fc565b9091555060408051868152602081018690527f976f8a9c5bdf8248dec172376d6e2b80a8e3df2f0328e381c6db8e1cf138c0f8910160405180910390a49250929050565b8685148015612b5f57508683145b612b7b5760405162461bcd60e51b815260040161096790614a2b565b60005b87811015612d1757868682818110612b9857612b98614754565b9050602002016020810190612bad919061423a565b607360008b8b85818110612bc357612bc3614754565b9050602002016020810190612bd8919061423a565b6001600160a01b03166001600160a01b031681526020019081526020016000206000878785818110612c0c57612c0c614754565b90506020020135815260200190815260200160002060000160016101000a8154816001600160a01b0302191690836001600160a01b03160217905550828282818110612c5a57612c5a614754565b9050602002016020810190612c6f9190614925565b607360008b8b85818110612c8557612c85614754565b9050602002016020810190612c9a919061423a565b6001600160a01b03166001600160a01b031681526020019081526020016000206000878785818110612cce57612cce614754565b60209081029290920135835250810191909152604001600020805460ff191660018381811115612d0057612d00613fc9565b021790555080612d0f816147fc565b915050612b7e565b507f2544bff60c6d5b84946e06804af9f84e150bbee85238dbdee79efca4e0adf4018888888888888888604051612d55989796959493929190614e28565b60405180910390a15050505050505050565b6000610995825490565b607480546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990602001612a7d565b600081516001811115612dd457612dd4613fc9565b148015612de5575060008160400151115b8015612df357506020810151155b80612e1d5750600181516001811115612e0e57612e0e613fc9565b148015612e1d57506040810151155b6116cd5760405162461bcd60e51b8152602060048201526013602482015272546f6b656e3a20696e76616c696420696e666f60681b6044820152606401610967565b6000612e716060830160408401614925565b6001811115612e8257612e82613fc9565b141580612ec0575060386000612e9e604084016020850161423a565b6001600160a01b03168152602081019190915260400160002054608082013510155b6116cd5760405162461bcd60e51b815260206004820152602f60248201527f4d696e696d756d5769746864726177616c3a20717565727920666f7220746f6f60448201526e20736d616c6c207175616e7469747960881b6064820152608401610967565b600060608186516001811115612f3c57612f3c613fc9565b036130195760408681015181516001600160a01b038881166024830152878116604483015260648083019390935283518083039093018352608490910183526020820180516001600160e01b03166323b872dd60e01b179052915191851691612fa59190614eb7565b6000604051808303816000865af19150503d8060008114612fe2576040519150601f19603f3d011682016040523d82523d6000602084013e612fe7565b606091505b5090925090508180156130125750805115806130125750808060200190518101906130129190614c0a565b9150613136565b60018651600181111561302e5761302e613fc9565b036130e457602086810151604080516001600160a01b0389811660248301528881166044830152606480830194909452825180830390940184526084909101825292820180516001600160e01b03166323b872dd60e01b17905251918516916130979190614eb7565b6000604051808303816000865af19150503d80600081146130d4576040519150601f19603f3d011682016040523d82523d6000602084013e6130d9565b606091505b505080925050613136565b60405162461bcd60e51b815260206004820152602160248201527f546f6b656e3a20756e737570706f7274656420746f6b656e207374616e6461726044820152601960fa1b6064820152608401610967565b8161165a5761314486613982565b613158866001600160a01b031660146135b3565b61316c866001600160a01b031660146135b3565b613180866001600160a01b031660146135b3565b6040516020016125569493929190614ed3565b6000816001600160a01b0316836001600160a01b0316036132425760408086015190516001600160a01b0386169180156108fc02916000818181858888f1935050505061323d57816001600160a01b031663d0e30db086604001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561321957600080fd5b505af115801561322d573d6000803e3d6000fd5b505050505061323d8585856139ef565b6120e9565b60008551600181111561325757613257613fc9565b036133ef576040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156132a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132c79190614d8b565b905085604001518110156133de57836001600160a01b03166340c10f19308389604001516132f59190614da4565b6040516001600160a01b03909216602483015260448201526064016040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516133499190614eb7565b6000604051808303816000865af19150503d8060008114613386576040519150601f19603f3d011682016040523d82523d6000602084013e61338b565b606091505b505080925050816133de5760405162461bcd60e51b815260206004820152601b60248201527f546f6b656e3a204552433230206d696e74696e67206661696c656400000000006044820152606401610967565b6133e98686866139ef565b506120e9565b60018551600181111561340457613404613fc9565b036130e45761341883858760200151613a91565b61323d57602085810151604080516001600160a01b038881166024830152604480830194909452825180830390940184526064909101825292820180516001600160e01b03166340c10f1960e01b17905251918516916134789190614eb7565b6000604051808303816000865af19150503d80600081146134b5576040519150601f19603f3d011682016040523d82523d6000602084013e6134ba565b606091505b5050809150508061323d5760405162461bcd60e51b815260206004820152601c60248201527f546f6b656e3a20455243373231206d696e74696e67206661696c6564000000006044820152606401610967565b805160208083015160408085015190516000946124c4947f353bdd8d69b9e3185b3972e08b03845c0c14a21a390215302776a7a34b0e87649491939192019384526001600160a01b03928316602085015291166040830152606082015260800190565b805160208083015160408085015190516000946124c4947f1e2b74b2a792d5c0f0b6e59b037fa9d43d84fbb759337f0112fcc15ca414fc8d949193919201614f8c565b606060006135c2836002614a14565b6135cd906002614ccd565b6001600160401b038111156135e4576135e46145ae565b6040519080825280601f01601f19166020018201604052801561360e576020820181803683370190505b509050600360fc1b8160008151811061362957613629614754565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061365857613658614754565b60200101906001600160f81b031916908160001a905350600061367c846002614a14565b613687906001614ccd565b90505b60018111156136ff576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106136bb576136bb614754565b1a60f81b8282815181106136d1576136d1614754565b60200101906001600160f81b031916908160001a90535060049490941c936136f881614fb7565b905061368a565b508315610edd5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610967565b6137588282611479565b6109ae57613770816001600160a01b031660146135b3565b61377b8360206135b3565b604051602001612556929190614fce565b6137968282611479565b6109ae576000828152606b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556137ce3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610edd836001600160a01b038416613b3c565b6138318282611479565b156109ae576000828152606b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610edd836001600160a01b038416613b8b565b60005460ff16610f245760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610967565b600082600001828154811061390357613903614754565b9060005260206000200154905092915050565b61391e613d9f565b92835260016020808501919091526060840180516001600160a01b0396871690528682015181519087169083015251466040918201528651818601805191881690915280519490961693909101929092529251810192909252910151608082015290565b60606139ad8260000151600181111561399d5761399d613fc9565b6001600160a01b031660016135b3565b6139ba8360200151613c7e565b6139c78460400151613c7e565b6040516020016139d993929190615043565b6040516020818303038152906040529050919050565b60008084516001811115613a0557613a05613fc9565b03613a2057613a1982848660400151613cd5565b9050613a49565b600184516001811115613a3557613a35613fc9565b036130e457613a1982848660200151613a91565b806111f457613a5784613982565b613a6b846001600160a01b031660146135b3565b613a7f846001600160a01b031660146135b3565b604051602001612556939291906150c1565b604080513060248201526001600160a01b038481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600092861691613aef91614eb7565b6000604051808303816000865af19150503d8060008114613b2c576040519150601f19603f3d011682016040523d82523d6000602084013e613b31565b606091505b509095945050505050565b6000818152600183016020526040812054613b8357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610995565b506000610995565b60008181526001830160205260408120548015613c74576000613baf600183614da4565b8554909150600090613bc390600190614da4565b9050818114613c28576000866000018281548110613be357613be3614754565b9060005260206000200154905080876000018481548110613c0657613c06614754565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613c3957613c39615152565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610995565b6000915050610995565b606081600003613ca85750506040805180820190915260048152630307830360e41b602082015290565b8160005b8115613ccb5780613cbc816147fc565b915050600882901c9150613cac565b611f9584826135b3565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009260609290871691613d329190614eb7565b6000604051808303816000865af19150503d8060008114613d6f576040519150601f19603f3d011682016040523d82523d6000602084013e613d74565b606091505b5090925090508180156126075750805115806126075750808060200190518101906126079190614c0a565b6040805160a08101825260008082526020808301829052835160608082018652838252818301849052818601849052848601919091528451808201865283815280830184905280860184905281850152845190810185528281529081018290529283015290608082015290565b600060208284031215613e1e57600080fd5b81356001600160e01b031981168114610edd57600080fd5b60008082840360c0811215613e4a57600080fd5b60a0811215613e5857600080fd5b50919360a08501359350915050565b60006101608284031215613e7a57600080fd5b50919050565b60008083601f840112613e9257600080fd5b5081356001600160401b03811115613ea957600080fd5b6020830191508360208260051b8501011115611a8e57600080fd5b60008060208385031215613ed757600080fd5b82356001600160401b03811115613eed57600080fd5b613ef985828601613e80565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b81811015613f3f578351151583529284019291840191600101613f21565b50909695505050505050565b600060208284031215613f5d57600080fd5b5035919050565b80356001600160a01b038116811461219257600080fd5b60008060408385031215613f8e57600080fd5b82359150613f9e60208401613f64565b90509250929050565b60008060408385031215613fba57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b6080810160058610613ff357613ff3613fc9565b9481526020810193909352604083019190915260609091015290565b60008083601f84011261402157600080fd5b5081356001600160401b0381111561403857600080fd5b60208301915083602060a083028501011115611a8e57600080fd5b60008060006040848603121561406857600080fd5b83356001600160401b0381111561407e57600080fd5b61408a8682870161400f565b909790965060209590950135949350505050565b600080604083850312156140b157600080fd5b6140ba83613f64565b946020939093013593505050565b600281106116cd576116cd613fc9565b815160408201906140e8816140c8565b82526020928301516001600160a01b0316929091019190915290565b6000806000806040858703121561411a57600080fd5b84356001600160401b038082111561413157600080fd5b61413d88838901613e80565b9096509450602087013591508082111561415657600080fd5b5061416387828801613e80565b95989497509550505050565b80516001600160a01b03908116835260208083015190911690830152604090810151910152565b80516141a1816140c8565b825260208181015190830152604090810151910152565b85815261016081016141c9866140c8565b8560208301526141dc604083018661416f565b6141e960a083018561416f565b6141f7610100830184614196565b9695505050505050565b6000806000806040858703121561421757600080fd5b84356001600160401b038082111561422e57600080fd5b61413d8883890161400f565b60006020828403121561424c57600080fd5b610edd82613f64565b806040810183101561099557600080fd5b600080600080600080600080600060e08a8c03121561428457600080fd5b61428d8a613f64565b985060208a0135975060408a0135965060608a01356001600160401b03808211156142b757600080fd5b6142c38d838e01613e80565b909850965060808c01359150808211156142dc57600080fd5b6142e88d838e01614255565b955060a08c01359150808211156142fe57600080fd5b61430a8d838e01614255565b945060c08c013591508082111561432057600080fd5b5061432d8c828d01613e80565b915080935050809150509295985092959850929598565b6000806020838503121561435757600080fd5b82356001600160401b038082111561436e57600080fd5b818501915085601f83011261438257600080fd5b81358181111561439157600080fd5b866020610160830285010111156143a757600080fd5b60209290920196919550909350505050565b6000806000806000806000806080898b0312156143d557600080fd5b88356001600160401b03808211156143ec57600080fd5b6143f88c838d01613e80565b909a50985060208b013591508082111561441157600080fd5b61441d8c838d01613e80565b909850965060408b013591508082111561443657600080fd5b6144428c838d01613e80565b909650945060608b013591508082111561445b57600080fd5b506144688b828c01613e80565b999c989b5096995094979396929594505050565b60008060006040848603121561449157600080fd5b8335925060208401356001600160401b038111156144ae57600080fd5b6144ba86828701613e80565b9497909650939450505050565b60005b838110156144e25781810151838201526020016144ca565b50506000910152565b600081518084526145038160208601602086016144c7565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561456c57603f1988860301845261455a8583516144eb565b9450928501929085019060010161453e565b5092979650505050505050565b60008060006060848603121561458e57600080fd5b83359250602084013591506145a560408501613f64565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b03811182821017156145e6576145e66145ae565b60405290565b600281106116cd57600080fd5b60006060828403121561460b57600080fd5b6146136145c4565b905061461e82613f64565b815261462c60208301613f64565b60208201526040820135604082015292915050565b60006060828403121561465357600080fd5b61465b6145c4565b90508135614668816145ec565b80825250602082013560208201526040820135604082015292915050565b6000610160828403121561469957600080fd5b60405160a081018181106001600160401b03821117156146bb576146bb6145ae565b6040528235815260208301356146d0816145ec565b60208201526146e284604085016145f9565b60408201526146f48460a085016145f9565b6060820152614707846101008501614641565b60808201529392505050565b6003811061472357614723613fc9565b9052565b606081016147358286614713565b60208201939093526001600160a01b0391909116604090910152919050565b634e487b7160e01b600052603260045260246000fd5b604081016147788285614713565b8260208301529392505050565b6000610180820190508382528251602083015260208301516147a6816140c8565b8060408401525060408301516147bf606084018261416f565b5060608301516147d260c084018261416f565b506080830151611d41610120840182614196565b634e487b7160e01b600052601160045260246000fd5b60006001820161480e5761480e6147e6565b5060010190565b60208082526023908201527f526f6e696e4761746577617956323a20756e617574686f72697a65642073656e6040820152623232b960e91b606082015260800190565b60208082526024908201527f526f6e696e4761746577617956323a207769746864726177616c73206d696772604082015263185d195960e21b606082015260800190565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b60208082526027908201527f4d696e696d756d5769746864726177616c3a20696e76616c6964206172726179604082015266040d8cadccee8d60cb1b606082015260800190565b60006020828403121561493757600080fd5b8135610edd816145ec565b60208082526026908201527f526f6e696e4761746577617956323a20696e76616c696420746f6b656e207374604082015265185b99185c9960d21b606082015260800190565b60208082526023908201527f526f6e696e4761746577617956323a2073657420746f206e6f6e2d636f6e74726040820152621858dd60ea1b606082015260800190565b6000808335601e198436030181126149e257600080fd5b8301803591506001600160401b038211156149fc57600080fd5b6020019150600581901b3603821315611a8e57600080fd5b8082028115828204841417610995576109956147e6565b60208082526024908201527f526f6e696e4761746577617956323a20696e76616c6964206172726179206c656040820152630dccee8d60e31b606082015260800190565b600181811c90821680614a8357607f821691505b602082108103613e7a57634e487b7160e01b600052602260045260246000fd5b6000808335601e19843603018112614aba57600080fd5b8301803591506001600160401b03821115614ad457600080fd5b602001915036819003821315611a8e57600080fd5b601f821115610dbe57600081815260208120601f850160051c81016020861015614b105750805b601f850160051c820191505b8181101561165a57828155600101614b1c565b6001600160401b03831115614b4657614b466145ae565b614b5a83614b548354614a6f565b83614ae9565b6000601f841160018114614b8e5760008515614b765750838201355b600019600387901b1c1916600186901b1783556120e9565b600083815260209020601f19861690835b82811015614bbf5786850135825560209485019460019092019101614b9f565b5086821015614bdc5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600060608284031215614c0057600080fd5b610edd8383614641565b600060208284031215614c1c57600080fd5b81518015158114610edd57600080fd5b8681526020810186905260c08101614c43866140c8565b8560408301528460608301528360808301528260a0830152979650505050505050565b73024b9b7b630ba32b223b7bb32b93730b731b29d160651b815260008251614c958160148501602087016144c7565b6d08185b1c9958591e481d9bdd195960921b6014939091019283015250602201919050565b602081526000610edd60208301846144eb565b80820180821115610995576109956147e6565b8183526000602080850194508260005b85811015614d1c576001600160a01b03614d0983613f64565b1687529582019590820190600101614cf0565b509495945050505050565b81835260006001600160fb1b03831115614d4057600080fd5b8260051b80836020870137939093016020019392505050565b604081526000614d6d604083018688614ce0565b8281036020840152614d80818587614d27565b979650505050505050565b600060208284031215614d9d57600080fd5b5051919050565b81810381811115610995576109956147e6565b600082614dd457634e487b7160e01b600052601260045260246000fd5b500490565b600060a08284031215614deb57600080fd5b614df36145c4565b614dfc83613f64565b8152614e0a60208401613f64565b6020820152614e1c8460408501614641565b60408201529392505050565b608081526000614e3c608083018a8c614ce0565b602083820381850152614e50828a8c614ce0565b91508382036040850152614e6582888a614d27565b8481036060860152858152869250810160005b86811015614ea6578335614e8b816145ec565b614e94816140c8565b82529282019290820190600101614e78565b509c9b505050505050505050505050565b60008251614ec98184602087016144c7565b9190910192915050565b7f546f6b656e3a20636f756c64206e6f74207472616e73666572200000000000008152600085516020614f0c82601a8601838b016144c7565b65010333937b6960d51b601a928501928301528651614f3081838501848b016144c7565b630103a37960e51b9201818101929092528551614f5381602485018985016144c7565b660103a37b5b2b7160cd1b602493909101928301528451614f7a81602b85018489016144c7565b91909101602b01979650505050505050565b84815260808101614f9c856140c8565b84602083015283604083015282606083015295945050505050565b600081614fc657614fc66147e6565b506000190190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516150068160178501602088016144c7565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516150378160288401602088016144c7565b01602801949350505050565b690a8ded6cadc92dcccde560b31b81526000845161506881600a8501602089016144c7565b8083019050600b60fa1b80600a830152855161508b81600b850160208a016144c7565b600b92019182015283516150a681600c8401602088016144c7565b602960f81b600c9290910191820152600d0195945050505050565b7f546f6b656e3a20636f756c64206e6f74207472616e73666572200000000000008152600084516150f981601a8501602089016144c7565b630103a37960e51b601a91840191820152845161511d81601e8401602089016144c7565b660103a37b5b2b7160cd1b601e929091019182015283516151458160258401602088016144c7565b0160250195945050505050565b634e487b7160e01b600052603160045260246000fdfe384495a48d92b97cd9b9d199c73ed783dd1aa0076a6ebcf9156ca7fef7d2cc40a26469706673582212206f3a8735b2344a2af6f5c9674b234e03c719f969c28f8bccf96400466868addf64736f6c63430008110033", - "deployedBytecode": "0x6080604052600436106102815760003560e01c806391d148541161014f578063ca15c873116100c1578063ecc836491161007a578063ecc836491461082e578063f0ce418e1461085b578063f668214a146108a1578063fa389659146108c1578063fc6574bc146108e1578063fe90d9c21461090157610290565b8063ca15c87314610776578063cdf64a7614610796578063d547741f146107b6578063dafae408146107d6578063dbd2ef6c146107f6578063e75235b81461081657610290565b8063affed0e011610113578063affed0e014610678578063b11b767e1461068e578063b9afa177146106ae578063b9c36209146106ce578063bc7f038614610703578063c28f78941461073057610290565b806391d14854146105e5578063931ec9871461060557806399439089146106255780639c8d98da14610643578063a217fddf1461066357610290565b806347b56b2c116101f357806364363f78116101ac57806364363f781461053457806371706cbe146105545780637de5dedd1461056a578063835fc6ca1461057f5780638456cb59146105b05780639010d07c146105c557610290565b806347b56b2c146104345780634d92c4f0146104545780634f2717c7146104b55780635a7dd06a146104cf5780635c975abb146104ef5780635d6a9a901461050757610290565b80632f2ff15d116102455780632f2ff15d1461037857806336568abe146103985780633b5afc22146103b85780633e4574ec146103cd5780633f4ba83a146103ed5780634493421e1461040257610290565b806301ffc9a7146102985780630b1ff17f146102cd578063109679ef146102ed57806317fa2ea11461030d578063248a9ca31461033a57610290565b366102905761028e610923565b005b61028e610923565b3480156102a457600080fd5b506102b86102b3366004613e0c565b610970565b60405190151581526020015b60405180910390f35b3480156102d957600080fd5b5061028e6102e8366004613e36565b61099b565b3480156102f957600080fd5b5061028e610308366004613e67565b6109b2565b34801561031957600080fd5b5061032d610328366004613ec4565b610a4e565b6040516102c49190613f05565b34801561034657600080fd5b5061036a610355366004613f4b565b6000908152606b602052604090206001015490565b6040519081526020016102c4565b34801561038457600080fd5b5061028e610393366004613f7b565b610d99565b3480156103a457600080fd5b5061028e6103b3366004613f7b565b610dc3565b3480156103c457600080fd5b5061028e610e3d565b3480156103d957600080fd5b506102b86103e8366004613f7b565b610eb4565b3480156103f957600080fd5b5061028e610ee4565b34801561040e57600080fd5b506075546001600160a01b03165b6040516001600160a01b0390911681526020016102c4565b34801561044057600080fd5b5061028e61044f366004613f4b565b610f26565b34801561046057600080fd5b506104a561046f366004613fa7565b606f602090815260009283526040808420909152908252902080546001820154600483015460059093015460ff90921692909184565b6040516102c49493929190613fdf565b3480156104c157600080fd5b50606d546102b89060ff1681565b3480156104db57600080fd5b5061028e6104ea366004614053565b611160565b3480156104fb57600080fd5b5060005460ff166102b8565b34801561051357600080fd5b5061052761052236600461409e565b6111fa565b6040516102c491906140d8565b34801561054057600080fd5b5061028e61054f366004614104565b6112d7565b34801561056057600080fd5b5061036a606e5481565b34801561057657600080fd5b5061036a611338565b34801561058b57600080fd5b5061059f61059a366004613f4b565b61134f565b6040516102c49594939291906141b8565b3480156105bc57600080fd5b5061028e611421565b3480156105d157600080fd5b5061041c6105e0366004613fa7565b611461565b3480156105f157600080fd5b506102b8610600366004613f7b565b611479565b34801561061157600080fd5b5061028e610620366004614201565b6114a4565b34801561063157600080fd5b506074546001600160a01b031661041c565b34801561064f57600080fd5b5061028e61065e36600461423a565b611662565b34801561066f57600080fd5b5061036a600081565b34801561068457600080fd5b5061036a60045481565b34801561069a57600080fd5b5061028e6106a9366004614266565b6116d0565b3480156106ba57600080fd5b5061032d6106c9366004614344565b6118b4565b3480156106da57600080fd5b506106ee6106e9366004613fa7565b611a44565b604080519283526020830191909152016102c4565b34801561070f57600080fd5b5061036a61071e36600461423a565b60386020526000908152604090205481565b34801561073c57600080fd5b506104a561074b366004613f4b565b607660205260009081526040902080546001820154600483015460059093015460ff90921692909184565b34801561078257600080fd5b5061036a610791366004613f4b565b611a95565b3480156107a257600080fd5b5061028e6107b136600461423a565b611aac565b3480156107c257600080fd5b5061028e6107d1366004613f7b565b611b17565b3480156107e257600080fd5b506102b86107f1366004613f4b565b611b3c565b34801561080257600080fd5b5061028e6108113660046143b9565b611b68565b34801561082257600080fd5b506001546002546106ee565b34801561083a57600080fd5b5061084e61084936600461447c565b611bd7565b6040516102c49190614517565b34801561086757600080fd5b506104a5610876366004613f4b565b607060205260009081526040902080546001820154600483015460059093015460ff90921692909184565b3480156108ad57600080fd5b506102b86108bc366004613f4b565b611d49565b3480156108cd57600080fd5b5061028e6108dc366004614104565b611d77565b3480156108ed57600080fd5b506102b86108fc366004614579565b611f64565b34801561090d57600080fd5b5061036a60008051602061516983398151915281565b60405162461bcd60e51b815260206004820152601f60248201527f526f6e696e4761746577617956323a20696e76616c696420726571756573740060448201526064015b60405180910390fd5b60006001600160e01b03198216635a05180f60e01b1480610995575061099582611f9d565b92915050565b6109a3611fd2565b6109ae823383612018565b5050565b3360006109be826120f0565b90506109e16109d236859003850185614686565b83836109dc611338565b612197565b60755460405163c7c4fea960e01b81526001600160a01b039091169063c7c4fea990610a17906000908735908790600401614727565b600060405180830381600087803b158015610a3157600080fd5b505af1158015610a45573d6000803e3d6000fd5b50505050505050565b6060336000610a5c826120f0565b90506000610a68611338565b90506000856001600160401b03811115610a8457610a846145ae565b604051908082528060200260200182016040528015610aad578160200160208202803683370190505b50945060005b86811015610d8e57878782818110610acd57610acd614754565b60755460405163c7c4fea960e01b81526020909202939093013594506001600160a01b039092169163c7c4fea99150610b0f9060029086908a90600401614727565b600060405180830381600087803b158015610b2957600080fd5b505af1158015610b3d573d6000803e3d6000fd5b50505050610b4a82611d49565b15610b78576001868281518110610b6357610b63614754565b91151560209283029190910190910152610d7c565b600082815260706020908152604080832060718352818420825160a081019093528054835260018082015492959491929184019160ff1690811115610bbf57610bbf613fc9565b6001811115610bd057610bd0613fc9565b8152604080516060808201835260028501546001600160a01b039081168352600386015481166020848101919091526004870154848601528086019390935283518083018552600587015482168152600687015490911692810192909252600785015482840152828401919091528151808201909252600884018054919093019290829060ff166001811115610c6857610c68613fc9565b6001811115610c7957610c79613fc9565b81526001820154602082015260029091015460409091015290525090506000610ca182612458565b90506000610cb2848a8a8a866124e1565b90506001816004811115610cc857610cc8613fc9565b03610d7757835460ff19166002908117855560755460405163114fc47560e11b81526001600160a01b039091169163229f88ea91610d0b91908a9060040161476a565b600060405180830381600087803b158015610d2557600080fd5b505af1158015610d39573d6000803e3d6000fd5b505050507f62520d049932cdee872e9b3c59c0f6073637147e5e9bc8b050b062430eaf5c9f8284604051610d6e929190614785565b60405180910390a15b505050505b80610d86816147fc565b915050610ab3565b505050505092915050565b6000828152606b6020526040902060010154610db481612610565b610dbe838361261a565b505050565b6001600160a01b0381163314610e335760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610967565b6109ae828261263c565b610e48600033611479565b80610e665750610e6660008051602061516983398151915233611479565b610e825760405162461bcd60e51b815260040161096790614815565b606d5460ff1615610ea55760405162461bcd60e51b815260040161096790614858565b606d805460ff19166001179055565b60008281526070602090815260408083206001600160a01b038516845260020190915281205415155b9392505050565b610eec61265e565b6001600160a01b0316336001600160a01b031614610f1c5760405162461bcd60e51b81526004016109679061489c565b610f2461268c565b565b610f2e611fd2565b610f3781611d49565b15610f9a5760405162461bcd60e51b815260206004820152602d60248201527f526f6e696e4761746577617956323a207769746864726577206f6e206d61696e60448201526c636861696e20616c726561647960981b6064820152608401610967565b6000818152607160209081526040808320815160a0810190925280548252600180820154929391929184019160ff1690811115610fd957610fd9613fc9565b6001811115610fea57610fea613fc9565b8152604080516060808201835260028501546001600160a01b039081168352600386015481166020848101919091526004870154848601528086019390935283518083018552600587015482168152600687015490911692810192909252600785015482840152828401919091528151808201909252600884018054919093019290829060ff16600181111561108257611082613fc9565b600181111561109357611093613fc9565b81526001820154602082015260029091015460409182015291526060830151015191925050461461111b5760405162461bcd60e51b815260206004820152602c60248201527f526f6e696e4761746577617956323a20717565727920666f7220696e76616c6960448201526b19081dda5d1a191c985dd85b60a21b6064820152608401610967565b7f04e8cbd836dea43a2dc7eb19de345cca3a8e6978a2ef5225d924775500f67c7c61114582612458565b82604051611154929190614785565b60405180910390a15050565b611168611fd2565b816111b55760405162461bcd60e51b815260206004820152601b60248201527f526f6e696e4761746577617956323a20656d70747920617272617900000000006044820152606401610967565b60005b828110156111f4576111e28484838181106111d5576111d5614754565b905060a002013384612018565b806111ec816147fc565b9150506111b8565b50505050565b604080518082018252600080825260208083018290526001600160a01b038616825260738152838220858352905282902082518084019093528054919291829060ff16600181111561124e5761124e613fc9565b600181111561125f5761125f613fc9565b815290546001600160a01b03610100909104811660209283015290820151919250166109955760405162461bcd60e51b815260206004820152602160248201527f526f6e696e4761746577617956323a20756e737570706f7274656420746f6b656044820152603760f91b6064820152608401610967565b6112df61265e565b6001600160a01b0316336001600160a01b03161461130f5760405162461bcd60e51b81526004016109679061489c565b8261132c5760405162461bcd60e51b8152600401610967906148de565b6111f4848484846126de565b600061134a6113456127bc565b61282a565b905090565b607160209081526000918252604091829020805460018083015485516060808201885260028601546001600160a01b03908116835260038701548116838901526004870154838a015288518083018a526005880154821681526006880154909116978101979097526007860154878901528751908101909752600885018054949760ff9384169792969295929490939192849216908111156113f3576113f3613fc9565b600181111561140457611404613fc9565b815260200160018201548152602001600282015481525050905085565b61142961265e565b6001600160a01b0316336001600160a01b0316146114595760405162461bcd60e51b81526004016109679061489c565b610f24612860565b6000828152606c60205260408120610edd908361289d565b6000918252606b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6000805160206151698339815191526114bc81612610565b606d5460ff16156114df5760405162461bcd60e51b815260040161096790614858565b81841480156114ed57508315155b6115475760405162461bcd60e51b815260206004820152602560248201527f526f6e696e4761746577617956323a20696e76616c6964206172726179206c656044820152646e6774687360d81b6064820152608401610967565b60005b8481101561165a57600061158887878481811061156957611569614754565b905060a002016020016020810190611581919061423a565b60016111fa565b8051909150600181111561159e5761159e613fc9565b8787848181106115b0576115b0614754565b6115c992606060a0909202019081019150604001614925565b60018111156115da576115da613fc9565b146115f75760405162461bcd60e51b815260040161096790614942565b61164587878481811061160c5761160c614754565b905060a00201600187878681811061162657611626614754565b905060200201602081019061163b919061423a565b84602001516128a9565b50508080611652906147fc565b91505061154a565b505050505050565b61166a61265e565b6001600160a01b0316336001600160a01b03161461169a5760405162461bcd60e51b81526004016109679061489c565b6000816001600160a01b03163b116116c45760405162461bcd60e51b815260040161096790614988565b6116cd81612a33565b50565b603754610100900460ff16158080156116f05750603754600160ff909116105b8061170a5750303b15801561170a575060375460ff166001145b61176d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610967565b6037805460ff191660011790558015611790576037805461ff0019166101001790555b61179b60008b612a88565b6117a58989612a92565b50600090506117b486806149cb565b90501115611806576117e76117c986806149cb565b6117d660208901896149cb565b6117e089806149cb565b8989612b51565b6118066117f486806149cb565b61180160208801886149cb565b6126de565b60005b868110156118615761184f60008051602061516983398151915289898481811061183557611835614754565b905060200201602081019061184a919061423a565b61261a565b80611859816147fc565b915050611809565b5080156118a8576037805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b60603360006118c2826120f0565b90506118cc613d9f565b846001600160401b038111156118e4576118e46145ae565b60405190808252806020026020018201604052801561190d578160200160208202803683370190505b509350600061191a611338565b905060005b86811015610d8e5787878281811061193957611939614754565b905061016002018036038101906119509190614686565b607554815160405163c7c4fea960e01b81529295506001600160a01b039091169163c7c4fea99161198991600091908a90600401614727565b600060405180830381600087803b1580156119a357600080fd5b505af11580156119b7573d6000803e3d6000fd5b50600292506119c4915050565b6040808501518101516000908152606f6020908152828220875183529052205460ff1660048111156119f8576119f8613fc9565b03611a26576001868281518110611a1157611a11614754565b91151560209283029190910190910152611a32565b611a3283868685612197565b80611a3c816147fc565b91505061191f565b600080611a4f61265e565b6001600160a01b0316336001600160a01b031614611a7f5760405162461bcd60e51b81526004016109679061489c565b611a898484612a92565b915091505b9250929050565b6000818152606c6020526040812061099590612d67565b611ab461265e565b6001600160a01b0316336001600160a01b031614611ae45760405162461bcd60e51b81526004016109679061489c565b6000816001600160a01b03163b11611b0e5760405162461bcd60e51b815260040161096790614988565b6116cd81612d71565b6000828152606b6020526040902060010154611b3281612610565b610dbe838361263c565b6000611b466127bc565b600154611b539190614a14565b600254611b609084614a14565b101592915050565b611b7061265e565b6001600160a01b0316336001600160a01b031614611ba05760405162461bcd60e51b81526004016109679061489c565b86611bbd5760405162461bcd60e51b815260040161096790614a2b565b611bcd8888888888888888612b51565b5050505050505050565b6060816001600160401b03811115611bf157611bf16145ae565b604051908082528060200260200182016040528015611c2457816020015b6060815260200190600190039081611c0f5790505b50905060005b82811015611d4157600085815260726020526040812090858584818110611c5357611c53614754565b9050602002016020810190611c68919061423a565b6001600160a01b03166001600160a01b031681526020019081526020016000208054611c9390614a6f565b80601f0160208091040260200160405190810160405280929190818152602001828054611cbf90614a6f565b8015611d0c5780601f10611ce157610100808354040283529160200191611d0c565b820191906000526020600020905b815481529060010190602001808311611cef57829003601f168201915b5050505050828281518110611d2357611d23614754565b60200260200101819052508080611d39906147fc565b915050611c2a565b509392505050565b6000600260008381526070602052604090205460ff166004811115611d7057611d70613fc9565b1492915050565b336000611d83826120f0565b90506000611d8f611338565b90508515801590611d9f57508584145b611dbb5760405162461bcd60e51b815260040161096790614a2b565b6000805b87811015611f5957888882818110611dd957611dd9614754565b905060200201359150868682818110611df457611df4614754565b9050602002810190611e069190614aa3565b60008481526072602090815260408083206001600160a01b038b168452909152902091611e34919083614b2f565b5060755460405163c7c4fea960e01b81526001600160a01b039091169063c7c4fea990611e6a9060019086908a90600401614727565b600060405180830381600087803b158015611e8457600080fd5b505af1158015611e98573d6000803e3d6000fd5b50505060008381526076602052604081209150611eb882888888886124e1565b90506001816004811115611ece57611ece613fc9565b03611f4457815460ff1916600217825560755460405163114fc47560e11b81526001600160a01b039091169063229f88ea90611f1190600190889060040161476a565b600060405180830381600087803b158015611f2b57600080fd5b505af1158015611f3f573d6000803e3d6000fd5b505050505b50508080611f51906147fc565b915050611dbf565b505050505050505050565b6000838152606f6020908152604080832085845282528083206001600160a01b038516845260020190915281205415155b949350505050565b60006001600160e01b03198216637965db0b60e01b148061099557506301ffc9a760e01b6001600160e01b0319831614610995565b60005460ff1615610f245760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610967565b61203261202d36859003850160408601614bee565b612dbf565b61203b83612e5f565b6000612056612050604086016020870161423a565b836111fa565b8051909150600181111561206c5761206c613fc9565b61207c6060860160408701614925565b600181111561208d5761208d613fc9565b146120aa5760405162461bcd60e51b815260040161096790614942565b6120d983306120bf604088016020890161423a565b6120d136899003890160408a01614bee565b929190612f24565b6120e984838584602001516128a9565b5050505050565b607454604051635a02d57960e11b81526001600160a01b038381166004830152600092169063b405aaf290602401602060405180830381865afa15801561213b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061215f9190614c0a565b61216a57600061216d565b60015b60ff169050600081116121925760405162461bcd60e51b815260040161096790614815565b919050565b835160808501516121a790612dbf565b6000856020015160018111156121bf576121bf613fc9565b146122185760405162461bcd60e51b8152602060048201526024808201527f526f6e696e4761746577617956323a20696e76616c69642072656365697074206044820152631ada5b9960e21b6064820152608401610967565b468560600151604001511461226f5760405162461bcd60e51b815260206004820181905260248201527f526f6e696e4761746577617956323a20696e76616c696420636861696e2069646044820152606401610967565b600061228b8660600151602001518760400151604001516111fa565b60808701515190915060018111156122a5576122a5613fc9565b815160018111156122b8576122b8613fc9565b1480156122e257508560400151602001516001600160a01b031681602001516001600160a01b0316145b61232e5760405162461bcd60e51b815260206004820152601f60248201527f526f6e696e4761746577617956323a20696e76616c69642072656365697074006044820152606401610967565b6040808701518101516000908152606f602090815282822085835290529081209061235888612458565b9050600061236983898989866124e1565b9050600181600481111561237f5761237f613fc9565b03611f5957825460ff191660021783556060890151805160209091015160808b01516123ae9290916000613193565b607554895160405163114fc47560e11b81526001600160a01b039092169163229f88ea916123e2916000919060040161476a565b600060405180830381600087803b1580156123fc57600080fd5b505af1158015612410573d6000803e3d6000fd5b505050507f8d20d8121a34dded9035ff5b43e901c142824f7a22126392992c353c37890524828a604051612445929190614785565b60405180910390a1505050505050505050565b60007fb9d1fe7c9deeec5dc90a2f47ff1684239519f2545b2228d3d91fb27df3189eea60001b82600001518360200151612495856040015161350d565b6124a2866060015161350d565b6124af8760800151613570565b6040516020016124c496959493929190614c2c565b604051602081830303815290604052805190602001209050919050565b60008086600401541180156124fa575042866004015411155b156125125750845460ff191660049081178655612607565b6001600160a01b03851660009081526002870160205260409020541561257c57612546856001600160a01b031660146135b3565b6040516020016125569190614c66565b60408051601f198184030181529082905262461bcd60e51b825261096791600401614cba565b6001600160a01b03851660009081526002870160209081526040808320859055848352600389019091528120805486919083906125ba908490614ccd565b92505081905590508381101580156125e757506000875460ff1660048111156125e5576125e5613fc9565b145b156125ff57865460ff19166001908117885587018390555b5050845460ff165b95945050505050565b6116cd813361374e565b612624828261378c565b6000828152606c60205260409020610dbe9082613812565b6126468282613827565b6000828152606c60205260409020610dbe908261388e565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b6126946138a3565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b8281146126fd5760405162461bcd60e51b8152600401610967906148de565b60005b838110156127785782828281811061271a5761271a614754565b905060200201356038600087878581811061273757612737614754565b905060200201602081019061274c919061423a565b6001600160a01b0316815260208101919091526040016000205580612770816147fc565b915050612700565b507f6f52f53a938df83439fa4c6055c7df0a6906d621aa6dfa4708187037fdfc41da848484846040516127ae9493929190614d59565b60405180910390a150505050565b6074546040805163158b54c160e21b815290516000926001600160a01b03169163562d53049160048083019260209291908290030181865afa158015612806573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061134a9190614d8b565b60006002546001600254846001546128429190614a14565b61284c9190614ccd565b6128569190614da4565b6109959190614db7565b612868611fd2565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a2586126c13390565b6000610edd83836138ec565b606e8054600091826128ba836147fc565b90915550905060006128e1848385886128d8368c90038c018c614dd9565b93929190613916565b60008381526071602090815260409091208251815590820151600180830180549495508594909160ff1990911690838181111561292057612920613fc9565b021790555060408281015180516002840180546001600160a01b039283166001600160a01b03199182161790915560208084015160038701805491851691841691909117905592840151600486015560608601518051600587018054918516918416919091179055928301516006860180549190931691161790550151600782015560808201518051600883018054909190829060ff1916600183818111156129cb576129cb613fc9565b0217905550602082015181600101556040820151816002015550509050507ff313c253a5be72c29d0deb2c8768a9543744ac03d6b3cafd50cc976f1c2632fc612a1382612458565b82604051612a22929190614785565b60405180910390a150949350505050565b607580546001600160a01b0319166001600160a01b0383169081179091556040519081527f034c8da497df28467c79ddadbba1cc3cdd41f510ea73faae271e6f16a6111621906020015b60405180910390a150565b6109ae828261261a565b60008082841115612ae55760405162461bcd60e51b815260206004820152601c60248201527f4761746577617956323a20696e76616c6964207468726573686f6c64000000006044820152606401610967565b50506001805460028054928590558390556004805491929184918691906000612b0d836147fc565b9091555060408051868152602081018690527f976f8a9c5bdf8248dec172376d6e2b80a8e3df2f0328e381c6db8e1cf138c0f8910160405180910390a49250929050565b8685148015612b5f57508683145b612b7b5760405162461bcd60e51b815260040161096790614a2b565b60005b87811015612d1757868682818110612b9857612b98614754565b9050602002016020810190612bad919061423a565b607360008b8b85818110612bc357612bc3614754565b9050602002016020810190612bd8919061423a565b6001600160a01b03166001600160a01b031681526020019081526020016000206000878785818110612c0c57612c0c614754565b90506020020135815260200190815260200160002060000160016101000a8154816001600160a01b0302191690836001600160a01b03160217905550828282818110612c5a57612c5a614754565b9050602002016020810190612c6f9190614925565b607360008b8b85818110612c8557612c85614754565b9050602002016020810190612c9a919061423a565b6001600160a01b03166001600160a01b031681526020019081526020016000206000878785818110612cce57612cce614754565b60209081029290920135835250810191909152604001600020805460ff191660018381811115612d0057612d00613fc9565b021790555080612d0f816147fc565b915050612b7e565b507f2544bff60c6d5b84946e06804af9f84e150bbee85238dbdee79efca4e0adf4018888888888888888604051612d55989796959493929190614e28565b60405180910390a15050505050505050565b6000610995825490565b607480546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990602001612a7d565b600081516001811115612dd457612dd4613fc9565b148015612de5575060008160400151115b8015612df357506020810151155b80612e1d5750600181516001811115612e0e57612e0e613fc9565b148015612e1d57506040810151155b6116cd5760405162461bcd60e51b8152602060048201526013602482015272546f6b656e3a20696e76616c696420696e666f60681b6044820152606401610967565b6000612e716060830160408401614925565b6001811115612e8257612e82613fc9565b141580612ec0575060386000612e9e604084016020850161423a565b6001600160a01b03168152602081019190915260400160002054608082013510155b6116cd5760405162461bcd60e51b815260206004820152602f60248201527f4d696e696d756d5769746864726177616c3a20717565727920666f7220746f6f60448201526e20736d616c6c207175616e7469747960881b6064820152608401610967565b600060608186516001811115612f3c57612f3c613fc9565b036130195760408681015181516001600160a01b038881166024830152878116604483015260648083019390935283518083039093018352608490910183526020820180516001600160e01b03166323b872dd60e01b179052915191851691612fa59190614eb7565b6000604051808303816000865af19150503d8060008114612fe2576040519150601f19603f3d011682016040523d82523d6000602084013e612fe7565b606091505b5090925090508180156130125750805115806130125750808060200190518101906130129190614c0a565b9150613136565b60018651600181111561302e5761302e613fc9565b036130e457602086810151604080516001600160a01b0389811660248301528881166044830152606480830194909452825180830390940184526084909101825292820180516001600160e01b03166323b872dd60e01b17905251918516916130979190614eb7565b6000604051808303816000865af19150503d80600081146130d4576040519150601f19603f3d011682016040523d82523d6000602084013e6130d9565b606091505b505080925050613136565b60405162461bcd60e51b815260206004820152602160248201527f546f6b656e3a20756e737570706f7274656420746f6b656e207374616e6461726044820152601960fa1b6064820152608401610967565b8161165a5761314486613982565b613158866001600160a01b031660146135b3565b61316c866001600160a01b031660146135b3565b613180866001600160a01b031660146135b3565b6040516020016125569493929190614ed3565b6000816001600160a01b0316836001600160a01b0316036132425760408086015190516001600160a01b0386169180156108fc02916000818181858888f1935050505061323d57816001600160a01b031663d0e30db086604001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561321957600080fd5b505af115801561322d573d6000803e3d6000fd5b505050505061323d8585856139ef565b6120e9565b60008551600181111561325757613257613fc9565b036133ef576040516370a0823160e01b81523060048201526000906001600160a01b038516906370a0823190602401602060405180830381865afa1580156132a3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132c79190614d8b565b905085604001518110156133de57836001600160a01b03166340c10f19308389604001516132f59190614da4565b6040516001600160a01b03909216602483015260448201526064016040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516133499190614eb7565b6000604051808303816000865af19150503d8060008114613386576040519150601f19603f3d011682016040523d82523d6000602084013e61338b565b606091505b505080925050816133de5760405162461bcd60e51b815260206004820152601b60248201527f546f6b656e3a204552433230206d696e74696e67206661696c656400000000006044820152606401610967565b6133e98686866139ef565b506120e9565b60018551600181111561340457613404613fc9565b036130e45761341883858760200151613a91565b61323d57602085810151604080516001600160a01b038881166024830152604480830194909452825180830390940184526064909101825292820180516001600160e01b03166340c10f1960e01b17905251918516916134789190614eb7565b6000604051808303816000865af19150503d80600081146134b5576040519150601f19603f3d011682016040523d82523d6000602084013e6134ba565b606091505b5050809150508061323d5760405162461bcd60e51b815260206004820152601c60248201527f546f6b656e3a20455243373231206d696e74696e67206661696c6564000000006044820152606401610967565b805160208083015160408085015190516000946124c4947f353bdd8d69b9e3185b3972e08b03845c0c14a21a390215302776a7a34b0e87649491939192019384526001600160a01b03928316602085015291166040830152606082015260800190565b805160208083015160408085015190516000946124c4947f1e2b74b2a792d5c0f0b6e59b037fa9d43d84fbb759337f0112fcc15ca414fc8d949193919201614f8c565b606060006135c2836002614a14565b6135cd906002614ccd565b6001600160401b038111156135e4576135e46145ae565b6040519080825280601f01601f19166020018201604052801561360e576020820181803683370190505b509050600360fc1b8160008151811061362957613629614754565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061365857613658614754565b60200101906001600160f81b031916908160001a905350600061367c846002614a14565b613687906001614ccd565b90505b60018111156136ff576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106136bb576136bb614754565b1a60f81b8282815181106136d1576136d1614754565b60200101906001600160f81b031916908160001a90535060049490941c936136f881614fb7565b905061368a565b508315610edd5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610967565b6137588282611479565b6109ae57613770816001600160a01b031660146135b3565b61377b8360206135b3565b604051602001612556929190614fce565b6137968282611479565b6109ae576000828152606b602090815260408083206001600160a01b03851684529091529020805460ff191660011790556137ce3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000610edd836001600160a01b038416613b3c565b6138318282611479565b156109ae576000828152606b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000610edd836001600160a01b038416613b8b565b60005460ff16610f245760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610967565b600082600001828154811061390357613903614754565b9060005260206000200154905092915050565b61391e613d9f565b92835260016020808501919091526060840180516001600160a01b0396871690528682015181519087169083015251466040918201528651818601805191881690915280519490961693909101929092529251810192909252910151608082015290565b60606139ad8260000151600181111561399d5761399d613fc9565b6001600160a01b031660016135b3565b6139ba8360200151613c7e565b6139c78460400151613c7e565b6040516020016139d993929190615043565b6040516020818303038152906040529050919050565b60008084516001811115613a0557613a05613fc9565b03613a2057613a1982848660400151613cd5565b9050613a49565b600184516001811115613a3557613a35613fc9565b036130e457613a1982848660200151613a91565b806111f457613a5784613982565b613a6b846001600160a01b031660146135b3565b613a7f846001600160a01b031660146135b3565b604051602001612556939291906150c1565b604080513060248201526001600160a01b038481166044830152606480830185905283518084039091018152608490920183526020820180516001600160e01b03166323b872dd60e01b1790529151600092861691613aef91614eb7565b6000604051808303816000865af19150503d8060008114613b2c576040519150601f19603f3d011682016040523d82523d6000602084013e613b31565b606091505b509095945050505050565b6000818152600183016020526040812054613b8357508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610995565b506000610995565b60008181526001830160205260408120548015613c74576000613baf600183614da4565b8554909150600090613bc390600190614da4565b9050818114613c28576000866000018281548110613be357613be3614754565b9060005260206000200154905080876000018481548110613c0657613c06614754565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613c3957613c39615152565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610995565b6000915050610995565b606081600003613ca85750506040805180820190915260048152630307830360e41b602082015290565b8160005b8115613ccb5780613cbc816147fc565b915050600882901c9150613cac565b611f9584826135b3565b604080516001600160a01b038481166024830152604480830185905283518084039091018152606490920183526020820180516001600160e01b031663a9059cbb60e01b179052915160009260609290871691613d329190614eb7565b6000604051808303816000865af19150503d8060008114613d6f576040519150601f19603f3d011682016040523d82523d6000602084013e613d74565b606091505b5090925090508180156126075750805115806126075750808060200190518101906126079190614c0a565b6040805160a08101825260008082526020808301829052835160608082018652838252818301849052818601849052848601919091528451808201865283815280830184905280860184905281850152845190810185528281529081018290529283015290608082015290565b600060208284031215613e1e57600080fd5b81356001600160e01b031981168114610edd57600080fd5b60008082840360c0811215613e4a57600080fd5b60a0811215613e5857600080fd5b50919360a08501359350915050565b60006101608284031215613e7a57600080fd5b50919050565b60008083601f840112613e9257600080fd5b5081356001600160401b03811115613ea957600080fd5b6020830191508360208260051b8501011115611a8e57600080fd5b60008060208385031215613ed757600080fd5b82356001600160401b03811115613eed57600080fd5b613ef985828601613e80565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b81811015613f3f578351151583529284019291840191600101613f21565b50909695505050505050565b600060208284031215613f5d57600080fd5b5035919050565b80356001600160a01b038116811461219257600080fd5b60008060408385031215613f8e57600080fd5b82359150613f9e60208401613f64565b90509250929050565b60008060408385031215613fba57600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b6080810160058610613ff357613ff3613fc9565b9481526020810193909352604083019190915260609091015290565b60008083601f84011261402157600080fd5b5081356001600160401b0381111561403857600080fd5b60208301915083602060a083028501011115611a8e57600080fd5b60008060006040848603121561406857600080fd5b83356001600160401b0381111561407e57600080fd5b61408a8682870161400f565b909790965060209590950135949350505050565b600080604083850312156140b157600080fd5b6140ba83613f64565b946020939093013593505050565b600281106116cd576116cd613fc9565b815160408201906140e8816140c8565b82526020928301516001600160a01b0316929091019190915290565b6000806000806040858703121561411a57600080fd5b84356001600160401b038082111561413157600080fd5b61413d88838901613e80565b9096509450602087013591508082111561415657600080fd5b5061416387828801613e80565b95989497509550505050565b80516001600160a01b03908116835260208083015190911690830152604090810151910152565b80516141a1816140c8565b825260208181015190830152604090810151910152565b85815261016081016141c9866140c8565b8560208301526141dc604083018661416f565b6141e960a083018561416f565b6141f7610100830184614196565b9695505050505050565b6000806000806040858703121561421757600080fd5b84356001600160401b038082111561422e57600080fd5b61413d8883890161400f565b60006020828403121561424c57600080fd5b610edd82613f64565b806040810183101561099557600080fd5b600080600080600080600080600060e08a8c03121561428457600080fd5b61428d8a613f64565b985060208a0135975060408a0135965060608a01356001600160401b03808211156142b757600080fd5b6142c38d838e01613e80565b909850965060808c01359150808211156142dc57600080fd5b6142e88d838e01614255565b955060a08c01359150808211156142fe57600080fd5b61430a8d838e01614255565b945060c08c013591508082111561432057600080fd5b5061432d8c828d01613e80565b915080935050809150509295985092959850929598565b6000806020838503121561435757600080fd5b82356001600160401b038082111561436e57600080fd5b818501915085601f83011261438257600080fd5b81358181111561439157600080fd5b866020610160830285010111156143a757600080fd5b60209290920196919550909350505050565b6000806000806000806000806080898b0312156143d557600080fd5b88356001600160401b03808211156143ec57600080fd5b6143f88c838d01613e80565b909a50985060208b013591508082111561441157600080fd5b61441d8c838d01613e80565b909850965060408b013591508082111561443657600080fd5b6144428c838d01613e80565b909650945060608b013591508082111561445b57600080fd5b506144688b828c01613e80565b999c989b5096995094979396929594505050565b60008060006040848603121561449157600080fd5b8335925060208401356001600160401b038111156144ae57600080fd5b6144ba86828701613e80565b9497909650939450505050565b60005b838110156144e25781810151838201526020016144ca565b50506000910152565b600081518084526145038160208601602086016144c7565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b8281101561456c57603f1988860301845261455a8583516144eb565b9450928501929085019060010161453e565b5092979650505050505050565b60008060006060848603121561458e57600080fd5b83359250602084013591506145a560408501613f64565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b03811182821017156145e6576145e66145ae565b60405290565b600281106116cd57600080fd5b60006060828403121561460b57600080fd5b6146136145c4565b905061461e82613f64565b815261462c60208301613f64565b60208201526040820135604082015292915050565b60006060828403121561465357600080fd5b61465b6145c4565b90508135614668816145ec565b80825250602082013560208201526040820135604082015292915050565b6000610160828403121561469957600080fd5b60405160a081018181106001600160401b03821117156146bb576146bb6145ae565b6040528235815260208301356146d0816145ec565b60208201526146e284604085016145f9565b60408201526146f48460a085016145f9565b6060820152614707846101008501614641565b60808201529392505050565b6003811061472357614723613fc9565b9052565b606081016147358286614713565b60208201939093526001600160a01b0391909116604090910152919050565b634e487b7160e01b600052603260045260246000fd5b604081016147788285614713565b8260208301529392505050565b6000610180820190508382528251602083015260208301516147a6816140c8565b8060408401525060408301516147bf606084018261416f565b5060608301516147d260c084018261416f565b506080830151611d41610120840182614196565b634e487b7160e01b600052601160045260246000fd5b60006001820161480e5761480e6147e6565b5060010190565b60208082526023908201527f526f6e696e4761746577617956323a20756e617574686f72697a65642073656e6040820152623232b960e91b606082015260800190565b60208082526024908201527f526f6e696e4761746577617956323a207769746864726177616c73206d696772604082015263185d195960e21b606082015260800190565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b60208082526027908201527f4d696e696d756d5769746864726177616c3a20696e76616c6964206172726179604082015266040d8cadccee8d60cb1b606082015260800190565b60006020828403121561493757600080fd5b8135610edd816145ec565b60208082526026908201527f526f6e696e4761746577617956323a20696e76616c696420746f6b656e207374604082015265185b99185c9960d21b606082015260800190565b60208082526023908201527f526f6e696e4761746577617956323a2073657420746f206e6f6e2d636f6e74726040820152621858dd60ea1b606082015260800190565b6000808335601e198436030181126149e257600080fd5b8301803591506001600160401b038211156149fc57600080fd5b6020019150600581901b3603821315611a8e57600080fd5b8082028115828204841417610995576109956147e6565b60208082526024908201527f526f6e696e4761746577617956323a20696e76616c6964206172726179206c656040820152630dccee8d60e31b606082015260800190565b600181811c90821680614a8357607f821691505b602082108103613e7a57634e487b7160e01b600052602260045260246000fd5b6000808335601e19843603018112614aba57600080fd5b8301803591506001600160401b03821115614ad457600080fd5b602001915036819003821315611a8e57600080fd5b601f821115610dbe57600081815260208120601f850160051c81016020861015614b105750805b601f850160051c820191505b8181101561165a57828155600101614b1c565b6001600160401b03831115614b4657614b466145ae565b614b5a83614b548354614a6f565b83614ae9565b6000601f841160018114614b8e5760008515614b765750838201355b600019600387901b1c1916600186901b1783556120e9565b600083815260209020601f19861690835b82811015614bbf5786850135825560209485019460019092019101614b9f565b5086821015614bdc5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600060608284031215614c0057600080fd5b610edd8383614641565b600060208284031215614c1c57600080fd5b81518015158114610edd57600080fd5b8681526020810186905260c08101614c43866140c8565b8560408301528460608301528360808301528260a0830152979650505050505050565b73024b9b7b630ba32b223b7bb32b93730b731b29d160651b815260008251614c958160148501602087016144c7565b6d08185b1c9958591e481d9bdd195960921b6014939091019283015250602201919050565b602081526000610edd60208301846144eb565b80820180821115610995576109956147e6565b8183526000602080850194508260005b85811015614d1c576001600160a01b03614d0983613f64565b1687529582019590820190600101614cf0565b509495945050505050565b81835260006001600160fb1b03831115614d4057600080fd5b8260051b80836020870137939093016020019392505050565b604081526000614d6d604083018688614ce0565b8281036020840152614d80818587614d27565b979650505050505050565b600060208284031215614d9d57600080fd5b5051919050565b81810381811115610995576109956147e6565b600082614dd457634e487b7160e01b600052601260045260246000fd5b500490565b600060a08284031215614deb57600080fd5b614df36145c4565b614dfc83613f64565b8152614e0a60208401613f64565b6020820152614e1c8460408501614641565b60408201529392505050565b608081526000614e3c608083018a8c614ce0565b602083820381850152614e50828a8c614ce0565b91508382036040850152614e6582888a614d27565b8481036060860152858152869250810160005b86811015614ea6578335614e8b816145ec565b614e94816140c8565b82529282019290820190600101614e78565b509c9b505050505050505050505050565b60008251614ec98184602087016144c7565b9190910192915050565b7f546f6b656e3a20636f756c64206e6f74207472616e73666572200000000000008152600085516020614f0c82601a8601838b016144c7565b65010333937b6960d51b601a928501928301528651614f3081838501848b016144c7565b630103a37960e51b9201818101929092528551614f5381602485018985016144c7565b660103a37b5b2b7160cd1b602493909101928301528451614f7a81602b85018489016144c7565b91909101602b01979650505050505050565b84815260808101614f9c856140c8565b84602083015283604083015282606083015295945050505050565b600081614fc657614fc66147e6565b506000190190565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516150068160178501602088016144c7565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516150378160288401602088016144c7565b01602801949350505050565b690a8ded6cadc92dcccde560b31b81526000845161506881600a8501602089016144c7565b8083019050600b60fa1b80600a830152855161508b81600b850160208a016144c7565b600b92019182015283516150a681600c8401602088016144c7565b602960f81b600c9290910191820152600d0195945050505050565b7f546f6b656e3a20636f756c64206e6f74207472616e73666572200000000000008152600084516150f981601a8501602089016144c7565b630103a37960e51b601a91840191820152845161511d81601e8401602089016144c7565b660103a37b5b2b7160cd1b601e929091019182015283516151458160258401602088016144c7565b0160250195945050505050565b634e487b7160e01b600052603160045260246000fdfe384495a48d92b97cd9b9d199c73ed783dd1aa0076a6ebcf9156ca7fef7d2cc40a26469706673582212206f3a8735b2344a2af6f5c9674b234e03c719f969c28f8bccf96400466868addf64736f6c63430008110033", + "numDeployments": 4, + "solcInputHash": "85b953b22882c536a643bf4b61b3153b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"ErrCallerMustBeBridgeTrackingContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeRoninTrustedOrgContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"BridgeTrackingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"receiptHash\",\"type\":\"bytes32\"}],\"name\":\"DepositVoted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"receiptHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"struct Transfer.Receipt\",\"name\":\"receipt\",\"type\":\"tuple\"}],\"name\":\"Deposited\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"receiptHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"struct Transfer.Receipt\",\"name\":\"receipt\",\"type\":\"tuple\"}],\"name\":\"MainchainWithdrew\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"threshold\",\"type\":\"uint256[]\"}],\"name\":\"MinimumThresholdsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Paused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"RoninTrustedOrganizationContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"numerator\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"denominator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousNumerator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousDenominator\",\"type\":\"uint256\"}],\"name\":\"ThresholdUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"roninTokens\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"mainchainTokens\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"chainIds\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"enum Token.Standard[]\",\"name\":\"standards\",\"type\":\"uint8[]\"}],\"name\":\"TokenMapped\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"numerator\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"denominator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousNumerator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousDenominator\",\"type\":\"uint256\"}],\"name\":\"TrustedThresholdUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"Unpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"receiptHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"struct Transfer.Receipt\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"WithdrawalRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"receiptHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"indexed\":false,\"internalType\":\"struct Transfer.Receipt\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"WithdrawalSignaturesRequested\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"WITHDRAWAL_MIGRATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bridgeTrackingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"internalType\":\"struct Transfer.Request[]\",\"name\":\"_requests\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"}],\"name\":\"bulkRequestWithdrawalFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_withdrawals\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_signatures\",\"type\":\"bytes[]\"}],\"name\":\"bulkSubmitWithdrawalSignatures\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_voteWeight\",\"type\":\"uint256\"}],\"name\":\"checkThreshold\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"internalType\":\"struct Transfer.Receipt\",\"name\":\"_receipt\",\"type\":\"tuple\"}],\"name\":\"depositFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"depositVote\",\"outputs\":[{\"internalType\":\"enum VoteStatusConsumer.VoteStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"finalHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"expiredAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_depositId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"depositVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyPauser\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_roninToken\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"}],\"name\":\"getMainchainToken\",\"outputs\":[{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"}],\"internalType\":\"struct MappedTokenConsumer.MappedToken\",\"name\":\"_token\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"num_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"denom_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getTrustedThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"trustedNum_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"trustedDenom_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawalId\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_validators\",\"type\":\"address[]\"}],\"name\":\"getWithdrawalSignatures\",\"outputs\":[{\"internalType\":\"bytes[]\",\"name\":\"_signatures\",\"type\":\"bytes[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_roleSetter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_numerator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_denominator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_trustedNumerator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_trustedDenominator\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_withdrawalMigrators\",\"type\":\"address[]\"},{\"internalType\":\"address[][2]\",\"name\":\"_packedAddresses\",\"type\":\"address[][2]\"},{\"internalType\":\"uint256[][2]\",\"name\":\"_packedNumbers\",\"type\":\"uint256[][2]\"},{\"internalType\":\"enum Token.Standard[]\",\"name\":\"_standards\",\"type\":\"uint8[]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawalId\",\"type\":\"uint256\"}],\"name\":\"mainchainWithdrew\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"mainchainWithdrewVote\",\"outputs\":[{\"internalType\":\"enum VoteStatusConsumer.VoteStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"finalHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"expiredAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawalId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"mainchainWithdrewVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_roninTokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_mainchainTokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_chainIds\",\"type\":\"uint256[]\"},{\"internalType\":\"enum Token.Standard[]\",\"name\":\"_standards\",\"type\":\"uint8[]\"}],\"name\":\"mapTokens\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"markWithdrawalMigrated\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"internalType\":\"struct Transfer.Request[]\",\"name\":\"_requests\",\"type\":\"tuple[]\"},{\"internalType\":\"address[]\",\"name\":\"_requesters\",\"type\":\"address[]\"}],\"name\":\"migrateWithdrawals\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"minimumThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minimumTrustedVoteWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minimumVoteWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"nonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"pause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"paused\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"internalType\":\"struct Transfer.Request\",\"name\":\"_request\",\"type\":\"tuple\"},{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawalFor\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_withdrawalId\",\"type\":\"uint256\"}],\"name\":\"requestWithdrawalSignatures\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninTrustedOrganizationContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setBridgeTrackingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setEmergencyPauser\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_tokens\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_thresholds\",\"type\":\"uint256[]\"}],\"name\":\"setMinimumThresholds\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setRoninTrustedOrganizationContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numerator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_denominator\",\"type\":\"uint256\"}],\"name\":\"setThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_trustedNumerator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_trustedDenominator\",\"type\":\"uint256\"}],\"name\":\"setTrustedThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_withdrawalIds\",\"type\":\"uint256[]\"}],\"name\":\"tryBulkAcknowledgeMainchainWithdrew\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_executedReceipts\",\"type\":\"bool[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"internalType\":\"struct Transfer.Receipt[]\",\"name\":\"_receipts\",\"type\":\"tuple[]\"}],\"name\":\"tryBulkDepositFor\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_executedReceipts\",\"type\":\"bool[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"unpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"withdrawal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"enum Transfer.Kind\",\"name\":\"kind\",\"type\":\"uint8\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"mainchain\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Owner\",\"name\":\"ronin\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"enum Token.Standard\",\"name\":\"erc\",\"type\":\"uint8\"},{\"internalType\":\"uint256\",\"name\":\"id\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"quantity\",\"type\":\"uint256\"}],\"internalType\":\"struct Token.Info\",\"name\":\"info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawalCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"withdrawalMigrated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"withdrawalStatVote\",\"outputs\":[{\"internalType\":\"enum VoteStatusConsumer.VoteStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"finalHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"expiredAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"createdAt\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrCallerMustBeBridgeTrackingContract()\":[{\"details\":\"Error of method caller must be bridge tracking contract.\"}],\"ErrCallerMustBeRoninTrustedOrgContract()\":[{\"details\":\"Error of method caller must be Ronin trusted org contract.\"}],\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"bridgeTrackingContract()\":{\"details\":\"Returns the bridge tracking contract.\"},\"bulkRequestWithdrawalFor((address,address,(uint8,uint256,uint256))[],uint256)\":{\"details\":\"Bulk requests withdrawals. Emits the `WithdrawalRequested` events.\"},\"bulkSubmitWithdrawalSignatures(uint256[],bytes[])\":{\"details\":\"Submits withdrawal signatures. Requirements: - The method caller is a validator.\"},\"checkThreshold(uint256)\":{\"details\":\"Checks whether the `_voteWeight` passes the threshold.\"},\"depositFor((uint256,uint8,(address,address,uint256),(address,address,uint256),(uint8,uint256,uint256)))\":{\"details\":\"Deposits based on the receipt. Requirements: - The method caller is a validator. Emits the `Deposited` once the assets are released.\"},\"depositVoted(uint256,uint256,address)\":{\"details\":\"Returns whether the deposit is casted by the voter.\"},\"getMainchainToken(address,uint256)\":{\"details\":\"Returns mainchain token address. Reverts for unsupported token.\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"getThreshold()\":{\"details\":\"Returns the threshold.\"},\"getTrustedThreshold()\":{\"details\":\"Returns the threshold about trusted org.\"},\"getWithdrawalSignatures(uint256,address[])\":{\"details\":\"Returns withdrawal signatures.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"initialize(address,uint256,uint256,uint256,uint256,address[],address[][2],uint256[][2],uint8[])\":{\"details\":\"Initializes contract storage.\"},\"mainchainWithdrew(uint256)\":{\"details\":\"Returns whether the withdrawal is done on mainchain.\"},\"mainchainWithdrewVoted(uint256,address)\":{\"details\":\"Returns whether the mainchain withdrew is casted by the voter.\"},\"mapTokens(address[],address[],uint256[],uint8[])\":{\"details\":\"Maps Ronin tokens to mainchain networks. Requirement: - The method caller is admin. - The arrays have the same length and its length larger than 0. Emits the `TokenMapped` event.\"},\"markWithdrawalMigrated()\":{\"details\":\"Mark the migration as done.\"},\"migrateWithdrawals((address,address,(uint8,uint256,uint256))[],address[])\":{\"details\":\"Migrates withdrawals. Requirements: - The method caller is the migrator. - The arrays have the same length and its length larger than 0.\"},\"minimumTrustedVoteWeight()\":{\"details\":\"Returns the minimum trusted vote weight to pass the threshold.\"},\"minimumVoteWeight()\":{\"details\":\"Returns the minimum vote weight to pass the threshold.\"},\"pause()\":{\"details\":\"Triggers paused state.\"},\"paused()\":{\"details\":\"Returns true if the contract is paused, and false otherwise.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"requestWithdrawalFor((address,address,(uint8,uint256,uint256)),uint256)\":{\"details\":\"Locks the assets and request withdrawal. Emits the `WithdrawalRequested` event.\"},\"requestWithdrawalSignatures(uint256)\":{\"details\":\"Requests withdrawal signatures for a specific withdrawal. Emits the `WithdrawalSignaturesRequested` event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"roninTrustedOrganizationContract()\":{\"details\":\"Returns the ronin trusted organization contract.\"},\"setBridgeTrackingContract(address)\":{\"details\":\"Sets the bridge tracking contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `BridgeTrackingContractUpdated`.\"},\"setEmergencyPauser(address)\":{\"details\":\"Grant emergency pauser role for `_addr`.\"},\"setMinimumThresholds(address[],uint256[])\":{\"details\":\"Sets the minimum thresholds to withdraw. Requirements: - The method caller is admin. - The arrays have the same length and its length larger than 0. Emits the `MinimumThresholdsUpdated` event.\"},\"setRoninTrustedOrganizationContract(address)\":{\"details\":\"Sets the ronin trusted organization contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `RoninTrustedOrganizationContractUpdated`.\"},\"setThreshold(uint256,uint256)\":{\"details\":\"Sets the threshold. Requirements: - The method caller is admin. Emits the `ThresholdUpdated` event.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"tryBulkAcknowledgeMainchainWithdrew(uint256[])\":{\"details\":\"Marks the withdrawals are done on mainchain and returns the boolean array indicating whether the withdrawal vote is already done before. Requirements: - The method caller is a validator. Emits the `MainchainWithdrew` once the valid call passes the quorum threshold.\"},\"tryBulkDepositFor((uint256,uint8,(address,address,uint256),(address,address,uint256),(uint8,uint256,uint256))[])\":{\"details\":\"Tries bulk deposits based on the receipts and returns the boolean array indicating whether the deposit vote is already done before. Reverts if the deposit is invalid or is voted by the validator again. Requirements: - The method caller is a validator. Emits the `Deposited` once the assets are released.\"},\"unpause()\":{\"details\":\"Triggers unpaused state.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"}},\"stateVariables\":{\"WITHDRAWAL_MIGRATOR\":{\"details\":\"Withdrawal unlocker role hash\"},\"_bridgeTrackingContract\":{\"details\":\"The bridge tracking contract\"},\"_mainchainToken\":{\"details\":\"Mapping from token address => chain id => mainchain token address\"},\"_trustedOrgContract\":{\"details\":\"The trusted organization contract\"},\"_validatorContract\":{\"details\":\"The ronin validator contract\"},\"_withdrawalSig\":{\"details\":\"Mapping from withdrawal id => validator address => signatures\"},\"depositVote\":{\"details\":\"Mapping from chain id => deposit id => deposit vote\"},\"mainchainWithdrewVote\":{\"details\":\"Mapping from withdrawal id => mainchain withdrew vote\"},\"withdrawal\":{\"details\":\"Mapping from withdrawal id => withdrawal receipt\"},\"withdrawalCount\":{\"details\":\"Total withdrawal\"},\"withdrawalMigrated\":{\"details\":\"Flag indicating whether the withdrawal migrate progress is done\"},\"withdrawalStatVote\":{\"details\":\"Mapping from withdrawal id => vote for recording withdrawal stats\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"depositFor((uint256,uint8,(address,address,uint256),(address,address,uint256),(uint8,uint256,uint256)))\":{\"notice\":\"The assets will be transferred whenever the valid call passes the quorum threshold.\"},\"tryBulkAcknowledgeMainchainWithdrew(uint256[])\":{\"notice\":\"Not reverting to avoid unnecessary failed transactions because the validators can send transactions at the same time.\"},\"tryBulkDepositFor((uint256,uint8,(address,address,uint256),(address,address,uint256),(uint8,uint256,uint256))[])\":{\"notice\":\"The assets will be transferred whenever the valid call for the receipt passes the quorum threshold. Not reverting to avoid unnecessary failed transactions because the validators can send transactions at the same time.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/gateway/RoninGatewayV2.sol\":\"RoninGatewayV2\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(uint160(account), 20),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5b35d8e68aeaccc685239bd9dd79b9ba01a0357930f8a3307ab85511733d9724\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/AccessControlEnumerable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlEnumerable.sol\\\";\\nimport \\\"./AccessControl.sol\\\";\\nimport \\\"../utils/structs/EnumerableSet.sol\\\";\\n\\n/**\\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\\n */\\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\\n return _roleMembers[role].at(index);\\n }\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\\n return _roleMembers[role].length();\\n }\\n\\n /**\\n * @dev Overload {_grantRole} to track enumerable memberships\\n */\\n function _grantRole(bytes32 role, address account) internal virtual override {\\n super._grantRole(role, account);\\n _roleMembers[role].add(account);\\n }\\n\\n /**\\n * @dev Overload {_revokeRole} to track enumerable memberships\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual override {\\n super._revokeRole(role, account);\\n _roleMembers[role].remove(account);\\n }\\n}\\n\",\"keccak256\":\"0x13f5e15f2a0650c0b6aaee2ef19e89eaf4870d6e79662d572a393334c1397247\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControlEnumerable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\n\\n/**\\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\\n */\\ninterface IAccessControlEnumerable is IAccessControl {\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xba4459ab871dfa300f5212c6c30178b63898c03533a1ede28436f11546626676\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/Pausable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/Context.sol\\\";\\n\\n/**\\n * @dev Contract module which allows children to implement an emergency stop\\n * mechanism that can be triggered by an authorized account.\\n *\\n * This module is used through inheritance. It will make available the\\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\\n * the functions of your contract. Note that they will not be pausable by\\n * simply including this module, only once the modifiers are put in place.\\n */\\nabstract contract Pausable is Context {\\n /**\\n * @dev Emitted when the pause is triggered by `account`.\\n */\\n event Paused(address account);\\n\\n /**\\n * @dev Emitted when the pause is lifted by `account`.\\n */\\n event Unpaused(address account);\\n\\n bool private _paused;\\n\\n /**\\n * @dev Initializes the contract in unpaused state.\\n */\\n constructor() {\\n _paused = false;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is not paused.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n modifier whenNotPaused() {\\n _requireNotPaused();\\n _;\\n }\\n\\n /**\\n * @dev Modifier to make a function callable only when the contract is paused.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n modifier whenPaused() {\\n _requirePaused();\\n _;\\n }\\n\\n /**\\n * @dev Returns true if the contract is paused, and false otherwise.\\n */\\n function paused() public view virtual returns (bool) {\\n return _paused;\\n }\\n\\n /**\\n * @dev Throws if the contract is paused.\\n */\\n function _requireNotPaused() internal view virtual {\\n require(!paused(), \\\"Pausable: paused\\\");\\n }\\n\\n /**\\n * @dev Throws if the contract is not paused.\\n */\\n function _requirePaused() internal view virtual {\\n require(paused(), \\\"Pausable: not paused\\\");\\n }\\n\\n /**\\n * @dev Triggers stopped state.\\n *\\n * Requirements:\\n *\\n * - The contract must not be paused.\\n */\\n function _pause() internal virtual whenNotPaused {\\n _paused = true;\\n emit Paused(_msgSender());\\n }\\n\\n /**\\n * @dev Returns to normal state.\\n *\\n * Requirements:\\n *\\n * - The contract must be paused.\\n */\\n function _unpause() internal virtual whenPaused {\\n _paused = false;\\n emit Unpaused(_msgSender());\\n }\\n}\\n\",\"keccak256\":\"0x0849d93b16c9940beb286a7864ed02724b248b93e0d80ef6355af5ef15c64773\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `from` to `to` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC721/IERC721.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../utils/introspection/IERC165.sol\\\";\\n\\n/**\\n * @dev Required interface of an ERC721 compliant contract.\\n */\\ninterface IERC721 is IERC165 {\\n /**\\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\\n */\\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\\n\\n /**\\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\\n */\\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\\n\\n /**\\n * @dev Returns the number of tokens in ``owner``'s account.\\n */\\n function balanceOf(address owner) external view returns (uint256 balance);\\n\\n /**\\n * @dev Returns the owner of the `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function ownerOf(uint256 tokenId) external view returns (address owner);\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId,\\n bytes calldata data\\n ) external;\\n\\n /**\\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must exist and be owned by `from`.\\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\\n *\\n * Emits a {Transfer} event.\\n */\\n function safeTransferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Transfers `tokenId` token from `from` to `to`.\\n *\\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\\n *\\n * Requirements:\\n *\\n * - `from` cannot be the zero address.\\n * - `to` cannot be the zero address.\\n * - `tokenId` token must be owned by `from`.\\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address from,\\n address to,\\n uint256 tokenId\\n ) external;\\n\\n /**\\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\\n * The approval is cleared when the token is transferred.\\n *\\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\\n *\\n * Requirements:\\n *\\n * - The caller must own the token or be an approved operator.\\n * - `tokenId` must exist.\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address to, uint256 tokenId) external;\\n\\n /**\\n * @dev Approve or remove `operator` as an operator for the caller.\\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\\n *\\n * Requirements:\\n *\\n * - The `operator` cannot be the caller.\\n *\\n * Emits an {ApprovalForAll} event.\\n */\\n function setApprovalForAll(address operator, bool _approved) external;\\n\\n /**\\n * @dev Returns the account approved for `tokenId` token.\\n *\\n * Requirements:\\n *\\n * - `tokenId` must exist.\\n */\\n function getApproved(uint256 tokenId) external view returns (address operator);\\n\\n /**\\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\\n *\\n * See {setApprovalForAll}\\n */\\n function isApprovedForAll(address owner, address operator) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xed6a749c5373af398105ce6ee3ac4763aa450ea7285d268c85d9eeca809cdb1f\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xdb7f5c28fc61cda0bd8ab60ce288e206b791643bcd3ba464a70cbec18895a2f5\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n return _values(set._inner);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x5050943b32b6a8f282573d166b2e9d87ab7eb4dbba4ab6acf36ecb54fe6995e4\",\"license\":\"MIT\"},\"contracts/extensions/GatewayV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/security/Pausable.sol\\\";\\nimport \\\"../interfaces/IQuorum.sol\\\";\\nimport \\\"./collections/HasProxyAdmin.sol\\\";\\n\\nabstract contract GatewayV2 is HasProxyAdmin, Pausable, IQuorum {\\n uint256 internal _num;\\n uint256 internal _denom;\\n\\n address private ______deprecated;\\n uint256 public nonce;\\n\\n address public emergencyPauser;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] private ______gap;\\n\\n /**\\n * @dev Grant emergency pauser role for `_addr`.\\n */\\n function setEmergencyPauser(address _addr) external onlyAdmin {\\n emergencyPauser = _addr;\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\\n return (_num, _denom);\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\\n return _voteWeight * _denom >= _num * _getTotalWeight();\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n virtual\\n onlyAdmin\\n returns (uint256, uint256)\\n {\\n return _setThreshold(_numerator, _denominator);\\n }\\n\\n /**\\n * @dev Triggers paused state.\\n */\\n function pause() external {\\n require(msg.sender == _getAdmin() || msg.sender == emergencyPauser, \\\"GatewayV2: not authorized pauser\\\");\\n _pause();\\n }\\n\\n /**\\n * @dev Triggers unpaused state.\\n */\\n function unpause() external {\\n require(msg.sender == _getAdmin() || msg.sender == emergencyPauser, \\\"GatewayV2: not authorized pauser\\\");\\n _unpause();\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function minimumVoteWeight() public view virtual returns (uint256) {\\n return _minimumVoteWeight(_getTotalWeight());\\n }\\n\\n /**\\n * @dev Sets threshold and returns the old one.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function _setThreshold(uint256 _numerator, uint256 _denominator)\\n internal\\n virtual\\n returns (uint256 _previousNum, uint256 _previousDenom)\\n {\\n require(_numerator <= _denominator, \\\"GatewayV2: invalid threshold\\\");\\n _previousNum = _num;\\n _previousDenom = _denom;\\n _num = _numerator;\\n _denom = _denominator;\\n emit ThresholdUpdated(nonce++, _numerator, _denominator, _previousNum, _previousDenom);\\n }\\n\\n /**\\n * @dev Returns minimum vote weight.\\n */\\n function _minimumVoteWeight(uint256 _totalWeight) internal view virtual returns (uint256) {\\n return (_num * _totalWeight + _denom - 1) / _denom;\\n }\\n\\n /**\\n * @dev Returns the total weight.\\n */\\n function _getTotalWeight() internal view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0xedf53a29f41b6a15350e8d4b57a4dcd5297011e2a2ad0a204efa1a550e837912\",\"license\":\"MIT\"},\"contracts/extensions/MinimumWithdrawal.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./collections/HasProxyAdmin.sol\\\";\\nimport \\\"../libraries/Transfer.sol\\\";\\n\\nabstract contract MinimumWithdrawal is HasProxyAdmin {\\n /// @dev Emitted when the minimum thresholds are updated\\n event MinimumThresholdsUpdated(address[] tokens, uint256[] threshold);\\n\\n /// @dev Mapping from token address => minimum thresholds\\n mapping(address => uint256) public minimumThreshold;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @dev Sets the minimum thresholds to withdraw.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The arrays have the same length and its length larger than 0.\\n *\\n * Emits the `MinimumThresholdsUpdated` event.\\n *\\n */\\n function setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) external virtual onlyAdmin {\\n require(_tokens.length > 0, \\\"MinimumWithdrawal: invalid array length\\\");\\n _setMinimumThresholds(_tokens, _thresholds);\\n }\\n\\n /**\\n * @dev Sets minimum thresholds.\\n *\\n * Requirements:\\n * - The array lengths are equal.\\n *\\n * Emits the `MinimumThresholdsUpdated` event.\\n *\\n */\\n function _setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\\n require(_tokens.length == _thresholds.length, \\\"MinimumWithdrawal: invalid array length\\\");\\n for (uint256 _i; _i < _tokens.length; _i++) {\\n minimumThreshold[_tokens[_i]] = _thresholds[_i];\\n }\\n emit MinimumThresholdsUpdated(_tokens, _thresholds);\\n }\\n\\n /**\\n * @dev Checks whether the request is larger than or equal to the minimum threshold.\\n */\\n function _checkWithdrawal(Transfer.Request calldata _request) internal view {\\n require(\\n _request.info.erc != Token.Standard.ERC20 || _request.info.quantity >= minimumThreshold[_request.tokenAddr],\\n \\\"MinimumWithdrawal: query for too small quantity\\\"\\n );\\n }\\n}\\n\",\"keccak256\":\"0x42d7ddf9210512fa99143e976f8a7c9a33bb85e428c553040b1eca5b360dacb6\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/interfaces/IBridgeTracking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBridgeTracking {\\n struct Request {\\n VoteKind kind;\\n uint256 id;\\n }\\n\\n enum VoteKind {\\n Deposit,\\n Withdrawal,\\n MainchainWithdrawal\\n }\\n\\n /**\\n * @dev Returns the total number of votes at the specific period `_period`.\\n */\\n function totalVotes(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots at the specific period `_period`.\\n */\\n function totalBallots(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\\n */\\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\\n */\\n function totalBallotsOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\\n\\n /**\\n * @dev Handles the request once it is approved.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\\n\\n /**\\n * @dev Records vote for a receipt and a operator.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function recordVote(\\n VoteKind _kind,\\n uint256 _requestId,\\n address _operator\\n ) external;\\n}\\n\",\"keccak256\":\"0x6066ff36c2ad0494a676dfeb4289c3cbe48d0d70266e8ec0930014a41f2a39a3\",\"license\":\"MIT\"},\"contracts/interfaces/IERC20Mintable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.2;\\n\\ninterface IERC20Mintable {\\n function mint(address _to, uint256 _value) external returns (bool _success);\\n}\\n\",\"keccak256\":\"0x6632cb3345e581a0b7868d6ce9a883f55d107576f9557f500a042c8285e51005\",\"license\":\"MIT\"},\"contracts/interfaces/IERC721Mintable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IERC721Mintable {\\n function mint(address _to, uint256 _tokenId) external returns (bool);\\n}\\n\",\"keccak256\":\"0x4f001516a2596c79c205a9e28de092aa866eb440040e78b8be9027451028f169\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x10f3b360430e6d03773c9959f54cbed6fb0346069645c05b05ef50cfb19f3753\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninGatewayV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../libraries/Transfer.sol\\\";\\nimport \\\"./consumers/MappedTokenConsumer.sol\\\";\\n\\ninterface IRoninGatewayV2 is MappedTokenConsumer {\\n /// @dev Emitted when the assets are depositted\\n event Deposited(bytes32 receiptHash, Transfer.Receipt receipt);\\n /// @dev Emitted when the withdrawal is requested\\n event WithdrawalRequested(bytes32 receiptHash, Transfer.Receipt);\\n /// @dev Emitted when the assets are withdrawn on mainchain\\n event MainchainWithdrew(bytes32 receiptHash, Transfer.Receipt receipt);\\n /// @dev Emitted when the withdrawal signatures is requested\\n event WithdrawalSignaturesRequested(bytes32 receiptHash, Transfer.Receipt);\\n /// @dev Emitted when the tokens are mapped\\n event TokenMapped(address[] roninTokens, address[] mainchainTokens, uint256[] chainIds, Token.Standard[] standards);\\n /// @dev Emitted when the threshold is updated\\n event TrustedThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n /// @dev Emitted when a deposit is voted\\n event DepositVoted(address indexed bridgeOperator, uint256 indexed id, uint256 indexed chainId, bytes32 receiptHash);\\n\\n /**\\n * @dev Returns withdrawal count.\\n */\\n function withdrawalCount() external view returns (uint256);\\n\\n /**\\n * @dev Returns withdrawal signatures.\\n */\\n function getWithdrawalSignatures(uint256 _withdrawalId, address[] calldata _validators)\\n external\\n view\\n returns (bytes[] memory);\\n\\n /**\\n * @dev Deposits based on the receipt.\\n *\\n * Requirements:\\n * - The method caller is a validator.\\n *\\n * Emits the `Deposited` once the assets are released.\\n *\\n * @notice The assets will be transferred whenever the valid call passes the quorum threshold.\\n *\\n */\\n function depositFor(Transfer.Receipt calldata _receipt) external;\\n\\n /**\\n * @dev Marks the withdrawals are done on mainchain and returns the boolean array indicating whether the withdrawal\\n * vote is already done before.\\n *\\n * Requirements:\\n * - The method caller is a validator.\\n *\\n * Emits the `MainchainWithdrew` once the valid call passes the quorum threshold.\\n *\\n * @notice Not reverting to avoid unnecessary failed transactions because the validators can send transactions at the\\n * same time.\\n *\\n */\\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds) external returns (bool[] memory);\\n\\n /**\\n * @dev Tries bulk deposits based on the receipts and returns the boolean array indicating whether the deposit vote\\n * is already done before. Reverts if the deposit is invalid or is voted by the validator again.\\n *\\n * Requirements:\\n * - The method caller is a validator.\\n *\\n * Emits the `Deposited` once the assets are released.\\n *\\n * @notice The assets will be transferred whenever the valid call for the receipt passes the quorum threshold. Not\\n * reverting to avoid unnecessary failed transactions because the validators can send transactions at the same time.\\n *\\n */\\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts) external returns (bool[] memory);\\n\\n /**\\n * @dev Locks the assets and request withdrawal.\\n *\\n * Emits the `WithdrawalRequested` event.\\n *\\n */\\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external;\\n\\n /**\\n * @dev Bulk requests withdrawals.\\n *\\n * Emits the `WithdrawalRequested` events.\\n *\\n */\\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external;\\n\\n /**\\n * @dev Requests withdrawal signatures for a specific withdrawal.\\n *\\n * Emits the `WithdrawalSignaturesRequested` event.\\n *\\n */\\n function requestWithdrawalSignatures(uint256 _withdrawalId) external;\\n\\n /**\\n * @dev Submits withdrawal signatures.\\n *\\n * Requirements:\\n * - The method caller is a validator.\\n *\\n */\\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures) external;\\n\\n /**\\n * @dev Maps Ronin tokens to mainchain networks.\\n *\\n * Requirement:\\n * - The method caller is admin.\\n * - The arrays have the same length and its length larger than 0.\\n *\\n * Emits the `TokenMapped` event.\\n *\\n */\\n function mapTokens(\\n address[] calldata _roninTokens,\\n address[] calldata _mainchainTokens,\\n uint256[] calldata chainIds,\\n Token.Standard[] calldata _standards\\n ) external;\\n\\n /**\\n * @dev Returns whether the deposit is casted by the voter.\\n */\\n function depositVoted(\\n uint256 _chainId,\\n uint256 _depositId,\\n address _voter\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the mainchain withdrew is casted by the voter.\\n */\\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the withdrawal is done on mainchain.\\n */\\n function mainchainWithdrew(uint256 _withdrawalId) external view returns (bool);\\n\\n /**\\n * @dev Returns mainchain token address.\\n * Reverts for unsupported token.\\n */\\n function getMainchainToken(address _roninToken, uint256 _chainId) external view returns (MappedToken memory _token);\\n}\\n\",\"keccak256\":\"0x1fe45e941766aec21809cb7fff1f4d96a1b5169f50780d92f9f1dfc0c37d0b9a\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeights() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganizations() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x1edb7a3f5d340e7efc141cb8d94c5499954dec869f026d3998ad92cbc714d604\",\"license\":\"MIT\"},\"contracts/interfaces/IWETH.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IWETH {\\n function deposit() external payable;\\n\\n function withdraw(uint256 _wad) external;\\n\\n function balanceOf(address) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x8acead2ae4364dee80c9bc76d52cc04d3763105e1743728e67d237f816155142\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasBridgeTrackingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasBridgeTrackingContract is IHasContract {\\n /// @dev Emitted when the bridge tracking contract is updated.\\n event BridgeTrackingContractUpdated(address);\\n\\n /// @dev Error of method caller must be bridge tracking contract.\\n error ErrCallerMustBeBridgeTrackingContract();\\n\\n /**\\n * @dev Returns the bridge tracking contract.\\n */\\n function bridgeTrackingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the bridge tracking contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `BridgeTrackingContractUpdated`.\\n *\\n */\\n function setBridgeTrackingContract(address) external;\\n}\\n\",\"keccak256\":\"0x2d1b7e356826bfe1c2a3348137d828f46ca931f7c2f48197379ad987e713714b\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\\n /// @dev Emitted when the ronin trusted organization contract is updated.\\n event RoninTrustedOrganizationContractUpdated(address);\\n\\n /// @dev Error of method caller must be Ronin trusted org contract.\\n error ErrCallerMustBeRoninTrustedOrgContract();\\n\\n /**\\n * @dev Returns the ronin trusted organization contract.\\n */\\n function roninTrustedOrganizationContract() external view returns (address);\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function setRoninTrustedOrganizationContract(address) external;\\n}\\n\",\"keccak256\":\"0x7d0a0b1d658e9cf4d69f4934748e0a5c1d22183024d26927f5d621fc61aff0b2\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/MappedTokenConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../libraries/Token.sol\\\";\\n\\ninterface MappedTokenConsumer {\\n struct MappedToken {\\n Token.Standard erc;\\n address tokenAddr;\\n }\\n}\\n\",\"keccak256\":\"0xfa220e968221af9b789e6c1dc4133631e90600c4a2bd63b7f01e96cb01f13e9b\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/VoteStatusConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface VoteStatusConsumer {\\n enum VoteStatus {\\n Pending,\\n Approved,\\n Executed,\\n Rejected,\\n Expired\\n }\\n}\\n\",\"keccak256\":\"0xa5045232c0c053fcf31fb3fe71942344444159c48d5f1b2063dbb06b6a1c9752\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/IsolatedGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"../interfaces/consumers/VoteStatusConsumer.sol\\\";\\n\\nlibrary IsolatedGovernance {\\n struct Vote {\\n VoteStatusConsumer.VoteStatus status;\\n bytes32 finalHash;\\n /// @dev Mapping from voter => receipt hash\\n mapping(address => bytes32) voteHashOf;\\n /// @dev The timestamp that voting is expired (no expiration=0)\\n uint256 expiredAt;\\n /// @dev The timestamp that voting is created\\n uint256 createdAt;\\n /// @dev The list of voters\\n address[] voters;\\n }\\n\\n /**\\n * @dev Casts vote for the receipt with the receipt hash `_hash`.\\n *\\n * Requirements:\\n * - The voter has not voted for the round.\\n *\\n */\\n function castVote(\\n Vote storage _v,\\n address _voter,\\n bytes32 _hash\\n ) internal {\\n if (_v.expiredAt > 0 && _v.expiredAt <= block.timestamp) {\\n _v.status = VoteStatusConsumer.VoteStatus.Expired;\\n }\\n\\n if (voted(_v, _voter)) {\\n revert(\\n string(abi.encodePacked(\\\"IsolatedGovernance: \\\", Strings.toHexString(uint160(_voter), 20), \\\" already voted\\\"))\\n );\\n }\\n\\n _v.voteHashOf[_voter] = _hash;\\n _v.voters.push(_voter);\\n }\\n\\n /**\\n * @dev Updates vote with the requirement of minimum vote weight.\\n */\\n function syncVoteStatus(\\n Vote storage _v,\\n uint256 _minimumVoteWeight,\\n uint256 _votedWeightForHash,\\n uint256 _minimumTrustedVoteWeight,\\n uint256 _trustedVotedWeightForHash,\\n bytes32 _hash\\n ) internal returns (VoteStatusConsumer.VoteStatus _status) {\\n if (\\n _votedWeightForHash >= _minimumVoteWeight &&\\n _trustedVotedWeightForHash >= _minimumTrustedVoteWeight &&\\n _v.status == VoteStatusConsumer.VoteStatus.Pending\\n ) {\\n _v.status = VoteStatusConsumer.VoteStatus.Approved;\\n _v.finalHash = _hash;\\n }\\n\\n return _v.status;\\n }\\n\\n /**\\n * @dev Returns the list of vote's addresses that voted for the hash `_hash`.\\n */\\n function filterByHash(Vote storage _v, bytes32 _hash) internal view returns (address[] memory _voters) {\\n uint256 _count;\\n _voters = new address[](_v.voters.length);\\n\\n for (uint _i; _i < _voters.length; _i++) {\\n address _voter = _v.voters[_i];\\n if (_v.voteHashOf[_voter] == _hash) {\\n _voters[_count++] = _voter;\\n }\\n }\\n\\n assembly {\\n mstore(_voters, _count)\\n }\\n }\\n\\n /**\\n * @dev Returns whether the voter casted for the proposal.\\n */\\n function voted(Vote storage _v, address _voter) internal view returns (bool) {\\n return _v.voteHashOf[_voter] != bytes32(0);\\n }\\n}\\n\",\"keccak256\":\"0x7bdb18ce2c548b3241360370312ca12f168140217fc3ee9c983627b86506c73f\",\"license\":\"MIT\"},\"contracts/libraries/Token.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC721/IERC721.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"../interfaces/IWETH.sol\\\";\\n\\nlibrary Token {\\n enum Standard {\\n ERC20,\\n ERC721\\n }\\n struct Info {\\n Standard erc;\\n // For ERC20: the id must be 0 and the quantity is larger than 0.\\n // For ERC721: the quantity must be 0.\\n uint256 id;\\n uint256 quantity;\\n }\\n\\n // keccak256(\\\"TokenInfo(uint8 erc,uint256 id,uint256 quantity)\\\");\\n bytes32 public constant INFO_TYPE_HASH = 0x1e2b74b2a792d5c0f0b6e59b037fa9d43d84fbb759337f0112fcc15ca414fc8d;\\n\\n /**\\n * @dev Returns token info struct hash.\\n */\\n function hash(Info memory _info) internal pure returns (bytes32) {\\n return keccak256(abi.encode(INFO_TYPE_HASH, _info.erc, _info.id, _info.quantity));\\n }\\n\\n /**\\n * @dev Validates the token info.\\n */\\n function validate(Info memory _info) internal pure {\\n require(\\n (_info.erc == Standard.ERC20 && _info.quantity > 0 && _info.id == 0) ||\\n (_info.erc == Standard.ERC721 && _info.quantity == 0),\\n \\\"Token: invalid info\\\"\\n );\\n }\\n\\n /**\\n * @dev Transfer asset from.\\n *\\n * Requirements:\\n * - The `_from` address must approve for the contract using this library.\\n *\\n */\\n function transferFrom(\\n Info memory _info,\\n address _from,\\n address _to,\\n address _token\\n ) internal {\\n bool _success;\\n bytes memory _data;\\n if (_info.erc == Standard.ERC20) {\\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, _from, _to, _info.quantity));\\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\\n } else if (_info.erc == Standard.ERC721) {\\n // bytes4(keccak256(\\\"transferFrom(address,address,uint256)\\\"))\\n (_success, ) = _token.call(abi.encodeWithSelector(0x23b872dd, _from, _to, _info.id));\\n } else {\\n revert(\\\"Token: unsupported token standard\\\");\\n }\\n\\n if (!_success) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"Token: could not transfer \\\",\\n toString(_info),\\n \\\" from \\\",\\n Strings.toHexString(uint160(_from), 20),\\n \\\" to \\\",\\n Strings.toHexString(uint160(_to), 20),\\n \\\" token \\\",\\n Strings.toHexString(uint160(_token), 20)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Transfers ERC721 token and returns the result.\\n */\\n function tryTransferERC721(\\n address _token,\\n address _to,\\n uint256 _id\\n ) internal returns (bool _success) {\\n (_success, ) = _token.call(abi.encodeWithSelector(IERC721.transferFrom.selector, address(this), _to, _id));\\n }\\n\\n /**\\n * @dev Transfers ERC20 token and returns the result.\\n */\\n function tryTransferERC20(\\n address _token,\\n address _to,\\n uint256 _quantity\\n ) internal returns (bool _success) {\\n bytes memory _data;\\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transfer.selector, _to, _quantity));\\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\\n }\\n\\n /**\\n * @dev Transfer assets from current address to `_to` address.\\n */\\n function transfer(\\n Info memory _info,\\n address _to,\\n address _token\\n ) internal {\\n bool _success;\\n if (_info.erc == Standard.ERC20) {\\n _success = tryTransferERC20(_token, _to, _info.quantity);\\n } else if (_info.erc == Standard.ERC721) {\\n _success = tryTransferERC721(_token, _to, _info.id);\\n } else {\\n revert(\\\"Token: unsupported token standard\\\");\\n }\\n\\n if (!_success) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"Token: could not transfer \\\",\\n toString(_info),\\n \\\" to \\\",\\n Strings.toHexString(uint160(_to), 20),\\n \\\" token \\\",\\n Strings.toHexString(uint160(_token), 20)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Tries minting and transfering assets.\\n *\\n * @notice Prioritizes transfer native token if the token is wrapped.\\n *\\n */\\n function handleAssetTransfer(\\n Info memory _info,\\n address payable _to,\\n address _token,\\n IWETH _wrappedNativeToken\\n ) internal {\\n bool _success;\\n if (_token == address(_wrappedNativeToken)) {\\n // Try sending the native token before transferring the wrapped token\\n if (!_to.send(_info.quantity)) {\\n _wrappedNativeToken.deposit{ value: _info.quantity }();\\n transfer(_info, _to, _token);\\n }\\n } else if (_info.erc == Token.Standard.ERC20) {\\n uint256 _balance = IERC20(_token).balanceOf(address(this));\\n\\n if (_balance < _info.quantity) {\\n // bytes4(keccak256(\\\"mint(address,uint256)\\\"))\\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, address(this), _info.quantity - _balance));\\n require(_success, \\\"Token: ERC20 minting failed\\\");\\n }\\n\\n transfer(_info, _to, _token);\\n } else if (_info.erc == Token.Standard.ERC721) {\\n if (!tryTransferERC721(_token, _to, _info.id)) {\\n // bytes4(keccak256(\\\"mint(address,uint256)\\\"))\\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, _to, _info.id));\\n require(_success, \\\"Token: ERC721 minting failed\\\");\\n }\\n } else {\\n revert(\\\"Token: unsupported token standard\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns readable string.\\n */\\n function toString(Info memory _info) internal pure returns (string memory) {\\n return\\n string(\\n abi.encodePacked(\\n \\\"TokenInfo(\\\",\\n Strings.toHexString(uint160(_info.erc), 1),\\n \\\",\\\",\\n Strings.toHexString(_info.id),\\n \\\",\\\",\\n Strings.toHexString(_info.quantity),\\n \\\")\\\"\\n )\\n );\\n }\\n\\n struct Owner {\\n address addr;\\n address tokenAddr;\\n uint256 chainId;\\n }\\n\\n // keccak256(\\\"TokenOwner(address addr,address tokenAddr,uint256 chainId)\\\");\\n bytes32 public constant OWNER_TYPE_HASH = 0x353bdd8d69b9e3185b3972e08b03845c0c14a21a390215302776a7a34b0e8764;\\n\\n /**\\n * @dev Returns ownership struct hash.\\n */\\n function hash(Owner memory _owner) internal pure returns (bytes32) {\\n return keccak256(abi.encode(OWNER_TYPE_HASH, _owner.addr, _owner.tokenAddr, _owner.chainId));\\n }\\n}\\n\",\"keccak256\":\"0xea68c5ccbd75695a7fb43bdbbec5636f63d1d3aabf36801b36a5ef0c43118c76\",\"license\":\"MIT\"},\"contracts/libraries/Transfer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"./Token.sol\\\";\\n\\nlibrary Transfer {\\n using ECDSA for bytes32;\\n\\n enum Kind {\\n Deposit,\\n Withdrawal\\n }\\n\\n struct Request {\\n // For deposit request: Recipient address on Ronin network\\n // For withdrawal request: Recipient address on mainchain network\\n address recipientAddr;\\n // Token address to deposit/withdraw\\n // Value 0: native token\\n address tokenAddr;\\n Token.Info info;\\n }\\n\\n /**\\n * @dev Converts the transfer request into the deposit receipt.\\n */\\n function into_deposit_receipt(\\n Request memory _request,\\n address _requester,\\n uint256 _id,\\n address _roninTokenAddr,\\n uint256 _roninChainId\\n ) internal view returns (Receipt memory _receipt) {\\n _receipt.id = _id;\\n _receipt.kind = Kind.Deposit;\\n _receipt.mainchain.addr = _requester;\\n _receipt.mainchain.tokenAddr = _request.tokenAddr;\\n _receipt.mainchain.chainId = block.chainid;\\n _receipt.ronin.addr = _request.recipientAddr;\\n _receipt.ronin.tokenAddr = _roninTokenAddr;\\n _receipt.ronin.chainId = _roninChainId;\\n _receipt.info = _request.info;\\n }\\n\\n /**\\n * @dev Converts the transfer request into the withdrawal receipt.\\n */\\n function into_withdrawal_receipt(\\n Request memory _request,\\n address _requester,\\n uint256 _id,\\n address _mainchainTokenAddr,\\n uint256 _mainchainId\\n ) internal view returns (Receipt memory _receipt) {\\n _receipt.id = _id;\\n _receipt.kind = Kind.Withdrawal;\\n _receipt.ronin.addr = _requester;\\n _receipt.ronin.tokenAddr = _request.tokenAddr;\\n _receipt.ronin.chainId = block.chainid;\\n _receipt.mainchain.addr = _request.recipientAddr;\\n _receipt.mainchain.tokenAddr = _mainchainTokenAddr;\\n _receipt.mainchain.chainId = _mainchainId;\\n _receipt.info = _request.info;\\n }\\n\\n struct Receipt {\\n uint256 id;\\n Kind kind;\\n Token.Owner mainchain;\\n Token.Owner ronin;\\n Token.Info info;\\n }\\n\\n // keccak256(\\\"Receipt(uint256 id,uint8 kind,TokenOwner mainchain,TokenOwner ronin,TokenInfo info)TokenInfo(uint8 erc,uint256 id,uint256 quantity)TokenOwner(address addr,address tokenAddr,uint256 chainId)\\\");\\n bytes32 public constant TYPE_HASH = 0xb9d1fe7c9deeec5dc90a2f47ff1684239519f2545b2228d3d91fb27df3189eea;\\n\\n /**\\n * @dev Returns token info struct hash.\\n */\\n function hash(Receipt memory _receipt) internal pure returns (bytes32) {\\n return\\n keccak256(\\n abi.encode(\\n TYPE_HASH,\\n _receipt.id,\\n _receipt.kind,\\n Token.hash(_receipt.mainchain),\\n Token.hash(_receipt.ronin),\\n Token.hash(_receipt.info)\\n )\\n );\\n }\\n\\n /**\\n * @dev Returns the receipt digest.\\n */\\n function receiptDigest(bytes32 _domainSeparator, bytes32 _receiptHash) internal pure returns (bytes32) {\\n return _domainSeparator.toTypedDataHash(_receiptHash);\\n }\\n}\\n\",\"keccak256\":\"0x377ec9931ffb0bc1a9b958aceb28c6afb735c5c04f961ee424ac7da5f2c30402\",\"license\":\"MIT\"},\"contracts/ronin/gateway/RoninGatewayV2.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/access/AccessControlEnumerable.sol\\\";\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../extensions/GatewayV2.sol\\\";\\nimport \\\"../../extensions/MinimumWithdrawal.sol\\\";\\nimport \\\"../../interfaces/IERC20Mintable.sol\\\";\\nimport \\\"../../interfaces/IERC721Mintable.sol\\\";\\nimport \\\"../../interfaces/IBridgeTracking.sol\\\";\\nimport \\\"../../interfaces/IRoninGatewayV2.sol\\\";\\nimport \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\nimport \\\"../../interfaces/consumers/VoteStatusConsumer.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/collections/IHasBridgeTrackingContract.sol\\\";\\nimport \\\"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../libraries/IsolatedGovernance.sol\\\";\\n\\ncontract RoninGatewayV2 is\\n GatewayV2,\\n Initializable,\\n MinimumWithdrawal,\\n AccessControlEnumerable,\\n VoteStatusConsumer,\\n IRoninGatewayV2,\\n IHasValidatorContract,\\n IHasBridgeTrackingContract,\\n IHasRoninTrustedOrganizationContract\\n{\\n using Token for Token.Info;\\n using Transfer for Transfer.Request;\\n using Transfer for Transfer.Receipt;\\n using IsolatedGovernance for IsolatedGovernance.Vote;\\n using EnumFlags for EnumFlags.ValidatorFlag;\\n\\n /// @dev Withdrawal unlocker role hash\\n bytes32 public constant WITHDRAWAL_MIGRATOR = keccak256(\\\"WITHDRAWAL_MIGRATOR\\\");\\n\\n /// @dev Flag indicating whether the withdrawal migrate progress is done\\n bool public withdrawalMigrated;\\n /// @dev Total withdrawal\\n uint256 public withdrawalCount;\\n /// @dev Mapping from chain id => deposit id => deposit vote\\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) public depositVote;\\n /// @dev Mapping from withdrawal id => mainchain withdrew vote\\n mapping(uint256 => IsolatedGovernance.Vote) public mainchainWithdrewVote;\\n /// @dev Mapping from withdrawal id => withdrawal receipt\\n mapping(uint256 => Transfer.Receipt) public withdrawal;\\n /// @dev Mapping from withdrawal id => validator address => signatures\\n mapping(uint256 => mapping(address => bytes)) internal _withdrawalSig;\\n /// @dev Mapping from token address => chain id => mainchain token address\\n mapping(address => mapping(uint256 => MappedToken)) internal _mainchainToken;\\n\\n /// @dev The ronin validator contract\\n IRoninValidatorSet internal _validatorContract;\\n /// @dev The bridge tracking contract\\n IBridgeTracking internal _bridgeTrackingContract;\\n\\n /// @dev Mapping from withdrawal id => vote for recording withdrawal stats\\n mapping(uint256 => IsolatedGovernance.Vote) public withdrawalStatVote;\\n\\n /// @dev The trusted organization contract\\n IRoninTrustedOrganization internal _trustedOrgContract;\\n\\n uint256 internal _trustedNum;\\n uint256 internal _trustedDenom;\\n\\n fallback() external payable {\\n _fallback();\\n }\\n\\n receive() external payable {\\n _fallback();\\n }\\n\\n modifier onlyBridgeOperator() {\\n require(_validatorContract.isBridgeOperator(msg.sender), \\\"RoninGatewayV2: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Initializes contract storage.\\n */\\n function initialize(\\n address _roleSetter,\\n uint256 _numerator,\\n uint256 _denominator,\\n uint256 _trustedNumerator,\\n uint256 _trustedDenominator,\\n address[] calldata _withdrawalMigrators,\\n // _packedAddresses[0]: roninTokens\\n // _packedAddresses[1]: mainchainTokens\\n address[][2] calldata _packedAddresses,\\n // _packedNumbers[0]: chainIds\\n // _packedNumbers[1]: minimumThresholds\\n uint256[][2] calldata _packedNumbers,\\n Token.Standard[] calldata _standards\\n ) external virtual initializer {\\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\\n _setThreshold(_numerator, _denominator);\\n _setTrustedThreshold(_trustedNumerator, _trustedDenominator);\\n if (_packedAddresses[0].length > 0) {\\n _mapTokens(_packedAddresses[0], _packedAddresses[1], _packedNumbers[0], _standards);\\n _setMinimumThresholds(_packedAddresses[0], _packedNumbers[1]);\\n }\\n\\n for (uint256 _i; _i < _withdrawalMigrators.length; _i++) {\\n _grantRole(WITHDRAWAL_MIGRATOR, _withdrawalMigrators[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() external view returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external override onlyAdmin {\\n require(_addr.code.length > 0, \\\"RoninGatewayV2: set to non-contract\\\");\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeTrackingContract\\n */\\n function bridgeTrackingContract() external view override returns (address) {\\n return address(_bridgeTrackingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeTrackingContract\\n */\\n function setBridgeTrackingContract(address _addr) external override onlyAdmin {\\n require(_addr.code.length > 0, \\\"RoninGatewayV2: set to non-contract\\\");\\n _setBridgeTrackingContract(_addr);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function roninTrustedOrganizationContract() external view override returns (address) {\\n return address(_trustedOrgContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function setRoninTrustedOrganizationContract(address _addr) external override onlyAdmin {\\n require(_addr.code.length > 0, \\\"RoninGatewayV2: set to non-contract\\\");\\n _setRoninTrustedOrganizationContract(_addr);\\n }\\n\\n /**\\n * @dev Migrates withdrawals.\\n *\\n * Requirements:\\n * - The method caller is the migrator.\\n * - The arrays have the same length and its length larger than 0.\\n *\\n */\\n function migrateWithdrawals(Transfer.Request[] calldata _requests, address[] calldata _requesters)\\n external\\n onlyRole(WITHDRAWAL_MIGRATOR)\\n {\\n require(!withdrawalMigrated, \\\"RoninGatewayV2: withdrawals migrated\\\");\\n require(_requesters.length == _requests.length && _requests.length > 0, \\\"RoninGatewayV2: invalid array lengths\\\");\\n for (uint256 _i; _i < _requests.length; _i++) {\\n MappedToken memory _token = getMainchainToken(_requests[_i].tokenAddr, 1);\\n require(_requests[_i].info.erc == _token.erc, \\\"RoninGatewayV2: invalid token standard\\\");\\n _storeAsReceipt(_requests[_i], 1, _requesters[_i], _token.tokenAddr);\\n }\\n }\\n\\n /**\\n * @dev Mark the migration as done.\\n */\\n function markWithdrawalMigrated() external {\\n require(\\n hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(WITHDRAWAL_MIGRATOR, msg.sender),\\n \\\"RoninGatewayV2: unauthorized sender\\\"\\n );\\n require(!withdrawalMigrated, \\\"RoninGatewayV2: withdrawals migrated\\\");\\n withdrawalMigrated = true;\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function getWithdrawalSignatures(uint256 _withdrawalId, address[] calldata _validators)\\n external\\n view\\n returns (bytes[] memory _signatures)\\n {\\n _signatures = new bytes[](_validators.length);\\n for (uint256 _i = 0; _i < _validators.length; _i++) {\\n _signatures[_i] = _withdrawalSig[_withdrawalId][_validators[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function depositFor(Transfer.Receipt calldata _receipt) external whenNotPaused onlyBridgeOperator {\\n address _sender = msg.sender;\\n _depositFor(_receipt, _sender, minimumVoteWeight(), minimumTrustedVoteWeight());\\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds)\\n external\\n onlyBridgeOperator\\n returns (bool[] memory _executedReceipts)\\n {\\n address _governor = msg.sender;\\n uint256 _minVoteWeight = minimumVoteWeight();\\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\\n\\n uint256 _withdrawalId;\\n _executedReceipts = new bool[](_withdrawalIds.length);\\n for (uint256 _i; _i < _withdrawalIds.length; _i++) {\\n _withdrawalId = _withdrawalIds[_i];\\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId, _governor);\\n if (mainchainWithdrew(_withdrawalId)) {\\n _executedReceipts[_i] = true;\\n } else {\\n IsolatedGovernance.Vote storage _vote = mainchainWithdrewVote[_withdrawalId];\\n Transfer.Receipt memory _withdrawal = withdrawal[_withdrawalId];\\n bytes32 _hash = _withdrawal.hash();\\n VoteStatus _status = _castIsolatedVote(_vote, _governor, _minVoteWeight, _minTrustedVoteWeight, _hash);\\n if (_status == VoteStatus.Approved) {\\n _vote.status = VoteStatus.Executed;\\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId);\\n emit MainchainWithdrew(_hash, _withdrawal);\\n }\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts)\\n external\\n whenNotPaused\\n onlyBridgeOperator\\n returns (bool[] memory _executedReceipts)\\n {\\n address _sender = msg.sender;\\n\\n Transfer.Receipt memory _receipt;\\n _executedReceipts = new bool[](_receipts.length);\\n uint256 _minVoteWeight = minimumVoteWeight();\\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\\n for (uint256 _i; _i < _receipts.length; _i++) {\\n _receipt = _receipts[_i];\\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\\n if (depositVote[_receipt.mainchain.chainId][_receipt.id].status == VoteStatus.Executed) {\\n _executedReceipts[_i] = true;\\n } else {\\n _depositFor(_receipt, _sender, _minVoteWeight, _minTrustedVoteWeight);\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external whenNotPaused {\\n _requestWithdrawalFor(_request, msg.sender, _chainId);\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external whenNotPaused {\\n require(_requests.length > 0, \\\"RoninGatewayV2: empty array\\\");\\n for (uint256 _i; _i < _requests.length; _i++) {\\n _requestWithdrawalFor(_requests[_i], msg.sender, _chainId);\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function requestWithdrawalSignatures(uint256 _withdrawalId) external whenNotPaused {\\n require(!mainchainWithdrew(_withdrawalId), \\\"RoninGatewayV2: withdrew on mainchain already\\\");\\n Transfer.Receipt memory _receipt = withdrawal[_withdrawalId];\\n require(_receipt.ronin.chainId == block.chainid, \\\"RoninGatewayV2: query for invalid withdrawal\\\");\\n emit WithdrawalSignaturesRequested(_receipt.hash(), _receipt);\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures)\\n external\\n whenNotPaused\\n onlyBridgeOperator\\n {\\n address _validator = msg.sender;\\n\\n require(\\n _withdrawals.length > 0 && _withdrawals.length == _signatures.length,\\n \\\"RoninGatewayV2: invalid array length\\\"\\n );\\n\\n uint256 _minVoteWeight = minimumVoteWeight();\\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\\n\\n uint256 _id;\\n for (uint256 _i; _i < _withdrawals.length; _i++) {\\n _id = _withdrawals[_i];\\n _withdrawalSig[_id][_validator] = _signatures[_i];\\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Withdrawal, _id, _validator);\\n\\n IsolatedGovernance.Vote storage _proposal = withdrawalStatVote[_id];\\n VoteStatus _status = _castIsolatedVote(\\n _proposal,\\n _validator,\\n _minVoteWeight,\\n _minTrustedVoteWeight,\\n bytes32(_id)\\n );\\n if (_status == VoteStatus.Approved) {\\n _proposal.status = VoteStatus.Executed;\\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Withdrawal, _id);\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function mapTokens(\\n address[] calldata _roninTokens,\\n address[] calldata _mainchainTokens,\\n uint256[] calldata _chainIds,\\n Token.Standard[] calldata _standards\\n ) external onlyAdmin {\\n require(_roninTokens.length > 0, \\\"RoninGatewayV2: invalid array length\\\");\\n _mapTokens(_roninTokens, _mainchainTokens, _chainIds, _standards);\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function depositVoted(\\n uint256 _chainId,\\n uint256 _depositId,\\n address _voter\\n ) external view returns (bool) {\\n return depositVote[_chainId][_depositId].voted(_voter);\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool) {\\n return mainchainWithdrewVote[_withdrawalId].voted(_voter);\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function mainchainWithdrew(uint256 _withdrawalId) public view returns (bool) {\\n return mainchainWithdrewVote[_withdrawalId].status == VoteStatus.Executed;\\n }\\n\\n /**\\n * @inheritdoc IRoninGatewayV2\\n */\\n function getMainchainToken(address _roninToken, uint256 _chainId) public view returns (MappedToken memory _token) {\\n _token = _mainchainToken[_roninToken][_chainId];\\n require(_token.tokenAddr != address(0), \\\"RoninGatewayV2: unsupported token\\\");\\n }\\n\\n /**\\n * @dev Maps Ronin tokens to mainchain networks.\\n *\\n * Requirement:\\n * - The arrays have the same length.\\n *\\n * Emits the `TokenMapped` event.\\n *\\n */\\n function _mapTokens(\\n address[] calldata _roninTokens,\\n address[] calldata _mainchainTokens,\\n uint256[] calldata _chainIds,\\n Token.Standard[] calldata _standards\\n ) internal {\\n require(\\n _roninTokens.length == _mainchainTokens.length && _roninTokens.length == _chainIds.length,\\n \\\"RoninGatewayV2: invalid array length\\\"\\n );\\n\\n for (uint256 _i; _i < _roninTokens.length; _i++) {\\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].tokenAddr = _mainchainTokens[_i];\\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].erc = _standards[_i];\\n }\\n\\n emit TokenMapped(_roninTokens, _mainchainTokens, _chainIds, _standards);\\n }\\n\\n /**\\n * @dev Deposits based on the receipt.\\n *\\n * Emits the `Deposited` once the assets are released.\\n *\\n */\\n function _depositFor(\\n Transfer.Receipt memory _receipt,\\n address _validator,\\n uint256 _minVoteWeight,\\n uint256 _minTrustedVoteWeight\\n ) internal {\\n uint256 _id = _receipt.id;\\n _receipt.info.validate();\\n require(_receipt.kind == Transfer.Kind.Deposit, \\\"RoninGatewayV2: invalid receipt kind\\\");\\n require(_receipt.ronin.chainId == block.chainid, \\\"RoninGatewayV2: invalid chain id\\\");\\n MappedToken memory _token = getMainchainToken(_receipt.ronin.tokenAddr, _receipt.mainchain.chainId);\\n require(\\n _token.erc == _receipt.info.erc && _token.tokenAddr == _receipt.mainchain.tokenAddr,\\n \\\"RoninGatewayV2: invalid receipt\\\"\\n );\\n\\n IsolatedGovernance.Vote storage _proposal = depositVote[_receipt.mainchain.chainId][_id];\\n bytes32 _receiptHash = _receipt.hash();\\n VoteStatus _status = _castIsolatedVote(_proposal, _validator, _minVoteWeight, _minTrustedVoteWeight, _receiptHash);\\n emit DepositVoted(_validator, _id, _receipt.mainchain.chainId, _receiptHash);\\n if (_status == VoteStatus.Approved) {\\n _proposal.status = VoteStatus.Executed;\\n _receipt.info.handleAssetTransfer(payable(_receipt.ronin.addr), _receipt.ronin.tokenAddr, IWETH(address(0)));\\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Deposit, _receipt.id);\\n emit Deposited(_receiptHash, _receipt);\\n }\\n }\\n\\n /**\\n * @dev Locks the assets and request withdrawal.\\n *\\n * Requirements:\\n * - The token info is valid.\\n *\\n * Emits the `WithdrawalRequested` event.\\n *\\n */\\n function _requestWithdrawalFor(\\n Transfer.Request calldata _request,\\n address _requester,\\n uint256 _chainId\\n ) internal {\\n _request.info.validate();\\n _checkWithdrawal(_request);\\n MappedToken memory _token = getMainchainToken(_request.tokenAddr, _chainId);\\n require(_request.info.erc == _token.erc, \\\"RoninGatewayV2: invalid token standard\\\");\\n _request.info.transferFrom(_requester, address(this), _request.tokenAddr);\\n _storeAsReceipt(_request, _chainId, _requester, _token.tokenAddr);\\n }\\n\\n /**\\n * @dev Stores the withdrawal request as a receipt.\\n *\\n * Emits the `WithdrawalRequested` event.\\n *\\n */\\n function _storeAsReceipt(\\n Transfer.Request calldata _request,\\n uint256 _chainId,\\n address _requester,\\n address _mainchainTokenAddr\\n ) internal returns (uint256 _withdrawalId) {\\n _withdrawalId = withdrawalCount++;\\n Transfer.Receipt memory _receipt = _request.into_withdrawal_receipt(\\n _requester,\\n _withdrawalId,\\n _mainchainTokenAddr,\\n _chainId\\n );\\n withdrawal[_withdrawalId] = _receipt;\\n emit WithdrawalRequested(_receipt.hash(), _receipt);\\n }\\n\\n /**\\n * @dev Don't send me RON.\\n */\\n function _fallback() internal virtual {\\n revert(\\\"RoninGatewayV2: invalid request\\\");\\n }\\n\\n /**\\n * @inheritdoc GatewayV2\\n */\\n function _getTotalWeight() internal view virtual override returns (uint256) {\\n return _validatorContract.totalBridgeOperators();\\n }\\n\\n /**\\n * @dev Returns the total trusted weight.\\n */\\n function _getTotalTrustedWeight() internal view virtual returns (uint256) {\\n return _trustedOrgContract.countTrustedOrganizations();\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n\\n /**\\n * @dev Sets the bridge tracking contract.\\n *\\n * Emits the event `BridgeTrackingContractUpdated`.\\n *\\n */\\n function _setBridgeTrackingContract(address _addr) internal {\\n _bridgeTrackingContract = IBridgeTracking(_addr);\\n emit BridgeTrackingContractUpdated(_addr);\\n }\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function _setRoninTrustedOrganizationContract(address _addr) internal {\\n _trustedOrgContract = IRoninTrustedOrganization(_addr);\\n emit RoninTrustedOrganizationContractUpdated(_addr);\\n }\\n\\n /**\\n * @dev Casts and updates the vote result.\\n *\\n * Requirements:\\n * - The vote is not finalized.\\n * - The voter has not voted for the round.\\n *\\n */\\n function _castIsolatedVote(\\n IsolatedGovernance.Vote storage _v,\\n address _voter,\\n uint256 _minVoteWeight,\\n uint256 _minTrustedVoteWeight,\\n bytes32 _hash\\n ) internal virtual returns (VoteStatus _status) {\\n _v.castVote(_voter, _hash);\\n (uint256 _totalWeight, uint256 _trustedWeight) = _getVoteWeight(_v, _hash);\\n return _v.syncVoteStatus(_minVoteWeight, _totalWeight, _minTrustedVoteWeight, _trustedWeight, _hash);\\n }\\n\\n /**\\n * @dev Returns the vote weight for a specified hash.\\n */\\n function _getVoteWeight(IsolatedGovernance.Vote storage _v, bytes32 _hash)\\n internal\\n view\\n returns (uint256 _totalWeight, uint256 _trustedWeight)\\n {\\n (\\n address[] memory _consensusList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n ) = _validatorContract.getValidators();\\n uint256[] memory _trustedWeights = _trustedOrgContract.getConsensusWeights(_consensusList);\\n\\n for (uint _i; _i < _bridgeOperators.length; _i++) {\\n if (_flags[_i].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator) && _v.voteHashOf[_bridgeOperators[_i]] == _hash) {\\n _totalWeight++;\\n if (_trustedWeights[_i] > 0) {\\n _trustedWeight++;\\n }\\n }\\n }\\n }\\n\\n function setTrustedThreshold(uint256 _trustedNumerator, uint256 _trustedDenominator)\\n external\\n virtual\\n onlyAdmin\\n returns (uint256, uint256)\\n {\\n return _setTrustedThreshold(_trustedNumerator, _trustedDenominator);\\n }\\n\\n /**\\n * @dev Returns the minimum trusted vote weight to pass the threshold.\\n */\\n function minimumTrustedVoteWeight() public view virtual returns (uint256) {\\n return _minimumTrustedVoteWeight(_getTotalTrustedWeight());\\n }\\n\\n /**\\n * @dev Returns the threshold about trusted org.\\n */\\n function getTrustedThreshold() external view virtual returns (uint256 trustedNum_, uint256 trustedDenom_) {\\n return (_trustedNum, _trustedDenom);\\n }\\n\\n /**\\n * @dev Sets trusted threshold and returns the old one.\\n *\\n * Emits the `TrustedThresholdUpdated` event.\\n *\\n */\\n function _setTrustedThreshold(uint256 _trustedNumerator, uint256 _trustedDenominator)\\n internal\\n virtual\\n returns (uint256 _previousTrustedNum, uint256 _previousTrustedDenom)\\n {\\n require(_trustedNumerator <= _trustedDenominator, \\\"GatewayV2: invalid trusted threshold\\\");\\n _previousTrustedNum = _num;\\n _previousTrustedDenom = _denom;\\n _trustedNum = _trustedNumerator;\\n _trustedDenom = _trustedDenominator;\\n emit TrustedThresholdUpdated(\\n nonce++,\\n _trustedNumerator,\\n _trustedDenominator,\\n _previousTrustedNum,\\n _previousTrustedDenom\\n );\\n }\\n\\n /**\\n * @dev Returns minimum trusted vote weight.\\n */\\n function _minimumTrustedVoteWeight(uint256 _totalTrustedWeight) internal view virtual returns (uint256) {\\n return (_trustedNum * _totalTrustedWeight + _trustedDenom - 1) / _trustedDenom;\\n }\\n}\\n\",\"keccak256\":\"0x5791de3f023ef7a12ac64648d5a8a10bceb440dbe38848ab5c1ac07aa81bd0dd\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b506000805460ff19169055615c7b806200002b6000396000f3fe60806040526004361061025e5760003560e01c806301ffc9a714610275578063065b3adf146102aa5780630b1ff17f146102d7578063109679ef146102f757806317892f961461031757806317fa2ea114610340578063248a9ca31461036d5780632f2ff15d1461039b57806336568abe146103bb5780633b5afc22146103db5780633e4574ec146103f05780633e70838b146104105780633f4ba83a146104305780634493421e1461044557806347b56b2c146104635780634d92c4f0146104835780634f2717c7146104e45780635511cde1146104fe5780635a7dd06a1461051c5780635c975abb1461053c5780635d6a9a901461055457806364363f781461058157806371706cbe146105a157806375535f86146105b75780637657990e146105d75780637de5dedd146105ec578063835fc6ca146106015780638456cb59146106325780639010d07c1461064757806391d1485414610667578063931ec987146106875780639584a592146106a757806399439089146106c75780639c8d98da146106e5578063a217fddf14610705578063affed0e01461071a578063b5e337de14610730578063b9afa17714610750578063b9c3620914610770578063bc7f038614610790578063c28f7894146107bd578063ca15c87314610803578063cdf64a7614610823578063d547741f14610843578063dafae40814610863578063dbd2ef6c14610883578063e75235b8146108a3578063ecc83649146108bb578063f0ce418e146108e8578063f668214a1461092e578063fa3896591461094e578063fc6574bc1461096e578063fe90d9c21461098e5761026d565b3661026d5761026b6109b0565b005b61026b6109b0565b34801561028157600080fd5b50610295610290366004614592565b6109fd565b60405190151581526020015b60405180910390f35b3480156102b657600080fd5b506005546102ca906001600160a01b031681565b6040516102a191906145bc565b3480156102e357600080fd5b5061026b6102f23660046145d0565b610a28565b34801561030357600080fd5b5061026b610312366004614601565b610a3f565b34801561032357600080fd5b506078546079545b604080519283526020830191909152016102a1565b34801561034c57600080fd5b5061036061035b36600461465e565b610b69565b6040516102a1919061469f565b34801561037957600080fd5b5061038d6103883660046146e5565b610f3f565b6040519081526020016102a1565b3480156103a757600080fd5b5061026b6103b6366004614723565b610f54565b3480156103c757600080fd5b5061026b6103d6366004614723565b610f75565b3480156103e757600080fd5b5061026b610fef565b3480156103fc57600080fd5b5061029561040b366004614723565b611066565b34801561041c57600080fd5b5061026b61042b366004614753565b611085565b34801561043c57600080fd5b5061026b6110df565b34801561045157600080fd5b506075546001600160a01b03166102ca565b34801561046f57600080fd5b5061026b61047e3660046146e5565b611136565b34801561048f57600080fd5b506104d461049e366004614770565b606f602090815260009283526040808420909152908252902080546001820154600383015460049093015460ff90921692909184565b6040516102a194939291906147a8565b3480156104f057600080fd5b50606d546102959060ff1681565b34801561050a57600080fd5b506077546001600160a01b03166102ca565b34801561052857600080fd5b5061026b61053736600461481c565b611370565b34801561054857600080fd5b5060005460ff16610295565b34801561056057600080fd5b5061057461056f366004614867565b611408565b6040516102a191906148a3565b34801561058d57600080fd5b5061026b61059c3660046148cf565b6114e5565b3480156105ad57600080fd5b5061038d606e5481565b3480156105c357600080fd5b5061032b6105d2366004614770565b611546565b3480156105e357600080fd5b5061038d611597565b3480156105f857600080fd5b5061038d6115ae565b34801561060d57600080fd5b5061062161061c3660046146e5565b6115c0565b6040516102a1959493929190614983565b34801561063e57600080fd5b5061026b611692565b34801561065357600080fd5b506102ca610662366004614770565b6116e7565b34801561067357600080fd5b50610295610682366004614723565b6116ff565b34801561069357600080fd5b5061026b6106a23660046149c2565b61172a565b3480156106b357600080fd5b5061026b6106c2366004614a0c565b6118ce565b3480156106d357600080fd5b506074546001600160a01b03166102ca565b3480156106f157600080fd5b5061026b610700366004614753565b611ac0565b34801561071157600080fd5b5061038d600081565b34801561072657600080fd5b5061038d60045481565b34801561073c57600080fd5b5061026b61074b366004614753565b611b2e565b34801561075c57600080fd5b5061036061076b366004614b05565b611b99565b34801561077c57600080fd5b5061032b61078b366004614770565b611dbd565b34801561079c57600080fd5b5061038d6107ab366004614753565b60386020526000908152604090205481565b3480156107c957600080fd5b506104d46107d83660046146e5565b607660205260009081526040902080546001820154600383015460049093015460ff90921692909184565b34801561080f57600080fd5b5061038d61081e3660046146e5565b611e02565b34801561082f57600080fd5b5061026b61083e366004614753565b611e19565b34801561084f57600080fd5b5061026b61085e366004614723565b611e84565b34801561086f57600080fd5b5061029561087e3660046146e5565b611ea0565b34801561088f57600080fd5b5061026b61089e366004614b7a565b611ecc565b3480156108af57600080fd5b5060015460025461032b565b3480156108c757600080fd5b506108db6108d6366004614c3d565b611f3b565b6040516102a19190614cd8565b3480156108f457600080fd5b506104d46109033660046146e5565b607060205260009081526040902080546001820154600383015460049093015460ff90921692909184565b34801561093a57600080fd5b506102956109493660046146e5565b6120ad565b34801561095a57600080fd5b5061026b6109693660046148cf565b6120db565b34801561097a57600080fd5b50610295610989366004614d3a565b61235c565b34801561099a57600080fd5b5061038d600080516020615c0683398151915281565b60405162461bcd60e51b815260206004820152601f60248201527f526f6e696e4761746577617956323a20696e76616c696420726571756573740060448201526064015b60405180910390fd5b60006001600160e01b03198216635a05180f60e01b1480610a225750610a2282612387565b92915050565b610a306123bc565b610a3b823383612402565b5050565b610a476123bc565b607454604051635a02d57960e11b81526001600160a01b039091169063b405aaf290610a779033906004016145bc565b602060405180830381865afa158015610a94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab89190614d73565b610ad45760405162461bcd60e51b81526004016109f490614d95565b33610afd610ae736849003840184614ee6565b82610af06115ae565b610af8611597565b6124da565b60755460405163c7c4fea960e01b81526001600160a01b039091169063c7c4fea990610b33906000908635908690600401614f87565b600060405180830381600087803b158015610b4d57600080fd5b505af1158015610b61573d6000803e3d6000fd5b505050505050565b607454604051635a02d57960e11b81526060916001600160a01b03169063b405aaf290610b9a9033906004016145bc565b602060405180830381865afa158015610bb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdb9190614d73565b610bf75760405162461bcd60e51b81526004016109f490614d95565b336000610c026115ae565b90506000610c0e611597565b90506000856001600160401b03811115610c2a57610c2a614dd8565b604051908082528060200260200182016040528015610c53578160200160208202803683370190505b50945060005b86811015610f3457878782818110610c7357610c73614fb4565b60755460405163c7c4fea960e01b81526020909202939093013594506001600160a01b039092169163c7c4fea99150610cb59060029086908a90600401614f87565b600060405180830381600087803b158015610ccf57600080fd5b505af1158015610ce3573d6000803e3d6000fd5b50505050610cf0826120ad565b15610d1e576001868281518110610d0957610d09614fb4565b91151560209283029190910190910152610f22565b600082815260706020908152604080832060718352818420825160a081019093528054835260018082015492959491929184019160ff1690811115610d6557610d65614792565b6001811115610d7657610d76614792565b8152604080516060808201835260028501546001600160a01b039081168352600386015481166020848101919091526004870154848601528086019390935283518083018552600587015482168152600687015490911692810192909252600785015482840152828401919091528151808201909252600884018054919093019290829060ff166001811115610e0e57610e0e614792565b6001811115610e1f57610e1f614792565b81526001820154602082015260029091015460409091015290525090506000610e47826127e8565b90506000610e58848a8a8a86612871565b90506001816004811115610e6e57610e6e614792565b03610f1d57835460ff19166002908117855560755460405163114fc47560e11b81526001600160a01b039091169163229f88ea91610eb191908a90600401614fca565b600060405180830381600087803b158015610ecb57600080fd5b505af1158015610edf573d6000803e3d6000fd5b505050507f62520d049932cdee872e9b3c59c0f6073637147e5e9bc8b050b062430eaf5c9f8284604051610f14929190614fe5565b60405180910390a15b505050505b80610f2c8161505c565b915050610c59565b505050505092915050565b6000908152606b602052604090206001015490565b610f5d82610f3f565b610f66816128aa565b610f7083836128b4565b505050565b6001600160a01b0381163314610fe55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016109f4565b610a3b82826128d6565b610ffa6000336116ff565b806110185750611018600080516020615c06833981519152336116ff565b6110345760405162461bcd60e51b81526004016109f490614d95565b606d5460ff16156110575760405162461bcd60e51b81526004016109f490615075565b606d805460ff19166001179055565b600082815260706020526040812061107e90836128f8565b9392505050565b61108d612919565b6001600160a01b0316336001600160a01b0316146110bd5760405162461bcd60e51b81526004016109f4906150b9565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6110e7612919565b6001600160a01b0316336001600160a01b0316148061111057506005546001600160a01b031633145b61112c5760405162461bcd60e51b81526004016109f4906150fb565b611134612947565b565b61113e6123bc565b611147816120ad565b156111aa5760405162461bcd60e51b815260206004820152602d60248201527f526f6e696e4761746577617956323a207769746864726577206f6e206d61696e60448201526c636861696e20616c726561647960981b60648201526084016109f4565b6000818152607160209081526040808320815160a0810190925280548252600180820154929391929184019160ff16908111156111e9576111e9614792565b60018111156111fa576111fa614792565b8152604080516060808201835260028501546001600160a01b039081168352600386015481166020848101919091526004870154848601528086019390935283518083018552600587015482168152600687015490911692810192909252600785015482840152828401919091528151808201909252600884018054919093019290829060ff16600181111561129257611292614792565b60018111156112a3576112a3614792565b81526001820154602082015260029091015460409182015291526060830151015191925050461461132b5760405162461bcd60e51b815260206004820152602c60248201527f526f6e696e4761746577617956323a20717565727920666f7220696e76616c6960448201526b19081dda5d1a191c985dd85b60a21b60648201526084016109f4565b7f04e8cbd836dea43a2dc7eb19de345cca3a8e6978a2ef5225d924775500f67c7c611355826127e8565b82604051611364929190614fe5565b60405180910390a15050565b6113786123bc565b816113c35760405162461bcd60e51b815260206004820152601b60248201527a526f6e696e4761746577617956323a20656d70747920617272617960281b60448201526064016109f4565b60005b82811015611402576113f08484838181106113e3576113e3614fb4565b905060a002013384612402565b806113fa8161505c565b9150506113c6565b50505050565b604080518082018252600080825260208083018290526001600160a01b038616825260738152838220858352905282902082518084019093528054919291829060ff16600181111561145c5761145c614792565b600181111561146d5761146d614792565b815290546001600160a01b0361010090910481166020928301529082015191925016610a225760405162461bcd60e51b815260206004820152602160248201527f526f6e696e4761746577617956323a20756e737570706f7274656420746f6b656044820152603760f91b60648201526084016109f4565b6114ed612919565b6001600160a01b0316336001600160a01b03161461151d5760405162461bcd60e51b81526004016109f4906150b9565b8261153a5760405162461bcd60e51b81526004016109f490615130565b61140284848484612993565b600080611551612919565b6001600160a01b0316336001600160a01b0316146115815760405162461bcd60e51b81526004016109f4906150b9565b61158b8484612a71565b915091505b9250929050565b60006115a96115a4612b3b565b612ba9565b905090565b60006115a96115bb612bdf565b612c29565b607160209081526000918252604091829020805460018083015485516060808201885260028601546001600160a01b03908116835260038701548116838901526004870154838a015288518083018a526005880154821681526006880154909116978101979097526007860154878901528751908101909752600885018054949760ff93841697929692959294909391928492169081111561166457611664614792565b600181111561167557611675614792565b815260200160018201548152602001600282015481525050905085565b61169a612919565b6001600160a01b0316336001600160a01b031614806116c357506005546001600160a01b031633145b6116df5760405162461bcd60e51b81526004016109f4906150fb565b611134612c41565b6000828152606c6020526040812061107e9083612c7e565b6000918252606b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020615c06833981519152611742816128aa565b606d5460ff16156117655760405162461bcd60e51b81526004016109f490615075565b818414801561177357508315155b6117bb5760405162461bcd60e51b81526020600482015260256024820152600080516020615c268339815191526044820152646e6774687360d81b60648201526084016109f4565b60005b84811015610b615760006117fc8787848181106117dd576117dd614fb4565b905060a0020160200160208101906117f59190614753565b6001611408565b8051909150600181111561181257611812614792565b87878481811061182457611824614fb4565b61183d92606060a0909202019081019150604001615177565b600181111561184e5761184e614792565b1461186b5760405162461bcd60e51b81526004016109f490615194565b6118b987878481811061188057611880614fb4565b905060a00201600187878681811061189a5761189a614fb4565b90506020020160208101906118af9190614753565b8460200151612c8a565b505080806118c69061505c565b9150506117be565b603754610100900460ff16158080156118ee5750603754600160ff909116105b806119085750303b158015611908575060375460ff166001145b61196b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016109f4565b6037805460ff19166001179055801561198e576037805461ff0019166101001790555b61199960008d612e14565b6119a38b8b612e1e565b50506119af8989612a71565b50600090506119be86806151da565b90501115611a10576119f16119d386806151da565b6119e060208901896151da565b6119ea89806151da565b8989612ed2565b611a106119fe86806151da565b611a0b60208801886151da565b612993565b60005b86811015611a6b57611a59600080516020615c06833981519152898984818110611a3f57611a3f614fb4565b9050602002016020810190611a549190614753565b6128b4565b80611a638161505c565b915050611a13565b508015611ab2576037805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050505050565b611ac8612919565b6001600160a01b0316336001600160a01b031614611af85760405162461bcd60e51b81526004016109f4906150b9565b6000816001600160a01b03163b11611b225760405162461bcd60e51b81526004016109f490615223565b611b2b816130e8565b50565b611b36612919565b6001600160a01b0316336001600160a01b031614611b665760405162461bcd60e51b81526004016109f4906150b9565b6000816001600160a01b03163b11611b905760405162461bcd60e51b81526004016109f490615223565b611b2b8161313e565b6060611ba36123bc565b607454604051635a02d57960e11b81526001600160a01b039091169063b405aaf290611bd39033906004016145bc565b602060405180830381865afa158015611bf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c149190614d73565b611c305760405162461bcd60e51b81526004016109f490614d95565b33611c39614523565b836001600160401b03811115611c5157611c51614dd8565b604051908082528060200260200182016040528015611c7a578160200160208202803683370190505b5092506000611c876115ae565b90506000611c93611597565b905060005b86811015610f3457878782818110611cb257611cb2614fb4565b90506101600201803603810190611cc99190614ee6565b607554815160405163c7c4fea960e01b81529296506001600160a01b039091169163c7c4fea991611d0291600091908a90600401614f87565b600060405180830381600087803b158015611d1c57600080fd5b505af1158015611d30573d6000803e3d6000fd5b5060029250611d3d915050565b6040808601518101516000908152606f6020908152828220885183529052205460ff166004811115611d7157611d71614792565b03611d9f576001868281518110611d8a57611d8a614fb4565b91151560209283029190910190910152611dab565b611dab848685856124da565b80611db58161505c565b915050611c98565b600080611dc8612919565b6001600160a01b0316336001600160a01b031614611df85760405162461bcd60e51b81526004016109f4906150b9565b61158b8484612e1e565b6000818152606c60205260408120610a2290613189565b611e21612919565b6001600160a01b0316336001600160a01b031614611e515760405162461bcd60e51b81526004016109f4906150b9565b6000816001600160a01b03163b11611e7b5760405162461bcd60e51b81526004016109f490615223565b611b2b81613193565b611e8d82610f3f565b611e96816128aa565b610f7083836128d6565b6000611eaa612bdf565b600154611eb79190615266565b600254611ec49084615266565b101592915050565b611ed4612919565b6001600160a01b0316336001600160a01b031614611f045760405162461bcd60e51b81526004016109f4906150b9565b86611f215760405162461bcd60e51b81526004016109f49061527d565b611f318888888888888888612ed2565b5050505050505050565b6060816001600160401b03811115611f5557611f55614dd8565b604051908082528060200260200182016040528015611f8857816020015b6060815260200190600190039081611f735790505b50905060005b828110156120a557600085815260726020526040812090858584818110611fb757611fb7614fb4565b9050602002016020810190611fcc9190614753565b6001600160a01b03166001600160a01b031681526020019081526020016000208054611ff7906152af565b80601f0160208091040260200160405190810160405280929190818152602001828054612023906152af565b80156120705780601f1061204557610100808354040283529160200191612070565b820191906000526020600020905b81548152906001019060200180831161205357829003601f168201915b505050505082828151811061208757612087614fb4565b6020026020010181905250808061209d9061505c565b915050611f8e565b509392505050565b6000600260008381526070602052604090205460ff1660048111156120d4576120d4614792565b1492915050565b6120e36123bc565b607454604051635a02d57960e11b81526001600160a01b039091169063b405aaf2906121139033906004016145bc565b602060405180830381865afa158015612130573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121549190614d73565b6121705760405162461bcd60e51b81526004016109f490614d95565b33831580159061217f57508382145b61219b5760405162461bcd60e51b81526004016109f49061527d565b60006121a56115ae565b905060006121b1611597565b90506000805b87811015612351578888828181106121d1576121d1614fb4565b9050602002013591508686828181106121ec576121ec614fb4565b90506020028101906121fe91906152e3565b60008481526072602090815260408083206001600160a01b038b16845290915290209161222c91908361536f565b5060755460405163c7c4fea960e01b81526001600160a01b039091169063c7c4fea9906122629060019086908a90600401614f87565b600060405180830381600087803b15801561227c57600080fd5b505af1158015612290573d6000803e3d6000fd5b505050600083815260766020526040812091506122b08288888888612871565b905060018160048111156122c6576122c6614792565b0361233c57815460ff1916600217825560755460405163114fc47560e11b81526001600160a01b039091169063229f88ea90612309906001908890600401614fca565b600060405180830381600087803b15801561232357600080fd5b505af1158015612337573d6000803e3d6000fd5b505050505b505080806123499061505c565b9150506121b7565b505050505050505050565b6000838152606f60209081526040808320858452909152812061237f90836128f8565b949350505050565b60006001600160e01b03198216637965db0b60e01b1480610a2257506301ffc9a760e01b6001600160e01b0319831614610a22565b60005460ff16156111345760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016109f4565b61241c6124173685900385016040860161542e565b6131de565b6124258361327e565b600061244061243a6040860160208701614753565b83611408565b8051909150600181111561245657612456614792565b6124666060860160408701615177565b600181111561247757612477614792565b146124945760405162461bcd60e51b81526004016109f490615194565b6124c383306124a96040880160208901614753565b6124bb36899003890160408a0161542e565b929190613343565b6124d38483858460200151612c8a565b5050505050565b835160808501516124ea906131de565b60008560200151600181111561250257612502614792565b1461255b5760405162461bcd60e51b8152602060048201526024808201527f526f6e696e4761746577617956323a20696e76616c69642072656365697074206044820152631ada5b9960e21b60648201526084016109f4565b46856060015160400151146125b25760405162461bcd60e51b815260206004820181905260248201527f526f6e696e4761746577617956323a20696e76616c696420636861696e20696460448201526064016109f4565b60006125ce866060015160200151876040015160400151611408565b60808701515190915060018111156125e8576125e8614792565b815160018111156125fb576125fb614792565b14801561262557508560400151602001516001600160a01b031681602001516001600160a01b0316145b6126715760405162461bcd60e51b815260206004820152601f60248201527f526f6e696e4761746577617956323a20696e76616c696420726563656970740060448201526064016109f4565b6040808701518101516000908152606f602090815282822085835290529081209061269b886127e8565b905060006126ac8389898986612871565b905088604001516040015185896001600160a01b03167f48c4262ed68beb92fe5d7d48d70772e49cd50c317937dea60a99f15f794b6459856040516126f391815260200190565b60405180910390a4600181600481111561270f5761270f614792565b0361235157825460ff191660021783556060890151805160209091015160808b015161273e92909160006135da565b607554895160405163114fc47560e11b81526001600160a01b039092169163229f88ea916127729160009190600401614fca565b600060405180830381600087803b15801561278c57600080fd5b505af11580156127a0573d6000803e3d6000fd5b505050507f8d20d8121a34dded9035ff5b43e901c142824f7a22126392992c353c37890524828a6040516127d5929190614fe5565b60405180910390a1505050505050505050565b60007fb9d1fe7c9deeec5dc90a2f47ff1684239519f2545b2228d3d91fb27df3189eea60001b82600001518360200151612825856040015161394f565b612832866060015161394f565b61283f87608001516139b2565b6040516020016128549695949392919061544a565b604051602081830303815290604052805190602001209050919050565b600061287e8686846139f5565b60008061288b8885613a9a565b909250905061289e888784888589613c8c565b98975050505050505050565b611b2b8133613ce8565b6128be8282613d26565b6000828152606c60205260409020610f709082613dac565b6128e08282613dc1565b6000828152606c60205260409020610f709082613e28565b6001600160a01b031660009081526002919091016020526040902054151590565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b61294f613e3d565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405161298991906145bc565b60405180910390a1565b8281146129b25760405162461bcd60e51b81526004016109f490615130565b60005b83811015612a2d578282828181106129cf576129cf614fb4565b90506020020135603860008787858181106129ec576129ec614fb4565b9050602002016020810190612a019190614753565b6001600160a01b0316815260208101919091526040016000205580612a258161505c565b9150506129b5565b507f6f52f53a938df83439fa4c6055c7df0a6906d621aa6dfa4708187037fdfc41da84848484604051612a6394939291906154ff565b60405180910390a150505050565b60008082841115612ad05760405162461bcd60e51b8152602060048201526024808201527f4761746577617956323a20696e76616c696420747275737465642074687265736044820152631a1bdb1960e21b60648201526084016109f4565b5050600154600254607884905560798390556004805484918691906000612af68361505c565b9091555060408051868152602081018690527feac82d4d949d2d4f77f96aa68ab6b1bb750da73f14e55d41a1b93f387471ecba91015b60405180910390a49250929050565b6077546040805163cacf8fb560e01b815290516000926001600160a01b03169163cacf8fb59160048083019260209291908290030181865afa158015612b85573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a99190615531565b6000607954600160795484607854612bc19190615266565b612bcb919061554a565b612bd5919061555d565b610a229190615570565b6074546040805163158b54c160e21b815290516000926001600160a01b03169163562d53049160048083019260209291908290030181865afa158015612b85573d6000803e3d6000fd5b6000600254600160025484600154612bc19190615266565b612c496123bc565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861297c3390565b600061107e8383613e86565b606e805460009182612c9b8361505c565b9091555090506000612cc284838588612cb9368c90038c018c615592565b93929190613eb0565b60008381526071602090815260409091208251815590820151600180830180549495508594909160ff19909116908381811115612d0157612d01614792565b021790555060408281015180516002840180546001600160a01b039283166001600160a01b03199182161790915560208084015160038701805491851691841691909117905592840151600486015560608601518051600587018054918516918416919091179055928301516006860180549190931691161790550151600782015560808201518051600883018054909190829060ff191660018381811115612dac57612dac614792565b0217905550602082015181600101556040820151816002015550509050507ff313c253a5be72c29d0deb2c8768a9543744ac03d6b3cafd50cc976f1c2632fc612df4826127e8565b82604051612e03929190614fe5565b60405180910390a150949350505050565b610a3b82826128b4565b60008082841115612e705760405162461bcd60e51b815260206004820152601c60248201527b11d85d195dd85e558c8e881a5b9d985b1a59081d1a1c995cda1bdb1960221b60448201526064016109f4565b50506001805460028054928590558390556004805491929184918691906000612e988361505c565b9091555060408051868152602081018690527f976f8a9c5bdf8248dec172376d6e2b80a8e3df2f0328e381c6db8e1cf138c0f89101612b2c565b8685148015612ee057508683145b612efc5760405162461bcd60e51b81526004016109f49061527d565b60005b8781101561309857868682818110612f1957612f19614fb4565b9050602002016020810190612f2e9190614753565b607360008b8b85818110612f4457612f44614fb4565b9050602002016020810190612f599190614753565b6001600160a01b03166001600160a01b031681526020019081526020016000206000878785818110612f8d57612f8d614fb4565b90506020020135815260200190815260200160002060000160016101000a8154816001600160a01b0302191690836001600160a01b03160217905550828282818110612fdb57612fdb614fb4565b9050602002016020810190612ff09190615177565b607360008b8b8581811061300657613006614fb4565b905060200201602081019061301b9190614753565b6001600160a01b03166001600160a01b03168152602001908152602001600020600087878581811061304f5761304f614fb4565b60209081029290920135835250810191909152604001600020805460ff19166001838181111561308157613081614792565b0217905550806130908161505c565b915050612eff565b507f2544bff60c6d5b84946e06804af9f84e150bbee85238dbdee79efca4e0adf40188888888888888886040516130d69897969594939291906155e5565b60405180910390a15050505050505050565b607580546001600160a01b0319166001600160a01b0383161790556040517f034c8da497df28467c79ddadbba1cc3cdd41f510ea73faae271e6f16a6111621906131339083906145bc565b60405180910390a150565b607780546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d7906131339083906145bc565b6000610a22825490565b607480546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906131339083906145bc565b6000815160018111156131f3576131f3614792565b148015613204575060008160400151115b801561321257506020810151155b8061323c575060018151600181111561322d5761322d614792565b14801561323c57506040810151155b611b2b5760405162461bcd60e51b8152602060048201526013602482015272546f6b656e3a20696e76616c696420696e666f60681b60448201526064016109f4565b60006132906060830160408401615177565b60018111156132a1576132a1614792565b1415806132df5750603860006132bd6040840160208501614753565b6001600160a01b03168152602081019190915260400160002054608082013510155b611b2b5760405162461bcd60e51b815260206004820152602f60248201527f4d696e696d756d5769746864726177616c3a20717565727920666f7220746f6f60448201526e20736d616c6c207175616e7469747960881b60648201526084016109f4565b60006060818651600181111561335b5761335b614792565b0361343d57826001600160a01b03166323b872dd60e01b8686896040015160405160240161338b93929190615674565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516133c99190615698565b6000604051808303816000865af19150503d8060008114613406576040519150601f19603f3d011682016040523d82523d6000602084013e61340b565b606091505b5090925090508180156134365750805115806134365750808060200190518101906134369190614d73565b9150613557565b60018651600181111561345257613452614792565b0361350557826001600160a01b03166323b872dd8686896020015160405160240161347f93929190615674565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516134b89190615698565b6000604051808303816000865af19150503d80600081146134f5576040519150601f19603f3d011682016040523d82523d6000602084013e6134fa565b606091505b505080925050613557565b60405162461bcd60e51b815260206004820152602160248201527f546f6b656e3a20756e737570706f7274656420746f6b656e207374616e6461726044820152601960fa1b60648201526084016109f4565b81610b615761356586613f1c565b613579866001600160a01b03166014613f89565b61358d866001600160a01b03166014613f89565b6135a1866001600160a01b03166014613f89565b6040516020016135b494939291906156b4565b60408051601f198184030181529082905262461bcd60e51b82526109f49160040161576a565b6000816001600160a01b0316836001600160a01b0316036136895760408086015190516001600160a01b0386169180156108fc02916000818181858888f1935050505061368457816001600160a01b031663d0e30db086604001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561366057600080fd5b505af1158015613674573d6000803e3d6000fd5b5050505050613684858585614124565b6124d3565b60008551600181111561369e5761369e614792565b0361382f576040516370a0823160e01b81526000906001600160a01b038516906370a08231906136d29030906004016145bc565b602060405180830381865afa1580156136ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137139190615531565b9050856040015181101561381e57836001600160a01b03166340c10f1930838960400151613741919061555d565b60405160240161375292919061577d565b6040516020818303038152906040529060e01b6020820180516001600160e01b03838183161783525050505060405161378b9190615698565b6000604051808303816000865af19150503d80600081146137c8576040519150601f19603f3d011682016040523d82523d6000602084013e6137cd565b606091505b5050809250508161381e5760405162461bcd60e51b815260206004820152601b60248201527a151bdad95b8e88115490cc8c081b5a5b9d1a5b99c819985a5b1959602a1b60448201526064016109f4565b613829868686614124565b506124d3565b60018551600181111561384457613844614792565b0361350557613858838587602001516141c6565b61368457826001600160a01b03166340c10f1985876020015160405160240161388292919061577d565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516138bb9190615698565b6000604051808303816000865af19150503d80600081146138f8576040519150601f19603f3d011682016040523d82523d6000602084013e6138fd565b606091505b505080915050806136845760405162461bcd60e51b815260206004820152601c60248201527b151bdad95b8e88115490cdcc8c481b5a5b9d1a5b99c819985a5b195960221b60448201526064016109f4565b80516020808301516040808501519051600094612854947f353bdd8d69b9e3185b3972e08b03845c0c14a21a390215302776a7a34b0e87649491939192019384526001600160a01b03928316602085015291166040830152606082015260800190565b80516020808301516040808501519051600094612854947f1e2b74b2a792d5c0f0b6e59b037fa9d43d84fbb759337f0112fcc15ca414fc8d949193919201615796565b60008360030154118015613a0d575042836003015411155b15613a1e57825460ff191660041783555b613a2883836128f8565b15613a5157613a41826001600160a01b03166014613f89565b6040516020016135b491906157c1565b6001600160a01b039091166000818152600284016020908152604082209390935560059093018054600181018255908452919092200180546001600160a01b0319169091179055565b6000806000806000607460009054906101000a90046001600160a01b03166001600160a01b031663b7ab4db56040518163ffffffff1660e01b8152600401600060405180830381865afa158015613af5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613b1d91908101906158ac565b607754604051632907e73160e11b815293965091945092506000916001600160a01b039091169063520fce6290613b58908790600401615997565b600060405180830381865afa158015613b75573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613b9d91908101906159d8565b905060005b8351811015613c8057613be16002848381518110613bc257613bc2614fb4565b60200260200101516003811115613bdb57613bdb614792565b9061427a565b8015613c2c575087896002016000868481518110613c0157613c01614fb4565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054145b15613c6e5786613c3b8161505c565b9750506000828281518110613c5257613c52614fb4565b60200260200101511115613c6e5785613c6a8161505c565b9650505b80613c788161505c565b915050613ba2565b50505050509250929050565b6000858510158015613c9e5750838310155b8015613cbf57506000875460ff166004811115613cbd57613cbd614792565b145b15613cd757865460ff19166001908117885587018290555b50855460ff165b9695505050505050565b613cf282826116ff565b610a3b57613d0a816001600160a01b03166014613f89565b613d15836020613f89565b6040516020016135b4929190615a5d565b613d3082826116ff565b610a3b576000828152606b602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613d683390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061107e836001600160a01b0384166142ad565b613dcb82826116ff565b15610a3b576000828152606b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061107e836001600160a01b0384166142fc565b60005460ff166111345760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109f4565b6000826000018281548110613e9d57613e9d614fb4565b9060005260206000200154905092915050565b613eb8614523565b92835260016020808501919091526060840180516001600160a01b0396871690528682015181519087169083015251466040918201528651818601805191881690915280519490961693909101929092529251810192909252910151608082015290565b6060613f4782600001516001811115613f3757613f37614792565b6001600160a01b03166001613f89565b613f5483602001516143ef565b613f6184604001516143ef565b604051602001613f7393929190615acc565b6040516020818303038152906040529050919050565b60606000613f98836002615266565b613fa390600261554a565b6001600160401b03811115613fba57613fba614dd8565b6040519080825280601f01601f191660200182016040528015613fe4576020820181803683370190505b509050600360fc1b81600081518110613fff57613fff614fb4565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061402e5761402e614fb4565b60200101906001600160f81b031916908160001a9053506000614052846002615266565b61405d90600161554a565b90505b60018111156140d5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061409157614091614fb4565b1a60f81b8282815181106140a7576140a7614fb4565b60200101906001600160f81b031916908160001a90535060049490941c936140ce81615b4a565b9050614060565b50831561107e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109f4565b6000808451600181111561413a5761413a614792565b036141555761414e82848660400151614446565b905061417e565b60018451600181111561416a5761416a614792565b036135055761414e828486602001516141c6565b806114025761418c84613f1c565b6141a0846001600160a01b03166014613f89565b6141b4846001600160a01b03166014613f89565b6040516020016135b493929190615b61565b6000836001600160a01b03166323b872dd60e01b3085856040516024016141ef93929190615674565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161422d9190615698565b6000604051808303816000865af19150503d806000811461426a576040519150601f19603f3d011682016040523d82523d6000602084013e61426f565b606091505b509095945050505050565b600081600381111561428e5761428e614792565b8360038111156142a0576142a0614792565b1660ff1615159392505050565b60008181526001830160205260408120546142f457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a22565b506000610a22565b600081815260018301602052604081205480156143e557600061432060018361555d565b85549091506000906143349060019061555d565b905081811461439957600086600001828154811061435457614354614fb4565b906000526020600020015490508087600001848154811061437757614377614fb4565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806143aa576143aa615bef565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a22565b6000915050610a22565b6060816000036144195750506040805180820190915260048152630307830360e41b602082015290565b8160005b811561443c578061442d8161505c565b915050600882901c915061441d565b61237f8482613f89565b60006060846001600160a01b031663a9059cbb60e01b858560405160240161446f92919061577d565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516144ad9190615698565b6000604051808303816000865af19150503d80600081146144ea576040519150601f19603f3d011682016040523d82523d6000602084013e6144ef565b606091505b50909250905081801561451a57508051158061451a57508080602001905181019061451a9190614d73565b95945050505050565b6040805160a08101825260008082526020820152908101614542614572565b815260200161454f614572565b815260408051606081018252600080825260208281018290529282015291015290565b604080516060810182526000808252602082018190529181019190915290565b6000602082840312156145a457600080fd5b81356001600160e01b03198116811461107e57600080fd5b6001600160a01b0391909116815260200190565b60008082840360c08112156145e457600080fd5b60a08112156145f257600080fd5b50919360a08501359350915050565b6000610160828403121561461457600080fd5b50919050565b60008083601f84011261462c57600080fd5b5081356001600160401b0381111561464357600080fd5b6020830191508360208260051b850101111561159057600080fd5b6000806020838503121561467157600080fd5b82356001600160401b0381111561468757600080fd5b6146938582860161461a565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156146d95783511515835292840192918401916001016146bb565b50909695505050505050565b6000602082840312156146f757600080fd5b5035919050565b6001600160a01b0381168114611b2b57600080fd5b803561471e816146fe565b919050565b6000806040838503121561473657600080fd5b823591506020830135614748816146fe565b809150509250929050565b60006020828403121561476557600080fd5b813561107e816146fe565b6000806040838503121561478357600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b60808101600586106147bc576147bc614792565b9481526020810193909352604083019190915260609091015290565b60008083601f8401126147ea57600080fd5b5081356001600160401b0381111561480157600080fd5b60208301915083602060a08302850101111561159057600080fd5b60008060006040848603121561483157600080fd5b83356001600160401b0381111561484757600080fd5b614853868287016147d8565b909790965060209590950135949350505050565b6000806040838503121561487a57600080fd5b8235614885816146fe565b946020939093013593505050565b60028110611b2b57611b2b614792565b815160408201906148b381614893565b82526020928301516001600160a01b0316929091019190915290565b600080600080604085870312156148e557600080fd5b84356001600160401b03808211156148fc57600080fd5b6149088883890161461a565b9096509450602087013591508082111561492157600080fd5b5061492e8782880161461a565b95989497509550505050565b80516001600160a01b03908116835260208083015190911690830152604090810151910152565b805161496c81614893565b825260208181015190830152604090810151910152565b858152610160810161499486614893565b8560208301526149a7604083018661493a565b6149b460a083018561493a565b613cde610100830184614961565b600080600080604085870312156149d857600080fd5b84356001600160401b03808211156149ef57600080fd5b614908888389016147d8565b8060408101831015610a2257600080fd5b60008060008060008060008060008060006101208c8e031215614a2e57600080fd5b614a378c614713565b9a5060208c0135995060408c0135985060608c0135975060808c013596506001600160401b0360a08d0135811015614a6e57600080fd5b614a7e8e60a08f01358f0161461a565b909750955060c08d0135811015614a9457600080fd5b614aa48e60c08f01358f016149fb565b94508060e08e01351115614ab757600080fd5b614ac78e60e08f01358f016149fb565b9350806101008e01351115614adb57600080fd5b50614aed8d6101008e01358e0161461a565b81935080925050509295989b509295989b9093969950565b60008060208385031215614b1857600080fd5b82356001600160401b0380821115614b2f57600080fd5b818501915085601f830112614b4357600080fd5b813581811115614b5257600080fd5b86602061016083028501011115614b6857600080fd5b60209290920196919550909350505050565b6000806000806000806000806080898b031215614b9657600080fd5b88356001600160401b0380821115614bad57600080fd5b614bb98c838d0161461a565b909a50985060208b0135915080821115614bd257600080fd5b614bde8c838d0161461a565b909850965060408b0135915080821115614bf757600080fd5b614c038c838d0161461a565b909650945060608b0135915080821115614c1c57600080fd5b50614c298b828c0161461a565b999c989b5096995094979396929594505050565b600080600060408486031215614c5257600080fd5b8335925060208401356001600160401b03811115614c6f57600080fd5b614c7b8682870161461a565b9497909650939450505050565b60005b83811015614ca3578181015183820152602001614c8b565b50506000910152565b60008151808452614cc4816020860160208601614c88565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015614d2d57603f19888603018452614d1b858351614cac565b94509285019290850190600101614cff565b5092979650505050505050565b600080600060608486031215614d4f57600080fd5b83359250602084013591506040840135614d68816146fe565b809150509250925092565b600060208284031215614d8557600080fd5b8151801515811461107e57600080fd5b60208082526023908201527f526f6e696e4761746577617956323a20756e617574686f72697a65642073656e6040820152623232b960e91b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715614e1057614e10614dd8565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614e3e57614e3e614dd8565b604052919050565b60028110611b2b57600080fd5b600060608284031215614e6557600080fd5b614e6d614dee565b90508135614e7a816146fe565b81526020820135614e8a816146fe565b806020830152506040820135604082015292915050565b600060608284031215614eb357600080fd5b614ebb614dee565b90508135614ec881614e46565b80825250602082013560208201526040820135604082015292915050565b60006101608284031215614ef957600080fd5b60405160a081016001600160401b0381118282101715614f1b57614f1b614dd8565b604052823581526020830135614f3081614e46565b6020820152614f428460408501614e53565b6040820152614f548460a08501614e53565b6060820152614f67846101008501614ea1565b60808201529392505050565b60038110614f8357614f83614792565b9052565b60608101614f958286614f73565b60208201939093526001600160a01b0391909116604090910152919050565b634e487b7160e01b600052603260045260246000fd5b60408101614fd88285614f73565b8260208301529392505050565b60006101808201905083825282516020830152602083015161500681614893565b80604084015250604083015161501f606084018261493a565b50606083015161503260c084018261493a565b5060808301516120a5610120840182614961565b634e487b7160e01b600052601160045260246000fd5b60006001820161506e5761506e615046565b5060010190565b60208082526024908201527f526f6e696e4761746577617956323a207769746864726177616c73206d696772604082015263185d195960e21b606082015260800190565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b6020808252818101527f4761746577617956323a206e6f7420617574686f72697a656420706175736572604082015260600190565b60208082526027908201527f4d696e696d756d5769746864726177616c3a20696e76616c6964206172726179604082015266040d8cadccee8d60cb1b606082015260800190565b60006020828403121561518957600080fd5b813561107e81614e46565b60208082526026908201527f526f6e696e4761746577617956323a20696e76616c696420746f6b656e207374604082015265185b99185c9960d21b606082015260800190565b6000808335601e198436030181126151f157600080fd5b8301803591506001600160401b0382111561520b57600080fd5b6020019150600581901b360382131561159057600080fd5b60208082526023908201527f526f6e696e4761746577617956323a2073657420746f206e6f6e2d636f6e74726040820152621858dd60ea1b606082015260800190565b8082028115828204841417610a2257610a22615046565b6020808252602490820152600080516020615c268339815191526040820152630dccee8d60e31b606082015260800190565b600181811c908216806152c357607f821691505b60208210810361461457634e487b7160e01b600052602260045260246000fd5b6000808335601e198436030181126152fa57600080fd5b8301803591506001600160401b0382111561531457600080fd5b60200191503681900382131561159057600080fd5b601f821115610f7057600081815260208120601f850160051c810160208610156153505750805b601f850160051c820191505b81811015610b615782815560010161535c565b6001600160401b0383111561538657615386614dd8565b61539a8361539483546152af565b83615329565b6000601f8411600181146153ce57600085156153b65750838201355b600019600387901b1c1916600186901b1783556124d3565b600083815260209020601f19861690835b828110156153ff57868501358255602094850194600190920191016153df565b508682101561541c5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60006060828403121561544057600080fd5b61107e8383614ea1565b8681526020810186905260c0810161546186614893565b8560408301528460608301528360808301528260a0830152979650505050505050565b8183526000602080850194508260005b858110156154c25781356154a7816146fe565b6001600160a01b031687529582019590820190600101615494565b509495945050505050565b81835260006001600160fb1b038311156154e657600080fd5b8260051b80836020870137939093016020019392505050565b604081526000615513604083018688615484565b82810360208401526155268185876154cd565b979650505050505050565b60006020828403121561554357600080fd5b5051919050565b80820180821115610a2257610a22615046565b81810381811115610a2257610a22615046565b60008261558d57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082840312156155a457600080fd5b6155ac614dee565b82356155b7816146fe565b815260208301356155c7816146fe565b60208201526155d98460408501614ea1565b60408201529392505050565b6080815260006155f9608083018a8c615484565b60208382038185015261560d828a8c615484565b9150838203604085015261562282888a6154cd565b8481036060860152858152869250810160005b8681101561566357833561564881614e46565b61565181614893565b82529282019290820190600101615635565b509c9b505050505050505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600082516156aa818460208701614c88565b9190910192915050565b7902a37b5b2b71d1031b7bab632103737ba103a3930b739b332b9160351b81526000855160206156ea82601a8601838b01614c88565b65010333937b6960d51b601a92850192830152865161570e81838501848b01614c88565b630103a37960e51b92018181019290925285516157318160248501898501614c88565b660103a37b5b2b7160cd1b60249390910192830152845161575881602b8501848901614c88565b91909101602b01979650505050505050565b60208152600061107e6020830184614cac565b6001600160a01b03929092168252602082015260400190565b848152608081016157a685614893565b84602083015283604083015282606083015295945050505050565b73024b9b7b630ba32b223b7bb32b93730b731b29d160651b8152600082516157f0816014850160208701614c88565b6d08185b1c9958591e481d9bdd195960921b6014939091019283015250602201919050565b60006001600160401b0382111561582e5761582e614dd8565b5060051b60200190565b600082601f83011261584957600080fd5b8151602061585e61585983615815565b614e16565b82815260059290921b8401810191818101908684111561587d57600080fd5b8286015b848110156158a1578051615894816146fe565b8352918301918301615881565b509695505050505050565b6000806000606084860312156158c157600080fd5b83516001600160401b03808211156158d857600080fd5b6158e487838801615838565b94506020915081860151818111156158fb57600080fd5b61590788828901615838565b94505060408601518181111561591c57600080fd5b86019050601f8101871361592f57600080fd5b805161593d61585982615815565b81815260059190911b8201830190838101908983111561595c57600080fd5b928401925b82841015615988578351600481106159795760008081fd5b82529284019290840190615961565b80955050505050509250925092565b6020808252825182820181905260009190848201906040850190845b818110156146d95783516001600160a01b0316835292840192918401916001016159b3565b600060208083850312156159eb57600080fd5b82516001600160401b03811115615a0157600080fd5b8301601f81018513615a1257600080fd5b8051615a2061585982615815565b81815260059190911b82018301908381019087831115615a3f57600080fd5b928401925b8284101561552657835182529284019290840190615a44565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615a8f816017850160208801614c88565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615ac0816028840160208801614c88565b01602801949350505050565b690a8ded6cadc92dcccde560b31b815260008451615af181600a850160208901614c88565b8083019050600b60fa1b80600a8301528551615b1481600b850160208a01614c88565b600b9201918201528351615b2f81600c840160208801614c88565b602960f81b600c9290910191820152600d0195945050505050565b600081615b5957615b59615046565b506000190190565b7902a37b5b2b71d1031b7bab632103737ba103a3930b739b332b9160351b815260008451615b9681601a850160208901614c88565b630103a37960e51b601a918401918201528451615bba81601e840160208901614c88565b660103a37b5b2b7160cd1b601e92909101918201528351615be2816025840160208801614c88565b0160250195945050505050565b634e487b7160e01b600052603160045260246000fdfe384495a48d92b97cd9b9d199c73ed783dd1aa0076a6ebcf9156ca7fef7d2cc40526f6e696e4761746577617956323a20696e76616c6964206172726179206c65a26469706673582212208cd4d8292599ff0b8fe0d69fd71f8f54876d48cbe03af5472ba8a902dd3fad7964736f6c63430008110033", + "deployedBytecode": "0x60806040526004361061025e5760003560e01c806301ffc9a714610275578063065b3adf146102aa5780630b1ff17f146102d7578063109679ef146102f757806317892f961461031757806317fa2ea114610340578063248a9ca31461036d5780632f2ff15d1461039b57806336568abe146103bb5780633b5afc22146103db5780633e4574ec146103f05780633e70838b146104105780633f4ba83a146104305780634493421e1461044557806347b56b2c146104635780634d92c4f0146104835780634f2717c7146104e45780635511cde1146104fe5780635a7dd06a1461051c5780635c975abb1461053c5780635d6a9a901461055457806364363f781461058157806371706cbe146105a157806375535f86146105b75780637657990e146105d75780637de5dedd146105ec578063835fc6ca146106015780638456cb59146106325780639010d07c1461064757806391d1485414610667578063931ec987146106875780639584a592146106a757806399439089146106c75780639c8d98da146106e5578063a217fddf14610705578063affed0e01461071a578063b5e337de14610730578063b9afa17714610750578063b9c3620914610770578063bc7f038614610790578063c28f7894146107bd578063ca15c87314610803578063cdf64a7614610823578063d547741f14610843578063dafae40814610863578063dbd2ef6c14610883578063e75235b8146108a3578063ecc83649146108bb578063f0ce418e146108e8578063f668214a1461092e578063fa3896591461094e578063fc6574bc1461096e578063fe90d9c21461098e5761026d565b3661026d5761026b6109b0565b005b61026b6109b0565b34801561028157600080fd5b50610295610290366004614592565b6109fd565b60405190151581526020015b60405180910390f35b3480156102b657600080fd5b506005546102ca906001600160a01b031681565b6040516102a191906145bc565b3480156102e357600080fd5b5061026b6102f23660046145d0565b610a28565b34801561030357600080fd5b5061026b610312366004614601565b610a3f565b34801561032357600080fd5b506078546079545b604080519283526020830191909152016102a1565b34801561034c57600080fd5b5061036061035b36600461465e565b610b69565b6040516102a1919061469f565b34801561037957600080fd5b5061038d6103883660046146e5565b610f3f565b6040519081526020016102a1565b3480156103a757600080fd5b5061026b6103b6366004614723565b610f54565b3480156103c757600080fd5b5061026b6103d6366004614723565b610f75565b3480156103e757600080fd5b5061026b610fef565b3480156103fc57600080fd5b5061029561040b366004614723565b611066565b34801561041c57600080fd5b5061026b61042b366004614753565b611085565b34801561043c57600080fd5b5061026b6110df565b34801561045157600080fd5b506075546001600160a01b03166102ca565b34801561046f57600080fd5b5061026b61047e3660046146e5565b611136565b34801561048f57600080fd5b506104d461049e366004614770565b606f602090815260009283526040808420909152908252902080546001820154600383015460049093015460ff90921692909184565b6040516102a194939291906147a8565b3480156104f057600080fd5b50606d546102959060ff1681565b34801561050a57600080fd5b506077546001600160a01b03166102ca565b34801561052857600080fd5b5061026b61053736600461481c565b611370565b34801561054857600080fd5b5060005460ff16610295565b34801561056057600080fd5b5061057461056f366004614867565b611408565b6040516102a191906148a3565b34801561058d57600080fd5b5061026b61059c3660046148cf565b6114e5565b3480156105ad57600080fd5b5061038d606e5481565b3480156105c357600080fd5b5061032b6105d2366004614770565b611546565b3480156105e357600080fd5b5061038d611597565b3480156105f857600080fd5b5061038d6115ae565b34801561060d57600080fd5b5061062161061c3660046146e5565b6115c0565b6040516102a1959493929190614983565b34801561063e57600080fd5b5061026b611692565b34801561065357600080fd5b506102ca610662366004614770565b6116e7565b34801561067357600080fd5b50610295610682366004614723565b6116ff565b34801561069357600080fd5b5061026b6106a23660046149c2565b61172a565b3480156106b357600080fd5b5061026b6106c2366004614a0c565b6118ce565b3480156106d357600080fd5b506074546001600160a01b03166102ca565b3480156106f157600080fd5b5061026b610700366004614753565b611ac0565b34801561071157600080fd5b5061038d600081565b34801561072657600080fd5b5061038d60045481565b34801561073c57600080fd5b5061026b61074b366004614753565b611b2e565b34801561075c57600080fd5b5061036061076b366004614b05565b611b99565b34801561077c57600080fd5b5061032b61078b366004614770565b611dbd565b34801561079c57600080fd5b5061038d6107ab366004614753565b60386020526000908152604090205481565b3480156107c957600080fd5b506104d46107d83660046146e5565b607660205260009081526040902080546001820154600383015460049093015460ff90921692909184565b34801561080f57600080fd5b5061038d61081e3660046146e5565b611e02565b34801561082f57600080fd5b5061026b61083e366004614753565b611e19565b34801561084f57600080fd5b5061026b61085e366004614723565b611e84565b34801561086f57600080fd5b5061029561087e3660046146e5565b611ea0565b34801561088f57600080fd5b5061026b61089e366004614b7a565b611ecc565b3480156108af57600080fd5b5060015460025461032b565b3480156108c757600080fd5b506108db6108d6366004614c3d565b611f3b565b6040516102a19190614cd8565b3480156108f457600080fd5b506104d46109033660046146e5565b607060205260009081526040902080546001820154600383015460049093015460ff90921692909184565b34801561093a57600080fd5b506102956109493660046146e5565b6120ad565b34801561095a57600080fd5b5061026b6109693660046148cf565b6120db565b34801561097a57600080fd5b50610295610989366004614d3a565b61235c565b34801561099a57600080fd5b5061038d600080516020615c0683398151915281565b60405162461bcd60e51b815260206004820152601f60248201527f526f6e696e4761746577617956323a20696e76616c696420726571756573740060448201526064015b60405180910390fd5b60006001600160e01b03198216635a05180f60e01b1480610a225750610a2282612387565b92915050565b610a306123bc565b610a3b823383612402565b5050565b610a476123bc565b607454604051635a02d57960e11b81526001600160a01b039091169063b405aaf290610a779033906004016145bc565b602060405180830381865afa158015610a94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ab89190614d73565b610ad45760405162461bcd60e51b81526004016109f490614d95565b33610afd610ae736849003840184614ee6565b82610af06115ae565b610af8611597565b6124da565b60755460405163c7c4fea960e01b81526001600160a01b039091169063c7c4fea990610b33906000908635908690600401614f87565b600060405180830381600087803b158015610b4d57600080fd5b505af1158015610b61573d6000803e3d6000fd5b505050505050565b607454604051635a02d57960e11b81526060916001600160a01b03169063b405aaf290610b9a9033906004016145bc565b602060405180830381865afa158015610bb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdb9190614d73565b610bf75760405162461bcd60e51b81526004016109f490614d95565b336000610c026115ae565b90506000610c0e611597565b90506000856001600160401b03811115610c2a57610c2a614dd8565b604051908082528060200260200182016040528015610c53578160200160208202803683370190505b50945060005b86811015610f3457878782818110610c7357610c73614fb4565b60755460405163c7c4fea960e01b81526020909202939093013594506001600160a01b039092169163c7c4fea99150610cb59060029086908a90600401614f87565b600060405180830381600087803b158015610ccf57600080fd5b505af1158015610ce3573d6000803e3d6000fd5b50505050610cf0826120ad565b15610d1e576001868281518110610d0957610d09614fb4565b91151560209283029190910190910152610f22565b600082815260706020908152604080832060718352818420825160a081019093528054835260018082015492959491929184019160ff1690811115610d6557610d65614792565b6001811115610d7657610d76614792565b8152604080516060808201835260028501546001600160a01b039081168352600386015481166020848101919091526004870154848601528086019390935283518083018552600587015482168152600687015490911692810192909252600785015482840152828401919091528151808201909252600884018054919093019290829060ff166001811115610e0e57610e0e614792565b6001811115610e1f57610e1f614792565b81526001820154602082015260029091015460409091015290525090506000610e47826127e8565b90506000610e58848a8a8a86612871565b90506001816004811115610e6e57610e6e614792565b03610f1d57835460ff19166002908117855560755460405163114fc47560e11b81526001600160a01b039091169163229f88ea91610eb191908a90600401614fca565b600060405180830381600087803b158015610ecb57600080fd5b505af1158015610edf573d6000803e3d6000fd5b505050507f62520d049932cdee872e9b3c59c0f6073637147e5e9bc8b050b062430eaf5c9f8284604051610f14929190614fe5565b60405180910390a15b505050505b80610f2c8161505c565b915050610c59565b505050505092915050565b6000908152606b602052604090206001015490565b610f5d82610f3f565b610f66816128aa565b610f7083836128b4565b505050565b6001600160a01b0381163314610fe55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084016109f4565b610a3b82826128d6565b610ffa6000336116ff565b806110185750611018600080516020615c06833981519152336116ff565b6110345760405162461bcd60e51b81526004016109f490614d95565b606d5460ff16156110575760405162461bcd60e51b81526004016109f490615075565b606d805460ff19166001179055565b600082815260706020526040812061107e90836128f8565b9392505050565b61108d612919565b6001600160a01b0316336001600160a01b0316146110bd5760405162461bcd60e51b81526004016109f4906150b9565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b6110e7612919565b6001600160a01b0316336001600160a01b0316148061111057506005546001600160a01b031633145b61112c5760405162461bcd60e51b81526004016109f4906150fb565b611134612947565b565b61113e6123bc565b611147816120ad565b156111aa5760405162461bcd60e51b815260206004820152602d60248201527f526f6e696e4761746577617956323a207769746864726577206f6e206d61696e60448201526c636861696e20616c726561647960981b60648201526084016109f4565b6000818152607160209081526040808320815160a0810190925280548252600180820154929391929184019160ff16908111156111e9576111e9614792565b60018111156111fa576111fa614792565b8152604080516060808201835260028501546001600160a01b039081168352600386015481166020848101919091526004870154848601528086019390935283518083018552600587015482168152600687015490911692810192909252600785015482840152828401919091528151808201909252600884018054919093019290829060ff16600181111561129257611292614792565b60018111156112a3576112a3614792565b81526001820154602082015260029091015460409182015291526060830151015191925050461461132b5760405162461bcd60e51b815260206004820152602c60248201527f526f6e696e4761746577617956323a20717565727920666f7220696e76616c6960448201526b19081dda5d1a191c985dd85b60a21b60648201526084016109f4565b7f04e8cbd836dea43a2dc7eb19de345cca3a8e6978a2ef5225d924775500f67c7c611355826127e8565b82604051611364929190614fe5565b60405180910390a15050565b6113786123bc565b816113c35760405162461bcd60e51b815260206004820152601b60248201527a526f6e696e4761746577617956323a20656d70747920617272617960281b60448201526064016109f4565b60005b82811015611402576113f08484838181106113e3576113e3614fb4565b905060a002013384612402565b806113fa8161505c565b9150506113c6565b50505050565b604080518082018252600080825260208083018290526001600160a01b038616825260738152838220858352905282902082518084019093528054919291829060ff16600181111561145c5761145c614792565b600181111561146d5761146d614792565b815290546001600160a01b0361010090910481166020928301529082015191925016610a225760405162461bcd60e51b815260206004820152602160248201527f526f6e696e4761746577617956323a20756e737570706f7274656420746f6b656044820152603760f91b60648201526084016109f4565b6114ed612919565b6001600160a01b0316336001600160a01b03161461151d5760405162461bcd60e51b81526004016109f4906150b9565b8261153a5760405162461bcd60e51b81526004016109f490615130565b61140284848484612993565b600080611551612919565b6001600160a01b0316336001600160a01b0316146115815760405162461bcd60e51b81526004016109f4906150b9565b61158b8484612a71565b915091505b9250929050565b60006115a96115a4612b3b565b612ba9565b905090565b60006115a96115bb612bdf565b612c29565b607160209081526000918252604091829020805460018083015485516060808201885260028601546001600160a01b03908116835260038701548116838901526004870154838a015288518083018a526005880154821681526006880154909116978101979097526007860154878901528751908101909752600885018054949760ff93841697929692959294909391928492169081111561166457611664614792565b600181111561167557611675614792565b815260200160018201548152602001600282015481525050905085565b61169a612919565b6001600160a01b0316336001600160a01b031614806116c357506005546001600160a01b031633145b6116df5760405162461bcd60e51b81526004016109f4906150fb565b611134612c41565b6000828152606c6020526040812061107e9083612c7e565b6000918252606b602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020615c06833981519152611742816128aa565b606d5460ff16156117655760405162461bcd60e51b81526004016109f490615075565b818414801561177357508315155b6117bb5760405162461bcd60e51b81526020600482015260256024820152600080516020615c268339815191526044820152646e6774687360d81b60648201526084016109f4565b60005b84811015610b615760006117fc8787848181106117dd576117dd614fb4565b905060a0020160200160208101906117f59190614753565b6001611408565b8051909150600181111561181257611812614792565b87878481811061182457611824614fb4565b61183d92606060a0909202019081019150604001615177565b600181111561184e5761184e614792565b1461186b5760405162461bcd60e51b81526004016109f490615194565b6118b987878481811061188057611880614fb4565b905060a00201600187878681811061189a5761189a614fb4565b90506020020160208101906118af9190614753565b8460200151612c8a565b505080806118c69061505c565b9150506117be565b603754610100900460ff16158080156118ee5750603754600160ff909116105b806119085750303b158015611908575060375460ff166001145b61196b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016109f4565b6037805460ff19166001179055801561198e576037805461ff0019166101001790555b61199960008d612e14565b6119a38b8b612e1e565b50506119af8989612a71565b50600090506119be86806151da565b90501115611a10576119f16119d386806151da565b6119e060208901896151da565b6119ea89806151da565b8989612ed2565b611a106119fe86806151da565b611a0b60208801886151da565b612993565b60005b86811015611a6b57611a59600080516020615c06833981519152898984818110611a3f57611a3f614fb4565b9050602002016020810190611a549190614753565b6128b4565b80611a638161505c565b915050611a13565b508015611ab2576037805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050505050505050565b611ac8612919565b6001600160a01b0316336001600160a01b031614611af85760405162461bcd60e51b81526004016109f4906150b9565b6000816001600160a01b03163b11611b225760405162461bcd60e51b81526004016109f490615223565b611b2b816130e8565b50565b611b36612919565b6001600160a01b0316336001600160a01b031614611b665760405162461bcd60e51b81526004016109f4906150b9565b6000816001600160a01b03163b11611b905760405162461bcd60e51b81526004016109f490615223565b611b2b8161313e565b6060611ba36123bc565b607454604051635a02d57960e11b81526001600160a01b039091169063b405aaf290611bd39033906004016145bc565b602060405180830381865afa158015611bf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c149190614d73565b611c305760405162461bcd60e51b81526004016109f490614d95565b33611c39614523565b836001600160401b03811115611c5157611c51614dd8565b604051908082528060200260200182016040528015611c7a578160200160208202803683370190505b5092506000611c876115ae565b90506000611c93611597565b905060005b86811015610f3457878782818110611cb257611cb2614fb4565b90506101600201803603810190611cc99190614ee6565b607554815160405163c7c4fea960e01b81529296506001600160a01b039091169163c7c4fea991611d0291600091908a90600401614f87565b600060405180830381600087803b158015611d1c57600080fd5b505af1158015611d30573d6000803e3d6000fd5b5060029250611d3d915050565b6040808601518101516000908152606f6020908152828220885183529052205460ff166004811115611d7157611d71614792565b03611d9f576001868281518110611d8a57611d8a614fb4565b91151560209283029190910190910152611dab565b611dab848685856124da565b80611db58161505c565b915050611c98565b600080611dc8612919565b6001600160a01b0316336001600160a01b031614611df85760405162461bcd60e51b81526004016109f4906150b9565b61158b8484612e1e565b6000818152606c60205260408120610a2290613189565b611e21612919565b6001600160a01b0316336001600160a01b031614611e515760405162461bcd60e51b81526004016109f4906150b9565b6000816001600160a01b03163b11611e7b5760405162461bcd60e51b81526004016109f490615223565b611b2b81613193565b611e8d82610f3f565b611e96816128aa565b610f7083836128d6565b6000611eaa612bdf565b600154611eb79190615266565b600254611ec49084615266565b101592915050565b611ed4612919565b6001600160a01b0316336001600160a01b031614611f045760405162461bcd60e51b81526004016109f4906150b9565b86611f215760405162461bcd60e51b81526004016109f49061527d565b611f318888888888888888612ed2565b5050505050505050565b6060816001600160401b03811115611f5557611f55614dd8565b604051908082528060200260200182016040528015611f8857816020015b6060815260200190600190039081611f735790505b50905060005b828110156120a557600085815260726020526040812090858584818110611fb757611fb7614fb4565b9050602002016020810190611fcc9190614753565b6001600160a01b03166001600160a01b031681526020019081526020016000208054611ff7906152af565b80601f0160208091040260200160405190810160405280929190818152602001828054612023906152af565b80156120705780601f1061204557610100808354040283529160200191612070565b820191906000526020600020905b81548152906001019060200180831161205357829003601f168201915b505050505082828151811061208757612087614fb4565b6020026020010181905250808061209d9061505c565b915050611f8e565b509392505050565b6000600260008381526070602052604090205460ff1660048111156120d4576120d4614792565b1492915050565b6120e36123bc565b607454604051635a02d57960e11b81526001600160a01b039091169063b405aaf2906121139033906004016145bc565b602060405180830381865afa158015612130573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121549190614d73565b6121705760405162461bcd60e51b81526004016109f490614d95565b33831580159061217f57508382145b61219b5760405162461bcd60e51b81526004016109f49061527d565b60006121a56115ae565b905060006121b1611597565b90506000805b87811015612351578888828181106121d1576121d1614fb4565b9050602002013591508686828181106121ec576121ec614fb4565b90506020028101906121fe91906152e3565b60008481526072602090815260408083206001600160a01b038b16845290915290209161222c91908361536f565b5060755460405163c7c4fea960e01b81526001600160a01b039091169063c7c4fea9906122629060019086908a90600401614f87565b600060405180830381600087803b15801561227c57600080fd5b505af1158015612290573d6000803e3d6000fd5b505050600083815260766020526040812091506122b08288888888612871565b905060018160048111156122c6576122c6614792565b0361233c57815460ff1916600217825560755460405163114fc47560e11b81526001600160a01b039091169063229f88ea90612309906001908890600401614fca565b600060405180830381600087803b15801561232357600080fd5b505af1158015612337573d6000803e3d6000fd5b505050505b505080806123499061505c565b9150506121b7565b505050505050505050565b6000838152606f60209081526040808320858452909152812061237f90836128f8565b949350505050565b60006001600160e01b03198216637965db0b60e01b1480610a2257506301ffc9a760e01b6001600160e01b0319831614610a22565b60005460ff16156111345760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016109f4565b61241c6124173685900385016040860161542e565b6131de565b6124258361327e565b600061244061243a6040860160208701614753565b83611408565b8051909150600181111561245657612456614792565b6124666060860160408701615177565b600181111561247757612477614792565b146124945760405162461bcd60e51b81526004016109f490615194565b6124c383306124a96040880160208901614753565b6124bb36899003890160408a0161542e565b929190613343565b6124d38483858460200151612c8a565b5050505050565b835160808501516124ea906131de565b60008560200151600181111561250257612502614792565b1461255b5760405162461bcd60e51b8152602060048201526024808201527f526f6e696e4761746577617956323a20696e76616c69642072656365697074206044820152631ada5b9960e21b60648201526084016109f4565b46856060015160400151146125b25760405162461bcd60e51b815260206004820181905260248201527f526f6e696e4761746577617956323a20696e76616c696420636861696e20696460448201526064016109f4565b60006125ce866060015160200151876040015160400151611408565b60808701515190915060018111156125e8576125e8614792565b815160018111156125fb576125fb614792565b14801561262557508560400151602001516001600160a01b031681602001516001600160a01b0316145b6126715760405162461bcd60e51b815260206004820152601f60248201527f526f6e696e4761746577617956323a20696e76616c696420726563656970740060448201526064016109f4565b6040808701518101516000908152606f602090815282822085835290529081209061269b886127e8565b905060006126ac8389898986612871565b905088604001516040015185896001600160a01b03167f48c4262ed68beb92fe5d7d48d70772e49cd50c317937dea60a99f15f794b6459856040516126f391815260200190565b60405180910390a4600181600481111561270f5761270f614792565b0361235157825460ff191660021783556060890151805160209091015160808b015161273e92909160006135da565b607554895160405163114fc47560e11b81526001600160a01b039092169163229f88ea916127729160009190600401614fca565b600060405180830381600087803b15801561278c57600080fd5b505af11580156127a0573d6000803e3d6000fd5b505050507f8d20d8121a34dded9035ff5b43e901c142824f7a22126392992c353c37890524828a6040516127d5929190614fe5565b60405180910390a1505050505050505050565b60007fb9d1fe7c9deeec5dc90a2f47ff1684239519f2545b2228d3d91fb27df3189eea60001b82600001518360200151612825856040015161394f565b612832866060015161394f565b61283f87608001516139b2565b6040516020016128549695949392919061544a565b604051602081830303815290604052805190602001209050919050565b600061287e8686846139f5565b60008061288b8885613a9a565b909250905061289e888784888589613c8c565b98975050505050505050565b611b2b8133613ce8565b6128be8282613d26565b6000828152606c60205260409020610f709082613dac565b6128e08282613dc1565b6000828152606c60205260409020610f709082613e28565b6001600160a01b031660009081526002919091016020526040902054151590565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b61294f613e3d565b6000805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405161298991906145bc565b60405180910390a1565b8281146129b25760405162461bcd60e51b81526004016109f490615130565b60005b83811015612a2d578282828181106129cf576129cf614fb4565b90506020020135603860008787858181106129ec576129ec614fb4565b9050602002016020810190612a019190614753565b6001600160a01b0316815260208101919091526040016000205580612a258161505c565b9150506129b5565b507f6f52f53a938df83439fa4c6055c7df0a6906d621aa6dfa4708187037fdfc41da84848484604051612a6394939291906154ff565b60405180910390a150505050565b60008082841115612ad05760405162461bcd60e51b8152602060048201526024808201527f4761746577617956323a20696e76616c696420747275737465642074687265736044820152631a1bdb1960e21b60648201526084016109f4565b5050600154600254607884905560798390556004805484918691906000612af68361505c565b9091555060408051868152602081018690527feac82d4d949d2d4f77f96aa68ab6b1bb750da73f14e55d41a1b93f387471ecba91015b60405180910390a49250929050565b6077546040805163cacf8fb560e01b815290516000926001600160a01b03169163cacf8fb59160048083019260209291908290030181865afa158015612b85573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115a99190615531565b6000607954600160795484607854612bc19190615266565b612bcb919061554a565b612bd5919061555d565b610a229190615570565b6074546040805163158b54c160e21b815290516000926001600160a01b03169163562d53049160048083019260209291908290030181865afa158015612b85573d6000803e3d6000fd5b6000600254600160025484600154612bc19190615266565b612c496123bc565b6000805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25861297c3390565b600061107e8383613e86565b606e805460009182612c9b8361505c565b9091555090506000612cc284838588612cb9368c90038c018c615592565b93929190613eb0565b60008381526071602090815260409091208251815590820151600180830180549495508594909160ff19909116908381811115612d0157612d01614792565b021790555060408281015180516002840180546001600160a01b039283166001600160a01b03199182161790915560208084015160038701805491851691841691909117905592840151600486015560608601518051600587018054918516918416919091179055928301516006860180549190931691161790550151600782015560808201518051600883018054909190829060ff191660018381811115612dac57612dac614792565b0217905550602082015181600101556040820151816002015550509050507ff313c253a5be72c29d0deb2c8768a9543744ac03d6b3cafd50cc976f1c2632fc612df4826127e8565b82604051612e03929190614fe5565b60405180910390a150949350505050565b610a3b82826128b4565b60008082841115612e705760405162461bcd60e51b815260206004820152601c60248201527b11d85d195dd85e558c8e881a5b9d985b1a59081d1a1c995cda1bdb1960221b60448201526064016109f4565b50506001805460028054928590558390556004805491929184918691906000612e988361505c565b9091555060408051868152602081018690527f976f8a9c5bdf8248dec172376d6e2b80a8e3df2f0328e381c6db8e1cf138c0f89101612b2c565b8685148015612ee057508683145b612efc5760405162461bcd60e51b81526004016109f49061527d565b60005b8781101561309857868682818110612f1957612f19614fb4565b9050602002016020810190612f2e9190614753565b607360008b8b85818110612f4457612f44614fb4565b9050602002016020810190612f599190614753565b6001600160a01b03166001600160a01b031681526020019081526020016000206000878785818110612f8d57612f8d614fb4565b90506020020135815260200190815260200160002060000160016101000a8154816001600160a01b0302191690836001600160a01b03160217905550828282818110612fdb57612fdb614fb4565b9050602002016020810190612ff09190615177565b607360008b8b8581811061300657613006614fb4565b905060200201602081019061301b9190614753565b6001600160a01b03166001600160a01b03168152602001908152602001600020600087878581811061304f5761304f614fb4565b60209081029290920135835250810191909152604001600020805460ff19166001838181111561308157613081614792565b0217905550806130908161505c565b915050612eff565b507f2544bff60c6d5b84946e06804af9f84e150bbee85238dbdee79efca4e0adf40188888888888888886040516130d69897969594939291906155e5565b60405180910390a15050505050505050565b607580546001600160a01b0319166001600160a01b0383161790556040517f034c8da497df28467c79ddadbba1cc3cdd41f510ea73faae271e6f16a6111621906131339083906145bc565b60405180910390a150565b607780546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d7906131339083906145bc565b6000610a22825490565b607480546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906131339083906145bc565b6000815160018111156131f3576131f3614792565b148015613204575060008160400151115b801561321257506020810151155b8061323c575060018151600181111561322d5761322d614792565b14801561323c57506040810151155b611b2b5760405162461bcd60e51b8152602060048201526013602482015272546f6b656e3a20696e76616c696420696e666f60681b60448201526064016109f4565b60006132906060830160408401615177565b60018111156132a1576132a1614792565b1415806132df5750603860006132bd6040840160208501614753565b6001600160a01b03168152602081019190915260400160002054608082013510155b611b2b5760405162461bcd60e51b815260206004820152602f60248201527f4d696e696d756d5769746864726177616c3a20717565727920666f7220746f6f60448201526e20736d616c6c207175616e7469747960881b60648201526084016109f4565b60006060818651600181111561335b5761335b614792565b0361343d57826001600160a01b03166323b872dd60e01b8686896040015160405160240161338b93929190615674565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516133c99190615698565b6000604051808303816000865af19150503d8060008114613406576040519150601f19603f3d011682016040523d82523d6000602084013e61340b565b606091505b5090925090508180156134365750805115806134365750808060200190518101906134369190614d73565b9150613557565b60018651600181111561345257613452614792565b0361350557826001600160a01b03166323b872dd8686896020015160405160240161347f93929190615674565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516134b89190615698565b6000604051808303816000865af19150503d80600081146134f5576040519150601f19603f3d011682016040523d82523d6000602084013e6134fa565b606091505b505080925050613557565b60405162461bcd60e51b815260206004820152602160248201527f546f6b656e3a20756e737570706f7274656420746f6b656e207374616e6461726044820152601960fa1b60648201526084016109f4565b81610b615761356586613f1c565b613579866001600160a01b03166014613f89565b61358d866001600160a01b03166014613f89565b6135a1866001600160a01b03166014613f89565b6040516020016135b494939291906156b4565b60408051601f198184030181529082905262461bcd60e51b82526109f49160040161576a565b6000816001600160a01b0316836001600160a01b0316036136895760408086015190516001600160a01b0386169180156108fc02916000818181858888f1935050505061368457816001600160a01b031663d0e30db086604001516040518263ffffffff1660e01b81526004016000604051808303818588803b15801561366057600080fd5b505af1158015613674573d6000803e3d6000fd5b5050505050613684858585614124565b6124d3565b60008551600181111561369e5761369e614792565b0361382f576040516370a0823160e01b81526000906001600160a01b038516906370a08231906136d29030906004016145bc565b602060405180830381865afa1580156136ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137139190615531565b9050856040015181101561381e57836001600160a01b03166340c10f1930838960400151613741919061555d565b60405160240161375292919061577d565b6040516020818303038152906040529060e01b6020820180516001600160e01b03838183161783525050505060405161378b9190615698565b6000604051808303816000865af19150503d80600081146137c8576040519150601f19603f3d011682016040523d82523d6000602084013e6137cd565b606091505b5050809250508161381e5760405162461bcd60e51b815260206004820152601b60248201527a151bdad95b8e88115490cc8c081b5a5b9d1a5b99c819985a5b1959602a1b60448201526064016109f4565b613829868686614124565b506124d3565b60018551600181111561384457613844614792565b0361350557613858838587602001516141c6565b61368457826001600160a01b03166340c10f1985876020015160405160240161388292919061577d565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516138bb9190615698565b6000604051808303816000865af19150503d80600081146138f8576040519150601f19603f3d011682016040523d82523d6000602084013e6138fd565b606091505b505080915050806136845760405162461bcd60e51b815260206004820152601c60248201527b151bdad95b8e88115490cdcc8c481b5a5b9d1a5b99c819985a5b195960221b60448201526064016109f4565b80516020808301516040808501519051600094612854947f353bdd8d69b9e3185b3972e08b03845c0c14a21a390215302776a7a34b0e87649491939192019384526001600160a01b03928316602085015291166040830152606082015260800190565b80516020808301516040808501519051600094612854947f1e2b74b2a792d5c0f0b6e59b037fa9d43d84fbb759337f0112fcc15ca414fc8d949193919201615796565b60008360030154118015613a0d575042836003015411155b15613a1e57825460ff191660041783555b613a2883836128f8565b15613a5157613a41826001600160a01b03166014613f89565b6040516020016135b491906157c1565b6001600160a01b039091166000818152600284016020908152604082209390935560059093018054600181018255908452919092200180546001600160a01b0319169091179055565b6000806000806000607460009054906101000a90046001600160a01b03166001600160a01b031663b7ab4db56040518163ffffffff1660e01b8152600401600060405180830381865afa158015613af5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613b1d91908101906158ac565b607754604051632907e73160e11b815293965091945092506000916001600160a01b039091169063520fce6290613b58908790600401615997565b600060405180830381865afa158015613b75573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613b9d91908101906159d8565b905060005b8351811015613c8057613be16002848381518110613bc257613bc2614fb4565b60200260200101516003811115613bdb57613bdb614792565b9061427a565b8015613c2c575087896002016000868481518110613c0157613c01614fb4565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002054145b15613c6e5786613c3b8161505c565b9750506000828281518110613c5257613c52614fb4565b60200260200101511115613c6e5785613c6a8161505c565b9650505b80613c788161505c565b915050613ba2565b50505050509250929050565b6000858510158015613c9e5750838310155b8015613cbf57506000875460ff166004811115613cbd57613cbd614792565b145b15613cd757865460ff19166001908117885587018290555b50855460ff165b9695505050505050565b613cf282826116ff565b610a3b57613d0a816001600160a01b03166014613f89565b613d15836020613f89565b6040516020016135b4929190615a5d565b613d3082826116ff565b610a3b576000828152606b602090815260408083206001600160a01b03851684529091529020805460ff19166001179055613d683390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061107e836001600160a01b0384166142ad565b613dcb82826116ff565b15610a3b576000828152606b602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061107e836001600160a01b0384166142fc565b60005460ff166111345760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016109f4565b6000826000018281548110613e9d57613e9d614fb4565b9060005260206000200154905092915050565b613eb8614523565b92835260016020808501919091526060840180516001600160a01b0396871690528682015181519087169083015251466040918201528651818601805191881690915280519490961693909101929092529251810192909252910151608082015290565b6060613f4782600001516001811115613f3757613f37614792565b6001600160a01b03166001613f89565b613f5483602001516143ef565b613f6184604001516143ef565b604051602001613f7393929190615acc565b6040516020818303038152906040529050919050565b60606000613f98836002615266565b613fa390600261554a565b6001600160401b03811115613fba57613fba614dd8565b6040519080825280601f01601f191660200182016040528015613fe4576020820181803683370190505b509050600360fc1b81600081518110613fff57613fff614fb4565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061402e5761402e614fb4565b60200101906001600160f81b031916908160001a9053506000614052846002615266565b61405d90600161554a565b90505b60018111156140d5576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061409157614091614fb4565b1a60f81b8282815181106140a7576140a7614fb4565b60200101906001600160f81b031916908160001a90535060049490941c936140ce81615b4a565b9050614060565b50831561107e5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016109f4565b6000808451600181111561413a5761413a614792565b036141555761414e82848660400151614446565b905061417e565b60018451600181111561416a5761416a614792565b036135055761414e828486602001516141c6565b806114025761418c84613f1c565b6141a0846001600160a01b03166014613f89565b6141b4846001600160a01b03166014613f89565b6040516020016135b493929190615b61565b6000836001600160a01b03166323b872dd60e01b3085856040516024016141ef93929190615674565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161422d9190615698565b6000604051808303816000865af19150503d806000811461426a576040519150601f19603f3d011682016040523d82523d6000602084013e61426f565b606091505b509095945050505050565b600081600381111561428e5761428e614792565b8360038111156142a0576142a0614792565b1660ff1615159392505050565b60008181526001830160205260408120546142f457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a22565b506000610a22565b600081815260018301602052604081205480156143e557600061432060018361555d565b85549091506000906143349060019061555d565b905081811461439957600086600001828154811061435457614354614fb4565b906000526020600020015490508087600001848154811061437757614377614fb4565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806143aa576143aa615bef565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a22565b6000915050610a22565b6060816000036144195750506040805180820190915260048152630307830360e41b602082015290565b8160005b811561443c578061442d8161505c565b915050600882901c915061441d565b61237f8482613f89565b60006060846001600160a01b031663a9059cbb60e01b858560405160240161446f92919061577d565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516144ad9190615698565b6000604051808303816000865af19150503d80600081146144ea576040519150601f19603f3d011682016040523d82523d6000602084013e6144ef565b606091505b50909250905081801561451a57508051158061451a57508080602001905181019061451a9190614d73565b95945050505050565b6040805160a08101825260008082526020820152908101614542614572565b815260200161454f614572565b815260408051606081018252600080825260208281018290529282015291015290565b604080516060810182526000808252602082018190529181019190915290565b6000602082840312156145a457600080fd5b81356001600160e01b03198116811461107e57600080fd5b6001600160a01b0391909116815260200190565b60008082840360c08112156145e457600080fd5b60a08112156145f257600080fd5b50919360a08501359350915050565b6000610160828403121561461457600080fd5b50919050565b60008083601f84011261462c57600080fd5b5081356001600160401b0381111561464357600080fd5b6020830191508360208260051b850101111561159057600080fd5b6000806020838503121561467157600080fd5b82356001600160401b0381111561468757600080fd5b6146938582860161461a565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156146d95783511515835292840192918401916001016146bb565b50909695505050505050565b6000602082840312156146f757600080fd5b5035919050565b6001600160a01b0381168114611b2b57600080fd5b803561471e816146fe565b919050565b6000806040838503121561473657600080fd5b823591506020830135614748816146fe565b809150509250929050565b60006020828403121561476557600080fd5b813561107e816146fe565b6000806040838503121561478357600080fd5b50508035926020909101359150565b634e487b7160e01b600052602160045260246000fd5b60808101600586106147bc576147bc614792565b9481526020810193909352604083019190915260609091015290565b60008083601f8401126147ea57600080fd5b5081356001600160401b0381111561480157600080fd5b60208301915083602060a08302850101111561159057600080fd5b60008060006040848603121561483157600080fd5b83356001600160401b0381111561484757600080fd5b614853868287016147d8565b909790965060209590950135949350505050565b6000806040838503121561487a57600080fd5b8235614885816146fe565b946020939093013593505050565b60028110611b2b57611b2b614792565b815160408201906148b381614893565b82526020928301516001600160a01b0316929091019190915290565b600080600080604085870312156148e557600080fd5b84356001600160401b03808211156148fc57600080fd5b6149088883890161461a565b9096509450602087013591508082111561492157600080fd5b5061492e8782880161461a565b95989497509550505050565b80516001600160a01b03908116835260208083015190911690830152604090810151910152565b805161496c81614893565b825260208181015190830152604090810151910152565b858152610160810161499486614893565b8560208301526149a7604083018661493a565b6149b460a083018561493a565b613cde610100830184614961565b600080600080604085870312156149d857600080fd5b84356001600160401b03808211156149ef57600080fd5b614908888389016147d8565b8060408101831015610a2257600080fd5b60008060008060008060008060008060006101208c8e031215614a2e57600080fd5b614a378c614713565b9a5060208c0135995060408c0135985060608c0135975060808c013596506001600160401b0360a08d0135811015614a6e57600080fd5b614a7e8e60a08f01358f0161461a565b909750955060c08d0135811015614a9457600080fd5b614aa48e60c08f01358f016149fb565b94508060e08e01351115614ab757600080fd5b614ac78e60e08f01358f016149fb565b9350806101008e01351115614adb57600080fd5b50614aed8d6101008e01358e0161461a565b81935080925050509295989b509295989b9093969950565b60008060208385031215614b1857600080fd5b82356001600160401b0380821115614b2f57600080fd5b818501915085601f830112614b4357600080fd5b813581811115614b5257600080fd5b86602061016083028501011115614b6857600080fd5b60209290920196919550909350505050565b6000806000806000806000806080898b031215614b9657600080fd5b88356001600160401b0380821115614bad57600080fd5b614bb98c838d0161461a565b909a50985060208b0135915080821115614bd257600080fd5b614bde8c838d0161461a565b909850965060408b0135915080821115614bf757600080fd5b614c038c838d0161461a565b909650945060608b0135915080821115614c1c57600080fd5b50614c298b828c0161461a565b999c989b5096995094979396929594505050565b600080600060408486031215614c5257600080fd5b8335925060208401356001600160401b03811115614c6f57600080fd5b614c7b8682870161461a565b9497909650939450505050565b60005b83811015614ca3578181015183820152602001614c8b565b50506000910152565b60008151808452614cc4816020860160208601614c88565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015614d2d57603f19888603018452614d1b858351614cac565b94509285019290850190600101614cff565b5092979650505050505050565b600080600060608486031215614d4f57600080fd5b83359250602084013591506040840135614d68816146fe565b809150509250925092565b600060208284031215614d8557600080fd5b8151801515811461107e57600080fd5b60208082526023908201527f526f6e696e4761746577617956323a20756e617574686f72697a65642073656e6040820152623232b960e91b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715614e1057614e10614dd8565b60405290565b604051601f8201601f191681016001600160401b0381118282101715614e3e57614e3e614dd8565b604052919050565b60028110611b2b57600080fd5b600060608284031215614e6557600080fd5b614e6d614dee565b90508135614e7a816146fe565b81526020820135614e8a816146fe565b806020830152506040820135604082015292915050565b600060608284031215614eb357600080fd5b614ebb614dee565b90508135614ec881614e46565b80825250602082013560208201526040820135604082015292915050565b60006101608284031215614ef957600080fd5b60405160a081016001600160401b0381118282101715614f1b57614f1b614dd8565b604052823581526020830135614f3081614e46565b6020820152614f428460408501614e53565b6040820152614f548460a08501614e53565b6060820152614f67846101008501614ea1565b60808201529392505050565b60038110614f8357614f83614792565b9052565b60608101614f958286614f73565b60208201939093526001600160a01b0391909116604090910152919050565b634e487b7160e01b600052603260045260246000fd5b60408101614fd88285614f73565b8260208301529392505050565b60006101808201905083825282516020830152602083015161500681614893565b80604084015250604083015161501f606084018261493a565b50606083015161503260c084018261493a565b5060808301516120a5610120840182614961565b634e487b7160e01b600052601160045260246000fd5b60006001820161506e5761506e615046565b5060010190565b60208082526024908201527f526f6e696e4761746577617956323a207769746864726177616c73206d696772604082015263185d195960e21b606082015260800190565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b6020808252818101527f4761746577617956323a206e6f7420617574686f72697a656420706175736572604082015260600190565b60208082526027908201527f4d696e696d756d5769746864726177616c3a20696e76616c6964206172726179604082015266040d8cadccee8d60cb1b606082015260800190565b60006020828403121561518957600080fd5b813561107e81614e46565b60208082526026908201527f526f6e696e4761746577617956323a20696e76616c696420746f6b656e207374604082015265185b99185c9960d21b606082015260800190565b6000808335601e198436030181126151f157600080fd5b8301803591506001600160401b0382111561520b57600080fd5b6020019150600581901b360382131561159057600080fd5b60208082526023908201527f526f6e696e4761746577617956323a2073657420746f206e6f6e2d636f6e74726040820152621858dd60ea1b606082015260800190565b8082028115828204841417610a2257610a22615046565b6020808252602490820152600080516020615c268339815191526040820152630dccee8d60e31b606082015260800190565b600181811c908216806152c357607f821691505b60208210810361461457634e487b7160e01b600052602260045260246000fd5b6000808335601e198436030181126152fa57600080fd5b8301803591506001600160401b0382111561531457600080fd5b60200191503681900382131561159057600080fd5b601f821115610f7057600081815260208120601f850160051c810160208610156153505750805b601f850160051c820191505b81811015610b615782815560010161535c565b6001600160401b0383111561538657615386614dd8565b61539a8361539483546152af565b83615329565b6000601f8411600181146153ce57600085156153b65750838201355b600019600387901b1c1916600186901b1783556124d3565b600083815260209020601f19861690835b828110156153ff57868501358255602094850194600190920191016153df565b508682101561541c5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b60006060828403121561544057600080fd5b61107e8383614ea1565b8681526020810186905260c0810161546186614893565b8560408301528460608301528360808301528260a0830152979650505050505050565b8183526000602080850194508260005b858110156154c25781356154a7816146fe565b6001600160a01b031687529582019590820190600101615494565b509495945050505050565b81835260006001600160fb1b038311156154e657600080fd5b8260051b80836020870137939093016020019392505050565b604081526000615513604083018688615484565b82810360208401526155268185876154cd565b979650505050505050565b60006020828403121561554357600080fd5b5051919050565b80820180821115610a2257610a22615046565b81810381811115610a2257610a22615046565b60008261558d57634e487b7160e01b600052601260045260246000fd5b500490565b600060a082840312156155a457600080fd5b6155ac614dee565b82356155b7816146fe565b815260208301356155c7816146fe565b60208201526155d98460408501614ea1565b60408201529392505050565b6080815260006155f9608083018a8c615484565b60208382038185015261560d828a8c615484565b9150838203604085015261562282888a6154cd565b8481036060860152858152869250810160005b8681101561566357833561564881614e46565b61565181614893565b82529282019290820190600101615635565b509c9b505050505050505050505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b600082516156aa818460208701614c88565b9190910192915050565b7902a37b5b2b71d1031b7bab632103737ba103a3930b739b332b9160351b81526000855160206156ea82601a8601838b01614c88565b65010333937b6960d51b601a92850192830152865161570e81838501848b01614c88565b630103a37960e51b92018181019290925285516157318160248501898501614c88565b660103a37b5b2b7160cd1b60249390910192830152845161575881602b8501848901614c88565b91909101602b01979650505050505050565b60208152600061107e6020830184614cac565b6001600160a01b03929092168252602082015260400190565b848152608081016157a685614893565b84602083015283604083015282606083015295945050505050565b73024b9b7b630ba32b223b7bb32b93730b731b29d160651b8152600082516157f0816014850160208701614c88565b6d08185b1c9958591e481d9bdd195960921b6014939091019283015250602201919050565b60006001600160401b0382111561582e5761582e614dd8565b5060051b60200190565b600082601f83011261584957600080fd5b8151602061585e61585983615815565b614e16565b82815260059290921b8401810191818101908684111561587d57600080fd5b8286015b848110156158a1578051615894816146fe565b8352918301918301615881565b509695505050505050565b6000806000606084860312156158c157600080fd5b83516001600160401b03808211156158d857600080fd5b6158e487838801615838565b94506020915081860151818111156158fb57600080fd5b61590788828901615838565b94505060408601518181111561591c57600080fd5b86019050601f8101871361592f57600080fd5b805161593d61585982615815565b81815260059190911b8201830190838101908983111561595c57600080fd5b928401925b82841015615988578351600481106159795760008081fd5b82529284019290840190615961565b80955050505050509250925092565b6020808252825182820181905260009190848201906040850190845b818110156146d95783516001600160a01b0316835292840192918401916001016159b3565b600060208083850312156159eb57600080fd5b82516001600160401b03811115615a0157600080fd5b8301601f81018513615a1257600080fd5b8051615a2061585982615815565b81815260059190911b82018301908381019087831115615a3f57600080fd5b928401925b8284101561552657835182529284019290840190615a44565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351615a8f816017850160208801614c88565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351615ac0816028840160208801614c88565b01602801949350505050565b690a8ded6cadc92dcccde560b31b815260008451615af181600a850160208901614c88565b8083019050600b60fa1b80600a8301528551615b1481600b850160208a01614c88565b600b9201918201528351615b2f81600c840160208801614c88565b602960f81b600c9290910191820152600d0195945050505050565b600081615b5957615b59615046565b506000190190565b7902a37b5b2b71d1031b7bab632103737ba103a3930b739b332b9160351b815260008451615b9681601a850160208901614c88565b630103a37960e51b601a918401918201528451615bba81601e840160208901614c88565b660103a37b5b2b7160cd1b601e92909101918201528351615be2816025840160208801614c88565b0160250195945050505050565b634e487b7160e01b600052603160045260246000fdfe384495a48d92b97cd9b9d199c73ed783dd1aa0076a6ebcf9156ca7fef7d2cc40526f6e696e4761746577617956323a20696e76616c6964206172726179206c65a26469706673582212208cd4d8292599ff0b8fe0d69fd71f8f54876d48cbe03af5472ba8a902dd3fad7964736f6c63430008110033", "devdoc": { "errors": { "ErrCallerMustBeBridgeTrackingContract()": [ @@ -1889,6 +2097,11 @@ "details": "Error of method caller must be bridge tracking contract." } ], + "ErrCallerMustBeRoninTrustedOrgContract()": [ + { + "details": "Error of method caller must be Ronin trusted org contract." + } + ], "ErrCallerMustBeValidatorContract()": [ { "details": "Error of method caller must be validator contract." @@ -1935,6 +2148,9 @@ "getThreshold()": { "details": "Returns the threshold." }, + "getTrustedThreshold()": { + "details": "Returns the threshold about trusted org." + }, "getWithdrawalSignatures(uint256,address[])": { "details": "Returns withdrawal signatures." }, @@ -1944,7 +2160,7 @@ "hasRole(bytes32,address)": { "details": "Returns `true` if `account` has been granted `role`." }, - "initialize(address,uint256,uint256,address[],address[][2],uint256[][2],uint8[])": { + "initialize(address,uint256,uint256,uint256,uint256,address[],address[][2],uint256[][2],uint8[])": { "details": "Initializes contract storage." }, "mainchainWithdrew(uint256)": { @@ -1962,6 +2178,9 @@ "migrateWithdrawals((address,address,(uint8,uint256,uint256))[],address[])": { "details": "Migrates withdrawals. Requirements: - The method caller is the migrator. - The arrays have the same length and its length larger than 0." }, + "minimumTrustedVoteWeight()": { + "details": "Returns the minimum trusted vote weight to pass the threshold." + }, "minimumVoteWeight()": { "details": "Returns the minimum vote weight to pass the threshold." }, @@ -1983,12 +2202,21 @@ "revokeRole(bytes32,address)": { "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event." }, + "roninTrustedOrganizationContract()": { + "details": "Returns the ronin trusted organization contract." + }, "setBridgeTrackingContract(address)": { "details": "Sets the bridge tracking contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `BridgeTrackingContractUpdated`." }, + "setEmergencyPauser(address)": { + "details": "Grant emergency pauser role for `_addr`." + }, "setMinimumThresholds(address[],uint256[])": { "details": "Sets the minimum thresholds to withdraw. Requirements: - The method caller is admin. - The arrays have the same length and its length larger than 0. Emits the `MinimumThresholdsUpdated` event." }, + "setRoninTrustedOrganizationContract(address)": { + "details": "Sets the ronin trusted organization contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `RoninTrustedOrganizationContractUpdated`." + }, "setThreshold(uint256,uint256)": { "details": "Sets the threshold. Requirements: - The method caller is admin. Emits the `ThresholdUpdated` event." }, @@ -2021,6 +2249,9 @@ "_mainchainToken": { "details": "Mapping from token address => chain id => mainchain token address" }, + "_trustedOrgContract": { + "details": "The trusted organization contract" + }, "_validatorContract": { "details": "The ronin validator contract" }, @@ -2067,7 +2298,7 @@ "storage": [ { "astId": 1535, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_paused", "offset": 0, "slot": "0", @@ -2075,7 +2306,7 @@ }, { "astId": 4326, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_num", "offset": 0, "slot": "1", @@ -2083,7 +2314,7 @@ }, { "astId": 4328, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_denom", "offset": 0, "slot": "2", @@ -2091,7 +2322,7 @@ }, { "astId": 4330, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "______deprecated", "offset": 0, "slot": "3", @@ -2099,23 +2330,31 @@ }, { "astId": 4332, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "nonce", "offset": 0, "slot": "4", "type": "t_uint256" }, { - "astId": 4337, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", - "label": "______gap", + "astId": 4334, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", + "label": "emergencyPauser", "offset": 0, "slot": "5", - "type": "t_array(t_uint256)50_storage" + "type": "t_address" + }, + { + "astId": 4339, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", + "label": "______gap", + "offset": 0, + "slot": "6", + "type": "t_array(t_uint256)49_storage" }, { "astId": 1373, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_initialized", "offset": 0, "slot": "55", @@ -2123,23 +2362,23 @@ }, { "astId": 1376, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_initializing", "offset": 1, "slot": "55", "type": "t_bool" }, { - "astId": 4835, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 4914, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "minimumThreshold", "offset": 0, "slot": "56", "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 4840, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 4919, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "______gap", "offset": 0, "slot": "57", @@ -2147,7 +2386,7 @@ }, { "astId": 24, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_roles", "offset": 0, "slot": "107", @@ -2155,91 +2394,115 @@ }, { "astId": 338, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_roleMembers", "offset": 0, "slot": "108", "type": "t_mapping(t_bytes32,t_struct(AddressSet)4026_storage)" }, { - "astId": 21664, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 24064, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "withdrawalMigrated", "offset": 0, "slot": "109", "type": "t_bool" }, { - "astId": 21667, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 24067, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "withdrawalCount", "offset": 0, "slot": "110", "type": "t_uint256" }, { - "astId": 21675, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 24075, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "depositVote", "offset": 0, "slot": "111", - "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(IsolatedVote)6717_storage))" + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)12985_storage))" }, { - "astId": 21681, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 24081, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "mainchainWithdrewVote", "offset": 0, "slot": "112", - "type": "t_mapping(t_uint256,t_struct(IsolatedVote)6717_storage)" + "type": "t_mapping(t_uint256,t_struct(Vote)12985_storage)" }, { - "astId": 21687, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 24087, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "withdrawal", "offset": 0, "slot": "113", - "type": "t_mapping(t_uint256,t_struct(Receipt)14182_storage)" + "type": "t_mapping(t_uint256,t_struct(Receipt)14453_storage)" }, { - "astId": 21694, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 24094, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_withdrawalSig", "offset": 0, "slot": "114", "type": "t_mapping(t_uint256,t_mapping(t_address,t_bytes_storage))" }, { - "astId": 21702, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 24102, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_mainchainToken", "offset": 0, "slot": "115", - "type": "t_mapping(t_address,t_mapping(t_uint256,t_struct(MappedToken)10558_storage))" + "type": "t_mapping(t_address,t_mapping(t_uint256,t_struct(MappedToken)10544_storage))" }, { - "astId": 21706, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 24106, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_validatorContract", "offset": 0, "slot": "116", - "type": "t_contract(IRoninValidatorSet)11978" + "type": "t_contract(IRoninValidatorSet)11973" }, { - "astId": 21710, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 24110, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_bridgeTrackingContract", "offset": 0, "slot": "117", - "type": "t_contract(IBridgeTracking)9335" + "type": "t_contract(IBridgeTracking)9283" }, { - "astId": 21716, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 24116, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "withdrawalStatVote", "offset": 0, "slot": "118", - "type": "t_mapping(t_uint256,t_struct(IsolatedVote)6717_storage)" + "type": "t_mapping(t_uint256,t_struct(Vote)12985_storage)" + }, + { + "astId": 24120, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", + "label": "_trustedOrgContract", + "offset": 0, + "slot": "119", + "type": "t_contract(IRoninTrustedOrganization)10182" + }, + { + "astId": 24122, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", + "label": "_trustedNum", + "offset": 0, + "slot": "120", + "type": "t_uint256" + }, + { + "astId": 24124, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", + "label": "_trustedDenom", + "offset": 0, + "slot": "121", + "type": "t_uint256" } ], "types": { @@ -2248,12 +2511,24 @@ "label": "address", "numberOfBytes": "20" }, + "t_array(t_address)dyn_storage": { + "base": "t_address", + "encoding": "dynamic_array", + "label": "address[]", + "numberOfBytes": "32" + }, "t_array(t_bytes32)dyn_storage": { "base": "t_bytes32", "encoding": "dynamic_array", "label": "bytes32[]", "numberOfBytes": "32" }, + "t_array(t_uint256)49_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[49]", + "numberOfBytes": "1568" + }, "t_array(t_uint256)50_storage": { "base": "t_uint256", "encoding": "inplace", @@ -2275,27 +2550,32 @@ "label": "bytes", "numberOfBytes": "32" }, - "t_contract(IBridgeTracking)9335": { + "t_contract(IBridgeTracking)9283": { "encoding": "inplace", "label": "contract IBridgeTracking", "numberOfBytes": "20" }, - "t_contract(IRoninValidatorSet)11978": { + "t_contract(IRoninTrustedOrganization)10182": { + "encoding": "inplace", + "label": "contract IRoninTrustedOrganization", + "numberOfBytes": "20" + }, + "t_contract(IRoninValidatorSet)11973": { "encoding": "inplace", "label": "contract IRoninValidatorSet", "numberOfBytes": "20" }, - "t_enum(Kind)13979": { + "t_enum(Kind)14250": { "encoding": "inplace", "label": "enum Transfer.Kind", "numberOfBytes": "1" }, - "t_enum(Standard)13371": { + "t_enum(Standard)13642": { "encoding": "inplace", "label": "enum Token.Standard", "numberOfBytes": "1" }, - "t_enum(VoteStatus)10585": { + "t_enum(VoteStatus)10571": { "encoding": "inplace", "label": "enum VoteStatusConsumer.VoteStatus", "numberOfBytes": "1" @@ -2321,12 +2601,12 @@ "numberOfBytes": "32", "value": "t_bytes_storage" }, - "t_mapping(t_address,t_mapping(t_uint256,t_struct(MappedToken)10558_storage))": { + "t_mapping(t_address,t_mapping(t_uint256,t_struct(MappedToken)10544_storage))": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => mapping(uint256 => struct MappedTokenConsumer.MappedToken))", "numberOfBytes": "32", - "value": "t_mapping(t_uint256,t_struct(MappedToken)10558_storage)" + "value": "t_mapping(t_uint256,t_struct(MappedToken)10544_storage)" }, "t_mapping(t_address,t_uint256)": { "encoding": "mapping", @@ -2363,33 +2643,33 @@ "numberOfBytes": "32", "value": "t_mapping(t_address,t_bytes_storage)" }, - "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(IsolatedVote)6717_storage))": { + "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)12985_storage))": { "encoding": "mapping", "key": "t_uint256", - "label": "mapping(uint256 => mapping(uint256 => struct IsolatedGovernance.IsolatedVote))", + "label": "mapping(uint256 => mapping(uint256 => struct IsolatedGovernance.Vote))", "numberOfBytes": "32", - "value": "t_mapping(t_uint256,t_struct(IsolatedVote)6717_storage)" + "value": "t_mapping(t_uint256,t_struct(Vote)12985_storage)" }, - "t_mapping(t_uint256,t_struct(IsolatedVote)6717_storage)": { + "t_mapping(t_uint256,t_struct(MappedToken)10544_storage)": { "encoding": "mapping", "key": "t_uint256", - "label": "mapping(uint256 => struct IsolatedGovernance.IsolatedVote)", + "label": "mapping(uint256 => struct MappedTokenConsumer.MappedToken)", "numberOfBytes": "32", - "value": "t_struct(IsolatedVote)6717_storage" + "value": "t_struct(MappedToken)10544_storage" }, - "t_mapping(t_uint256,t_struct(MappedToken)10558_storage)": { + "t_mapping(t_uint256,t_struct(Receipt)14453_storage)": { "encoding": "mapping", "key": "t_uint256", - "label": "mapping(uint256 => struct MappedTokenConsumer.MappedToken)", + "label": "mapping(uint256 => struct Transfer.Receipt)", "numberOfBytes": "32", - "value": "t_struct(MappedToken)10558_storage" + "value": "t_struct(Receipt)14453_storage" }, - "t_mapping(t_uint256,t_struct(Receipt)14182_storage)": { + "t_mapping(t_uint256,t_struct(Vote)12985_storage)": { "encoding": "mapping", "key": "t_uint256", - "label": "mapping(uint256 => struct Transfer.Receipt)", + "label": "mapping(uint256 => struct IsolatedGovernance.Vote)", "numberOfBytes": "32", - "value": "t_struct(Receipt)14182_storage" + "value": "t_struct(Vote)12985_storage" }, "t_struct(AddressSet)4026_storage": { "encoding": "inplace", @@ -2397,7 +2677,7 @@ "members": [ { "astId": 4025, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_inner", "offset": 0, "slot": "0", @@ -2406,29 +2686,29 @@ ], "numberOfBytes": "64" }, - "t_struct(Info)13379_storage": { + "t_struct(Info)13650_storage": { "encoding": "inplace", "label": "struct Token.Info", "members": [ { - "astId": 13374, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 13645, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "erc", "offset": 0, "slot": "0", - "type": "t_enum(Standard)13371" + "type": "t_enum(Standard)13642" }, { - "astId": 13376, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 13647, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "id", "offset": 0, "slot": "1", "type": "t_uint256" }, { - "astId": 13378, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 13649, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "quantity", "offset": 0, "slot": "2", @@ -2437,76 +2717,21 @@ ], "numberOfBytes": "96" }, - "t_struct(IsolatedVote)6717_storage": { - "encoding": "inplace", - "label": "struct IsolatedGovernance.IsolatedVote", - "members": [ - { - "astId": 6698, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", - "label": "status", - "offset": 0, - "slot": "0", - "type": "t_enum(VoteStatus)10585" - }, - { - "astId": 6700, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", - "label": "finalHash", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 6705, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", - "label": "voteHashOf", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_address,t_bytes32)" - }, - { - "astId": 6710, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", - "label": "weight", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_bytes32,t_uint256)" - }, - { - "astId": 6713, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", - "label": "expiredAt", - "offset": 0, - "slot": "4", - "type": "t_uint256" - }, - { - "astId": 6716, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", - "label": "createdAt", - "offset": 0, - "slot": "5", - "type": "t_uint256" - } - ], - "numberOfBytes": "192" - }, - "t_struct(MappedToken)10558_storage": { + "t_struct(MappedToken)10544_storage": { "encoding": "inplace", "label": "struct MappedTokenConsumer.MappedToken", "members": [ { - "astId": 10555, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 10541, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "erc", "offset": 0, "slot": "0", - "type": "t_enum(Standard)13371" + "type": "t_enum(Standard)13642" }, { - "astId": 10557, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 10543, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "tokenAddr", "offset": 1, "slot": "0", @@ -2515,29 +2740,29 @@ ], "numberOfBytes": "32" }, - "t_struct(Owner)13940_storage": { + "t_struct(Owner)14211_storage": { "encoding": "inplace", "label": "struct Token.Owner", "members": [ { - "astId": 13935, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 14206, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "addr", "offset": 0, "slot": "0", "type": "t_address" }, { - "astId": 13937, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 14208, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "tokenAddr", "offset": 0, "slot": "1", "type": "t_address" }, { - "astId": 13939, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 14210, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "chainId", "offset": 0, "slot": "2", @@ -2546,49 +2771,49 @@ ], "numberOfBytes": "96" }, - "t_struct(Receipt)14182_storage": { + "t_struct(Receipt)14453_storage": { "encoding": "inplace", "label": "struct Transfer.Receipt", "members": [ { - "astId": 14169, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 14440, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "id", "offset": 0, "slot": "0", "type": "t_uint256" }, { - "astId": 14172, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 14443, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "kind", "offset": 0, "slot": "1", - "type": "t_enum(Kind)13979" + "type": "t_enum(Kind)14250" }, { - "astId": 14175, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 14446, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "mainchain", "offset": 0, "slot": "2", - "type": "t_struct(Owner)13940_storage" + "type": "t_struct(Owner)14211_storage" }, { - "astId": 14178, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 14449, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "ronin", "offset": 0, "slot": "5", - "type": "t_struct(Owner)13940_storage" + "type": "t_struct(Owner)14211_storage" }, { - "astId": 14181, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "astId": 14452, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "info", "offset": 0, "slot": "8", - "type": "t_struct(Info)13379_storage" + "type": "t_struct(Info)13650_storage" } ], "numberOfBytes": "352" @@ -2599,7 +2824,7 @@ "members": [ { "astId": 16, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "members", "offset": 0, "slot": "0", @@ -2607,7 +2832,7 @@ }, { "astId": 18, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "adminRole", "offset": 0, "slot": "1", @@ -2622,7 +2847,7 @@ "members": [ { "astId": 3720, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_values", "offset": 0, "slot": "0", @@ -2630,7 +2855,7 @@ }, { "astId": 3724, - "contract": "contracts/ronin/RoninGatewayV2.sol:RoninGatewayV2", + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", "label": "_indexes", "offset": 0, "slot": "1", @@ -2639,6 +2864,61 @@ ], "numberOfBytes": "64" }, + "t_struct(Vote)12985_storage": { + "encoding": "inplace", + "label": "struct IsolatedGovernance.Vote", + "members": [ + { + "astId": 12967, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", + "label": "status", + "offset": 0, + "slot": "0", + "type": "t_enum(VoteStatus)10571" + }, + { + "astId": 12969, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", + "label": "finalHash", + "offset": 0, + "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 12974, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", + "label": "voteHashOf", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_bytes32)" + }, + { + "astId": 12977, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", + "label": "expiredAt", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 12980, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", + "label": "createdAt", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 12984, + "contract": "contracts/ronin/gateway/RoninGatewayV2.sol:RoninGatewayV2", + "label": "voters", + "offset": 0, + "slot": "5", + "type": "t_array(t_address)dyn_storage" + } + ], + "numberOfBytes": "192" + }, "t_uint256": { "encoding": "inplace", "label": "uint256", diff --git a/deployments/ronin-testnet/RoninGovernanceAdmin.json b/deployments/ronin-testnet/RoninGovernanceAdmin.json index 6a4cd7c73..92fea8886 100644 --- a/deployments/ronin-testnet/RoninGovernanceAdmin.json +++ b/deployments/ronin-testnet/RoninGovernanceAdmin.json @@ -1,5 +1,5 @@ { - "address": "0xEac7DaB101E4676D0538d8885F3eE29614Fa7513", + "address": "0x0362Ab3e6A48d363de1E8E4FdE7bfc3104ABE697", "abi": [ { "inputs": [ @@ -47,6 +47,17 @@ "name": "ErrCallerMustBeValidatorContract", "type": "error" }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "methodSignature", + "type": "bytes4" + } + ], + "name": "ErrProxyCallFailed", + "type": "error" + }, { "inputs": [], "name": "ErrZeroCodeContract", @@ -1531,56 +1542,56 @@ "type": "function" } ], - "transactionHash": "0xa7ae48c4cf885555d35bf591c9dfdd131bd507ff0e4ba3f36ce77088d65729e6", + "transactionHash": "0x37f4804cc93724546860e6f3a74f4c49fa54a1f645afd8170db7676f66692a9d", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0xEac7DaB101E4676D0538d8885F3eE29614Fa7513", + "contractAddress": "0x0362Ab3e6A48d363de1E8E4FdE7bfc3104ABE697", "transactionIndex": 0, - "gasUsed": "5328538", - "logsBloom": "0x00000000000000000000010000000000000000000000000000000000000000000000000010002000000000000000000000000000000000000000000000000000040400000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000800000000000000000000000000000000000000000000000002000000000000000100000000000000000000000000000000000000002004000000000", - "blockHash": "0xf8013594f502d1b35317147f51c42b8f65b00ecc77fac0b847680eacf7241529", - "transactionHash": "0xa7ae48c4cf885555d35bf591c9dfdd131bd507ff0e4ba3f36ce77088d65729e6", + "gasUsed": "5159473", + "logsBloom": "0x00000000000000000000010000000000000000000000000000000000000000000000000010002000000000000000000000000000000000000000000000000000040400000000000000000004000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000004000000000", + "blockHash": "0x35be8c492ae2d10fac48cf22fc8726fbafd1815dd1576b6c1e59c6e6f7a18542", + "transactionHash": "0x37f4804cc93724546860e6f3a74f4c49fa54a1f645afd8170db7676f66692a9d", "logs": [ { "transactionIndex": 0, - "blockNumber": 14748856, - "transactionHash": "0xa7ae48c4cf885555d35bf591c9dfdd131bd507ff0e4ba3f36ce77088d65729e6", - "address": "0xEac7DaB101E4676D0538d8885F3eE29614Fa7513", + "blockNumber": 16817941, + "transactionHash": "0x37f4804cc93724546860e6f3a74f4c49fa54a1f645afd8170db7676f66692a9d", + "address": "0x0362Ab3e6A48d363de1E8E4FdE7bfc3104ABE697", "topics": [ "0xfd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d7" ], "data": "0x0000000000000000000000007507dc433a98e1fe105d69f19f3b40e4315a4f32", "logIndex": 0, - "blockHash": "0xf8013594f502d1b35317147f51c42b8f65b00ecc77fac0b847680eacf7241529" + "blockHash": "0x35be8c492ae2d10fac48cf22fc8726fbafd1815dd1576b6c1e59c6e6f7a18542" }, { "transactionIndex": 0, - "blockNumber": 14748856, - "transactionHash": "0xa7ae48c4cf885555d35bf591c9dfdd131bd507ff0e4ba3f36ce77088d65729e6", - "address": "0xEac7DaB101E4676D0538d8885F3eE29614Fa7513", + "blockNumber": 16817941, + "transactionHash": "0x37f4804cc93724546860e6f3a74f4c49fa54a1f645afd8170db7676f66692a9d", + "address": "0x0362Ab3e6A48d363de1E8E4FdE7bfc3104ABE697", "topics": [ "0x5cbd8a0bb00196365d5eb3457c6734e7f06666c3c78e5469b4c9deec7edae048" ], "data": "0x000000000000000000000000cee681c9108c42c710c6a8a949307d5f13c9f3ca", "logIndex": 1, - "blockHash": "0xf8013594f502d1b35317147f51c42b8f65b00ecc77fac0b847680eacf7241529" + "blockHash": "0x35be8c492ae2d10fac48cf22fc8726fbafd1815dd1576b6c1e59c6e6f7a18542" }, { "transactionIndex": 0, - "blockNumber": 14748856, - "transactionHash": "0xa7ae48c4cf885555d35bf591c9dfdd131bd507ff0e4ba3f36ce77088d65729e6", - "address": "0xEac7DaB101E4676D0538d8885F3eE29614Fa7513", + "blockNumber": 16817941, + "transactionHash": "0x37f4804cc93724546860e6f3a74f4c49fa54a1f645afd8170db7676f66692a9d", + "address": "0x0362Ab3e6A48d363de1E8E4FdE7bfc3104ABE697", "topics": [ "0xef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169" ], "data": "0x00000000000000000000000054b3ac74a90e64e8dde60671b6fe8f8ddf18ec9d", "logIndex": 2, - "blockHash": "0xf8013594f502d1b35317147f51c42b8f65b00ecc77fac0b847680eacf7241529" + "blockHash": "0x35be8c492ae2d10fac48cf22fc8726fbafd1815dd1576b6c1e59c6e6f7a18542" } ], - "blockNumber": 14748856, - "cumulativeGasUsed": "5328538", + "blockNumber": 16817941, + "cumulativeGasUsed": "5159473", "status": 1, "byzantium": true }, @@ -1591,11 +1602,11 @@ "0x54B3AC74a90E64E8dDE60671b6fE8F8DDf18eC9d", 1209600 ], - "numDeployments": 6, - "solcInputHash": "1fd2739e5c5a547bccbf26ee45f48ee5", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_roninChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_roninTrustedOrganizationContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bridgeContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_proposalExpiryDuration\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeBridgeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeRoninTrustedOrgContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"BridgeContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"_operators\",\"type\":\"address[]\"}],\"name\":\"BridgeOperatorsApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_voteHash\",\"type\":\"bytes32\"}],\"name\":\"EmergencyExitPollApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_voteHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_recipientAfterUnlockedFund\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_requestedAt\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_expiredAt\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitPollCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_voteHash\",\"type\":\"bytes32\"}],\"name\":\"EmergencyExitPollExpired\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"round\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"indexed\":false,\"internalType\":\"struct Proposal.ProposalDetail\",\"name\":\"proposal\",\"type\":\"tuple\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"globalProposalHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"enum GlobalProposal.TargetOption[]\",\"name\":\"targetOptions\",\"type\":\"uint8[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"indexed\":false,\"internalType\":\"struct GlobalProposal.GlobalProposalDetail\",\"name\":\"globalProposal\",\"type\":\"tuple\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"GlobalProposalCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"}],\"name\":\"ProposalApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"round\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"indexed\":false,\"internalType\":\"struct Proposal.ProposalDetail\",\"name\":\"proposal\",\"type\":\"tuple\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"ProposalCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bool[]\",\"name\":\"successCalls\",\"type\":\"bool[]\"},{\"indexed\":false,\"internalType\":\"bytes[]\",\"name\":\"returnDatas\",\"type\":\"bytes[]\"}],\"name\":\"ProposalExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"}],\"name\":\"ProposalExpired\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"}],\"name\":\"ProposalRejected\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"voter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"enum Ballot.VoteType\",\"name\":\"support\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"}],\"name\":\"ProposalVoted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"RoninTrustedOrganizationContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bridgeContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"bridgeOperatorsVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"enum GlobalProposal.TargetOption[]\",\"name\":\"targetOptions\",\"type\":\"uint8[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"internalType\":\"struct GlobalProposal.GlobalProposalDetail\",\"name\":\"_globalProposal\",\"type\":\"tuple\"},{\"internalType\":\"enum Ballot.VoteType[]\",\"name\":\"_supports\",\"type\":\"uint8[]\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"name\":\"castGlobalProposalBySignatures\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"internalType\":\"struct Proposal.ProposalDetail\",\"name\":\"_proposal\",\"type\":\"tuple\"},{\"internalType\":\"enum Ballot.VoteType[]\",\"name\":\"_supports\",\"type\":\"uint8[]\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"name\":\"castProposalBySignatures\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"internalType\":\"struct Proposal.ProposalDetail\",\"name\":\"_proposal\",\"type\":\"tuple\"},{\"internalType\":\"enum Ballot.VoteType\",\"name\":\"_support\",\"type\":\"uint8\"}],\"name\":\"castProposalVoteForCurrentNetwork\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_proxy\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newAdmin\",\"type\":\"address\"}],\"name\":\"changeProxyAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_recipientAfterUnlockedFund\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_requestedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_expiredAt\",\"type\":\"uint256\"}],\"name\":\"createEmergencyExitPoll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"}],\"name\":\"deleteExpired\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_voteHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"emergencyPollVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"getBridgeOperatorVotingSignatures\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_voters\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getProposalExpiryDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"}],\"name\":\"getProposalSignatures\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_voters\",\"type\":\"address[]\"},{\"internalType\":\"enum Ballot.VoteType[]\",\"name\":\"_supports\",\"type\":\"uint8[]\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_proxy\",\"type\":\"address\"}],\"name\":\"getProxyAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_proxy\",\"type\":\"address\"}],\"name\":\"getProxyImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastSyncedBridgeOperatorSetInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"operators\",\"type\":\"address[]\"}],\"internalType\":\"struct BridgeOperatorsBallot.BridgeOperatorSet\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bridgeVoter\",\"type\":\"address\"}],\"name\":\"lastVotedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"proposalVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_gasAmounts\",\"type\":\"uint256[]\"}],\"name\":\"propose\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"enum GlobalProposal.TargetOption[]\",\"name\":\"_targetOptions\",\"type\":\"uint8[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_gasAmounts\",\"type\":\"uint256[]\"}],\"name\":\"proposeGlobal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"enum GlobalProposal.TargetOption[]\",\"name\":\"targetOptions\",\"type\":\"uint8[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"internalType\":\"struct GlobalProposal.GlobalProposalDetail\",\"name\":\"_globalProposal\",\"type\":\"tuple\"},{\"internalType\":\"enum Ballot.VoteType[]\",\"name\":\"_supports\",\"type\":\"uint8[]\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"name\":\"proposeGlobalProposalStructAndCastVotes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_gasAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"enum Ballot.VoteType\",\"name\":\"_support\",\"type\":\"uint8\"}],\"name\":\"proposeProposalForCurrentNetwork\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"internalType\":\"struct Proposal.ProposalDetail\",\"name\":\"_proposal\",\"type\":\"tuple\"},{\"internalType\":\"enum Ballot.VoteType[]\",\"name\":\"_supports\",\"type\":\"uint8[]\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"name\":\"proposeProposalStructAndCastVotes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninChainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninTrustedOrganizationContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"round\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setBridgeContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_expiryDuration\",\"type\":\"uint256\"}],\"name\":\"setProposalExpiryDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setRoninTrustedOrganizationContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"vote\",\"outputs\":[{\"internalType\":\"enum VoteStatusConsumer.VoteStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"againstVoteWeight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"forVoteWeight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"operators\",\"type\":\"address[]\"}],\"internalType\":\"struct BridgeOperatorsBallot.BridgeOperatorSet\",\"name\":\"_ballot\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"name\":\"voteBridgeOperatorsBySignatures\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_voteHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_recipientAfterUnlockedFund\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_requestedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_expiredAt\",\"type\":\"uint256\"}],\"name\":\"voteEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallerMustBeBridgeContract()\":[{\"details\":\"Error of method caller must be bridge contract.\"}],\"ErrCallerMustBeRoninTrustedOrgContract()\":[{\"details\":\"Error of method caller must be Ronin trusted org contract.\"}],\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"bridgeContract()\":{\"details\":\"Returns the bridge contract.\"},\"bridgeOperatorsVoted(uint256,uint256,address)\":{\"details\":\"Returns whether the voter `_voter` casted vote for bridge operators at a specific period.\"},\"castGlobalProposalBySignatures((uint256,uint256,uint8[],uint256[],bytes[],uint256[]),uint8[],(uint8,bytes32,bytes32)[])\":{\"details\":\"See `GovernanceProposal-_castGlobalProposalBySignatures`.\"},\"castProposalBySignatures((uint256,uint256,uint256,address[],uint256[],bytes[],uint256[]),uint8[],(uint8,bytes32,bytes32)[])\":{\"details\":\"See `GovernanceProposal-_castProposalBySignatures`.\"},\"castProposalVoteForCurrentNetwork((uint256,uint256,uint256,address[],uint256[],bytes[],uint256[]),uint8)\":{\"details\":\"Casts vote for a proposal on the current network. Requirements: - The method caller is governor.\"},\"changeProxyAdmin(address,address)\":{\"details\":\"Changes the admin of `_proxy` to `newAdmin`. Requirements: - This contract must be the current admin of `_proxy`.\"},\"createEmergencyExitPoll(address,address,uint256,uint256)\":{\"details\":\"Create a vote to agree that an emergency exit is valid and should return the locked funds back.a Requirements: - The method caller is validator contract.\"},\"deleteExpired(uint256,uint256)\":{\"details\":\"Deletes the expired proposal by its chainId and nonce, without creating a new proposal. Requirements: - The proposal is already created.\"},\"emergencyPollVoted(bytes32,address)\":{\"details\":\"Returns whether the voter casted vote for emergency exit poll.\"},\"getBridgeOperatorVotingSignatures(uint256,uint256)\":{\"details\":\"Returns the voted signatures for bridge operators at a specific period. Note: Does not verify whether the voter casted vote for the proposal and the returned signature can be empty. Please consider filtering for empty signatures after calling this function.\"},\"getProposalExpiryDuration()\":{\"details\":\"Returns the proposal expiry duration.\"},\"getProposalSignatures(uint256,uint256)\":{\"details\":\"Returns the voted signatures for the proposals. Note: The signatures can be empty in case the proposal is voted on the current network.\"},\"getProxyAdmin(address)\":{\"details\":\"Returns the current admin of `_proxy`. Requirements: - This contract must be the admin of `_proxy`.\"},\"getProxyImplementation(address)\":{\"details\":\"Returns the current implementation of `_proxy`. Requirements: - This contract must be the admin of `_proxy`.\"},\"lastSyncedBridgeOperatorSetInfo()\":{\"details\":\"Returns the synced bridge operator set info.\"},\"lastVotedBlock(address)\":{\"details\":\"Returns the last voted block of the bridge voter.\"},\"proposalVoted(uint256,uint256,address)\":{\"details\":\"Returns whether the voter `_voter` casted vote for the proposal.\"},\"propose(uint256,uint256,address[],uint256[],bytes[],uint256[])\":{\"details\":\"See `CoreGovernance-_proposeProposal`. Requirements: - The method caller is governor.\"},\"proposeGlobal(uint256,uint8[],uint256[],bytes[],uint256[])\":{\"details\":\"See `CoreGovernance-_proposeGlobal`. Requirements: - The method caller is governor.\"},\"proposeGlobalProposalStructAndCastVotes((uint256,uint256,uint8[],uint256[],bytes[],uint256[]),uint8[],(uint8,bytes32,bytes32)[])\":{\"details\":\"See `GovernanceProposal-_proposeGlobalProposalStructAndCastVotes`. Requirements: - The method caller is governor.\"},\"proposeProposalForCurrentNetwork(uint256,address[],uint256[],bytes[],uint256[],uint8)\":{\"details\":\"Proposes and casts vote for a proposal on the current network. Requirements: - The method caller is governor. - The proposal is for the current network.\"},\"proposeProposalStructAndCastVotes((uint256,uint256,uint256,address[],uint256[],bytes[],uint256[]),uint8[],(uint8,bytes32,bytes32)[])\":{\"details\":\"See `GovernanceProposal-_proposeProposalStructAndCastVotes`. Requirements: - The method caller is governor. - The proposal is for the current network.\"},\"roninTrustedOrganizationContract()\":{\"details\":\"Returns the ronin trusted organization contract.\"},\"setBridgeContract(address)\":{\"details\":\"Sets the bridge contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `BridgeContractUpdated`.\"},\"setProposalExpiryDuration(uint256)\":{\"details\":\"Sets the expiry duration for a new proposal. Requirements: - Only allowing self-call to this method, since this contract does not have admin.\"},\"setRoninTrustedOrganizationContract(address)\":{\"details\":\"Sets the ronin trusted organization contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `RoninTrustedOrganizationContractUpdated`.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"},\"voteBridgeOperatorsBySignatures((uint256,uint256,address[]),(uint8,bytes32,bytes32)[])\":{\"details\":\"See `BOsGovernanceProposal-_castVotesBySignatures`.\"},\"voteEmergencyExit(bytes32,address,address,uint256,uint256)\":{\"details\":\"Votes for an emergency exit. Executes to unlock fund for the emergency exit's requester. Requirements: - The voter is governor. - The voting is existent. - The voting is not expired yet.\"}},\"stateVariables\":{\"_emergencyExitPoll\":{\"details\":\"Mapping from request hash => emergency poll\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"round(uint256)\":{\"notice\":\"chain id = 0 for global proposal\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/RoninGovernanceAdmin.sol\":\"RoninGovernanceAdmin\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xdb7f5c28fc61cda0bd8ab60ce288e206b791643bcd3ba464a70cbec18895a2f5\",\"license\":\"MIT\"},\"contracts/extensions/GovernanceAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../extensions/sequential-governance/CoreGovernance.sol\\\";\\nimport \\\"../extensions/collections/HasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../extensions/collections/HasBridgeContract.sol\\\";\\nimport \\\"../interfaces/IRoninTrustedOrganization.sol\\\";\\n\\nabstract contract GovernanceAdmin is CoreGovernance, HasRoninTrustedOrganizationContract, HasBridgeContract {\\n uint256 public roninChainId;\\n /// @dev Domain separator\\n bytes32 public DOMAIN_SEPARATOR;\\n\\n modifier onlySelfCall() {\\n require(msg.sender == address(this), \\\"GovernanceAdmin: only allowed self-call\\\");\\n _;\\n }\\n\\n constructor(\\n uint256 _roninChainId,\\n address _roninTrustedOrganizationContract,\\n address _bridgeContract,\\n uint256 _proposalExpiryDuration\\n ) CoreGovernance(_proposalExpiryDuration) {\\n roninChainId = _roninChainId;\\n DOMAIN_SEPARATOR = keccak256(\\n abi.encode(\\n keccak256(\\\"EIP712Domain(string name,string version,bytes32 salt)\\\"),\\n keccak256(\\\"GovernanceAdmin\\\"), // name hash\\n keccak256(\\\"2\\\"), // version hash\\n keccak256(abi.encode(\\\"RONIN_GOVERNANCE_ADMIN\\\", _roninChainId)) // salt\\n )\\n );\\n _setRoninTrustedOrganizationContract(_roninTrustedOrganizationContract);\\n _setBridgeContract(_bridgeContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function setRoninTrustedOrganizationContract(address _addr) external override onlySelfCall {\\n require(_addr.code.length > 0, \\\"GovernanceAdmin: set to non-contract\\\");\\n _setRoninTrustedOrganizationContract(_addr);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeContract\\n */\\n function setBridgeContract(address _addr) external override onlySelfCall {\\n require(_addr.code.length > 0, \\\"GovernanceAdmin: set to non-contract\\\");\\n _setBridgeContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the expiry duration for a new proposal.\\n *\\n * Requirements:\\n * - Only allowing self-call to this method, since this contract does not have admin.\\n *\\n */\\n function setProposalExpiryDuration(uint256 _expiryDuration) external onlySelfCall {\\n _setProposalExpiryDuration(_expiryDuration);\\n }\\n\\n /**\\n * @dev Returns the current implementation of `_proxy`.\\n *\\n * Requirements:\\n * - This contract must be the admin of `_proxy`.\\n *\\n */\\n function getProxyImplementation(address _proxy) external view returns (address) {\\n // We need to manually run the static call since the getter cannot be flagged as view\\n // bytes4(keccak256(\\\"implementation()\\\")) == 0x5c60da1b\\n (bool _success, bytes memory _returndata) = _proxy.staticcall(hex\\\"5c60da1b\\\");\\n require(_success, \\\"GovernanceAdmin: proxy call `implementation()` failed\\\");\\n return abi.decode(_returndata, (address));\\n }\\n\\n /**\\n * @dev Returns the proposal expiry duration.\\n */\\n function getProposalExpiryDuration() external view returns (uint256) {\\n return super._getProposalExpiryDuration();\\n }\\n\\n /**\\n * @dev Returns the current admin of `_proxy`.\\n *\\n * Requirements:\\n * - This contract must be the admin of `_proxy`.\\n *\\n */\\n function getProxyAdmin(address _proxy) external view returns (address) {\\n // We need to manually run the static call since the getter cannot be flagged as view\\n // bytes4(keccak256(\\\"admin()\\\")) == 0xf851a440\\n (bool _success, bytes memory _returndata) = _proxy.staticcall(hex\\\"f851a440\\\");\\n require(_success, \\\"GovernanceAdmin: proxy call `admin()` failed\\\");\\n return abi.decode(_returndata, (address));\\n }\\n\\n /**\\n * @dev Changes the admin of `_proxy` to `newAdmin`.\\n *\\n * Requirements:\\n * - This contract must be the current admin of `_proxy`.\\n *\\n */\\n function changeProxyAdmin(address _proxy, address _newAdmin) external onlySelfCall {\\n // bytes4(keccak256(\\\"changeAdmin(address)\\\"))\\n (bool _success, ) = _proxy.call(abi.encodeWithSelector(0x8f283970, _newAdmin));\\n require(_success, \\\"GovernanceAdmin: proxy call `changeAdmin(address)` failed\\\");\\n }\\n\\n /**\\n * @dev Override `CoreGovernance-_getMinimumVoteWeight`.\\n */\\n function _getMinimumVoteWeight() internal view virtual override returns (uint256) {\\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\\n abi.encodeWithSelector(\\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\\n 0x4bb5274a,\\n abi.encodeWithSelector(IQuorum.minimumVoteWeight.selector)\\n )\\n );\\n require(_success, \\\"GovernanceAdmin: proxy call `minimumVoteWeight()` failed\\\");\\n return abi.decode(_returndata, (uint256));\\n }\\n\\n /**\\n * @dev Override `CoreGovernance-_getTotalWeights`.\\n */\\n function _getTotalWeights() internal view virtual override returns (uint256) {\\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\\n abi.encodeWithSelector(\\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\\n 0x4bb5274a,\\n abi.encodeWithSelector(IRoninTrustedOrganization.totalWeights.selector)\\n )\\n );\\n require(_success, \\\"GovernanceAdmin: proxy call `totalWeights()` failed\\\");\\n return abi.decode(_returndata, (uint256));\\n }\\n}\\n\",\"keccak256\":\"0xe7ff3968824b74d4c49a5861adafde78763992801fe316cbe751198c47654e0b\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasBridgeContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasBridgeContract.sol\\\";\\nimport \\\"../../interfaces/IBridge.sol\\\";\\n\\ncontract HasBridgeContract is IHasBridgeContract, HasProxyAdmin {\\n IBridge internal _bridgeContract;\\n\\n modifier onlyBridgeContract() {\\n if (bridgeContract() != msg.sender) revert ErrCallerMustBeBridgeContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeContract\\n */\\n function bridgeContract() public view override returns (address) {\\n return address(_bridgeContract);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeContract\\n */\\n function setBridgeContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length <= 0) revert ErrZeroCodeContract();\\n _setBridgeContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the bridge contract.\\n *\\n * Emits the event `BridgeContractUpdated`.\\n *\\n */\\n function _setBridgeContract(address _addr) internal {\\n _bridgeContract = IBridge(_addr);\\n emit BridgeContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x6fabd1a69eb4391793a28f0d5449f4662b7e7eaf3d9ca87554ccbc77e2b099f9\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\n\\ncontract HasRoninTrustedOrganizationContract is IHasRoninTrustedOrganizationContract, HasProxyAdmin {\\n IRoninTrustedOrganization internal _roninTrustedOrganizationContract;\\n\\n modifier onlyRoninTrustedOrganizationContract() {\\n if (roninTrustedOrganizationContract() != msg.sender) revert ErrCallerMustBeRoninTrustedOrgContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function roninTrustedOrganizationContract() public view override returns (address) {\\n return address(_roninTrustedOrganizationContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function setRoninTrustedOrganizationContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setRoninTrustedOrganizationContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function _setRoninTrustedOrganizationContract(address _addr) internal {\\n _roninTrustedOrganizationContract = IRoninTrustedOrganization(_addr);\\n emit RoninTrustedOrganizationContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x951fd730f4853d8c932da5484ea093f3094c8186735b603d31fb53035c395751\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/extensions/isolated-governance/IsolatedGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"../../interfaces/consumers/VoteStatusConsumer.sol\\\";\\n\\nabstract contract IsolatedGovernance is VoteStatusConsumer {\\n struct IsolatedVote {\\n VoteStatus status;\\n bytes32 finalHash;\\n /// @dev Mapping from voter => receipt hash\\n mapping(address => bytes32) voteHashOf;\\n /// @dev Mapping from receipt hash => vote weight\\n mapping(bytes32 => uint256) weight;\\n /// @dev The timestamp that voting is expired (no expiration=0)\\n uint256 expiredAt;\\n /// @dev The timestamp that voting is created\\n uint256 createdAt;\\n }\\n\\n /**\\n * @dev Casts vote for the receipt with the receipt hash `_hash`.\\n *\\n * Requirements:\\n * - The vote is not finalized.\\n * - The voter has not voted for the round.\\n *\\n */\\n function _castVote(\\n IsolatedVote storage _proposal,\\n address _voter,\\n uint256 _voterWeight,\\n uint256 _minimumVoteWeight,\\n bytes32 _hash\\n ) internal virtual returns (VoteStatus _status) {\\n if (_proposal.expiredAt > 0 && _proposal.expiredAt <= block.timestamp) {\\n _proposal.status = VoteStatus.Expired;\\n return _proposal.status;\\n }\\n\\n if (_voted(_proposal, _voter)) {\\n revert(\\n string(abi.encodePacked(\\\"IsolatedGovernance: \\\", Strings.toHexString(uint160(_voter), 20), \\\" already voted\\\"))\\n );\\n }\\n\\n // Record for voter\\n _proposal.voteHashOf[_voter] = _hash;\\n // Increase vote weight\\n uint256 _weight = _proposal.weight[_hash] += _voterWeight;\\n\\n if (_weight >= _minimumVoteWeight && _proposal.status == VoteStatus.Pending) {\\n _proposal.status = VoteStatus.Approved;\\n _proposal.finalHash = _hash;\\n }\\n\\n _status = _proposal.status;\\n }\\n\\n /**\\n * @dev Returns whether the voter casted for the proposal.\\n */\\n function _voted(IsolatedVote storage _proposal, address _voter) internal view virtual returns (bool) {\\n return _proposal.voteHashOf[_voter] != bytes32(0);\\n }\\n}\\n\",\"keccak256\":\"0xe2d3bd6a2dae71c371aca5e6db35dc20cb76621d62a747d445d0da616145866b\",\"license\":\"MIT\"},\"contracts/extensions/isolated-governance/bridge-operator-governance/BOsGovernanceProposal.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../../extensions/isolated-governance/IsolatedGovernance.sol\\\";\\nimport \\\"../../../interfaces/consumers/SignatureConsumer.sol\\\";\\nimport \\\"../../../libraries/BridgeOperatorsBallot.sol\\\";\\nimport \\\"../../../interfaces/IRoninGovernanceAdmin.sol\\\";\\n\\nabstract contract BOsGovernanceProposal is SignatureConsumer, IsolatedGovernance, IRoninGovernanceAdmin {\\n struct VotingSignature {\\n mapping(address => Signature) signatureOf;\\n address[] voters;\\n }\\n\\n /// @dev The last the brige operator set info.\\n BridgeOperatorsBallot.BridgeOperatorSet internal _lastSyncedBridgeOperatorSetInfo;\\n /// @dev Mapping from period index => epoch index => bridge operators vote\\n mapping(uint256 => mapping(uint256 => IsolatedVote)) internal _vote;\\n /// @dev Mapping from bridge voter address => last block that the address voted\\n mapping(address => uint256) internal _lastVotedBlock;\\n /// @dev Mapping from period index => epoch index => bridge voter signatures\\n mapping(uint256 => mapping(uint256 => VotingSignature)) internal _bridgeVoterSig;\\n\\n /**\\n * @inheritdoc IRoninGovernanceAdmin\\n */\\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256) {\\n return _lastVotedBlock[_bridgeVoter];\\n }\\n\\n /**\\n * @inheritdoc IRoninGovernanceAdmin\\n */\\n function lastSyncedBridgeOperatorSetInfo() external view returns (BridgeOperatorsBallot.BridgeOperatorSet memory) {\\n return _lastSyncedBridgeOperatorSetInfo;\\n }\\n\\n /**\\n * @dev Votes for a set of bridge operators by signatures.\\n *\\n * Requirements:\\n * - The period of voting is larger than the last synced period.\\n * - The arrays are not empty.\\n * - The signature signers are in order.\\n *\\n */\\n function _castVotesBySignatures(\\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\\n Signature[] calldata _signatures,\\n uint256 _minimumVoteWeight,\\n bytes32 _domainSeperator\\n ) internal {\\n require(\\n _ballot.period >= _lastSyncedBridgeOperatorSetInfo.period &&\\n _ballot.epoch >= _lastSyncedBridgeOperatorSetInfo.epoch,\\n \\\"BOsGovernanceProposal: query for outdated bridge operator set\\\"\\n );\\n BridgeOperatorsBallot.verifyBallot(_ballot);\\n require(_signatures.length > 0, \\\"BOsGovernanceProposal: invalid array length\\\");\\n\\n address _signer;\\n address _lastSigner;\\n bytes32 _hash = BridgeOperatorsBallot.hash(_ballot);\\n bytes32 _digest = ECDSA.toTypedDataHash(_domainSeperator, _hash);\\n IsolatedVote storage _v = _vote[_ballot.period][_ballot.epoch];\\n VotingSignature storage _info = _bridgeVoterSig[_ballot.period][_ballot.epoch];\\n bool _hasValidVotes;\\n\\n for (uint256 _i = 0; _i < _signatures.length; _i++) {\\n // Avoids stack too deeps\\n {\\n Signature calldata _sig = _signatures[_i];\\n _signer = ECDSA.recover(_digest, _sig.v, _sig.r, _sig.s);\\n require(_lastSigner < _signer, \\\"BOsGovernanceProposal: invalid signer order\\\");\\n _lastSigner = _signer;\\n }\\n\\n uint256 _weight = _getBridgeVoterWeight(_signer);\\n if (_weight > 0) {\\n _hasValidVotes = true;\\n _lastVotedBlock[_signer] = block.number;\\n _info.signatureOf[_signer] = _signatures[_i];\\n _info.voters.push(_signer);\\n _castVote(_v, _signer, _weight, _minimumVoteWeight, _hash);\\n }\\n }\\n\\n require(_hasValidVotes, \\\"BOsGovernanceProposal: invalid signatures\\\");\\n }\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function _getBridgeVoterWeight(address _bridgeVoter) internal view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x1f66853b94700ae6f19bba06d95e5e03d6003c1104bacc1d9c8e3d2582400cc3\",\"license\":\"MIT\"},\"contracts/extensions/sequential-governance/CoreGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"../../libraries/Proposal.sol\\\";\\nimport \\\"../../libraries/GlobalProposal.sol\\\";\\nimport \\\"../../libraries/Ballot.sol\\\";\\nimport \\\"../../interfaces/consumers/ChainTypeConsumer.sol\\\";\\nimport \\\"../../interfaces/consumers/SignatureConsumer.sol\\\";\\nimport \\\"../../interfaces/consumers/VoteStatusConsumer.sol\\\";\\n\\nabstract contract CoreGovernance is SignatureConsumer, VoteStatusConsumer, ChainTypeConsumer {\\n using Proposal for Proposal.ProposalDetail;\\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\\n\\n struct ProposalVote {\\n VoteStatus status;\\n bytes32 hash;\\n uint256 againstVoteWeight; // Total weight of against votes\\n uint256 forVoteWeight; // Total weight of for votes\\n address[] forVoteds; // Array of addresses voting for\\n address[] againstVoteds; // Array of addresses voting against\\n uint256 expiryTimestamp;\\n mapping(address => Signature) sig;\\n mapping(address => bool) voted;\\n }\\n\\n /// @dev Emitted when a proposal is created\\n event ProposalCreated(\\n uint256 indexed chainId,\\n uint256 indexed round,\\n bytes32 indexed proposalHash,\\n Proposal.ProposalDetail proposal,\\n address creator\\n );\\n /// @dev Emitted when a proposal is created\\n event GlobalProposalCreated(\\n uint256 indexed round,\\n bytes32 indexed proposalHash,\\n Proposal.ProposalDetail proposal,\\n bytes32 globalProposalHash,\\n GlobalProposal.GlobalProposalDetail globalProposal,\\n address creator\\n );\\n /// @dev Emitted when the proposal is voted\\n event ProposalVoted(bytes32 indexed proposalHash, address indexed voter, Ballot.VoteType support, uint256 weight);\\n /// @dev Emitted when the proposal is approved\\n event ProposalApproved(bytes32 indexed proposalHash);\\n /// @dev Emitted when the vote is reject\\n event ProposalRejected(bytes32 indexed proposalHash);\\n /// @dev Emitted when the vote is expired\\n event ProposalExpired(bytes32 indexed proposalHash);\\n /// @dev Emitted when the proposal is executed\\n event ProposalExecuted(bytes32 indexed proposalHash, bool[] successCalls, bytes[] returnDatas);\\n\\n /// @dev Mapping from chain id => vote round\\n /// @notice chain id = 0 for global proposal\\n mapping(uint256 => uint256) public round;\\n /// @dev Mapping from chain id => vote round => proposal vote\\n mapping(uint256 => mapping(uint256 => ProposalVote)) public vote;\\n\\n uint256 private _proposalExpiryDuration;\\n\\n constructor(uint256 _expiryDuration) {\\n _setProposalExpiryDuration(_expiryDuration);\\n }\\n\\n /**\\n * @dev Creates new voting round by calculating the `_round` number of chain `_chainId`.\\n * Increases the `_round` number if the previous one is not expired. Delete the previous proposal\\n * if it is expired and not increase the `_round`.\\n */\\n function _createVotingRound(uint256 _chainId) internal returns (uint256 _round) {\\n _round = round[_chainId];\\n // Skip checking for the first ever round\\n if (_round == 0) {\\n _round = round[_chainId] = 1;\\n } else {\\n ProposalVote storage _latestProposalVote = vote[_chainId][_round];\\n bool _isExpired = _tryDeleteExpiredVotingRound(_latestProposalVote);\\n // Skip increasing round number if the latest round is expired, allow the vote to be overridden\\n if (!_isExpired) {\\n require(_latestProposalVote.status != VoteStatus.Pending, \\\"CoreGovernance: current proposal is not completed\\\");\\n _round = ++round[_chainId];\\n }\\n }\\n }\\n\\n /**\\n * @dev Saves new round voting for the proposal `_proposalHash` of chain `_chainId`.\\n */\\n function _saveVotingRound(\\n ProposalVote storage _vote,\\n bytes32 _proposalHash,\\n uint256 _expiryTimestamp\\n ) internal {\\n _vote.hash = _proposalHash;\\n _vote.expiryTimestamp = _expiryTimestamp;\\n }\\n\\n /**\\n * @dev Proposes for a new proposal.\\n *\\n * Requirements:\\n * - The chain id is not equal to 0.\\n *\\n * Emits the `ProposalCreated` event.\\n *\\n */\\n function _proposeProposal(\\n uint256 _chainId,\\n uint256 _expiryTimestamp,\\n address[] memory _targets,\\n uint256[] memory _values,\\n bytes[] memory _calldatas,\\n uint256[] memory _gasAmounts,\\n address _creator\\n ) internal virtual returns (Proposal.ProposalDetail memory _proposal) {\\n require(_chainId != 0, \\\"CoreGovernance: invalid chain id\\\");\\n uint256 _round = _createVotingRound(_chainId);\\n\\n _proposal = Proposal.ProposalDetail(_round, _chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts);\\n _proposal.validate(_proposalExpiryDuration);\\n\\n bytes32 _proposalHash = _proposal.hash();\\n _saveVotingRound(vote[_chainId][_round], _proposalHash, _expiryTimestamp);\\n emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator);\\n }\\n\\n /**\\n * @dev Proposes proposal struct.\\n *\\n * Requirements:\\n * - The chain id is not equal to 0.\\n * - The proposal nonce is equal to the new round.\\n *\\n * Emits the `ProposalCreated` event.\\n *\\n */\\n function _proposeProposalStruct(Proposal.ProposalDetail memory _proposal, address _creator)\\n internal\\n virtual\\n returns (uint256 _round)\\n {\\n uint256 _chainId = _proposal.chainId;\\n require(_chainId != 0, \\\"CoreGovernance: invalid chain id\\\");\\n _proposal.validate(_proposalExpiryDuration);\\n\\n bytes32 _proposalHash = _proposal.hash();\\n _round = _createVotingRound(_chainId);\\n _saveVotingRound(vote[_chainId][_round], _proposalHash, _proposal.expiryTimestamp);\\n require(_round == _proposal.nonce, \\\"CoreGovernance: invalid proposal nonce\\\");\\n emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator);\\n }\\n\\n /**\\n * @dev Proposes for a global proposal.\\n *\\n * Emits the `GlobalProposalCreated` event.\\n *\\n */\\n function _proposeGlobal(\\n uint256 _expiryTimestamp,\\n GlobalProposal.TargetOption[] calldata _targetOptions,\\n uint256[] memory _values,\\n bytes[] memory _calldatas,\\n uint256[] memory _gasAmounts,\\n address _roninTrustedOrganizationContract,\\n address _gatewayContract,\\n address _creator\\n ) internal virtual {\\n uint256 _round = _createVotingRound(0);\\n GlobalProposal.GlobalProposalDetail memory _globalProposal = GlobalProposal.GlobalProposalDetail(\\n _round,\\n _expiryTimestamp,\\n _targetOptions,\\n _values,\\n _calldatas,\\n _gasAmounts\\n );\\n Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail(\\n _roninTrustedOrganizationContract,\\n _gatewayContract\\n );\\n _proposal.validate(_proposalExpiryDuration);\\n\\n bytes32 _proposalHash = _proposal.hash();\\n _saveVotingRound(vote[0][_round], _proposalHash, _expiryTimestamp);\\n emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator);\\n }\\n\\n /**\\n * @dev Proposes global proposal struct.\\n *\\n * Requirements:\\n * - The proposal nonce is equal to the new round.\\n *\\n * Emits the `GlobalProposalCreated` event.\\n *\\n */\\n function _proposeGlobalStruct(\\n GlobalProposal.GlobalProposalDetail memory _globalProposal,\\n address _roninTrustedOrganizationContract,\\n address _gatewayContract,\\n address _creator\\n ) internal virtual returns (Proposal.ProposalDetail memory _proposal) {\\n _proposal = _globalProposal.into_proposal_detail(_roninTrustedOrganizationContract, _gatewayContract);\\n _proposal.validate(_proposalExpiryDuration);\\n\\n bytes32 _proposalHash = _proposal.hash();\\n uint256 _round = _createVotingRound(0);\\n _saveVotingRound(vote[0][_round], _proposalHash, _globalProposal.expiryTimestamp);\\n require(_round == _proposal.nonce, \\\"CoreGovernance: invalid proposal nonce\\\");\\n emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator);\\n }\\n\\n /**\\n * @dev Casts vote for the proposal with data and returns whether the voting is done.\\n *\\n * Requirements:\\n * - The proposal nonce is equal to the round.\\n * - The vote is not finalized.\\n * - The voter has not voted for the round.\\n *\\n * Emits the `ProposalVoted` event. Emits the `ProposalApproved`, `ProposalExecuted` or `ProposalRejected` once the\\n * proposal is approved, executed or rejected.\\n *\\n */\\n function _castVote(\\n Proposal.ProposalDetail memory _proposal,\\n Ballot.VoteType _support,\\n uint256 _minimumForVoteWeight,\\n uint256 _minimumAgainstVoteWeight,\\n address _voter,\\n Signature memory _signature,\\n uint256 _voterWeight\\n ) internal virtual returns (bool _done) {\\n uint256 _chainId = _proposal.chainId;\\n uint256 _round = _proposal.nonce;\\n ProposalVote storage _vote = vote[_chainId][_round];\\n\\n if (_tryDeleteExpiredVotingRound(_vote)) {\\n return true;\\n }\\n\\n require(round[_proposal.chainId] == _round, \\\"CoreGovernance: query for invalid proposal nonce\\\");\\n require(_vote.status == VoteStatus.Pending, \\\"CoreGovernance: the vote is finalized\\\");\\n if (_voted(_vote, _voter)) {\\n revert(string(abi.encodePacked(\\\"CoreGovernance: \\\", Strings.toHexString(uint160(_voter), 20), \\\" already voted\\\")));\\n }\\n\\n _vote.voted[_voter] = true;\\n // Stores the signature if it is not empty\\n if (_signature.r > 0 || _signature.s > 0 || _signature.v > 0) {\\n _vote.sig[_voter] = _signature;\\n }\\n emit ProposalVoted(_vote.hash, _voter, _support, _voterWeight);\\n\\n uint256 _forVoteWeight;\\n uint256 _againstVoteWeight;\\n if (_support == Ballot.VoteType.For) {\\n _vote.forVoteds.push(_voter);\\n _forVoteWeight = _vote.forVoteWeight += _voterWeight;\\n } else if (_support == Ballot.VoteType.Against) {\\n _vote.againstVoteds.push(_voter);\\n _againstVoteWeight = _vote.againstVoteWeight += _voterWeight;\\n } else {\\n revert(\\\"CoreGovernance: unsupported vote type\\\");\\n }\\n\\n if (_forVoteWeight >= _minimumForVoteWeight) {\\n _done = true;\\n _vote.status = VoteStatus.Approved;\\n emit ProposalApproved(_vote.hash);\\n _tryExecute(_vote, _proposal);\\n } else if (_againstVoteWeight >= _minimumAgainstVoteWeight) {\\n _done = true;\\n _vote.status = VoteStatus.Rejected;\\n emit ProposalRejected(_vote.hash);\\n }\\n }\\n\\n /**\\n * @dev When the contract is on Ronin chain, checks whether the proposal is expired and delete it if is expired.\\n *\\n * Emits the event `ProposalExpired` if the vote is expired.\\n *\\n * Note: This function assumes the vote `_proposalVote` is already created, consider verifying the vote's existence\\n * before or it will emit an unexpected event of `ProposalExpired`.\\n */\\n function _tryDeleteExpiredVotingRound(ProposalVote storage _proposalVote) internal returns (bool _isExpired) {\\n _isExpired =\\n _getChainType() == ChainType.RoninChain &&\\n _proposalVote.status == VoteStatus.Pending &&\\n _proposalVote.expiryTimestamp <= block.timestamp;\\n\\n if (_isExpired) {\\n emit ProposalExpired(_proposalVote.hash);\\n\\n for (uint256 _i; _i < _proposalVote.forVoteds.length; _i++) {\\n delete _proposalVote.voted[_proposalVote.forVoteds[_i]];\\n delete _proposalVote.sig[_proposalVote.forVoteds[_i]];\\n }\\n for (uint256 _i; _i < _proposalVote.againstVoteds.length; _i++) {\\n delete _proposalVote.voted[_proposalVote.againstVoteds[_i]];\\n delete _proposalVote.sig[_proposalVote.againstVoteds[_i]];\\n }\\n delete _proposalVote.status;\\n delete _proposalVote.hash;\\n delete _proposalVote.againstVoteWeight;\\n delete _proposalVote.forVoteWeight;\\n delete _proposalVote.forVoteds;\\n delete _proposalVote.againstVoteds;\\n delete _proposalVote.expiryTimestamp;\\n }\\n }\\n\\n /**\\n * @dev Executes the proposal and update the vote status once the proposal is executable.\\n */\\n function _tryExecute(ProposalVote storage _vote, Proposal.ProposalDetail memory _proposal) internal {\\n if (_proposal.executable()) {\\n _vote.status = VoteStatus.Executed;\\n (bool[] memory _successCalls, bytes[] memory _returnDatas) = _proposal.execute();\\n emit ProposalExecuted(_vote.hash, _successCalls, _returnDatas);\\n }\\n }\\n\\n /**\\n * @dev Sets the expiry duration for a new proposal.\\n */\\n function _setProposalExpiryDuration(uint256 _expiryDuration) internal {\\n _proposalExpiryDuration = _expiryDuration;\\n }\\n\\n /**\\n * @dev Returns whether the voter casted for the proposal.\\n */\\n function _voted(ProposalVote storage _vote, address _voter) internal view returns (bool) {\\n return _vote.voted[_voter];\\n }\\n\\n /**\\n * @dev Returns the expiry duration for a new proposal.\\n */\\n function _getProposalExpiryDuration() internal view returns (uint256) {\\n return _proposalExpiryDuration;\\n }\\n\\n /**\\n * @dev Returns total weight from validators.\\n */\\n function _getTotalWeights() internal view virtual returns (uint256);\\n\\n /**\\n * @dev Returns minimum vote to pass a proposal.\\n */\\n function _getMinimumVoteWeight() internal view virtual returns (uint256);\\n\\n /**\\n * @dev Returns current context is running on whether Ronin chain or on mainchain.\\n */\\n function _getChainType() internal view virtual returns (ChainType);\\n}\\n\",\"keccak256\":\"0x4c38499b2dcde8b53fa2c28efba0fdfd939a6225c660da265d45ab1cd93597f8\",\"license\":\"MIT\"},\"contracts/extensions/sequential-governance/GovernanceProposal.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./CoreGovernance.sol\\\";\\n\\nabstract contract GovernanceProposal is CoreGovernance {\\n using Proposal for Proposal.ProposalDetail;\\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\\n\\n /**\\n * @dev Casts votes by signatures.\\n *\\n * Note: This method does not verify the proposal hash with the vote hash. Please consider checking it before.\\n *\\n */\\n function _castVotesBySignatures(\\n Proposal.ProposalDetail memory _proposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures,\\n bytes32 _forDigest,\\n bytes32 _againstDigest\\n ) internal {\\n require(_supports.length > 0 && _supports.length == _signatures.length, \\\"GovernanceProposal: invalid array length\\\");\\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\\n\\n address _lastSigner;\\n address _signer;\\n Signature calldata _sig;\\n bool _hasValidVotes;\\n for (uint256 _i; _i < _signatures.length; _i++) {\\n _sig = _signatures[_i];\\n\\n if (_supports[_i] == Ballot.VoteType.For) {\\n _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s);\\n } else if (_supports[_i] == Ballot.VoteType.Against) {\\n _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s);\\n } else {\\n revert(\\\"GovernanceProposal: query for unsupported vote type\\\");\\n }\\n\\n require(_lastSigner < _signer, \\\"GovernanceProposal: invalid order\\\");\\n _lastSigner = _signer;\\n\\n uint256 _weight = _getWeight(_signer);\\n if (_weight > 0) {\\n _hasValidVotes = true;\\n if (\\n _castVote(_proposal, _supports[_i], _minimumForVoteWeight, _minimumAgainstVoteWeight, _signer, _sig, _weight)\\n ) {\\n return;\\n }\\n }\\n }\\n\\n require(_hasValidVotes, \\\"GovernanceProposal: invalid signatures\\\");\\n }\\n\\n /**\\n * @dev Proposes a proposal struct and casts votes by signature.\\n */\\n function _proposeProposalStructAndCastVotes(\\n Proposal.ProposalDetail calldata _proposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures,\\n bytes32 _domainSeparator,\\n address _creator\\n ) internal {\\n _proposeProposalStruct(_proposal, _creator);\\n bytes32 _proposalHash = _proposal.hash();\\n _castVotesBySignatures(\\n _proposal,\\n _supports,\\n _signatures,\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\\n );\\n }\\n\\n /**\\n * @dev Proposes a proposal struct and casts votes by signature.\\n */\\n function _castProposalBySignatures(\\n Proposal.ProposalDetail calldata _proposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures,\\n bytes32 _domainSeparator\\n ) internal {\\n bytes32 _proposalHash = _proposal.hash();\\n require(\\n vote[_proposal.chainId][_proposal.nonce].hash == _proposalHash,\\n \\\"GovernanceAdmin: cast vote for invalid proposal\\\"\\n );\\n _castVotesBySignatures(\\n _proposal,\\n _supports,\\n _signatures,\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\\n );\\n }\\n\\n /**\\n * @dev Proposes and votes by signature.\\n */\\n function _proposeGlobalProposalStructAndCastVotes(\\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures,\\n bytes32 _domainSeparator,\\n address _roninTrustedOrganizationContract,\\n address _gatewayContract,\\n address _creator\\n ) internal returns (Proposal.ProposalDetail memory _proposal) {\\n _proposal = _proposeGlobalStruct(_globalProposal, _roninTrustedOrganizationContract, _gatewayContract, _creator);\\n bytes32 _globalProposalHash = _globalProposal.hash();\\n _castVotesBySignatures(\\n _proposal,\\n _supports,\\n _signatures,\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\\n );\\n }\\n\\n /**\\n * @dev Proposes a global proposal struct and casts votes by signature.\\n */\\n function _castGlobalProposalBySignatures(\\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures,\\n bytes32 _domainSeparator,\\n address _roninTrustedOrganizationContract,\\n address _gatewayContract\\n ) internal {\\n Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail(\\n _roninTrustedOrganizationContract,\\n _gatewayContract\\n );\\n bytes32 _globalProposalHash = _globalProposal.hash();\\n require(vote[0][_proposal.nonce].hash == _proposal.hash(), \\\"GovernanceAdmin: cast vote for invalid proposal\\\");\\n _castVotesBySignatures(\\n _proposal,\\n _supports,\\n _signatures,\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\\n );\\n }\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function _getWeight(address _governor) internal view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x5ae6611dcf49152c8e84853772f4cbf4d538c91cb9d4c85a1b0be04a215fd6e0\",\"license\":\"MIT\"},\"contracts/interfaces/IBridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBridge {\\n /**\\n * @dev Replaces the old bridge operator list by the new one.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emitted the event `BridgeOperatorsReplaced`.\\n *\\n */\\n function replaceBridgeOperators(address[] calldata) external;\\n\\n /**\\n * @dev Returns the bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n}\\n\",\"keccak256\":\"0x614db701e54383b7d0a749bc9b0d2da95d42652cd673499bf71e25096548b96e\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x10f3b360430e6d03773c9959f54cbed6fb0346069645c05b05ef50cfb19f3753\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninGovernanceAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../libraries/BridgeOperatorsBallot.sol\\\";\\n\\ninterface IRoninGovernanceAdmin {\\n /// @dev Emitted when the bridge operators are approved.\\n event BridgeOperatorsApproved(uint256 _period, uint256 _epoch, address[] _operators);\\n /// @dev Emitted when an emergency exit poll is created.\\n event EmergencyExitPollCreated(\\n bytes32 _voteHash,\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n );\\n /// @dev Emitted when an emergency exit poll is approved.\\n event EmergencyExitPollApproved(bytes32 _voteHash);\\n /// @dev Emitted when an emergency exit poll is expired.\\n event EmergencyExitPollExpired(bytes32 _voteHash);\\n\\n /**\\n * @dev Returns the last voted block of the bridge voter.\\n */\\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256);\\n\\n /**\\n * @dev Returns the synced bridge operator set info.\\n */\\n function lastSyncedBridgeOperatorSetInfo()\\n external\\n view\\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory _bridgeOperatorSetInfo);\\n\\n /**\\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n */\\n function createEmergencyExitPoll(\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) external;\\n}\\n\",\"keccak256\":\"0x1aa218f9a8cad8fa9f865c179b257aa8f2614e034100dedebdd352da9a7d96d9\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeights() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganizations() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x1edb7a3f5d340e7efc141cb8d94c5499954dec869f026d3998ad92cbc714d604\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasBridgeContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasBridgeContract is IHasContract {\\n /// @dev Emitted when the bridge contract is updated.\\n event BridgeContractUpdated(address);\\n\\n /// @dev Error of method caller must be bridge contract.\\n error ErrCallerMustBeBridgeContract();\\n\\n /**\\n * @dev Returns the bridge contract.\\n */\\n function bridgeContract() external view returns (address);\\n\\n /**\\n * @dev Sets the bridge contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `BridgeContractUpdated`.\\n *\\n */\\n function setBridgeContract(address) external;\\n}\\n\",\"keccak256\":\"0xf3ab1830ba7797cb3b8011512af3a5e38a316549f62140b0c10e0b4dcb67f773\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\\n /// @dev Emitted when the ronin trusted organization contract is updated.\\n event RoninTrustedOrganizationContractUpdated(address);\\n\\n /// @dev Error of method caller must be Ronin trusted org contract.\\n error ErrCallerMustBeRoninTrustedOrgContract();\\n\\n /**\\n * @dev Returns the ronin trusted organization contract.\\n */\\n function roninTrustedOrganizationContract() external view returns (address);\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function setRoninTrustedOrganizationContract(address) external;\\n}\\n\",\"keccak256\":\"0x7d0a0b1d658e9cf4d69f4934748e0a5c1d22183024d26927f5d621fc61aff0b2\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/ChainTypeConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface ChainTypeConsumer {\\n enum ChainType {\\n RoninChain,\\n Mainchain\\n }\\n}\\n\",\"keccak256\":\"0xe0d20e00c8d237f8e0fb881abf1ff1ef114173bcb428f06f689c581666a22db7\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/SignatureConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface SignatureConsumer {\\n struct Signature {\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n }\\n}\\n\",\"keccak256\":\"0xd370e350722067097dec1a5c31bda6e47e83417fa5c3288293bb910028cd136b\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/VoteStatusConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface VoteStatusConsumer {\\n enum VoteStatus {\\n Pending,\\n Approved,\\n Executed,\\n Rejected,\\n Expired\\n }\\n}\\n\",\"keccak256\":\"0xa5045232c0c053fcf31fb3fe71942344444159c48d5f1b2063dbb06b6a1c9752\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0xe4060b7e3b04a0043bd334011fe4ba67c990b0484dad52d7f14b35040989b6ab\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n // Error thrown when receives RON from neither staking vesting contract nor staking contract\\\"\\n error ErrUnauthorizedReceiveRON();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0x4e81a61359a3f8bcc9d452615e3df7b0d0201823ce88f763530ddd4f00c2fc48\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address[] calldata _blockProducers) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address[] calldata _blockProducers, uint256 _period)\\n external\\n view\\n returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the current period.\\n */\\n\\n function checkBridgeRewardDeprecated(address _consensusAddr) external view returns (bool _result);\\n}\\n\",\"keccak256\":\"0x853e7d0ac33ad868721733fc2ab4b78f2e613973a579eb0ea485cbdaa750e057\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator or not.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0xbd10b0207a749e3a7a2aadcb6e93784cb17343a5266d056a3d0b79acb7c5c93d\",\"license\":\"MIT\"},\"contracts/libraries/Ballot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nlibrary Ballot {\\n using ECDSA for bytes32;\\n\\n enum VoteType {\\n For,\\n Against\\n }\\n\\n // keccak256(\\\"Ballot(bytes32 proposalHash,uint8 support)\\\");\\n bytes32 public constant BALLOT_TYPEHASH = 0xd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c2;\\n\\n function hash(bytes32 _proposalHash, VoteType _support) internal pure returns (bytes32) {\\n return keccak256(abi.encode(BALLOT_TYPEHASH, _proposalHash, _support));\\n }\\n}\\n\",\"keccak256\":\"0x28a0192db886307f30ada203bdb902749ee3f30d42710de4eaf303cba23c32c2\",\"license\":\"MIT\"},\"contracts/libraries/BridgeOperatorsBallot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nlibrary BridgeOperatorsBallot {\\n struct BridgeOperatorSet {\\n uint256 period;\\n uint256 epoch;\\n address[] operators;\\n }\\n\\n // keccak256(\\\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\\\");\\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\\n\\n /**\\n * @dev Verifies whether the ballot is valid or not.\\n *\\n * Requirements:\\n * - The ballot is not for an empty operator set.\\n * - The operator address list is in order.\\n *\\n */\\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\\n require(_ballot.operators.length > 0, \\\"BridgeOperatorsBallot: invalid array length\\\");\\n address _addr = _ballot.operators[0];\\n for (uint _i = 1; _i < _ballot.operators.length; _i++) {\\n require(_addr < _ballot.operators[_i], \\\"BridgeOperatorsBallot: invalid order of bridge operators\\\");\\n _addr = _ballot.operators[_i];\\n }\\n }\\n\\n /**\\n * @dev Returns hash of the ballot.\\n */\\n function hash(BridgeOperatorSet calldata _ballot) internal pure returns (bytes32) {\\n bytes32 _operatorsHash;\\n address[] memory _operators = _ballot.operators;\\n\\n assembly {\\n _operatorsHash := keccak256(add(_operators, 32), mul(mload(_operators), 32))\\n }\\n\\n return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\\n }\\n}\\n\",\"keccak256\":\"0x986425ebae2dcfcfa266c9ca825232ff300ec8ce796e8975da6714d87e921793\",\"license\":\"MIT\"},\"contracts/libraries/EmergencyExitBallot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nlibrary EmergencyExitBallot {\\n // keccak256(\\\"EmergencyExitBallot(address consensusAddress,address recipientAfterUnlockedFund,uint256 requestedAt,uint256 expiredAt)\\\");\\n bytes32 public constant EMERGENCY_EXIT_BALLOT_TYPEHASH =\\n 0x697acba4deaf1a718d8c2d93e42860488cb7812696f28ca10eed17bac41e7027;\\n\\n /**\\n * @dev Returns hash of the ballot.\\n */\\n function hash(\\n address _consensusAddress,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) internal pure returns (bytes32) {\\n return\\n keccak256(\\n abi.encode(\\n EMERGENCY_EXIT_BALLOT_TYPEHASH,\\n _consensusAddress,\\n _recipientAfterUnlockedFund,\\n _requestedAt,\\n _expiredAt\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfee3f0b001f34b3760a06c7abcf4f7d35054dba0004221adfc4c5f5ede4a1114\",\"license\":\"MIT\"},\"contracts/libraries/GlobalProposal.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Proposal.sol\\\";\\n\\nlibrary GlobalProposal {\\n enum TargetOption {\\n RoninTrustedOrganizationContract,\\n GatewayContract\\n }\\n\\n struct GlobalProposalDetail {\\n // Nonce to make sure proposals are executed in order\\n uint256 nonce;\\n uint256 expiryTimestamp;\\n TargetOption[] targetOptions;\\n uint256[] values;\\n bytes[] calldatas;\\n uint256[] gasAmounts;\\n }\\n\\n // keccak256(\\\"GlobalProposalDetail(uint256 nonce,uint256 expiryTimestamp,uint8[] targetOptions,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\\\");\\n bytes32 public constant TYPE_HASH = 0x1463f426c05aff2c1a7a0957a71c9898bc8b47142540538e79ee25ee91141350;\\n\\n /**\\n * @dev Returns struct hash of the proposal.\\n */\\n function hash(GlobalProposalDetail memory _proposal) internal pure returns (bytes32) {\\n bytes32 _targetsHash;\\n bytes32 _valuesHash;\\n bytes32 _calldatasHash;\\n bytes32 _gasAmountsHash;\\n\\n uint256[] memory _values = _proposal.values;\\n TargetOption[] memory _targets = _proposal.targetOptions;\\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\\n\\n for (uint256 _i; _i < _calldataHashList.length; _i++) {\\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\\n }\\n\\n assembly {\\n _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32))\\n _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32))\\n _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32))\\n _gasAmountsHash := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32))\\n }\\n\\n return\\n keccak256(\\n abi.encode(\\n TYPE_HASH,\\n _proposal.nonce,\\n _proposal.expiryTimestamp,\\n _targetsHash,\\n _valuesHash,\\n _calldatasHash,\\n _gasAmountsHash\\n )\\n );\\n }\\n\\n /**\\n * @dev Converts into the normal proposal.\\n */\\n function into_proposal_detail(\\n GlobalProposalDetail memory _proposal,\\n address _roninTrustedOrganizationContract,\\n address _gatewayContract\\n ) internal pure returns (Proposal.ProposalDetail memory _detail) {\\n _detail.nonce = _proposal.nonce;\\n _detail.expiryTimestamp = _proposal.expiryTimestamp;\\n _detail.chainId = 0;\\n _detail.targets = new address[](_proposal.targetOptions.length);\\n _detail.values = _proposal.values;\\n _detail.calldatas = _proposal.calldatas;\\n _detail.gasAmounts = _proposal.gasAmounts;\\n\\n for (uint256 _i; _i < _proposal.targetOptions.length; _i++) {\\n if (_proposal.targetOptions[_i] == TargetOption.GatewayContract) {\\n _detail.targets[_i] = _gatewayContract;\\n } else if (_proposal.targetOptions[_i] == TargetOption.RoninTrustedOrganizationContract) {\\n _detail.targets[_i] = _roninTrustedOrganizationContract;\\n } else {\\n revert(\\\"GlobalProposal: unsupported target\\\");\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4749e811eebe029ac572b48e5c755bc852cc74e8234c5243a57f7536c3ed00e0\",\"license\":\"MIT\"},\"contracts/libraries/Proposal.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nlibrary Proposal {\\n struct ProposalDetail {\\n // Nonce to make sure proposals are executed in order\\n uint256 nonce;\\n // Value 0: all chain should run this proposal\\n // Other values: only specifc chain has to execute\\n uint256 chainId;\\n uint256 expiryTimestamp;\\n address[] targets;\\n uint256[] values;\\n bytes[] calldatas;\\n uint256[] gasAmounts;\\n }\\n\\n // keccak256(\\\"ProposalDetail(uint256 nonce,uint256 chainId,uint256 expiryTimestamp,address[] targets,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\\\");\\n bytes32 public constant TYPE_HASH = 0xd051578048e6ff0bbc9fca3b65a42088dbde10f36ca841de566711087ad9b08a;\\n\\n /**\\n * @dev Validates the proposal.\\n */\\n function validate(ProposalDetail memory _proposal, uint256 _maxExpiryDuration) internal view {\\n require(\\n _proposal.targets.length > 0 &&\\n _proposal.targets.length == _proposal.values.length &&\\n _proposal.targets.length == _proposal.calldatas.length &&\\n _proposal.targets.length == _proposal.gasAmounts.length,\\n \\\"Proposal: invalid array length\\\"\\n );\\n require(_proposal.expiryTimestamp <= block.timestamp + _maxExpiryDuration, \\\"Proposal: invalid expiry timestamp\\\");\\n }\\n\\n /**\\n * @dev Returns struct hash of the proposal.\\n */\\n function hash(ProposalDetail memory _proposal) internal pure returns (bytes32) {\\n bytes32 _targetsHash;\\n bytes32 _valuesHash;\\n bytes32 _calldatasHash;\\n bytes32 _gasAmountsHash;\\n\\n uint256[] memory _values = _proposal.values;\\n address[] memory _targets = _proposal.targets;\\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\\n\\n for (uint256 _i; _i < _calldataHashList.length; _i++) {\\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\\n }\\n\\n assembly {\\n _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32))\\n _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32))\\n _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32))\\n _gasAmountsHash := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32))\\n }\\n\\n return\\n keccak256(\\n abi.encode(\\n TYPE_HASH,\\n _proposal.nonce,\\n _proposal.chainId,\\n _proposal.expiryTimestamp,\\n _targetsHash,\\n _valuesHash,\\n _calldatasHash,\\n _gasAmountsHash\\n )\\n );\\n }\\n\\n /**\\n * @dev Returns whether the proposal is executable for the current chain.\\n *\\n * @notice Does not check whether the call result is successful or not. Please use `execute` instead.\\n *\\n */\\n function executable(ProposalDetail memory _proposal) internal view returns (bool _result) {\\n return _proposal.chainId == 0 || _proposal.chainId == block.chainid;\\n }\\n\\n /**\\n * @dev Executes the proposal.\\n */\\n function execute(ProposalDetail memory _proposal)\\n internal\\n returns (bool[] memory _successCalls, bytes[] memory _returnDatas)\\n {\\n require(executable(_proposal), \\\"Proposal: query for invalid chainId\\\");\\n _successCalls = new bool[](_proposal.targets.length);\\n _returnDatas = new bytes[](_proposal.targets.length);\\n for (uint256 _i = 0; _i < _proposal.targets.length; ++_i) {\\n require(gasleft() > _proposal.gasAmounts[_i], \\\"Proposal: insufficient gas\\\");\\n\\n (_successCalls[_i], _returnDatas[_i]) = _proposal.targets[_i].call{\\n value: _proposal.values[_i],\\n gas: _proposal.gasAmounts[_i]\\n }(_proposal.calldatas[_i]);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x96bf9eaea9a87a5eceed026a6eaedc74cf5dde6760f7e969d5b5974dad43ff80\",\"license\":\"MIT\"},\"contracts/ronin/RoninGovernanceAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../extensions/isolated-governance/bridge-operator-governance/BOsGovernanceProposal.sol\\\";\\nimport \\\"../extensions/sequential-governance/GovernanceProposal.sol\\\";\\nimport \\\"../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../extensions/GovernanceAdmin.sol\\\";\\nimport \\\"../libraries/EmergencyExitBallot.sol\\\";\\nimport \\\"../interfaces/IRoninGovernanceAdmin.sol\\\";\\n\\ncontract RoninGovernanceAdmin is\\n IRoninGovernanceAdmin,\\n GovernanceAdmin,\\n GovernanceProposal,\\n BOsGovernanceProposal,\\n HasValidatorContract\\n{\\n using Proposal for Proposal.ProposalDetail;\\n\\n /// @dev Mapping from request hash => emergency poll\\n mapping(bytes32 => IsolatedVote) internal _emergencyExitPoll;\\n\\n modifier onlyGovernor() {\\n require(_getWeight(msg.sender) > 0, \\\"RoninGovernanceAdmin: sender is not governor\\\");\\n _;\\n }\\n\\n constructor(\\n uint256 _roninChainId,\\n address _roninTrustedOrganizationContract,\\n address _bridgeContract,\\n address _validatorContract,\\n uint256 _proposalExpiryDuration\\n ) GovernanceAdmin(_roninChainId, _roninTrustedOrganizationContract, _bridgeContract, _proposalExpiryDuration) {\\n _setValidatorContract(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external override onlySelfCall {\\n require(_addr.code.length > 0, \\\"RoninGovernanceAdmin: set to non-contract\\\");\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Returns the voted signatures for the proposals.\\n *\\n * Note: The signatures can be empty in case the proposal is voted on the current network.\\n *\\n */\\n function getProposalSignatures(uint256 _chainId, uint256 _round)\\n external\\n view\\n returns (\\n address[] memory _voters,\\n Ballot.VoteType[] memory _supports,\\n Signature[] memory _signatures\\n )\\n {\\n ProposalVote storage _vote = vote[_chainId][_round];\\n\\n uint256 _forLength = _vote.forVoteds.length;\\n uint256 _againstLength = _vote.againstVoteds.length;\\n uint256 _voterLength = _forLength + _againstLength;\\n\\n _supports = new Ballot.VoteType[](_voterLength);\\n _signatures = new Signature[](_voterLength);\\n _voters = new address[](_voterLength);\\n for (uint256 _i; _i < _forLength; _i++) {\\n _supports[_i] = Ballot.VoteType.For;\\n _signatures[_i] = vote[_chainId][_round].sig[_vote.forVoteds[_i]];\\n _voters[_i] = _vote.forVoteds[_i];\\n }\\n for (uint256 _i; _i < _againstLength; _i++) {\\n _supports[_i + _forLength] = Ballot.VoteType.Against;\\n _signatures[_i + _forLength] = vote[_chainId][_round].sig[_vote.againstVoteds[_i]];\\n _voters[_i + _forLength] = _vote.againstVoteds[_i];\\n }\\n }\\n\\n /**\\n * @dev Returns the voted signatures for bridge operators at a specific period.\\n *\\n * Note: Does not verify whether the voter casted vote for the proposal and the returned signature can be empty.\\n * Please consider filtering for empty signatures after calling this function.\\n *\\n */\\n function getBridgeOperatorVotingSignatures(uint256 _period, uint256 _epoch)\\n external\\n view\\n returns (address[] memory _voters, Signature[] memory _signatures)\\n {\\n VotingSignature storage _info = _bridgeVoterSig[_period][_epoch];\\n _voters = _info.voters;\\n _signatures = new Signature[](_voters.length);\\n for (uint _i; _i < _voters.length; _i++) {\\n _signatures[_i] = _info.signatureOf[_voters[_i]];\\n }\\n }\\n\\n /**\\n * @dev Returns whether the voter `_voter` casted vote for the proposal.\\n */\\n function proposalVoted(\\n uint256 _chainId,\\n uint256 _round,\\n address _voter\\n ) external view returns (bool) {\\n return _voted(vote[_chainId][_round], _voter);\\n }\\n\\n /**\\n * @dev Returns whether the voter `_voter` casted vote for bridge operators at a specific period.\\n */\\n function bridgeOperatorsVoted(\\n uint256 _period,\\n uint256 _epoch,\\n address _voter\\n ) external view returns (bool) {\\n return _voted(_vote[_period][_epoch], _voter);\\n }\\n\\n /**\\n * @dev Returns whether the voter casted vote for emergency exit poll.\\n */\\n function emergencyPollVoted(bytes32 _voteHash, address _voter) external view returns (bool) {\\n return _voted(_emergencyExitPoll[_voteHash], _voter);\\n }\\n\\n /**\\n * @dev See `CoreGovernance-_proposeProposal`.\\n *\\n * Requirements:\\n * - The method caller is governor.\\n *\\n */\\n function propose(\\n uint256 _chainId,\\n uint256 _expiryTimestamp,\\n address[] calldata _targets,\\n uint256[] calldata _values,\\n bytes[] calldata _calldatas,\\n uint256[] calldata _gasAmounts\\n ) external onlyGovernor {\\n _proposeProposal(_chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts, msg.sender);\\n }\\n\\n /**\\n * @dev See `GovernanceProposal-_proposeProposalStructAndCastVotes`.\\n *\\n * Requirements:\\n * - The method caller is governor.\\n * - The proposal is for the current network.\\n *\\n */\\n function proposeProposalStructAndCastVotes(\\n Proposal.ProposalDetail calldata _proposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures\\n ) external onlyGovernor {\\n _proposeProposalStructAndCastVotes(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender);\\n }\\n\\n /**\\n * @dev Proposes and casts vote for a proposal on the current network.\\n *\\n * Requirements:\\n * - The method caller is governor.\\n * - The proposal is for the current network.\\n *\\n */\\n function proposeProposalForCurrentNetwork(\\n uint256 _expiryTimestamp,\\n address[] calldata _targets,\\n uint256[] calldata _values,\\n bytes[] calldata _calldatas,\\n uint256[] calldata _gasAmounts,\\n Ballot.VoteType _support\\n ) external onlyGovernor {\\n address _voter = msg.sender;\\n Proposal.ProposalDetail memory _proposal = _proposeProposal(\\n block.chainid,\\n _expiryTimestamp,\\n _targets,\\n _values,\\n _calldatas,\\n _gasAmounts,\\n _voter\\n );\\n _castProposalVoteForCurrentNetwork(_voter, _proposal, _support);\\n }\\n\\n /**\\n * @dev Casts vote for a proposal on the current network.\\n *\\n * Requirements:\\n * - The method caller is governor.\\n *\\n */\\n function castProposalVoteForCurrentNetwork(Proposal.ProposalDetail calldata _proposal, Ballot.VoteType _support)\\n external\\n onlyGovernor\\n {\\n _castProposalVoteForCurrentNetwork(msg.sender, _proposal, _support);\\n }\\n\\n /**\\n * @dev See `GovernanceProposal-_castProposalBySignatures`.\\n */\\n function castProposalBySignatures(\\n Proposal.ProposalDetail calldata _proposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures\\n ) external {\\n _castProposalBySignatures(_proposal, _supports, _signatures, DOMAIN_SEPARATOR);\\n }\\n\\n /**\\n * @dev See `CoreGovernance-_proposeGlobal`.\\n *\\n * Requirements:\\n * - The method caller is governor.\\n *\\n */\\n function proposeGlobal(\\n uint256 _expiryTimestamp,\\n GlobalProposal.TargetOption[] calldata _targetOptions,\\n uint256[] calldata _values,\\n bytes[] calldata _calldatas,\\n uint256[] calldata _gasAmounts\\n ) external onlyGovernor {\\n _proposeGlobal(\\n _expiryTimestamp,\\n _targetOptions,\\n _values,\\n _calldatas,\\n _gasAmounts,\\n roninTrustedOrganizationContract(),\\n bridgeContract(),\\n msg.sender\\n );\\n }\\n\\n /**\\n * @dev See `GovernanceProposal-_proposeGlobalProposalStructAndCastVotes`.\\n *\\n * Requirements:\\n * - The method caller is governor.\\n *\\n */\\n function proposeGlobalProposalStructAndCastVotes(\\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures\\n ) external onlyGovernor {\\n _proposeGlobalProposalStructAndCastVotes(\\n _globalProposal,\\n _supports,\\n _signatures,\\n DOMAIN_SEPARATOR,\\n roninTrustedOrganizationContract(),\\n bridgeContract(),\\n msg.sender\\n );\\n }\\n\\n /**\\n * @dev See `GovernanceProposal-_castGlobalProposalBySignatures`.\\n */\\n function castGlobalProposalBySignatures(\\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures\\n ) external {\\n _castGlobalProposalBySignatures(\\n _globalProposal,\\n _supports,\\n _signatures,\\n DOMAIN_SEPARATOR,\\n roninTrustedOrganizationContract(),\\n bridgeContract()\\n );\\n }\\n\\n /**\\n * @dev Deletes the expired proposal by its chainId and nonce, without creating a new proposal.\\n *\\n * Requirements:\\n * - The proposal is already created.\\n *\\n */\\n function deleteExpired(uint256 _chainId, uint256 _round) external {\\n ProposalVote storage _vote = vote[_chainId][_round];\\n require(_vote.hash != bytes32(0), \\\"RoninGovernanceAdmin: query for empty voting\\\");\\n _tryDeleteExpiredVotingRound(_vote);\\n }\\n\\n /**\\n * @dev See `BOsGovernanceProposal-_castVotesBySignatures`.\\n */\\n function voteBridgeOperatorsBySignatures(\\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\\n Signature[] calldata _signatures\\n ) external {\\n _castVotesBySignatures(_ballot, _signatures, _getMinimumVoteWeight(), DOMAIN_SEPARATOR);\\n IsolatedVote storage _v = _vote[_ballot.period][_ballot.epoch];\\n if (_v.status == VoteStatus.Approved) {\\n _lastSyncedBridgeOperatorSetInfo = _ballot;\\n emit BridgeOperatorsApproved(_ballot.period, _ballot.epoch, _ballot.operators);\\n _v.status = VoteStatus.Executed;\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninGovernanceAdmin\\n */\\n function createEmergencyExitPoll(\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) external onlyValidatorContract {\\n bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\\n IsolatedVote storage _v = _emergencyExitPoll[_hash];\\n _v.createdAt = block.timestamp;\\n _v.expiredAt = _expiredAt;\\n emit EmergencyExitPollCreated(_hash, _consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\\n }\\n\\n /**\\n * @dev Votes for an emergency exit. Executes to unlock fund for the emergency exit's requester.\\n *\\n * Requirements:\\n * - The voter is governor.\\n * - The voting is existent.\\n * - The voting is not expired yet.\\n *\\n */\\n function voteEmergencyExit(\\n bytes32 _voteHash,\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) external {\\n address _voter = msg.sender;\\n uint256 _weight = _getWeight(_voter);\\n require(_weight > 0, \\\"RoninGovernanceAdmin: sender is not governor\\\");\\n\\n bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\\n require(_voteHash == _hash, \\\"RoninGovernanceAdmin: invalid vote hash\\\");\\n\\n IsolatedVote storage _v = _emergencyExitPoll[_hash];\\n require(_v.createdAt > 0, \\\"RoninGovernanceAdmin: query for non-existent vote\\\");\\n require(_v.status != VoteStatus.Expired, \\\"RoninGovernanceAdmin: query for expired vote\\\");\\n\\n VoteStatus _stt = _castVote(_v, _voter, _weight, _getMinimumVoteWeight(), _hash);\\n if (_stt == VoteStatus.Approved) {\\n _execReleaseLockedFundForEmergencyExitRequest(_consensusAddr, _recipientAfterUnlockedFund);\\n emit EmergencyExitPollApproved(_hash);\\n _v.status = VoteStatus.Executed;\\n } else if (_stt == VoteStatus.Expired) {\\n emit EmergencyExitPollExpired(_hash);\\n }\\n }\\n\\n /**\\n * @inheritdoc GovernanceProposal\\n */\\n function _getWeight(address _governor) internal view virtual override returns (uint256) {\\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\\n abi.encodeWithSelector(\\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\\n 0x4bb5274a,\\n abi.encodeWithSelector(IRoninTrustedOrganization.getGovernorWeight.selector, _governor)\\n )\\n );\\n require(_success, \\\"GovernanceAdmin: proxy call `getGovernorWeight(address)` failed\\\");\\n return abi.decode(_returndata, (uint256));\\n }\\n\\n /**\\n * @inheritdoc BOsGovernanceProposal\\n */\\n function _getBridgeVoterWeight(address _governor) internal view virtual override returns (uint256) {\\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\\n abi.encodeWithSelector(\\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\\n 0x4bb5274a,\\n abi.encodeWithSelector(IRoninTrustedOrganization.getBridgeVoterWeight.selector, _governor)\\n )\\n );\\n require(_success, \\\"GovernanceAdmin: proxy call `getBridgeVoterWeight(address)` failed\\\");\\n return abi.decode(_returndata, (uint256));\\n }\\n\\n /**\\n * @dev Trigger function from validator contract to unlock fund for emeregency exit request.\\n */\\n function _execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address _recipientAfterUnlockedFund)\\n internal\\n virtual\\n {\\n (bool _success, ) = validatorContract().call(\\n abi.encodeWithSelector(\\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\\n 0x4bb5274a,\\n abi.encodeWithSelector(\\n _validatorContract.execReleaseLockedFundForEmergencyExitRequest.selector,\\n _consensusAddr,\\n _recipientAfterUnlockedFund\\n )\\n )\\n );\\n require(\\n _success,\\n \\\"GovernanceAdmin: proxy call `execReleaseLockedFundForEmergencyExitRequest(address,address)` failed\\\"\\n );\\n }\\n\\n /**\\n * @dev See `CoreGovernance-_getChainType`.\\n */\\n function _getChainType() internal pure override returns (ChainType) {\\n return ChainType.RoninChain;\\n }\\n\\n /**\\n * @dev See `castProposalVoteForCurrentNetwork`.\\n */\\n function _castProposalVoteForCurrentNetwork(\\n address _voter,\\n Proposal.ProposalDetail memory _proposal,\\n Ballot.VoteType _support\\n ) internal {\\n require(_proposal.chainId == block.chainid, \\\"RoninGovernanceAdmin: invalid chain id\\\");\\n require(\\n vote[_proposal.chainId][_proposal.nonce].hash == _proposal.hash(),\\n \\\"RoninGovernanceAdmin: cast vote for invalid proposal\\\"\\n );\\n\\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\\n Signature memory _emptySignature;\\n _castVote(\\n _proposal,\\n _support,\\n _minimumForVoteWeight,\\n _minimumAgainstVoteWeight,\\n _voter,\\n _emptySignature,\\n _getWeight(_voter)\\n );\\n }\\n}\\n\",\"keccak256\":\"0x50453e9c86e2c323eee5050eb2de664e73ad3f27ae8a576a77683568b1ff5cbb\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b5060405162005fce38038062005fce833981016040819052620000349162000280565b84848483806200004381600255565b506005849055604080516020808201839052601660608301527f524f4e494e5f474f5645524e414e43455f41444d494e000000000000000000006080808401919091528284018890528351808403909101815260a0830184528051908201207f599a80fcaa47b95e2323ab4d34d34e0cc9feda4b843edafcc30c7bdf60ea15bf60c08401527f7e7935007966eb860f4a2ee3dcc9fd53fb3205ce2aa86b0126d4893d4d4c14b960e08401527fad7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a561010084015261012080840191909152835180840390910181526101409092019092528051910120600655620001458362000170565b6200015082620001c5565b5050505062000165826200021460201b60201c565b5050505050620002de565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d7906020015b60405180910390a150565b600480546001600160a01b0319166001600160a01b0383169081179091556040519081527f5cbd8a0bb00196365d5eb3457c6734e7f06666c3c78e5469b4c9deec7edae04890602001620001ba565b600d80546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990602001620001ba565b80516001600160a01b03811681146200027b57600080fd5b919050565b600080600080600060a086880312156200029957600080fd5b85519450620002ab6020870162000263565b9350620002bb6040870162000263565b9250620002cb6060870162000263565b9150608086015190509295509295909350565b615ce080620002ee6000396000f3fe608060405234801561001057600080fd5b50600436106101955760003560e01c80624054b81461019a57806309fcd8c7146101af5780630b26cf66146101c25780630b881830146101d557806317ce2dd4146101e85780631c905e39146102045780631e23e04814610226578063204e1c7a146102475780632b5df351146102675780632c5e65201461028a5780632e96a6fb1461029d5780632faf925d146102b057806334d5f37b146102c35780633644e515146102e35780635511cde1146102ec57806360911e8e146102f457806362e52e5f14610307578063663ac0111461031c5780637eff275e1461032f578063988ef53c14610342578063994390891461036b5780639a7d3382146103735780639e0dc0b314610386578063a1819f9a14610399578063a2fae570146103ac578063a8a0e32c146103bf578063b384abef146103d2578063b5e337de1461042d578063bc96180b14610440578063cd59658314610448578063cdf64a7614610450578063dcc3eb1914610463578063f3b7dead14610476578063fb4f637114610489575b600080fd5b6101ad6101a83660046146c0565b61049c565b005b6101ad6101bd366004614754565b6104e5565b6101ad6101d0366004614838565b6105a9565b6101ad6101e33660046146c0565b6105fe565b6101f160055481565b6040519081526020015b60405180910390f35b610217610212366004614855565b61060e565b6040516101fb9392919061492a565b610239610234366004614855565b6109f9565b6040516101fb92919061499d565b61025a610255366004614838565b610b6e565b6040516101fb91906149c2565b61027a6102753660046149d6565b610c60565b60405190151581526020016101fb565b61027a6102983660046149d6565b610c83565b6101ad6102ab366004614a0f565b610ca6565b6101ad6102be366004614a28565b610cce565b6101f16102d1366004614a0f565b60006020819052908152604090205481565b6101f160065481565b61025a610cee565b6101ad610302366004614a81565b610cfd565b61030f610dbd565b6040516101fb9190614af1565b6101ad61032a366004614b38565b610e5f565b6101ad61033d366004614c15565b610f6b565b6101f1610350366004614838565b6001600160a01b03166000908152600b602052604090205490565b61025a61109f565b6101ad610381366004614855565b6110ae565b6101ad610394366004614c4e565b611124565b6101ad6103a7366004614ca0565b611367565b6101ad6103ba366004614d79565b61144d565b6101ad6103cd366004614dbf565b6114f3565b61041c6103e0366004614855565b600160208181526000938452604080852090915291835291208054918101546002820154600383015460069093015460ff909416939192909185565b6040516101fb959493929190614e05565b6101ad61043b366004614838565b611532565b6101f1611584565b61025a611594565b6101ad61045e366004614838565b6115a3565b61027a610471366004614e3a565b611637565b61025a610484366004614838565b611658565b6101ad610497366004614a28565b611725565b60006104a733611776565b116104cd5760405162461bcd60e51b81526004016104c490614e5f565b60405180910390fd5b6104de8585858585600654336118de565b5050505050565b60006104f033611776565b1161050d5760405162461bcd60e51b81526004016104c490614e5f565b61059e89898989898080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061055392508a91508b905061502e565b8787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506105909250610cee915050565b610598611594565b33611948565b505050505050505050565b3330146105c85760405162461bcd60e51b81526004016104c49061503b565b6000816001600160a01b03163b116105f25760405162461bcd60e51b81526004016104c490615082565b6105fb81611a57565b50565b6104de8585858585600654611aad565b6000828152600160209081526040808320848452909152812060048101546005820154606093849384939092909161064682846150dc565b9050806001600160401b0381111561066057610660614eab565b604051908082528060200260200182016040528015610689578160200160208202803683370190505b509550806001600160401b038111156106a4576106a4614eab565b6040519080825280602002602001820160405280156106dd57816020015b6106ca61458a565b8152602001906001900390816106c25790505b509450806001600160401b038111156106f8576106f8614eab565b604051908082528060200260200182016040528015610721578160200160208202803683370190505b50965060005b83811015610880576000878281518110610743576107436150ef565b6020026020010190600181111561075c5761075c6148bb565b9081600181111561076f5761076f6148bb565b90525060008a81526001602090815260408083208c8452909152812060048701805460079092019291849081106107a8576107a86150ef565b60009182526020808320909101546001600160a01b0316835282810193909352604091820190208151606081018352815460ff16815260018201549381019390935260020154908201528651879083908110610806576108066150ef565b6020026020010181905250846004018181548110610826576108266150ef565b9060005260206000200160009054906101000a90046001600160a01b0316888281518110610856576108566150ef565b6001600160a01b03909216602092830291909101909101528061087881615105565b915050610727565b5060005b828110156109ed5760018761089986846150dc565b815181106108a9576108a96150ef565b602002602001019060018111156108c2576108c26148bb565b908160018111156108d5576108d56148bb565b90525060008a81526001602090815260408083208c84529091528120600587018054600790920192918490811061090e5761090e6150ef565b60009182526020808320909101546001600160a01b0316835282810193909352604091820190208151606081018352815460ff16815260018201549381019390935260020154908201528661096386846150dc565b81518110610973576109736150ef565b6020026020010181905250846005018181548110610993576109936150ef565b6000918252602090912001546001600160a01b0316886109b386846150dc565b815181106109c3576109c36150ef565b6001600160a01b0390921660209283029190910190910152806109e581615105565b915050610884565b50505050509250925092565b6000828152600c60209081526040808320848452825291829020600181018054845181850281018501909552808552606094859490929190830182828015610a6a57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610a4c575b5050505050925082516001600160401b03811115610a8a57610a8a614eab565b604051908082528060200260200182016040528015610ac357816020015b610ab061458a565b815260200190600190039081610aa85790505b50915060005b8351811015610b6557816000016000858381518110610aea57610aea6150ef565b6020908102919091018101516001600160a01b031682528181019290925260409081016000208151606081018352815460ff16815260018201549381019390935260020154908201528351849083908110610b4757610b476150ef565b60200260200101819052508080610b5d90615105565b915050610ac9565b50509250929050565b6000806000836001600160a01b0316604051610b9490635c60da1b60e01b815260040190565b600060405180830381855afa9150503d8060008114610bcf576040519150601f19603f3d011682016040523d82523d6000602084013e610bd4565b606091505b509150915081610c445760405162461bcd60e51b815260206004820152603560248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c2060696d706044820152741b195b595b9d185d1a5bdb8a0a580819985a5b1959605a1b60648201526084016104c4565b80806020019051810190610c58919061511e565b949350505050565b6000838152600a602090815260408083208584529091528120610c589083611b34565b60008381526001602090815260408083208584529091528120610c589083611b55565b333014610cc55760405162461bcd60e51b81526004016104c49061503b565b6105fb81600255565b6104de8585858585600654610ce1610cee565b610ce9611594565b611b77565b6003546001600160a01b031690565b610d13838383610d0b611c19565b600654611d76565b82356000908152600a6020908152604080832082870135845290915290206001815460ff166004811115610d4957610d496148bb565b03610db757836007610d5b82826151a8565b507f7c45875370690698791a915954b9c69729cc5f9373edc5a2e04436c07589f30d905084356020860135610d93604088018861513b565b604051610da39493929190615276565b60405180910390a1805460ff191660021781555b50505050565b610de160405180606001604052806000815260200160008152602001606081525090565b60408051606081018252600780548252600854602080840191909152600980548551818402810184018752818152949593949386019392830182828015610e5157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610e33575b505050505081525050905090565b6000610e6a33611776565b11610e875760405162461bcd60e51b81526004016104c490614e5f565b60003390506000610f50468d8d8d80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508c8c80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610f1592508d91508e905061502e565b8a8a808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b9250612083915050565b9050610f5d82828561216b565b505050505050505050505050565b333014610f8a5760405162461bcd60e51b81526004016104c49061503b565b6000826001600160a01b0316638f28397083604051602401610fac91906149c2565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051610fe591906152f9565b6000604051808303816000865af19150503d8060008114611022576040519150601f19603f3d011682016040523d82523d6000602084013e611027565b606091505b505090508061109a5760405162461bcd60e51b815260206004820152603960248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c20606368616044820152781b99d950591b5a5b8a1859191c995cdcca580819985a5b1959603a1b60648201526084016104c4565b505050565b600d546001600160a01b031690565b60008281526001602081815260408084208585529091529091209081015461111b5760405162461bcd60e51b815260206004820152602c6024820152600080516020615c0b83398151915260448201526b656d70747920766f74696e6760a01b60648201526084016104c4565b610db7816122ae565b33600061113082611776565b9050600081116111525760405162461bcd60e51b81526004016104c490614e5f565b6000611160878787876124d0565b90508088146111c15760405162461bcd60e51b815260206004820152602760248201527f526f6e696e476f7665726e616e636541646d696e3a20696e76616c696420766f6044820152660e8ca40d0c2e6d60cb1b60648201526084016104c4565b6000818152600e6020526040902060058101546112285760405162461bcd60e51b81526020600482015260316024820152600080516020615c0b8339815191526044820152706e6f6e2d6578697374656e7420766f746560781b60648201526084016104c4565b6004815460ff166004811115611240576112406148bb565b036112905760405162461bcd60e51b815260206004820152602c6024820152600080516020615c0b83398151915260448201526b6578706972656420766f746560a01b60648201526084016104c4565b60006112a68286866112a0611c19565b8761252c565b905060018160048111156112bc576112bc6148bb565b0361130e576112cb898961264a565b6040518381527fd3500576a0d4923326fbb893cf2169273e0df93f3cb6b94b83f2ca2e0ecb681b9060200160405180910390a1815460ff1916600217825561135b565b6004816004811115611322576113226148bb565b0361135b576040518381527feecb3148acc573548e89cb64eb5f2023a61171f1c413ed8bf0fe506c19aeebe49060200160405180910390a15b50505050505050505050565b600061137233611776565b1161138f5760405162461bcd60e51b81526004016104c490614e5f565b6114408a8a8a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808e0282810182019093528d82529093508d92508c91829185019084908082843760009201919091525061140592508a91508b905061502e565b878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250339250612083915050565b5050505050505050505050565b3361145661109f565b6001600160a01b03161461147d57604051630e6444a160e31b815260040160405180910390fd5b600061148b858585856124d0565b6000818152600e602052604090819020426005820155600481018590559051919250907f18ea835340bb2973a31996158138f109e9c5b9cfdb2424e999e6b1a9ce565de8906114e39084908990899089908990615315565b60405180910390a1505050505050565b60006114fe33611776565b1161151b5760405162461bcd60e51b81526004016104c490614e5f565b61152e336115288461542e565b8361216b565b5050565b3330146115515760405162461bcd60e51b81526004016104c49061503b565b6000816001600160a01b03163b1161157b5760405162461bcd60e51b81526004016104c490615082565b6105fb816127dc565b600061158f60025490565b905090565b6004546001600160a01b031690565b3330146115c25760405162461bcd60e51b81526004016104c49061503b565b6000816001600160a01b03163b1161162e5760405162461bcd60e51b815260206004820152602960248201527f526f6e696e476f7665726e616e636541646d696e3a2073657420746f206e6f6e6044820152680b58dbdb9d1c9858dd60ba1b60648201526084016104c4565b6105fb81612827565b6000828152600e6020526040812061164f9083611b34565b90505b92915050565b6000806000836001600160a01b031660405161167e906303e1469160e61b815260040190565b600060405180830381855afa9150503d80600081146116b9576040519150601f19603f3d011682016040523d82523d6000602084013e6116be565b606091505b509150915081610c445760405162461bcd60e51b815260206004820152602c60248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c206061646d60448201526b1a5b8a0a580819985a5b195960a21b60648201526084016104c4565b600061173033611776565b1161174d5760405162461bcd60e51b81526004016104c490614e5f565b61176e8585858585600654611760610cee565b611768611594565b33612872565b505050505050565b6000806000611783610cee565b6001600160a01b0316634bb5274a63d78392f860e01b866040516024016117aa91906149c2565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516117eb919060240161552e565b6040516020818303038152906040529060e01b6020820180516001600160e01b03838183161783525050505060405161182491906152f9565b600060405180830381855afa9150503d806000811461185f576040519150601f19603f3d011682016040523d82523d6000602084013e611864565b606091505b5091509150816118ca5760405162461bcd60e51b815260206004820152603f6024820152600080516020615c4b83398151915260448201527f476f7665726e6f7257656967687428616464726573732960206661696c65640060648201526084016104c4565b80806020019051810190610c589190615541565b6118f06118ea8861542e565b826128d4565b5060006119046118ff8961542e565b61299e565b905061193e6119128961542e565b8888888861192a89611925896000612b3d565b612b93565b6119398a6119258a6001612b3d565b612bba565b5050505050505050565b60006119546000612ef3565b905060006040518060c001604052808381526020018c81526020018b8b808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505050602082018b9052604082018a905260609091018890529091506119c8828787612ff6565b90506119df600254826131c490919063ffffffff16565b60006119ea8261299e565b6000858152600080516020615beb83398151915260205260409020909150611a1390828f6132c0565b8084600080516020615c8b83398151915284611a2e876132d0565b878a604051611a409493929190615662565b60405180910390a350505050505050505050505050565b600480546001600160a01b0319166001600160a01b0383161790556040517f5cbd8a0bb00196365d5eb3457c6734e7f06666c3c78e5469b4c9deec7edae04890611aa29083906149c2565b60405180910390a150565b6000611abb6118ff8861542e565b6020808901356000908152600180835260408083208c35845290935291902001549091508114611afd5760405162461bcd60e51b81526004016104c490615749565b611b2b611b098861542e565b87878787611b1c88611925896000612b3d565b611939896119258a6001612b3d565b50505050505050565b6001600160a01b031660009081526002919091016020526040902054151590565b6001600160a01b03166000908152600891909101602052604090205460ff1690565b6000611b8e8383611b878c6157fc565b9190612ff6565b90506000611ba3611b9e8b6157fc565b6132d0565b9050611bae8261299e565b60008080526001602081815285518352600080516020615beb83398151915290526040909120015414611bf35760405162461bcd60e51b81526004016104c490615749565b61135b828a8a8a8a611c0a8b611925896000612b3d565b6119398c6119258a6001612b3d565b6000806000611c26610cee565b6040805160048152602480820183526020820180516001600160e01b0316637de5dedd60e01b17905291516001600160a01b039390931692634bb5274a92611c6f92910161552e565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051611ca891906152f9565b600060405180830381855afa9150503d8060008114611ce3576040519150601f19603f3d011682016040523d82523d6000602084013e611ce8565b606091505b509150915081611d5b5760405162461bcd60e51b815260206004820152603860248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c20606d696e6044820152771a5b5d5b559bdd1955d95a59da1d0a0a580819985a5b195960421b60648201526084016104c4565b80806020019051810190611d6f9190615541565b9250505090565b600754853510801590611d8f5750600854602086013510155b611e015760405162461bcd60e51b815260206004820152603d60248201527f424f73476f7665726e616e636550726f706f73616c3a20717565727920666f7260448201527f206f7574646174656420627269646765206f70657261746f722073657400000060648201526084016104c4565b611e0a8561342a565b82611e6b5760405162461bcd60e51b815260206004820152602b60248201527f424f73476f7665726e616e636550726f706f73616c3a20696e76616c6964206160448201526a0e4e4c2f240d8cadccee8d60ab1b60648201526084016104c4565b6000806000611e79886135e5565b90506000611e878583612b93565b89356000818152600a60209081526040808320828f0135808552908352818420948452600c83528184209084529091528120929350909190805b8a81101561203557368c8c83818110611edc57611edc6150ef565b606002919091019150611f07905086611ef860208401846158d5565b83602001358460400135613697565b9850886001600160a01b0316886001600160a01b031610611f6c5760405162461bcd60e51b815260206004820152602b6024820152600080516020615c6b83398151915260448201526a34b3b732b91037b93232b960a91b60648201526084016104c4565b889750506000611f7b896136bf565b90508015612022576001600160a01b0389166000908152600b60205260409020439055600192508c8c83818110611fb457611fb46150ef565b6001600160a01b038c166000908152602088905260409020606090910292909201919050611fe282826158f2565b50506001848101805491820181556000908152602090200180546001600160a01b0319166001600160a01b038b16179055612020858a838e8b61252c565b505b508061202d81615105565b915050611ec1565b5080610f5d5760405162461bcd60e51b81526020600482015260296024820152600080516020615c6b83398151915260448201526869676e61747572657360b81b60648201526084016104c4565b61208b6145aa565b876000036120ab5760405162461bcd60e51b81526004016104c490615923565b60006120b689612ef3565b90506040518060e001604052808281526020018a8152602001898152602001888152602001878152602001868152602001858152509150612102600254836131c490919063ffffffff16565b600061210d8361299e565b60008b8152600160209081526040808320868452909152902090915061213490828b6132c0565b80828b600080516020615c2b8339815191528688604051612156929190615958565b60405180910390a45050979650505050505050565b468260200151146121cd5760405162461bcd60e51b815260206004820152602660248201527f526f6e696e476f7665726e616e636541646d696e3a20696e76616c6964206368604482015265185a5b881a5960d21b60648201526084016104c4565b6121d68261299e565b602080840151600090815260018083526040808320875184529093529190200154146122615760405162461bcd60e51b815260206004820152603460248201527f526f6e696e476f7665726e616e636541646d696e3a206361737420766f746520604482015273199bdc881a5b9d985b1a59081c1c9bdc1bdcd85b60621b60648201526084016104c4565b600061226b611c19565b905060008161227861381e565b6122829190615982565b61228d9060016150dc565b905061229761458a565b611b2b858585858a866122a98d611776565b61395b565b600080825460ff1660048111156122c7576122c76148bb565b1480156122d8575042826006015411155b905080156124cb5760018201546040517f58f98006a7f2f253f8ae8f8b7cec9008ca05359633561cd7c22f3005682d4a5590600090a260005b60048301548110156123ca57826008016000846004018381548110612338576123386150ef565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff191690556004840180546007860192919084908110612381576123816150ef565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff191681556001810182905560020155806123c281615105565b915050612311565b5060005b6005830154811015612487578260080160008460050183815481106123f5576123f56150ef565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff19169055600584018054600786019291908490811061243e5761243e6150ef565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff1916815560018101829055600201558061247f81615105565b9150506123ce565b50815460ff1916825560006001830181905560028301819055600383018190556124b59060048401906145e7565b6124c36005830160006145e7565b600060068301555b919050565b60405160009061250c907f697acba4deaf1a718d8c2d93e42860488cb7812696f28ca10eed17bac41e7027908790879087908790602001615315565b604051602081830303815290604052805190602001209050949350505050565b6000808660040154118015612545575042866004015411155b1561255d5750845460ff191660049081178655612641565b6125678686611b34565b156125b657612580856001600160a01b03166014613d62565b6040516020016125909190615995565b60408051601f198184030181529082905262461bcd60e51b82526104c49160040161552e565b6001600160a01b03851660009081526002870160209081526040808320859055848352600389019091528120805486919083906125f49084906150dc565b925050819055905083811015801561262157506000875460ff16600481111561261f5761261f6148bb565b145b1561263957865460ff19166001908117885587018390555b5050845460ff165b95945050505050565b600061265461109f565b604080516001600160a01b0386811660248084019190915286821660448085019190915284518085039091018152606490930184526020830180516001600160e01b03166361e45aeb60e11b1790529251931692634bb5274a926126b992910161552e565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516126f291906152f9565b6000604051808303816000865af19150503d806000811461272f576040519150601f19603f3d011682016040523d82523d6000602084013e612734565b606091505b505090508061109a5760405162461bcd60e51b815260206004820152606260248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c206065786560448201527f6352656c656173654c6f636b656446756e64466f72456d657267656e6379457860648201527f69745265717565737428616464726573732c616464726573732960206661696c608482015261195960f21b60a482015260c4016104c4565b600380546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d790611aa29083906149c2565b600d80546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990611aa29083906149c2565b61287a6145aa565b61288e6128868b6157fc565b858585613efd565b9050600061289e611b9e8c6157fc565b90506128c6828b8b8b8b6128b78c611925896000612b3d565b6119398d6119258a6001612b3d565b509998505050505050505050565b60208201516000908082036128fb5760405162461bcd60e51b81526004016104c490615923565b6002546129099085906131c4565b60006129148561299e565b905061291f82612ef3565b6000838152600160209081526040808320848452909152908190209087015191945061294c9183906132c0565b8451831461296c5760405162461bcd60e51b81526004016104c4906159e9565b808383600080516020615c2b833981519152888860405161298e929190615958565b60405180910390a4505092915050565b6000806000806000808660800151905060008760600151905060008860a00151516001600160401b038111156129d6576129d6614eab565b6040519080825280602002602001820160405280156129ff578160200160208202803683370190505b5060c08a015190915060005b8251811015612a68578a60a001518181518110612a2a57612a2a6150ef565b602002602001015180519060200120838281518110612a4b57612a4b6150ef565b602090810291909101015280612a6081615105565b915050612a0b565b506020835102602084012097506020845102602085012096506020825102602083012095506020815102602082012094507fd051578048e6ff0bbc9fca3b65a42088dbde10f36ca841de566711087ad9b08a60001b8a600001518b602001518c604001518b8b8b8b604051602001612b18989796959493929190978852602088019690965260408701949094526060860192909252608085015260a084015260c083015260e08201526101000190565b6040516020818303038152906040528051906020012098505050505050505050919050565b604051600090612b75907fd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c29085908590602001615a2f565b60405160208183030381529060405280519060200120905092915050565b60405161190160f01b60208201526022810183905260428101829052600090606201612b75565b8415801590612bc857508483145b612c255760405162461bcd60e51b815260206004820152602860248201527f476f7665726e616e636550726f706f73616c3a20696e76616c696420617272616044820152670f240d8cadccee8d60c31b60648201526084016104c4565b6000612c2f611c19565b9050600081612c3c61381e565b612c469190615982565b612c519060016150dc565b9050600080366000805b89811015612e87578a8a82818110612c7557612c756150ef565b606002919091019350600090508d8d83818110612c9457612c946150ef565b9050602002016020810190612ca99190615a54565b6001811115612cba57612cba6148bb565b03612ce657612cdf89612cd060208601866158d5565b85602001358660400135613697565b9350612d9a565b60018d8d83818110612cfa57612cfa6150ef565b9050602002016020810190612d0f9190615a54565b6001811115612d2057612d206148bb565b03612d3657612cdf88612cd060208601866158d5565b60405162461bcd60e51b815260206004820152603360248201527f476f7665726e616e636550726f706f73616c3a20717565727920666f7220756e604482015272737570706f7274656420766f7465207479706560681b60648201526084016104c4565b836001600160a01b0316856001600160a01b031610612e055760405162461bcd60e51b815260206004820152602160248201527f476f7665726e616e636550726f706f73616c3a20696e76616c6964206f7264656044820152603960f91b60648201526084016104c4565b8394506000612e1385611776565b90508015612e745760019250612e628f8f8f85818110612e3557612e356150ef565b9050602002016020810190612e4a9190615a54565b8a8a89612e5c368b90038b018b615a71565b8761395b565b15612e74575050505050505050611b2b565b5080612e7f81615105565b915050612c5b565b5080612ee45760405162461bcd60e51b815260206004820152602660248201527f476f7665726e616e636550726f706f73616c3a20696e76616c6964207369676e60448201526561747572657360d01b60648201526084016104c4565b50505050505050505050505050565b60008181526020819052604081205490819003612f225750600090815260208190526040902060019081905590565b6000828152600160209081526040808320848452909152812090612f45826122ae565b905080612fef576000825460ff166004811115612f6457612f646148bb565b03612fcb5760405162461bcd60e51b815260206004820152603160248201527f436f7265476f7665726e616e63653a2063757272656e742070726f706f73616c604482015270081a5cc81b9bdd0818dbdb5c1b195d1959607a1b60648201526084016104c4565b60008481526020819052604081208054909190612fe790615105565b918290555092505b5050919050565b612ffe6145aa565b83518152602080850151604080840191909152600091830191909152840151516001600160401b0381111561303557613035614eab565b60405190808252806020026020018201604052801561305e578160200160208202803683370190505b5060608083019190915284015160808083019190915284015160a08083019190915284015160c082015260005b8460400151518110156131bc576001856040015182815181106130b0576130b06150ef565b602002602001015160018111156130c9576130c96148bb565b0361310a5782826060015182815181106130e5576130e56150ef565b60200260200101906001600160a01b031690816001600160a01b0316815250506131aa565b600085604001518281518110613122576131226150ef565b6020026020010151600181111561313b5761313b6148bb565b036131575783826060015182815181106130e5576130e56150ef565b60405162461bcd60e51b815260206004820152602260248201527f476c6f62616c50726f706f73616c3a20756e737570706f727465642074617267604482015261195d60f21b60648201526084016104c4565b806131b481615105565b91505061308b565b509392505050565b60008260600151511180156131e25750816080015151826060015151145b80156131f757508160a0015151826060015151145b801561320c57508160c0015151826060015151145b6132585760405162461bcd60e51b815260206004820152601e60248201527f50726f706f73616c3a20696e76616c6964206172726179206c656e677468000060448201526064016104c4565b61326281426150dc565b8260400151111561152e5760405162461bcd60e51b815260206004820152602260248201527f50726f706f73616c3a20696e76616c6964206578706972792074696d6573746160448201526106d760f41b60648201526084016104c4565b6001830191909155600690910155565b6000806000806000808660600151905060008760400151905060008860800151516001600160401b0381111561330857613308614eab565b604051908082528060200260200182016040528015613331578160200160208202803683370190505b5060a08a015190915060005b825181101561339a578a60800151818151811061335c5761335c6150ef565b60200260200101518051906020012083828151811061337d5761337d6150ef565b60209081029190910101528061339281615105565b91505061333d565b5082516020908102848201208551820286830120845183028584012084518402858501208e518f860151604080517f1463f426c05aff2c1a7a0957a71c9898bc8b47142540538e79ee25ee911413509881019890985287019190915260608601526080850184905260a0850183905260c0850182905260e08501819052929b509099509750955061010001612b18565b6000613439604083018361513b565b90501161349c5760405162461bcd60e51b815260206004820152602b60248201527f4272696467654f70657261746f727342616c6c6f743a20696e76616c6964206160448201526a0e4e4c2f240d8cadccee8d60ab1b60648201526084016104c4565b60006134ab604083018361513b565b60008181106134bc576134bc6150ef565b90506020020160208101906134d19190614838565b905060015b6134e3604084018461513b565b905081101561109a576134f9604084018461513b565b82818110613509576135096150ef565b905060200201602081019061351e9190614838565b6001600160a01b0316826001600160a01b03161061359f5760405162461bcd60e51b815260206004820152603860248201527f4272696467654f70657261746f727342616c6c6f743a20696e76616c6964206f60448201527772646572206f6620627269646765206f70657261746f727360401b60648201526084016104c4565b6135ac604084018461513b565b828181106135bc576135bc6150ef565b90506020020160208101906135d19190614838565b9150806135dd81615105565b9150506134d6565b600080806135f6604085018561513b565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250508251602090810293810193909320604080517fd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a818701528935818301529885013560608a01526080808a01929092528051808a03909201825260a0909801909752505084519401939093209392505050565b60008060006136a887878787613fcf565b915091506136b5816140b2565b5095945050505050565b60008060006136cc610cee565b6001600160a01b0316634bb5274a635624191160e01b866040516024016136f391906149c2565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051613734919060240161552e565b6040516020818303038152906040529060e01b6020820180516001600160e01b03838183161783525050505060405161376d91906152f9565b600060405180830381855afa9150503d80600081146137a8576040519150601f19603f3d011682016040523d82523d6000602084013e6137ad565b606091505b5091509150816118ca5760405162461bcd60e51b81526020600482015260426024820152600080516020615c4b83398151915260448201527f427269646765566f74657257656967687428616464726573732960206661696c606482015261195960f21b608482015260a4016104c4565b600080600061382b610cee565b6040805160048152602480820183526020820180516001600160e01b031663926323d560e01b17905291516001600160a01b039390931692634bb5274a9261387492910161552e565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516138ad91906152f9565b600060405180830381855afa9150503d80600081146138e8576040519150601f19603f3d011682016040523d82523d6000602084013e6138ed565b606091505b509150915081611d5b5760405162461bcd60e51b815260206004820152603360248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c2060746f74604482015272185b15d95a59da1d1cca0a580819985a5b1959606a1b60648201526084016104c4565b60208088015188516000828152600184526040808220838352909452928320613983816122ae565b156139945760019350505050613d57565b6020808c015160009081529081905260409020548214613a0f5760405162461bcd60e51b815260206004820152603060248201527f436f7265476f7665726e616e63653a20717565727920666f7220696e76616c6960448201526f642070726f706f73616c206e6f6e636560801b60648201526084016104c4565b6000815460ff166004811115613a2757613a276148bb565b14613a825760405162461bcd60e51b815260206004820152602560248201527f436f7265476f7665726e616e63653a2074686520766f74652069732066696e616044820152641b1a5e995960da1b60648201526084016104c4565b613a8c8188611b55565b15613ab557613aa5876001600160a01b03166014613d62565b6040516020016125909190615ad2565b6001600160a01b03871660009081526008820160209081526040909120805460ff19166001179055860151151580613af05750604086015115155b80613afe5750855160ff1615155b15613b45576001600160a01b03871660009081526007820160209081526040918290208851815460ff191660ff909116178155908801516001820155908701516002909101555b866001600160a01b031681600101547f1203f9e81c814a35f5f4cc24087b2a24c6fb7986a9f1406b68a9484882c93a238c88604051613b85929190615b22565b60405180910390a3600080808c6001811115613ba357613ba36148bb565b03613bf8576004830180546001810182556000918252602082200180546001600160a01b0319166001600160a01b038c16179055600384018054899290613beb9084906150dc565b9250508190559150613cb7565b60018c6001811115613c0c57613c0c6148bb565b03613c61576005830180546001810182556000918252602082200180546001600160a01b0319166001600160a01b038c16179055600284018054899290613c549084906150dc565b9250508190559050613cb7565b60405162461bcd60e51b815260206004820152602560248201527f436f7265476f7665726e616e63653a20756e737570706f7274656420766f7465604482015264207479706560d81b60648201526084016104c4565b8a8210613d0b57825460ff19166001908117845580840154604051919750907f5c819725ea53655a3b898f3df59b66489761935454e9212ca1e5ebd759953d0b90600090a2613d06838e614263565b613d51565b898110613d5157825460ff19166003178355600180840154604051919750907f55295d4ce992922fa2e5ffbf3a3dcdb367de0a15e125ace083456017fd22060f90600090a25b50505050505b979650505050505050565b60606000613d71836002615184565b613d7c9060026150dc565b6001600160401b03811115613d9357613d93614eab565b6040519080825280601f01601f191660200182016040528015613dbd576020820181803683370190505b509050600360fc1b81600081518110613dd857613dd86150ef565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613e0757613e076150ef565b60200101906001600160f81b031916908160001a9053506000613e2b846002615184565b613e369060016150dc565b90505b6001811115613eae576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613e6a57613e6a6150ef565b1a60f81b828281518110613e8057613e806150ef565b60200101906001600160f81b031916908160001a90535060049490941c93613ea781615b39565b9050613e39565b50831561164f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104c4565b613f056145aa565b613f10858585612ff6565b9050613f27600254826131c490919063ffffffff16565b6000613f328261299e565b90506000613f406000612ef3565b6000818152600080516020615beb8339815191526020908152604090912090890151919250613f709184906132c0565b82518114613f905760405162461bcd60e51b81526004016104c4906159e9565b8181600080516020615c8b83398151915285613fab8b6132d0565b8b89604051613fbd9493929190615662565b60405180910390a35050949350505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613ffc57506000905060036140a9565b8460ff16601b1415801561401457508460ff16601c14155b1561402557506000905060046140a9565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614079573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166140a2576000600192509250506140a9565b9150600090505b94509492505050565b60008160048111156140c6576140c66148bb565b036140ce5750565b60018160048111156140e2576140e26148bb565b0361412a5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016104c4565b600281600481111561413e5761413e6148bb565b0361418b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104c4565b600381600481111561419f5761419f6148bb565b036141f75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104c4565b600481600481111561420b5761420b6148bb565b036105fb5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016104c4565b61426c816142d0565b1561152e57815460ff19166002178255600080614288836142ea565b9150915083600101547fe134987599ae266ec90edeff1b26125b287dbb57b10822649432d1bb26537fba83836040516142c2929190615b50565b60405180910390a250505050565b600081602001516000148061165257505060200151461490565b6060806142f6836142d0565b61434e5760405162461bcd60e51b815260206004820152602360248201527f50726f706f73616c3a20717565727920666f7220696e76616c696420636861696044820152621b925960ea1b60648201526084016104c4565b8260600151516001600160401b0381111561436b5761436b614eab565b604051908082528060200260200182016040528015614394578160200160208202803683370190505b5091508260600151516001600160401b038111156143b4576143b4614eab565b6040519080825280602002602001820160405280156143e757816020015b60608152602001906001900390816143d25790505b50905060005b836060015151811015614584578360c001518181518110614410576144106150ef565b60200260200101515a116144635760405162461bcd60e51b815260206004820152601a60248201527950726f706f73616c3a20696e73756666696369656e742067617360301b60448201526064016104c4565b83606001518181518110614479576144796150ef565b60200260200101516001600160a01b0316846080015182815181106144a0576144a06150ef565b60200260200101518560c0015183815181106144be576144be6150ef565b6020026020010151908660a0015184815181106144dd576144dd6150ef565b60200260200101516040516144f291906152f9565b600060405180830381858888f193505050503d8060008114614530576040519150601f19603f3d011682016040523d82523d6000602084013e614535565b606091505b50848381518110614548576145486150ef565b60200260200101848481518110614561576145616150ef565b6020908102919091010191909152901515905261457d81615105565b90506143ed565b50915091565b604080516060810182526000808252602082018190529181019190915290565b6040518060e00160405280600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b50805460008255906000526020600020908101906105fb91905b808211156146155760008155600101614601565b5090565b600060e0828403121561462b57600080fd5b50919050565b60008083601f84011261464357600080fd5b5081356001600160401b0381111561465a57600080fd5b6020830191508360208260051b850101111561467557600080fd5b9250929050565b60008083601f84011261468e57600080fd5b5081356001600160401b038111156146a557600080fd5b60208301915083602060608302850101111561467557600080fd5b6000806000806000606086880312156146d857600080fd5b85356001600160401b03808211156146ef57600080fd5b6146fb89838a01614619565b9650602088013591508082111561471157600080fd5b61471d89838a01614631565b9096509450604088013591508082111561473657600080fd5b506147438882890161467c565b969995985093965092949392505050565b600080600080600080600080600060a08a8c03121561477257600080fd5b8935985060208a01356001600160401b038082111561479057600080fd5b61479c8d838e01614631565b909a50985060408c01359150808211156147b557600080fd5b6147c18d838e01614631565b909850965060608c01359150808211156147da57600080fd5b6147e68d838e01614631565b909650945060808c01359150808211156147ff57600080fd5b5061480c8c828d01614631565b915080935050809150509295985092959850929598565b6001600160a01b03811681146105fb57600080fd5b60006020828403121561484a57600080fd5b813561164f81614823565b6000806040838503121561486857600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b838110156148b05781516001600160a01b03168752958201959082019060010161488b565b509495945050505050565b634e487b7160e01b600052602160045260246000fd5b600281106105fb576105fb6148bb565b600081518084526020808501945080840160005b838110156148b0578151805160ff168852838101518489015260409081015190880152606090960195908201906001016148f5565b60608152600061493d6060830186614877565b82810360208481019190915285518083528682019282019060005b8181101561497d57845161496b816148d1565b83529383019391830191600101614958565b5050848103604086015261499181876148e1565b98975050505050505050565b6040815260006149b06040830185614877565b828103602084015261264181856148e1565b6001600160a01b0391909116815260200190565b6000806000606084860312156149eb57600080fd5b83359250602084013591506040840135614a0481614823565b809150509250925092565b600060208284031215614a2157600080fd5b5035919050565b600080600080600060608688031215614a4057600080fd5b85356001600160401b0380821115614a5757600080fd5b9087019060c0828a031215614a6b57600080fd5b9095506020870135908082111561471157600080fd5b600080600060408486031215614a9657600080fd5b83356001600160401b0380821115614aad57600080fd5b9085019060608288031215614ac157600080fd5b90935060208501359080821115614ad757600080fd5b50614ae48682870161467c565b9497909650939450505050565b60208152815160208201526020820151604082015260006040830151606080840152610c586080840182614877565b600281106105fb57600080fd5b80356124cb81614b20565b60008060008060008060008060008060c08b8d031215614b5757600080fd5b8a35995060208b01356001600160401b0380821115614b7557600080fd5b614b818e838f01614631565b909b50995060408d0135915080821115614b9a57600080fd5b614ba68e838f01614631565b909950975060608d0135915080821115614bbf57600080fd5b614bcb8e838f01614631565b909750955060808d0135915080821115614be457600080fd5b50614bf18d828e01614631565b9094509250614c04905060a08c01614b2d565b90509295989b9194979a5092959850565b60008060408385031215614c2857600080fd5b8235614c3381614823565b91506020830135614c4381614823565b809150509250929050565b600080600080600060a08688031215614c6657600080fd5b853594506020860135614c7881614823565b93506040860135614c8881614823565b94979396509394606081013594506080013592915050565b60008060008060008060008060008060c08b8d031215614cbf57600080fd5b8a35995060208b0135985060408b01356001600160401b0380821115614ce457600080fd5b614cf08e838f01614631565b909a50985060608d0135915080821115614d0957600080fd5b614d158e838f01614631565b909850965060808d0135915080821115614d2e57600080fd5b614d3a8e838f01614631565b909650945060a08d0135915080821115614d5357600080fd5b50614d608d828e01614631565b915080935050809150509295989b9194979a5092959850565b60008060008060808587031215614d8f57600080fd5b8435614d9a81614823565b93506020850135614daa81614823565b93969395505050506040820135916060013590565b60008060408385031215614dd257600080fd5b82356001600160401b03811115614de857600080fd5b614df485828601614619565b9250506020830135614c4381614b20565b60a0810160058710614e1957614e196148bb565b95815260208101949094526040840192909252606083015260809091015290565b60008060408385031215614e4d57600080fd5b823591506020830135614c4381614823565b6020808252602c908201527f526f6e696e476f7665726e616e636541646d696e3a2073656e6465722069732060408201526b3737ba1033b7bb32b93737b960a11b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715614ee357614ee3614eab565b60405290565b60405160c081016001600160401b0381118282101715614ee357614ee3614eab565b604051601f8201601f191681016001600160401b0381118282101715614f3357614f33614eab565b604052919050565b60006001600160401b03821115614f5457614f54614eab565b5060051b60200190565b6000614f71614f6c84614f3b565b614f0b565b8381529050602080820190600585901b840186811115614f9057600080fd5b845b818110156150235780356001600160401b0380821115614fb25760008081fd5b8188019150601f8a81840112614fc85760008081fd5b823582811115614fda57614fda614eab565b614feb818301601f19168801614f0b565b92508083528b8782860101111561500457600091508182fd5b8087850188850137600090830187015250855250928201928201614f92565b505050509392505050565b600061164f368484614f5e565b60208082526027908201527f476f7665726e616e636541646d696e3a206f6e6c7920616c6c6f7765642073656040820152661b198b58d85b1b60ca1b606082015260800190565b60208082526024908201527f476f7665726e616e636541646d696e3a2073657420746f206e6f6e2d636f6e746040820152631c9858dd60e21b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115611652576116526150c6565b634e487b7160e01b600052603260045260246000fd5b600060018201615117576151176150c6565b5060010190565b60006020828403121561513057600080fd5b815161164f81614823565b6000808335601e1984360301811261515257600080fd5b8301803591506001600160401b0382111561516c57600080fd5b6020019150600581901b360382131561467557600080fd5b8082028115828204841417611652576116526150c6565b6000813561165281614823565b81358155600160208084013582840155600283016040850135601e198636030181126151d357600080fd5b850180356001600160401b038111156151eb57600080fd5b83820191508060051b360382131561520257600080fd5b600160401b81111561521657615216614eab565b82548184558082101561524a5760008481528581208381019083015b808210156152465782825590880190615232565b5050505b50600092835260208320925b8181101561193e576152678361519b565b84820155918401918501615256565b84815260208082018590526060604083018190528201839052600090849060808401835b868110156152c85783356152ad81614823565b6001600160a01b03168252928201929082019060010161529a565b5098975050505050505050565b60005b838110156152f05781810151838201526020016152d8565b50506000910152565b6000825161530b8184602087016152d5565b9190910192915050565b9485526001600160a01b0393841660208601529190921660408401526060830191909152608082015260a00190565b600082601f83011261535557600080fd5b81356020615365614f6c83614f3b565b82815260059290921b8401810191818101908684111561538457600080fd5b8286015b848110156153a857803561539b81614823565b8352918301918301615388565b509695505050505050565b600082601f8301126153c457600080fd5b813560206153d4614f6c83614f3b565b82815260059290921b840181019181810190868411156153f357600080fd5b8286015b848110156153a857803583529183019183016153f7565b600082601f83011261541f57600080fd5b61164f83833560208501614f5e565b600060e0823603121561544057600080fd5b615448614ec1565b82358152602080840135908201526040808401359082015260608301356001600160401b038082111561547a57600080fd5b61548636838701615344565b6060840152608085013591508082111561549f57600080fd5b6154ab368387016153b3565b608084015260a08501359150808211156154c457600080fd5b6154d03683870161540e565b60a084015260c08501359150808211156154e957600080fd5b506154f6368286016153b3565b60c08301525092915050565b6000815180845261551a8160208601602086016152d5565b601f01601f19169290920160200192915050565b60208152600061164f6020830184615502565b60006020828403121561555357600080fd5b5051919050565b600081518084526020808501945080840160005b838110156148b05781518752958201959082019060010161556e565b600082825180855260208086019550808260051b84010181860160005b848110156155d557601f198684030189526155c3838351615502565b988401989250908301906001016155a7565b5090979650505050505050565b8051825260208101516020830152604081015160408301526000606082015160e0606085015261561560e0850182614877565b90506080830151848203608086015261562e828261555a565b91505060a083015184820360a0860152615648828261558a565b91505060c083015184820360c0860152612641828261555a565b60808152600061567560808301876155e2565b60208681850152838203604085015260c08201865183528187015182840152604087015160c0604085015281815180845260e0860191508483019350600092505b808310156156df5783516156c9816148d1565b82529284019260019290920191908401906156b6565b506060890151935084810360608601526156f9818561555a565b935050505060808601518282036080840152615715828261558a565b91505060a086015182820360a084015261572f828261555a565b935050505061264160608301846001600160a01b03169052565b6020808252602f908201527f476f7665726e616e636541646d696e3a206361737420766f746520666f72206960408201526e1b9d985b1a59081c1c9bdc1bdcd85b608a1b606082015260800190565b600082601f8301126157a957600080fd5b813560206157b9614f6c83614f3b565b82815260059290921b840181019181810190868411156157d857600080fd5b8286015b848110156153a85780356157ef81614b20565b83529183019183016157dc565b600060c0823603121561580e57600080fd5b615816614ee9565b823581526020808401359082015260408301356001600160401b038082111561583e57600080fd5b61584a36838701615798565b6040840152606085013591508082111561586357600080fd5b61586f368387016153b3565b6060840152608085013591508082111561588857600080fd5b6158943683870161540e565b608084015260a08501359150808211156158ad57600080fd5b506158ba368286016153b3565b60a08301525092915050565b60ff811681146105fb57600080fd5b6000602082840312156158e757600080fd5b813561164f816158c6565b81356158fd816158c6565b60ff811660ff198354161782555060208201356001820155604082013560028201555050565b6020808252818101527f436f7265476f7665726e616e63653a20696e76616c696420636861696e206964604082015260600190565b60408152600061596b60408301856155e2565b905060018060a01b03831660208301529392505050565b81810381811115611652576116526150c6565b73024b9b7b630ba32b223b7bb32b93730b731b29d160651b8152600082516159c48160148501602087016152d5565b6d08185b1c9958591e481d9bdd195960921b6014939091019283015250602201919050565b60208082526026908201527f436f7265476f7665726e616e63653a20696e76616c69642070726f706f73616c604082015265206e6f6e636560d01b606082015260800190565b8381526020810183905260608101615a46836148d1565b826040830152949350505050565b600060208284031215615a6657600080fd5b813561164f81614b20565b600060608284031215615a8357600080fd5b604051606081016001600160401b0381118282101715615aa557615aa5614eab565b6040528235615ab3816158c6565b8152602083810135908201526040928301359281019290925250919050565b6f021b7b932a3b7bb32b93730b731b29d160851b815260008251615afd8160108501602087016152d5565b6d08185b1c9958591e481d9bdd195960921b6010939091019283015250601e01919050565b60408101615b2f846148d1565b9281526020015290565b600081615b4857615b486150c6565b506000190190565b604080825283519082018190526000906020906060840190828701845b82811015615b8b578151151584529284019290840190600101615b6d565b50505083810382850152845180825282820190600581901b8301840187850160005b83811015615bdb57601f19868403018552615bc9838351615502565b94870194925090860190600101615bad565b5090999850505050505050505056fea6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49526f6e696e476f7665726e616e636541646d696e3a20717565727920666f7220a57d40f1496988cf60ab7c9d5ba4ff83647f67d3898d441a3aaf21b651678fd9476f7665726e616e636541646d696e3a2070726f78792063616c6c2060676574424f73476f7665726e616e636550726f706f73616c3a20696e76616c69642073771d78ae9e5fca95a532fb0971d575d0ce9b59d14823c063e08740137e0e0ecaa26469706673582212201c35729dcf98c0008f5a87ae846728958d4a922275a1b8f983059093af38632364736f6c63430008110033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101955760003560e01c80624054b81461019a57806309fcd8c7146101af5780630b26cf66146101c25780630b881830146101d557806317ce2dd4146101e85780631c905e39146102045780631e23e04814610226578063204e1c7a146102475780632b5df351146102675780632c5e65201461028a5780632e96a6fb1461029d5780632faf925d146102b057806334d5f37b146102c35780633644e515146102e35780635511cde1146102ec57806360911e8e146102f457806362e52e5f14610307578063663ac0111461031c5780637eff275e1461032f578063988ef53c14610342578063994390891461036b5780639a7d3382146103735780639e0dc0b314610386578063a1819f9a14610399578063a2fae570146103ac578063a8a0e32c146103bf578063b384abef146103d2578063b5e337de1461042d578063bc96180b14610440578063cd59658314610448578063cdf64a7614610450578063dcc3eb1914610463578063f3b7dead14610476578063fb4f637114610489575b600080fd5b6101ad6101a83660046146c0565b61049c565b005b6101ad6101bd366004614754565b6104e5565b6101ad6101d0366004614838565b6105a9565b6101ad6101e33660046146c0565b6105fe565b6101f160055481565b6040519081526020015b60405180910390f35b610217610212366004614855565b61060e565b6040516101fb9392919061492a565b610239610234366004614855565b6109f9565b6040516101fb92919061499d565b61025a610255366004614838565b610b6e565b6040516101fb91906149c2565b61027a6102753660046149d6565b610c60565b60405190151581526020016101fb565b61027a6102983660046149d6565b610c83565b6101ad6102ab366004614a0f565b610ca6565b6101ad6102be366004614a28565b610cce565b6101f16102d1366004614a0f565b60006020819052908152604090205481565b6101f160065481565b61025a610cee565b6101ad610302366004614a81565b610cfd565b61030f610dbd565b6040516101fb9190614af1565b6101ad61032a366004614b38565b610e5f565b6101ad61033d366004614c15565b610f6b565b6101f1610350366004614838565b6001600160a01b03166000908152600b602052604090205490565b61025a61109f565b6101ad610381366004614855565b6110ae565b6101ad610394366004614c4e565b611124565b6101ad6103a7366004614ca0565b611367565b6101ad6103ba366004614d79565b61144d565b6101ad6103cd366004614dbf565b6114f3565b61041c6103e0366004614855565b600160208181526000938452604080852090915291835291208054918101546002820154600383015460069093015460ff909416939192909185565b6040516101fb959493929190614e05565b6101ad61043b366004614838565b611532565b6101f1611584565b61025a611594565b6101ad61045e366004614838565b6115a3565b61027a610471366004614e3a565b611637565b61025a610484366004614838565b611658565b6101ad610497366004614a28565b611725565b60006104a733611776565b116104cd5760405162461bcd60e51b81526004016104c490614e5f565b60405180910390fd5b6104de8585858585600654336118de565b5050505050565b60006104f033611776565b1161050d5760405162461bcd60e51b81526004016104c490614e5f565b61059e89898989898080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061055392508a91508b905061502e565b8787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506105909250610cee915050565b610598611594565b33611948565b505050505050505050565b3330146105c85760405162461bcd60e51b81526004016104c49061503b565b6000816001600160a01b03163b116105f25760405162461bcd60e51b81526004016104c490615082565b6105fb81611a57565b50565b6104de8585858585600654611aad565b6000828152600160209081526040808320848452909152812060048101546005820154606093849384939092909161064682846150dc565b9050806001600160401b0381111561066057610660614eab565b604051908082528060200260200182016040528015610689578160200160208202803683370190505b509550806001600160401b038111156106a4576106a4614eab565b6040519080825280602002602001820160405280156106dd57816020015b6106ca61458a565b8152602001906001900390816106c25790505b509450806001600160401b038111156106f8576106f8614eab565b604051908082528060200260200182016040528015610721578160200160208202803683370190505b50965060005b83811015610880576000878281518110610743576107436150ef565b6020026020010190600181111561075c5761075c6148bb565b9081600181111561076f5761076f6148bb565b90525060008a81526001602090815260408083208c8452909152812060048701805460079092019291849081106107a8576107a86150ef565b60009182526020808320909101546001600160a01b0316835282810193909352604091820190208151606081018352815460ff16815260018201549381019390935260020154908201528651879083908110610806576108066150ef565b6020026020010181905250846004018181548110610826576108266150ef565b9060005260206000200160009054906101000a90046001600160a01b0316888281518110610856576108566150ef565b6001600160a01b03909216602092830291909101909101528061087881615105565b915050610727565b5060005b828110156109ed5760018761089986846150dc565b815181106108a9576108a96150ef565b602002602001019060018111156108c2576108c26148bb565b908160018111156108d5576108d56148bb565b90525060008a81526001602090815260408083208c84529091528120600587018054600790920192918490811061090e5761090e6150ef565b60009182526020808320909101546001600160a01b0316835282810193909352604091820190208151606081018352815460ff16815260018201549381019390935260020154908201528661096386846150dc565b81518110610973576109736150ef565b6020026020010181905250846005018181548110610993576109936150ef565b6000918252602090912001546001600160a01b0316886109b386846150dc565b815181106109c3576109c36150ef565b6001600160a01b0390921660209283029190910190910152806109e581615105565b915050610884565b50505050509250925092565b6000828152600c60209081526040808320848452825291829020600181018054845181850281018501909552808552606094859490929190830182828015610a6a57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610a4c575b5050505050925082516001600160401b03811115610a8a57610a8a614eab565b604051908082528060200260200182016040528015610ac357816020015b610ab061458a565b815260200190600190039081610aa85790505b50915060005b8351811015610b6557816000016000858381518110610aea57610aea6150ef565b6020908102919091018101516001600160a01b031682528181019290925260409081016000208151606081018352815460ff16815260018201549381019390935260020154908201528351849083908110610b4757610b476150ef565b60200260200101819052508080610b5d90615105565b915050610ac9565b50509250929050565b6000806000836001600160a01b0316604051610b9490635c60da1b60e01b815260040190565b600060405180830381855afa9150503d8060008114610bcf576040519150601f19603f3d011682016040523d82523d6000602084013e610bd4565b606091505b509150915081610c445760405162461bcd60e51b815260206004820152603560248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c2060696d706044820152741b195b595b9d185d1a5bdb8a0a580819985a5b1959605a1b60648201526084016104c4565b80806020019051810190610c58919061511e565b949350505050565b6000838152600a602090815260408083208584529091528120610c589083611b34565b60008381526001602090815260408083208584529091528120610c589083611b55565b333014610cc55760405162461bcd60e51b81526004016104c49061503b565b6105fb81600255565b6104de8585858585600654610ce1610cee565b610ce9611594565b611b77565b6003546001600160a01b031690565b610d13838383610d0b611c19565b600654611d76565b82356000908152600a6020908152604080832082870135845290915290206001815460ff166004811115610d4957610d496148bb565b03610db757836007610d5b82826151a8565b507f7c45875370690698791a915954b9c69729cc5f9373edc5a2e04436c07589f30d905084356020860135610d93604088018861513b565b604051610da39493929190615276565b60405180910390a1805460ff191660021781555b50505050565b610de160405180606001604052806000815260200160008152602001606081525090565b60408051606081018252600780548252600854602080840191909152600980548551818402810184018752818152949593949386019392830182828015610e5157602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610e33575b505050505081525050905090565b6000610e6a33611776565b11610e875760405162461bcd60e51b81526004016104c490614e5f565b60003390506000610f50468d8d8d80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508c8c80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610f1592508d91508e905061502e565b8a8a808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b9250612083915050565b9050610f5d82828561216b565b505050505050505050505050565b333014610f8a5760405162461bcd60e51b81526004016104c49061503b565b6000826001600160a01b0316638f28397083604051602401610fac91906149c2565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051610fe591906152f9565b6000604051808303816000865af19150503d8060008114611022576040519150601f19603f3d011682016040523d82523d6000602084013e611027565b606091505b505090508061109a5760405162461bcd60e51b815260206004820152603960248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c20606368616044820152781b99d950591b5a5b8a1859191c995cdcca580819985a5b1959603a1b60648201526084016104c4565b505050565b600d546001600160a01b031690565b60008281526001602081815260408084208585529091529091209081015461111b5760405162461bcd60e51b815260206004820152602c6024820152600080516020615c0b83398151915260448201526b656d70747920766f74696e6760a01b60648201526084016104c4565b610db7816122ae565b33600061113082611776565b9050600081116111525760405162461bcd60e51b81526004016104c490614e5f565b6000611160878787876124d0565b90508088146111c15760405162461bcd60e51b815260206004820152602760248201527f526f6e696e476f7665726e616e636541646d696e3a20696e76616c696420766f6044820152660e8ca40d0c2e6d60cb1b60648201526084016104c4565b6000818152600e6020526040902060058101546112285760405162461bcd60e51b81526020600482015260316024820152600080516020615c0b8339815191526044820152706e6f6e2d6578697374656e7420766f746560781b60648201526084016104c4565b6004815460ff166004811115611240576112406148bb565b036112905760405162461bcd60e51b815260206004820152602c6024820152600080516020615c0b83398151915260448201526b6578706972656420766f746560a01b60648201526084016104c4565b60006112a68286866112a0611c19565b8761252c565b905060018160048111156112bc576112bc6148bb565b0361130e576112cb898961264a565b6040518381527fd3500576a0d4923326fbb893cf2169273e0df93f3cb6b94b83f2ca2e0ecb681b9060200160405180910390a1815460ff1916600217825561135b565b6004816004811115611322576113226148bb565b0361135b576040518381527feecb3148acc573548e89cb64eb5f2023a61171f1c413ed8bf0fe506c19aeebe49060200160405180910390a15b50505050505050505050565b600061137233611776565b1161138f5760405162461bcd60e51b81526004016104c490614e5f565b6114408a8a8a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808e0282810182019093528d82529093508d92508c91829185019084908082843760009201919091525061140592508a91508b905061502e565b878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250339250612083915050565b5050505050505050505050565b3361145661109f565b6001600160a01b03161461147d57604051630e6444a160e31b815260040160405180910390fd5b600061148b858585856124d0565b6000818152600e602052604090819020426005820155600481018590559051919250907f18ea835340bb2973a31996158138f109e9c5b9cfdb2424e999e6b1a9ce565de8906114e39084908990899089908990615315565b60405180910390a1505050505050565b60006114fe33611776565b1161151b5760405162461bcd60e51b81526004016104c490614e5f565b61152e336115288461542e565b8361216b565b5050565b3330146115515760405162461bcd60e51b81526004016104c49061503b565b6000816001600160a01b03163b1161157b5760405162461bcd60e51b81526004016104c490615082565b6105fb816127dc565b600061158f60025490565b905090565b6004546001600160a01b031690565b3330146115c25760405162461bcd60e51b81526004016104c49061503b565b6000816001600160a01b03163b1161162e5760405162461bcd60e51b815260206004820152602960248201527f526f6e696e476f7665726e616e636541646d696e3a2073657420746f206e6f6e6044820152680b58dbdb9d1c9858dd60ba1b60648201526084016104c4565b6105fb81612827565b6000828152600e6020526040812061164f9083611b34565b90505b92915050565b6000806000836001600160a01b031660405161167e906303e1469160e61b815260040190565b600060405180830381855afa9150503d80600081146116b9576040519150601f19603f3d011682016040523d82523d6000602084013e6116be565b606091505b509150915081610c445760405162461bcd60e51b815260206004820152602c60248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c206061646d60448201526b1a5b8a0a580819985a5b195960a21b60648201526084016104c4565b600061173033611776565b1161174d5760405162461bcd60e51b81526004016104c490614e5f565b61176e8585858585600654611760610cee565b611768611594565b33612872565b505050505050565b6000806000611783610cee565b6001600160a01b0316634bb5274a63d78392f860e01b866040516024016117aa91906149c2565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516117eb919060240161552e565b6040516020818303038152906040529060e01b6020820180516001600160e01b03838183161783525050505060405161182491906152f9565b600060405180830381855afa9150503d806000811461185f576040519150601f19603f3d011682016040523d82523d6000602084013e611864565b606091505b5091509150816118ca5760405162461bcd60e51b815260206004820152603f6024820152600080516020615c4b83398151915260448201527f476f7665726e6f7257656967687428616464726573732960206661696c65640060648201526084016104c4565b80806020019051810190610c589190615541565b6118f06118ea8861542e565b826128d4565b5060006119046118ff8961542e565b61299e565b905061193e6119128961542e565b8888888861192a89611925896000612b3d565b612b93565b6119398a6119258a6001612b3d565b612bba565b5050505050505050565b60006119546000612ef3565b905060006040518060c001604052808381526020018c81526020018b8b808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505050602082018b9052604082018a905260609091018890529091506119c8828787612ff6565b90506119df600254826131c490919063ffffffff16565b60006119ea8261299e565b6000858152600080516020615beb83398151915260205260409020909150611a1390828f6132c0565b8084600080516020615c8b83398151915284611a2e876132d0565b878a604051611a409493929190615662565b60405180910390a350505050505050505050505050565b600480546001600160a01b0319166001600160a01b0383161790556040517f5cbd8a0bb00196365d5eb3457c6734e7f06666c3c78e5469b4c9deec7edae04890611aa29083906149c2565b60405180910390a150565b6000611abb6118ff8861542e565b6020808901356000908152600180835260408083208c35845290935291902001549091508114611afd5760405162461bcd60e51b81526004016104c490615749565b611b2b611b098861542e565b87878787611b1c88611925896000612b3d565b611939896119258a6001612b3d565b50505050505050565b6001600160a01b031660009081526002919091016020526040902054151590565b6001600160a01b03166000908152600891909101602052604090205460ff1690565b6000611b8e8383611b878c6157fc565b9190612ff6565b90506000611ba3611b9e8b6157fc565b6132d0565b9050611bae8261299e565b60008080526001602081815285518352600080516020615beb83398151915290526040909120015414611bf35760405162461bcd60e51b81526004016104c490615749565b61135b828a8a8a8a611c0a8b611925896000612b3d565b6119398c6119258a6001612b3d565b6000806000611c26610cee565b6040805160048152602480820183526020820180516001600160e01b0316637de5dedd60e01b17905291516001600160a01b039390931692634bb5274a92611c6f92910161552e565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051611ca891906152f9565b600060405180830381855afa9150503d8060008114611ce3576040519150601f19603f3d011682016040523d82523d6000602084013e611ce8565b606091505b509150915081611d5b5760405162461bcd60e51b815260206004820152603860248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c20606d696e6044820152771a5b5d5b559bdd1955d95a59da1d0a0a580819985a5b195960421b60648201526084016104c4565b80806020019051810190611d6f9190615541565b9250505090565b600754853510801590611d8f5750600854602086013510155b611e015760405162461bcd60e51b815260206004820152603d60248201527f424f73476f7665726e616e636550726f706f73616c3a20717565727920666f7260448201527f206f7574646174656420627269646765206f70657261746f722073657400000060648201526084016104c4565b611e0a8561342a565b82611e6b5760405162461bcd60e51b815260206004820152602b60248201527f424f73476f7665726e616e636550726f706f73616c3a20696e76616c6964206160448201526a0e4e4c2f240d8cadccee8d60ab1b60648201526084016104c4565b6000806000611e79886135e5565b90506000611e878583612b93565b89356000818152600a60209081526040808320828f0135808552908352818420948452600c83528184209084529091528120929350909190805b8a81101561203557368c8c83818110611edc57611edc6150ef565b606002919091019150611f07905086611ef860208401846158d5565b83602001358460400135613697565b9850886001600160a01b0316886001600160a01b031610611f6c5760405162461bcd60e51b815260206004820152602b6024820152600080516020615c6b83398151915260448201526a34b3b732b91037b93232b960a91b60648201526084016104c4565b889750506000611f7b896136bf565b90508015612022576001600160a01b0389166000908152600b60205260409020439055600192508c8c83818110611fb457611fb46150ef565b6001600160a01b038c166000908152602088905260409020606090910292909201919050611fe282826158f2565b50506001848101805491820181556000908152602090200180546001600160a01b0319166001600160a01b038b16179055612020858a838e8b61252c565b505b508061202d81615105565b915050611ec1565b5080610f5d5760405162461bcd60e51b81526020600482015260296024820152600080516020615c6b83398151915260448201526869676e61747572657360b81b60648201526084016104c4565b61208b6145aa565b876000036120ab5760405162461bcd60e51b81526004016104c490615923565b60006120b689612ef3565b90506040518060e001604052808281526020018a8152602001898152602001888152602001878152602001868152602001858152509150612102600254836131c490919063ffffffff16565b600061210d8361299e565b60008b8152600160209081526040808320868452909152902090915061213490828b6132c0565b80828b600080516020615c2b8339815191528688604051612156929190615958565b60405180910390a45050979650505050505050565b468260200151146121cd5760405162461bcd60e51b815260206004820152602660248201527f526f6e696e476f7665726e616e636541646d696e3a20696e76616c6964206368604482015265185a5b881a5960d21b60648201526084016104c4565b6121d68261299e565b602080840151600090815260018083526040808320875184529093529190200154146122615760405162461bcd60e51b815260206004820152603460248201527f526f6e696e476f7665726e616e636541646d696e3a206361737420766f746520604482015273199bdc881a5b9d985b1a59081c1c9bdc1bdcd85b60621b60648201526084016104c4565b600061226b611c19565b905060008161227861381e565b6122829190615982565b61228d9060016150dc565b905061229761458a565b611b2b858585858a866122a98d611776565b61395b565b600080825460ff1660048111156122c7576122c76148bb565b1480156122d8575042826006015411155b905080156124cb5760018201546040517f58f98006a7f2f253f8ae8f8b7cec9008ca05359633561cd7c22f3005682d4a5590600090a260005b60048301548110156123ca57826008016000846004018381548110612338576123386150ef565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff191690556004840180546007860192919084908110612381576123816150ef565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff191681556001810182905560020155806123c281615105565b915050612311565b5060005b6005830154811015612487578260080160008460050183815481106123f5576123f56150ef565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff19169055600584018054600786019291908490811061243e5761243e6150ef565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff1916815560018101829055600201558061247f81615105565b9150506123ce565b50815460ff1916825560006001830181905560028301819055600383018190556124b59060048401906145e7565b6124c36005830160006145e7565b600060068301555b919050565b60405160009061250c907f697acba4deaf1a718d8c2d93e42860488cb7812696f28ca10eed17bac41e7027908790879087908790602001615315565b604051602081830303815290604052805190602001209050949350505050565b6000808660040154118015612545575042866004015411155b1561255d5750845460ff191660049081178655612641565b6125678686611b34565b156125b657612580856001600160a01b03166014613d62565b6040516020016125909190615995565b60408051601f198184030181529082905262461bcd60e51b82526104c49160040161552e565b6001600160a01b03851660009081526002870160209081526040808320859055848352600389019091528120805486919083906125f49084906150dc565b925050819055905083811015801561262157506000875460ff16600481111561261f5761261f6148bb565b145b1561263957865460ff19166001908117885587018390555b5050845460ff165b95945050505050565b600061265461109f565b604080516001600160a01b0386811660248084019190915286821660448085019190915284518085039091018152606490930184526020830180516001600160e01b03166361e45aeb60e11b1790529251931692634bb5274a926126b992910161552e565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516126f291906152f9565b6000604051808303816000865af19150503d806000811461272f576040519150601f19603f3d011682016040523d82523d6000602084013e612734565b606091505b505090508061109a5760405162461bcd60e51b815260206004820152606260248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c206065786560448201527f6352656c656173654c6f636b656446756e64466f72456d657267656e6379457860648201527f69745265717565737428616464726573732c616464726573732960206661696c608482015261195960f21b60a482015260c4016104c4565b600380546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d790611aa29083906149c2565b600d80546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990611aa29083906149c2565b61287a6145aa565b61288e6128868b6157fc565b858585613efd565b9050600061289e611b9e8c6157fc565b90506128c6828b8b8b8b6128b78c611925896000612b3d565b6119398d6119258a6001612b3d565b509998505050505050505050565b60208201516000908082036128fb5760405162461bcd60e51b81526004016104c490615923565b6002546129099085906131c4565b60006129148561299e565b905061291f82612ef3565b6000838152600160209081526040808320848452909152908190209087015191945061294c9183906132c0565b8451831461296c5760405162461bcd60e51b81526004016104c4906159e9565b808383600080516020615c2b833981519152888860405161298e929190615958565b60405180910390a4505092915050565b6000806000806000808660800151905060008760600151905060008860a00151516001600160401b038111156129d6576129d6614eab565b6040519080825280602002602001820160405280156129ff578160200160208202803683370190505b5060c08a015190915060005b8251811015612a68578a60a001518181518110612a2a57612a2a6150ef565b602002602001015180519060200120838281518110612a4b57612a4b6150ef565b602090810291909101015280612a6081615105565b915050612a0b565b506020835102602084012097506020845102602085012096506020825102602083012095506020815102602082012094507fd051578048e6ff0bbc9fca3b65a42088dbde10f36ca841de566711087ad9b08a60001b8a600001518b602001518c604001518b8b8b8b604051602001612b18989796959493929190978852602088019690965260408701949094526060860192909252608085015260a084015260c083015260e08201526101000190565b6040516020818303038152906040528051906020012098505050505050505050919050565b604051600090612b75907fd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c29085908590602001615a2f565b60405160208183030381529060405280519060200120905092915050565b60405161190160f01b60208201526022810183905260428101829052600090606201612b75565b8415801590612bc857508483145b612c255760405162461bcd60e51b815260206004820152602860248201527f476f7665726e616e636550726f706f73616c3a20696e76616c696420617272616044820152670f240d8cadccee8d60c31b60648201526084016104c4565b6000612c2f611c19565b9050600081612c3c61381e565b612c469190615982565b612c519060016150dc565b9050600080366000805b89811015612e87578a8a82818110612c7557612c756150ef565b606002919091019350600090508d8d83818110612c9457612c946150ef565b9050602002016020810190612ca99190615a54565b6001811115612cba57612cba6148bb565b03612ce657612cdf89612cd060208601866158d5565b85602001358660400135613697565b9350612d9a565b60018d8d83818110612cfa57612cfa6150ef565b9050602002016020810190612d0f9190615a54565b6001811115612d2057612d206148bb565b03612d3657612cdf88612cd060208601866158d5565b60405162461bcd60e51b815260206004820152603360248201527f476f7665726e616e636550726f706f73616c3a20717565727920666f7220756e604482015272737570706f7274656420766f7465207479706560681b60648201526084016104c4565b836001600160a01b0316856001600160a01b031610612e055760405162461bcd60e51b815260206004820152602160248201527f476f7665726e616e636550726f706f73616c3a20696e76616c6964206f7264656044820152603960f91b60648201526084016104c4565b8394506000612e1385611776565b90508015612e745760019250612e628f8f8f85818110612e3557612e356150ef565b9050602002016020810190612e4a9190615a54565b8a8a89612e5c368b90038b018b615a71565b8761395b565b15612e74575050505050505050611b2b565b5080612e7f81615105565b915050612c5b565b5080612ee45760405162461bcd60e51b815260206004820152602660248201527f476f7665726e616e636550726f706f73616c3a20696e76616c6964207369676e60448201526561747572657360d01b60648201526084016104c4565b50505050505050505050505050565b60008181526020819052604081205490819003612f225750600090815260208190526040902060019081905590565b6000828152600160209081526040808320848452909152812090612f45826122ae565b905080612fef576000825460ff166004811115612f6457612f646148bb565b03612fcb5760405162461bcd60e51b815260206004820152603160248201527f436f7265476f7665726e616e63653a2063757272656e742070726f706f73616c604482015270081a5cc81b9bdd0818dbdb5c1b195d1959607a1b60648201526084016104c4565b60008481526020819052604081208054909190612fe790615105565b918290555092505b5050919050565b612ffe6145aa565b83518152602080850151604080840191909152600091830191909152840151516001600160401b0381111561303557613035614eab565b60405190808252806020026020018201604052801561305e578160200160208202803683370190505b5060608083019190915284015160808083019190915284015160a08083019190915284015160c082015260005b8460400151518110156131bc576001856040015182815181106130b0576130b06150ef565b602002602001015160018111156130c9576130c96148bb565b0361310a5782826060015182815181106130e5576130e56150ef565b60200260200101906001600160a01b031690816001600160a01b0316815250506131aa565b600085604001518281518110613122576131226150ef565b6020026020010151600181111561313b5761313b6148bb565b036131575783826060015182815181106130e5576130e56150ef565b60405162461bcd60e51b815260206004820152602260248201527f476c6f62616c50726f706f73616c3a20756e737570706f727465642074617267604482015261195d60f21b60648201526084016104c4565b806131b481615105565b91505061308b565b509392505050565b60008260600151511180156131e25750816080015151826060015151145b80156131f757508160a0015151826060015151145b801561320c57508160c0015151826060015151145b6132585760405162461bcd60e51b815260206004820152601e60248201527f50726f706f73616c3a20696e76616c6964206172726179206c656e677468000060448201526064016104c4565b61326281426150dc565b8260400151111561152e5760405162461bcd60e51b815260206004820152602260248201527f50726f706f73616c3a20696e76616c6964206578706972792074696d6573746160448201526106d760f41b60648201526084016104c4565b6001830191909155600690910155565b6000806000806000808660600151905060008760400151905060008860800151516001600160401b0381111561330857613308614eab565b604051908082528060200260200182016040528015613331578160200160208202803683370190505b5060a08a015190915060005b825181101561339a578a60800151818151811061335c5761335c6150ef565b60200260200101518051906020012083828151811061337d5761337d6150ef565b60209081029190910101528061339281615105565b91505061333d565b5082516020908102848201208551820286830120845183028584012084518402858501208e518f860151604080517f1463f426c05aff2c1a7a0957a71c9898bc8b47142540538e79ee25ee911413509881019890985287019190915260608601526080850184905260a0850183905260c0850182905260e08501819052929b509099509750955061010001612b18565b6000613439604083018361513b565b90501161349c5760405162461bcd60e51b815260206004820152602b60248201527f4272696467654f70657261746f727342616c6c6f743a20696e76616c6964206160448201526a0e4e4c2f240d8cadccee8d60ab1b60648201526084016104c4565b60006134ab604083018361513b565b60008181106134bc576134bc6150ef565b90506020020160208101906134d19190614838565b905060015b6134e3604084018461513b565b905081101561109a576134f9604084018461513b565b82818110613509576135096150ef565b905060200201602081019061351e9190614838565b6001600160a01b0316826001600160a01b03161061359f5760405162461bcd60e51b815260206004820152603860248201527f4272696467654f70657261746f727342616c6c6f743a20696e76616c6964206f60448201527772646572206f6620627269646765206f70657261746f727360401b60648201526084016104c4565b6135ac604084018461513b565b828181106135bc576135bc6150ef565b90506020020160208101906135d19190614838565b9150806135dd81615105565b9150506134d6565b600080806135f6604085018561513b565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250508251602090810293810193909320604080517fd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a818701528935818301529885013560608a01526080808a01929092528051808a03909201825260a0909801909752505084519401939093209392505050565b60008060006136a887878787613fcf565b915091506136b5816140b2565b5095945050505050565b60008060006136cc610cee565b6001600160a01b0316634bb5274a635624191160e01b866040516024016136f391906149c2565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051613734919060240161552e565b6040516020818303038152906040529060e01b6020820180516001600160e01b03838183161783525050505060405161376d91906152f9565b600060405180830381855afa9150503d80600081146137a8576040519150601f19603f3d011682016040523d82523d6000602084013e6137ad565b606091505b5091509150816118ca5760405162461bcd60e51b81526020600482015260426024820152600080516020615c4b83398151915260448201527f427269646765566f74657257656967687428616464726573732960206661696c606482015261195960f21b608482015260a4016104c4565b600080600061382b610cee565b6040805160048152602480820183526020820180516001600160e01b031663926323d560e01b17905291516001600160a01b039390931692634bb5274a9261387492910161552e565b6040516020818303038152906040529060e01b6020820180516001600160e01b0383818316178352505050506040516138ad91906152f9565b600060405180830381855afa9150503d80600081146138e8576040519150601f19603f3d011682016040523d82523d6000602084013e6138ed565b606091505b509150915081611d5b5760405162461bcd60e51b815260206004820152603360248201527f476f7665726e616e636541646d696e3a2070726f78792063616c6c2060746f74604482015272185b15d95a59da1d1cca0a580819985a5b1959606a1b60648201526084016104c4565b60208088015188516000828152600184526040808220838352909452928320613983816122ae565b156139945760019350505050613d57565b6020808c015160009081529081905260409020548214613a0f5760405162461bcd60e51b815260206004820152603060248201527f436f7265476f7665726e616e63653a20717565727920666f7220696e76616c6960448201526f642070726f706f73616c206e6f6e636560801b60648201526084016104c4565b6000815460ff166004811115613a2757613a276148bb565b14613a825760405162461bcd60e51b815260206004820152602560248201527f436f7265476f7665726e616e63653a2074686520766f74652069732066696e616044820152641b1a5e995960da1b60648201526084016104c4565b613a8c8188611b55565b15613ab557613aa5876001600160a01b03166014613d62565b6040516020016125909190615ad2565b6001600160a01b03871660009081526008820160209081526040909120805460ff19166001179055860151151580613af05750604086015115155b80613afe5750855160ff1615155b15613b45576001600160a01b03871660009081526007820160209081526040918290208851815460ff191660ff909116178155908801516001820155908701516002909101555b866001600160a01b031681600101547f1203f9e81c814a35f5f4cc24087b2a24c6fb7986a9f1406b68a9484882c93a238c88604051613b85929190615b22565b60405180910390a3600080808c6001811115613ba357613ba36148bb565b03613bf8576004830180546001810182556000918252602082200180546001600160a01b0319166001600160a01b038c16179055600384018054899290613beb9084906150dc565b9250508190559150613cb7565b60018c6001811115613c0c57613c0c6148bb565b03613c61576005830180546001810182556000918252602082200180546001600160a01b0319166001600160a01b038c16179055600284018054899290613c549084906150dc565b9250508190559050613cb7565b60405162461bcd60e51b815260206004820152602560248201527f436f7265476f7665726e616e63653a20756e737570706f7274656420766f7465604482015264207479706560d81b60648201526084016104c4565b8a8210613d0b57825460ff19166001908117845580840154604051919750907f5c819725ea53655a3b898f3df59b66489761935454e9212ca1e5ebd759953d0b90600090a2613d06838e614263565b613d51565b898110613d5157825460ff19166003178355600180840154604051919750907f55295d4ce992922fa2e5ffbf3a3dcdb367de0a15e125ace083456017fd22060f90600090a25b50505050505b979650505050505050565b60606000613d71836002615184565b613d7c9060026150dc565b6001600160401b03811115613d9357613d93614eab565b6040519080825280601f01601f191660200182016040528015613dbd576020820181803683370190505b509050600360fc1b81600081518110613dd857613dd86150ef565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613e0757613e076150ef565b60200101906001600160f81b031916908160001a9053506000613e2b846002615184565b613e369060016150dc565b90505b6001811115613eae576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613e6a57613e6a6150ef565b1a60f81b828281518110613e8057613e806150ef565b60200101906001600160f81b031916908160001a90535060049490941c93613ea781615b39565b9050613e39565b50831561164f5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104c4565b613f056145aa565b613f10858585612ff6565b9050613f27600254826131c490919063ffffffff16565b6000613f328261299e565b90506000613f406000612ef3565b6000818152600080516020615beb8339815191526020908152604090912090890151919250613f709184906132c0565b82518114613f905760405162461bcd60e51b81526004016104c4906159e9565b8181600080516020615c8b83398151915285613fab8b6132d0565b8b89604051613fbd9493929190615662565b60405180910390a35050949350505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613ffc57506000905060036140a9565b8460ff16601b1415801561401457508460ff16601c14155b1561402557506000905060046140a9565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015614079573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166140a2576000600192509250506140a9565b9150600090505b94509492505050565b60008160048111156140c6576140c66148bb565b036140ce5750565b60018160048111156140e2576140e26148bb565b0361412a5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016104c4565b600281600481111561413e5761413e6148bb565b0361418b5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104c4565b600381600481111561419f5761419f6148bb565b036141f75760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104c4565b600481600481111561420b5761420b6148bb565b036105fb5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016104c4565b61426c816142d0565b1561152e57815460ff19166002178255600080614288836142ea565b9150915083600101547fe134987599ae266ec90edeff1b26125b287dbb57b10822649432d1bb26537fba83836040516142c2929190615b50565b60405180910390a250505050565b600081602001516000148061165257505060200151461490565b6060806142f6836142d0565b61434e5760405162461bcd60e51b815260206004820152602360248201527f50726f706f73616c3a20717565727920666f7220696e76616c696420636861696044820152621b925960ea1b60648201526084016104c4565b8260600151516001600160401b0381111561436b5761436b614eab565b604051908082528060200260200182016040528015614394578160200160208202803683370190505b5091508260600151516001600160401b038111156143b4576143b4614eab565b6040519080825280602002602001820160405280156143e757816020015b60608152602001906001900390816143d25790505b50905060005b836060015151811015614584578360c001518181518110614410576144106150ef565b60200260200101515a116144635760405162461bcd60e51b815260206004820152601a60248201527950726f706f73616c3a20696e73756666696369656e742067617360301b60448201526064016104c4565b83606001518181518110614479576144796150ef565b60200260200101516001600160a01b0316846080015182815181106144a0576144a06150ef565b60200260200101518560c0015183815181106144be576144be6150ef565b6020026020010151908660a0015184815181106144dd576144dd6150ef565b60200260200101516040516144f291906152f9565b600060405180830381858888f193505050503d8060008114614530576040519150601f19603f3d011682016040523d82523d6000602084013e614535565b606091505b50848381518110614548576145486150ef565b60200260200101848481518110614561576145616150ef565b6020908102919091010191909152901515905261457d81615105565b90506143ed565b50915091565b604080516060810182526000808252602082018190529181019190915290565b6040518060e00160405280600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b50805460008255906000526020600020908101906105fb91905b808211156146155760008155600101614601565b5090565b600060e0828403121561462b57600080fd5b50919050565b60008083601f84011261464357600080fd5b5081356001600160401b0381111561465a57600080fd5b6020830191508360208260051b850101111561467557600080fd5b9250929050565b60008083601f84011261468e57600080fd5b5081356001600160401b038111156146a557600080fd5b60208301915083602060608302850101111561467557600080fd5b6000806000806000606086880312156146d857600080fd5b85356001600160401b03808211156146ef57600080fd5b6146fb89838a01614619565b9650602088013591508082111561471157600080fd5b61471d89838a01614631565b9096509450604088013591508082111561473657600080fd5b506147438882890161467c565b969995985093965092949392505050565b600080600080600080600080600060a08a8c03121561477257600080fd5b8935985060208a01356001600160401b038082111561479057600080fd5b61479c8d838e01614631565b909a50985060408c01359150808211156147b557600080fd5b6147c18d838e01614631565b909850965060608c01359150808211156147da57600080fd5b6147e68d838e01614631565b909650945060808c01359150808211156147ff57600080fd5b5061480c8c828d01614631565b915080935050809150509295985092959850929598565b6001600160a01b03811681146105fb57600080fd5b60006020828403121561484a57600080fd5b813561164f81614823565b6000806040838503121561486857600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b838110156148b05781516001600160a01b03168752958201959082019060010161488b565b509495945050505050565b634e487b7160e01b600052602160045260246000fd5b600281106105fb576105fb6148bb565b600081518084526020808501945080840160005b838110156148b0578151805160ff168852838101518489015260409081015190880152606090960195908201906001016148f5565b60608152600061493d6060830186614877565b82810360208481019190915285518083528682019282019060005b8181101561497d57845161496b816148d1565b83529383019391830191600101614958565b5050848103604086015261499181876148e1565b98975050505050505050565b6040815260006149b06040830185614877565b828103602084015261264181856148e1565b6001600160a01b0391909116815260200190565b6000806000606084860312156149eb57600080fd5b83359250602084013591506040840135614a0481614823565b809150509250925092565b600060208284031215614a2157600080fd5b5035919050565b600080600080600060608688031215614a4057600080fd5b85356001600160401b0380821115614a5757600080fd5b9087019060c0828a031215614a6b57600080fd5b9095506020870135908082111561471157600080fd5b600080600060408486031215614a9657600080fd5b83356001600160401b0380821115614aad57600080fd5b9085019060608288031215614ac157600080fd5b90935060208501359080821115614ad757600080fd5b50614ae48682870161467c565b9497909650939450505050565b60208152815160208201526020820151604082015260006040830151606080840152610c586080840182614877565b600281106105fb57600080fd5b80356124cb81614b20565b60008060008060008060008060008060c08b8d031215614b5757600080fd5b8a35995060208b01356001600160401b0380821115614b7557600080fd5b614b818e838f01614631565b909b50995060408d0135915080821115614b9a57600080fd5b614ba68e838f01614631565b909950975060608d0135915080821115614bbf57600080fd5b614bcb8e838f01614631565b909750955060808d0135915080821115614be457600080fd5b50614bf18d828e01614631565b9094509250614c04905060a08c01614b2d565b90509295989b9194979a5092959850565b60008060408385031215614c2857600080fd5b8235614c3381614823565b91506020830135614c4381614823565b809150509250929050565b600080600080600060a08688031215614c6657600080fd5b853594506020860135614c7881614823565b93506040860135614c8881614823565b94979396509394606081013594506080013592915050565b60008060008060008060008060008060c08b8d031215614cbf57600080fd5b8a35995060208b0135985060408b01356001600160401b0380821115614ce457600080fd5b614cf08e838f01614631565b909a50985060608d0135915080821115614d0957600080fd5b614d158e838f01614631565b909850965060808d0135915080821115614d2e57600080fd5b614d3a8e838f01614631565b909650945060a08d0135915080821115614d5357600080fd5b50614d608d828e01614631565b915080935050809150509295989b9194979a5092959850565b60008060008060808587031215614d8f57600080fd5b8435614d9a81614823565b93506020850135614daa81614823565b93969395505050506040820135916060013590565b60008060408385031215614dd257600080fd5b82356001600160401b03811115614de857600080fd5b614df485828601614619565b9250506020830135614c4381614b20565b60a0810160058710614e1957614e196148bb565b95815260208101949094526040840192909252606083015260809091015290565b60008060408385031215614e4d57600080fd5b823591506020830135614c4381614823565b6020808252602c908201527f526f6e696e476f7665726e616e636541646d696e3a2073656e6465722069732060408201526b3737ba1033b7bb32b93737b960a11b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715614ee357614ee3614eab565b60405290565b60405160c081016001600160401b0381118282101715614ee357614ee3614eab565b604051601f8201601f191681016001600160401b0381118282101715614f3357614f33614eab565b604052919050565b60006001600160401b03821115614f5457614f54614eab565b5060051b60200190565b6000614f71614f6c84614f3b565b614f0b565b8381529050602080820190600585901b840186811115614f9057600080fd5b845b818110156150235780356001600160401b0380821115614fb25760008081fd5b8188019150601f8a81840112614fc85760008081fd5b823582811115614fda57614fda614eab565b614feb818301601f19168801614f0b565b92508083528b8782860101111561500457600091508182fd5b8087850188850137600090830187015250855250928201928201614f92565b505050509392505050565b600061164f368484614f5e565b60208082526027908201527f476f7665726e616e636541646d696e3a206f6e6c7920616c6c6f7765642073656040820152661b198b58d85b1b60ca1b606082015260800190565b60208082526024908201527f476f7665726e616e636541646d696e3a2073657420746f206e6f6e2d636f6e746040820152631c9858dd60e21b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115611652576116526150c6565b634e487b7160e01b600052603260045260246000fd5b600060018201615117576151176150c6565b5060010190565b60006020828403121561513057600080fd5b815161164f81614823565b6000808335601e1984360301811261515257600080fd5b8301803591506001600160401b0382111561516c57600080fd5b6020019150600581901b360382131561467557600080fd5b8082028115828204841417611652576116526150c6565b6000813561165281614823565b81358155600160208084013582840155600283016040850135601e198636030181126151d357600080fd5b850180356001600160401b038111156151eb57600080fd5b83820191508060051b360382131561520257600080fd5b600160401b81111561521657615216614eab565b82548184558082101561524a5760008481528581208381019083015b808210156152465782825590880190615232565b5050505b50600092835260208320925b8181101561193e576152678361519b565b84820155918401918501615256565b84815260208082018590526060604083018190528201839052600090849060808401835b868110156152c85783356152ad81614823565b6001600160a01b03168252928201929082019060010161529a565b5098975050505050505050565b60005b838110156152f05781810151838201526020016152d8565b50506000910152565b6000825161530b8184602087016152d5565b9190910192915050565b9485526001600160a01b0393841660208601529190921660408401526060830191909152608082015260a00190565b600082601f83011261535557600080fd5b81356020615365614f6c83614f3b565b82815260059290921b8401810191818101908684111561538457600080fd5b8286015b848110156153a857803561539b81614823565b8352918301918301615388565b509695505050505050565b600082601f8301126153c457600080fd5b813560206153d4614f6c83614f3b565b82815260059290921b840181019181810190868411156153f357600080fd5b8286015b848110156153a857803583529183019183016153f7565b600082601f83011261541f57600080fd5b61164f83833560208501614f5e565b600060e0823603121561544057600080fd5b615448614ec1565b82358152602080840135908201526040808401359082015260608301356001600160401b038082111561547a57600080fd5b61548636838701615344565b6060840152608085013591508082111561549f57600080fd5b6154ab368387016153b3565b608084015260a08501359150808211156154c457600080fd5b6154d03683870161540e565b60a084015260c08501359150808211156154e957600080fd5b506154f6368286016153b3565b60c08301525092915050565b6000815180845261551a8160208601602086016152d5565b601f01601f19169290920160200192915050565b60208152600061164f6020830184615502565b60006020828403121561555357600080fd5b5051919050565b600081518084526020808501945080840160005b838110156148b05781518752958201959082019060010161556e565b600082825180855260208086019550808260051b84010181860160005b848110156155d557601f198684030189526155c3838351615502565b988401989250908301906001016155a7565b5090979650505050505050565b8051825260208101516020830152604081015160408301526000606082015160e0606085015261561560e0850182614877565b90506080830151848203608086015261562e828261555a565b91505060a083015184820360a0860152615648828261558a565b91505060c083015184820360c0860152612641828261555a565b60808152600061567560808301876155e2565b60208681850152838203604085015260c08201865183528187015182840152604087015160c0604085015281815180845260e0860191508483019350600092505b808310156156df5783516156c9816148d1565b82529284019260019290920191908401906156b6565b506060890151935084810360608601526156f9818561555a565b935050505060808601518282036080840152615715828261558a565b91505060a086015182820360a084015261572f828261555a565b935050505061264160608301846001600160a01b03169052565b6020808252602f908201527f476f7665726e616e636541646d696e3a206361737420766f746520666f72206960408201526e1b9d985b1a59081c1c9bdc1bdcd85b608a1b606082015260800190565b600082601f8301126157a957600080fd5b813560206157b9614f6c83614f3b565b82815260059290921b840181019181810190868411156157d857600080fd5b8286015b848110156153a85780356157ef81614b20565b83529183019183016157dc565b600060c0823603121561580e57600080fd5b615816614ee9565b823581526020808401359082015260408301356001600160401b038082111561583e57600080fd5b61584a36838701615798565b6040840152606085013591508082111561586357600080fd5b61586f368387016153b3565b6060840152608085013591508082111561588857600080fd5b6158943683870161540e565b608084015260a08501359150808211156158ad57600080fd5b506158ba368286016153b3565b60a08301525092915050565b60ff811681146105fb57600080fd5b6000602082840312156158e757600080fd5b813561164f816158c6565b81356158fd816158c6565b60ff811660ff198354161782555060208201356001820155604082013560028201555050565b6020808252818101527f436f7265476f7665726e616e63653a20696e76616c696420636861696e206964604082015260600190565b60408152600061596b60408301856155e2565b905060018060a01b03831660208301529392505050565b81810381811115611652576116526150c6565b73024b9b7b630ba32b223b7bb32b93730b731b29d160651b8152600082516159c48160148501602087016152d5565b6d08185b1c9958591e481d9bdd195960921b6014939091019283015250602201919050565b60208082526026908201527f436f7265476f7665726e616e63653a20696e76616c69642070726f706f73616c604082015265206e6f6e636560d01b606082015260800190565b8381526020810183905260608101615a46836148d1565b826040830152949350505050565b600060208284031215615a6657600080fd5b813561164f81614b20565b600060608284031215615a8357600080fd5b604051606081016001600160401b0381118282101715615aa557615aa5614eab565b6040528235615ab3816158c6565b8152602083810135908201526040928301359281019290925250919050565b6f021b7b932a3b7bb32b93730b731b29d160851b815260008251615afd8160108501602087016152d5565b6d08185b1c9958591e481d9bdd195960921b6010939091019283015250601e01919050565b60408101615b2f846148d1565b9281526020015290565b600081615b4857615b486150c6565b506000190190565b604080825283519082018190526000906020906060840190828701845b82811015615b8b578151151584529284019290840190600101615b6d565b50505083810382850152845180825282820190600581901b8301840187850160005b83811015615bdb57601f19868403018552615bc9838351615502565b94870194925090860190600101615bad565b5090999850505050505050505056fea6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49526f6e696e476f7665726e616e636541646d696e3a20717565727920666f7220a57d40f1496988cf60ab7c9d5ba4ff83647f67d3898d441a3aaf21b651678fd9476f7665726e616e636541646d696e3a2070726f78792063616c6c2060676574424f73476f7665726e616e636550726f706f73616c3a20696e76616c69642073771d78ae9e5fca95a532fb0971d575d0ce9b59d14823c063e08740137e0e0ecaa26469706673582212201c35729dcf98c0008f5a87ae846728958d4a922275a1b8f983059093af38632364736f6c63430008110033", + "numDeployments": 7, + "solcInputHash": "2a8db5de0d3bfe0cb40ba15ae8460f16", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_roninChainId\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_roninTrustedOrganizationContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bridgeContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_proposalExpiryDuration\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeBridgeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeRoninTrustedOrgContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"methodSignature\",\"type\":\"bytes4\"}],\"name\":\"ErrProxyCallFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"BridgeContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"_operators\",\"type\":\"address[]\"}],\"name\":\"BridgeOperatorsApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_voteHash\",\"type\":\"bytes32\"}],\"name\":\"EmergencyExitPollApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_voteHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"_recipientAfterUnlockedFund\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_requestedAt\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_expiredAt\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitPollCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_voteHash\",\"type\":\"bytes32\"}],\"name\":\"EmergencyExitPollExpired\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"round\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"indexed\":false,\"internalType\":\"struct Proposal.ProposalDetail\",\"name\":\"proposal\",\"type\":\"tuple\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"globalProposalHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"enum GlobalProposal.TargetOption[]\",\"name\":\"targetOptions\",\"type\":\"uint8[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"indexed\":false,\"internalType\":\"struct GlobalProposal.GlobalProposalDetail\",\"name\":\"globalProposal\",\"type\":\"tuple\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"GlobalProposalCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"}],\"name\":\"ProposalApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"round\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"indexed\":false,\"internalType\":\"struct Proposal.ProposalDetail\",\"name\":\"proposal\",\"type\":\"tuple\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"creator\",\"type\":\"address\"}],\"name\":\"ProposalCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bool[]\",\"name\":\"successCalls\",\"type\":\"bool[]\"},{\"indexed\":false,\"internalType\":\"bytes[]\",\"name\":\"returnDatas\",\"type\":\"bytes[]\"}],\"name\":\"ProposalExecuted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"}],\"name\":\"ProposalExpired\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"}],\"name\":\"ProposalRejected\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"proposalHash\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"voter\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"enum Ballot.VoteType\",\"name\":\"support\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"}],\"name\":\"ProposalVoted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"RoninTrustedOrganizationContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DOMAIN_SEPARATOR\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bridgeContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"bridgeOperatorsVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"enum GlobalProposal.TargetOption[]\",\"name\":\"targetOptions\",\"type\":\"uint8[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"internalType\":\"struct GlobalProposal.GlobalProposalDetail\",\"name\":\"_globalProposal\",\"type\":\"tuple\"},{\"internalType\":\"enum Ballot.VoteType[]\",\"name\":\"_supports\",\"type\":\"uint8[]\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"name\":\"castGlobalProposalBySignatures\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"internalType\":\"struct Proposal.ProposalDetail\",\"name\":\"_proposal\",\"type\":\"tuple\"},{\"internalType\":\"enum Ballot.VoteType[]\",\"name\":\"_supports\",\"type\":\"uint8[]\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"name\":\"castProposalBySignatures\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"internalType\":\"struct Proposal.ProposalDetail\",\"name\":\"_proposal\",\"type\":\"tuple\"},{\"internalType\":\"enum Ballot.VoteType\",\"name\":\"_support\",\"type\":\"uint8\"}],\"name\":\"castProposalVoteForCurrentNetwork\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_proxy\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_newAdmin\",\"type\":\"address\"}],\"name\":\"changeProxyAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_recipientAfterUnlockedFund\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_requestedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_expiredAt\",\"type\":\"uint256\"}],\"name\":\"createEmergencyExitPoll\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"}],\"name\":\"deleteExpired\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_voteHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"emergencyPollVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"getBridgeOperatorVotingSignatures\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_voters\",\"type\":\"address[]\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getProposalExpiryDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"}],\"name\":\"getProposalSignatures\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_voters\",\"type\":\"address[]\"},{\"internalType\":\"enum Ballot.VoteType[]\",\"name\":\"_supports\",\"type\":\"uint8[]\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_proxy\",\"type\":\"address\"}],\"name\":\"getProxyAdmin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_proxy\",\"type\":\"address\"}],\"name\":\"getProxyImplementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastSyncedBridgeOperatorSetInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"operators\",\"type\":\"address[]\"}],\"internalType\":\"struct BridgeOperatorsBallot.BridgeOperatorSet\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bridgeVoter\",\"type\":\"address\"}],\"name\":\"lastVotedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_round\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_voter\",\"type\":\"address\"}],\"name\":\"proposalVoted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_gasAmounts\",\"type\":\"uint256[]\"}],\"name\":\"propose\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"enum GlobalProposal.TargetOption[]\",\"name\":\"_targetOptions\",\"type\":\"uint8[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_gasAmounts\",\"type\":\"uint256[]\"}],\"name\":\"proposeGlobal\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"enum GlobalProposal.TargetOption[]\",\"name\":\"targetOptions\",\"type\":\"uint8[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"internalType\":\"struct GlobalProposal.GlobalProposalDetail\",\"name\":\"_globalProposal\",\"type\":\"tuple\"},{\"internalType\":\"enum Ballot.VoteType[]\",\"name\":\"_supports\",\"type\":\"uint8[]\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"name\":\"proposeGlobalProposalStructAndCastVotes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"_targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"_calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_gasAmounts\",\"type\":\"uint256[]\"},{\"internalType\":\"enum Ballot.VoteType\",\"name\":\"_support\",\"type\":\"uint8\"}],\"name\":\"proposeProposalForCurrentNetwork\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"chainId\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"targets\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"values\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes[]\",\"name\":\"calldatas\",\"type\":\"bytes[]\"},{\"internalType\":\"uint256[]\",\"name\":\"gasAmounts\",\"type\":\"uint256[]\"}],\"internalType\":\"struct Proposal.ProposalDetail\",\"name\":\"_proposal\",\"type\":\"tuple\"},{\"internalType\":\"enum Ballot.VoteType[]\",\"name\":\"_supports\",\"type\":\"uint8[]\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"name\":\"proposeProposalStructAndCastVotes\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninChainId\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninTrustedOrganizationContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"round\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setBridgeContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_expiryDuration\",\"type\":\"uint256\"}],\"name\":\"setProposalExpiryDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setRoninTrustedOrganizationContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"vote\",\"outputs\":[{\"internalType\":\"enum VoteStatusConsumer.VoteStatus\",\"name\":\"status\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"hash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"againstVoteWeight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"forVoteWeight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"expiryTimestamp\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"internalType\":\"address[]\",\"name\":\"operators\",\"type\":\"address[]\"}],\"internalType\":\"struct BridgeOperatorsBallot.BridgeOperatorSet\",\"name\":\"_ballot\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct SignatureConsumer.Signature[]\",\"name\":\"_signatures\",\"type\":\"tuple[]\"}],\"name\":\"voteBridgeOperatorsBySignatures\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"_voteHash\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_recipientAfterUnlockedFund\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_requestedAt\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_expiredAt\",\"type\":\"uint256\"}],\"name\":\"voteEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallerMustBeBridgeContract()\":[{\"details\":\"Error of method caller must be bridge contract.\"}],\"ErrCallerMustBeRoninTrustedOrgContract()\":[{\"details\":\"Error of method caller must be Ronin trusted org contract.\"}],\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"bridgeContract()\":{\"details\":\"Returns the bridge contract.\"},\"bridgeOperatorsVoted(uint256,uint256,address)\":{\"details\":\"Returns whether the voter `_voter` casted vote for bridge operators at a specific period.\"},\"castGlobalProposalBySignatures((uint256,uint256,uint8[],uint256[],bytes[],uint256[]),uint8[],(uint8,bytes32,bytes32)[])\":{\"details\":\"See `GovernanceProposal-_castGlobalProposalBySignatures`.\"},\"castProposalBySignatures((uint256,uint256,uint256,address[],uint256[],bytes[],uint256[]),uint8[],(uint8,bytes32,bytes32)[])\":{\"details\":\"See `GovernanceProposal-_castProposalBySignatures`.\"},\"castProposalVoteForCurrentNetwork((uint256,uint256,uint256,address[],uint256[],bytes[],uint256[]),uint8)\":{\"details\":\"Casts vote for a proposal on the current network. Requirements: - The method caller is governor.\"},\"changeProxyAdmin(address,address)\":{\"details\":\"Changes the admin of `_proxy` to `newAdmin`. Requirements: - This contract must be the current admin of `_proxy`.\"},\"createEmergencyExitPoll(address,address,uint256,uint256)\":{\"details\":\"Create a vote to agree that an emergency exit is valid and should return the locked funds back.a Requirements: - The method caller is validator contract.\"},\"deleteExpired(uint256,uint256)\":{\"details\":\"Deletes the expired proposal by its chainId and nonce, without creating a new proposal. Requirements: - The proposal is already created.\"},\"emergencyPollVoted(bytes32,address)\":{\"details\":\"Returns whether the voter casted vote for emergency exit poll.\"},\"getBridgeOperatorVotingSignatures(uint256,uint256)\":{\"details\":\"Returns the voted signatures for bridge operators at a specific period.\"},\"getProposalExpiryDuration()\":{\"details\":\"Returns the proposal expiry duration.\"},\"getProposalSignatures(uint256,uint256)\":{\"details\":\"Returns the voted signatures for the proposals. Note: The signatures can be empty in case the proposal is voted on the current network.\"},\"getProxyAdmin(address)\":{\"details\":\"Returns the current admin of `_proxy`. Requirements: - This contract must be the admin of `_proxy`.\"},\"getProxyImplementation(address)\":{\"details\":\"Returns the current implementation of `_proxy`. Requirements: - This contract must be the admin of `_proxy`.\"},\"lastSyncedBridgeOperatorSetInfo()\":{\"details\":\"Returns the synced bridge operator set info.\"},\"lastVotedBlock(address)\":{\"details\":\"Returns the last voted block of the bridge voter.\"},\"proposalVoted(uint256,uint256,address)\":{\"details\":\"Returns whether the voter `_voter` casted vote for the proposal.\"},\"propose(uint256,uint256,address[],uint256[],bytes[],uint256[])\":{\"details\":\"See `CoreGovernance-_proposeProposal`. Requirements: - The method caller is governor.\"},\"proposeGlobal(uint256,uint8[],uint256[],bytes[],uint256[])\":{\"details\":\"See `CoreGovernance-_proposeGlobal`. Requirements: - The method caller is governor.\"},\"proposeGlobalProposalStructAndCastVotes((uint256,uint256,uint8[],uint256[],bytes[],uint256[]),uint8[],(uint8,bytes32,bytes32)[])\":{\"details\":\"See `GovernanceProposal-_proposeGlobalProposalStructAndCastVotes`. Requirements: - The method caller is governor.\"},\"proposeProposalForCurrentNetwork(uint256,address[],uint256[],bytes[],uint256[],uint8)\":{\"details\":\"Proposes and casts vote for a proposal on the current network. Requirements: - The method caller is governor. - The proposal is for the current network.\"},\"proposeProposalStructAndCastVotes((uint256,uint256,uint256,address[],uint256[],bytes[],uint256[]),uint8[],(uint8,bytes32,bytes32)[])\":{\"details\":\"See `GovernanceProposal-_proposeProposalStructAndCastVotes`. Requirements: - The method caller is governor. - The proposal is for the current network.\"},\"roninTrustedOrganizationContract()\":{\"details\":\"Returns the ronin trusted organization contract.\"},\"setBridgeContract(address)\":{\"details\":\"Sets the bridge contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `BridgeContractUpdated`.\"},\"setProposalExpiryDuration(uint256)\":{\"details\":\"Sets the expiry duration for a new proposal. Requirements: - Only allowing self-call to this method, since this contract does not have admin.\"},\"setRoninTrustedOrganizationContract(address)\":{\"details\":\"Sets the ronin trusted organization contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `RoninTrustedOrganizationContractUpdated`.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"},\"voteBridgeOperatorsBySignatures((uint256,uint256,address[]),(uint8,bytes32,bytes32)[])\":{\"details\":\"See `BOsGovernanceProposal-_castVotesBySignatures`.\"},\"voteEmergencyExit(bytes32,address,address,uint256,uint256)\":{\"details\":\"Votes for an emergency exit. Executes to unlock fund for the emergency exit's requester. Requirements: - The voter is governor. - The voting is existent. - The voting is not expired yet.\"}},\"stateVariables\":{\"_emergencyExitPoll\":{\"details\":\"Mapping from request hash => emergency poll\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"round(uint256)\":{\"notice\":\"chain id = 0 for global proposal\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/RoninGovernanceAdmin.sol\":\"RoninGovernanceAdmin\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":0},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xdb7f5c28fc61cda0bd8ab60ce288e206b791643bcd3ba464a70cbec18895a2f5\",\"license\":\"MIT\"},\"contracts/extensions/GovernanceAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../extensions/sequential-governance/CoreGovernance.sol\\\";\\nimport \\\"../extensions/collections/HasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../extensions/collections/HasBridgeContract.sol\\\";\\nimport \\\"../interfaces/IRoninTrustedOrganization.sol\\\";\\n\\nabstract contract GovernanceAdmin is CoreGovernance, HasRoninTrustedOrganizationContract, HasBridgeContract {\\n uint256 public roninChainId;\\n /// @dev Domain separator\\n bytes32 public DOMAIN_SEPARATOR;\\n\\n error ErrProxyCallFailed(bytes4 methodSignature);\\n\\n modifier onlySelfCall() {\\n require(msg.sender == address(this), \\\"GovernanceAdmin: only allowed self-call\\\");\\n _;\\n }\\n\\n constructor(\\n uint256 _roninChainId,\\n address _roninTrustedOrganizationContract,\\n address _bridgeContract,\\n uint256 _proposalExpiryDuration\\n ) CoreGovernance(_proposalExpiryDuration) {\\n roninChainId = _roninChainId;\\n DOMAIN_SEPARATOR = keccak256(\\n abi.encode(\\n keccak256(\\\"EIP712Domain(string name,string version,bytes32 salt)\\\"),\\n keccak256(\\\"GovernanceAdmin\\\"), // name hash\\n keccak256(\\\"2\\\"), // version hash\\n keccak256(abi.encode(\\\"RONIN_GOVERNANCE_ADMIN\\\", _roninChainId)) // salt\\n )\\n );\\n _setRoninTrustedOrganizationContract(_roninTrustedOrganizationContract);\\n _setBridgeContract(_bridgeContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function setRoninTrustedOrganizationContract(address _addr) external override onlySelfCall {\\n require(_addr.code.length > 0, \\\"GovernanceAdmin: set to non-contract\\\");\\n _setRoninTrustedOrganizationContract(_addr);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeContract\\n */\\n function setBridgeContract(address _addr) external override onlySelfCall {\\n require(_addr.code.length > 0, \\\"GovernanceAdmin: set to non-contract\\\");\\n _setBridgeContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the expiry duration for a new proposal.\\n *\\n * Requirements:\\n * - Only allowing self-call to this method, since this contract does not have admin.\\n *\\n */\\n function setProposalExpiryDuration(uint256 _expiryDuration) external onlySelfCall {\\n _setProposalExpiryDuration(_expiryDuration);\\n }\\n\\n /**\\n * @dev Returns the current implementation of `_proxy`.\\n *\\n * Requirements:\\n * - This contract must be the admin of `_proxy`.\\n *\\n */\\n function getProxyImplementation(address _proxy) external view returns (address) {\\n // We need to manually run the static call since the getter cannot be flagged as view\\n // bytes4(keccak256(\\\"implementation()\\\")) == 0x5c60da1b\\n bytes4 _selector = 0x5c60da1b;\\n (bool _success, bytes memory _returndata) = _proxy.staticcall(abi.encodeWithSelector(_selector));\\n if (!_success) revert ErrProxyCallFailed(_selector);\\n return abi.decode(_returndata, (address));\\n }\\n\\n /**\\n * @dev Returns the proposal expiry duration.\\n */\\n function getProposalExpiryDuration() external view returns (uint256) {\\n return super._getProposalExpiryDuration();\\n }\\n\\n /**\\n * @dev Returns the current admin of `_proxy`.\\n *\\n * Requirements:\\n * - This contract must be the admin of `_proxy`.\\n *\\n */\\n function getProxyAdmin(address _proxy) external view returns (address) {\\n // We need to manually run the static call since the getter cannot be flagged as view\\n // bytes4(keccak256(\\\"admin()\\\")) == 0xf851a440\\n bytes4 _selector = 0xf851a440;\\n (bool _success, bytes memory _returndata) = _proxy.staticcall(abi.encodeWithSelector(_selector));\\n if (!_success) revert ErrProxyCallFailed(_selector);\\n return abi.decode(_returndata, (address));\\n }\\n\\n /**\\n * @dev Changes the admin of `_proxy` to `newAdmin`.\\n *\\n * Requirements:\\n * - This contract must be the current admin of `_proxy`.\\n *\\n */\\n function changeProxyAdmin(address _proxy, address _newAdmin) external onlySelfCall {\\n // bytes4(keccak256(\\\"changeAdmin(address)\\\"))\\n bytes4 _selector = 0x8f283970;\\n (bool _success, ) = _proxy.call(abi.encodeWithSelector(_selector, _newAdmin));\\n if (!_success) revert ErrProxyCallFailed(_selector);\\n }\\n\\n /**\\n * @dev Override `CoreGovernance-_getMinimumVoteWeight`.\\n */\\n function _getMinimumVoteWeight() internal view virtual override returns (uint256) {\\n bytes4 _selector = IQuorum.minimumVoteWeight.selector;\\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\\n abi.encodeWithSelector(\\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\\n 0x4bb5274a,\\n abi.encodeWithSelector(_selector)\\n )\\n );\\n if (!_success) revert ErrProxyCallFailed(_selector);\\n return abi.decode(_returndata, (uint256));\\n }\\n\\n /**\\n * @dev Override `CoreGovernance-_getTotalWeights`.\\n */\\n function _getTotalWeights() internal view virtual override returns (uint256) {\\n bytes4 _selector = IRoninTrustedOrganization.totalWeights.selector;\\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\\n abi.encodeWithSelector(\\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\\n 0x4bb5274a,\\n abi.encodeWithSelector(_selector)\\n )\\n );\\n if (!_success) revert ErrProxyCallFailed(_selector);\\n return abi.decode(_returndata, (uint256));\\n }\\n}\\n\",\"keccak256\":\"0xbff249fe2d4abc0be822b6ec1f33d1575e0813c58c017d12aef028c253171eb6\",\"license\":\"MIT\"},\"contracts/extensions/bridge-operator-governance/BOsGovernanceProposal.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../../interfaces/consumers/SignatureConsumer.sol\\\";\\nimport \\\"../../libraries/BridgeOperatorsBallot.sol\\\";\\nimport \\\"../../interfaces/IRoninGovernanceAdmin.sol\\\";\\nimport \\\"../../libraries/IsolatedGovernance.sol\\\";\\n\\nabstract contract BOsGovernanceProposal is SignatureConsumer, IRoninGovernanceAdmin {\\n using IsolatedGovernance for IsolatedGovernance.Vote;\\n\\n /// @dev The last the brige operator set info.\\n BridgeOperatorsBallot.BridgeOperatorSet internal _lastSyncedBridgeOperatorSetInfo;\\n /// @dev Mapping from period index => epoch index => bridge operators vote\\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) internal _bridgeOperatorVote;\\n /// @dev Mapping from bridge voter address => last block that the address voted\\n mapping(address => uint256) internal _lastVotedBlock;\\n /// @dev Mapping from period index => epoch index => voter => bridge voter signatures\\n mapping(uint256 => mapping(uint256 => mapping(address => Signature))) internal _bridgeVoterSig;\\n\\n /**\\n * @inheritdoc IRoninGovernanceAdmin\\n */\\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256) {\\n return _lastVotedBlock[_bridgeVoter];\\n }\\n\\n /**\\n * @inheritdoc IRoninGovernanceAdmin\\n */\\n function lastSyncedBridgeOperatorSetInfo() external view returns (BridgeOperatorsBallot.BridgeOperatorSet memory) {\\n return _lastSyncedBridgeOperatorSetInfo;\\n }\\n\\n /**\\n * @dev Votes for a set of bridge operators by signatures.\\n *\\n * Requirements:\\n * - The period of voting is larger than the last synced period.\\n * - The arrays are not empty.\\n * - The signature signers are in order.\\n *\\n */\\n function _castBOVotesBySignatures(\\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\\n Signature[] calldata _signatures,\\n uint256 _minimumVoteWeight,\\n bytes32 _domainSeperator\\n ) internal {\\n require(\\n _ballot.period >= _lastSyncedBridgeOperatorSetInfo.period &&\\n _ballot.epoch >= _lastSyncedBridgeOperatorSetInfo.epoch,\\n \\\"BOsGovernanceProposal: query for outdated bridge operator set\\\"\\n );\\n BridgeOperatorsBallot.verifyBallot(_ballot);\\n require(_signatures.length > 0, \\\"BOsGovernanceProposal: invalid array length\\\");\\n\\n address _signer;\\n address _lastSigner;\\n bytes32 _hash = BridgeOperatorsBallot.hash(_ballot);\\n bytes32 _digest = ECDSA.toTypedDataHash(_domainSeperator, _hash);\\n IsolatedGovernance.Vote storage _v = _bridgeOperatorVote[_ballot.period][_ballot.epoch];\\n mapping(address => Signature) storage _sigMap = _bridgeVoterSig[_ballot.period][_ballot.epoch];\\n bool _hasValidVotes;\\n\\n for (uint256 _i; _i < _signatures.length; _i++) {\\n // Avoids stack too deeps\\n {\\n Signature calldata _sig = _signatures[_i];\\n _signer = ECDSA.recover(_digest, _sig.v, _sig.r, _sig.s);\\n require(_lastSigner < _signer, \\\"BOsGovernanceProposal: invalid signer order\\\");\\n _lastSigner = _signer;\\n }\\n\\n if (_isBridgeVoter(_signer)) {\\n _hasValidVotes = true;\\n _lastVotedBlock[_signer] = block.number;\\n _sigMap[_signer] = _signatures[_i];\\n _v.castVote(_signer, _hash);\\n }\\n }\\n\\n require(_hasValidVotes, \\\"BOsGovernanceProposal: invalid signatures\\\");\\n address[] memory _filteredVoters = _v.filterByHash(_hash);\\n _v.syncVoteStatus(_minimumVoteWeight, _sumBridgeVoterWeights(_filteredVoters), 0, 0, _hash);\\n }\\n\\n /**\\n * @dev Returns whether the address is the bridge voter.\\n */\\n function _isBridgeVoter(address) internal view virtual returns (bool);\\n\\n /**\\n * @dev Returns the weight of many bridge voters.\\n */\\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x05e0ac44abb0504f79842e2a31ddbf6ad196bfe364d49ca813f4669e5d8a241a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasBridgeContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasBridgeContract.sol\\\";\\nimport \\\"../../interfaces/IBridge.sol\\\";\\n\\ncontract HasBridgeContract is IHasBridgeContract, HasProxyAdmin {\\n IBridge internal _bridgeContract;\\n\\n modifier onlyBridgeContract() {\\n if (bridgeContract() != msg.sender) revert ErrCallerMustBeBridgeContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeContract\\n */\\n function bridgeContract() public view override returns (address) {\\n return address(_bridgeContract);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeContract\\n */\\n function setBridgeContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length <= 0) revert ErrZeroCodeContract();\\n _setBridgeContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the bridge contract.\\n *\\n * Emits the event `BridgeContractUpdated`.\\n *\\n */\\n function _setBridgeContract(address _addr) internal {\\n _bridgeContract = IBridge(_addr);\\n emit BridgeContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x6fabd1a69eb4391793a28f0d5449f4662b7e7eaf3d9ca87554ccbc77e2b099f9\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\n\\ncontract HasRoninTrustedOrganizationContract is IHasRoninTrustedOrganizationContract, HasProxyAdmin {\\n IRoninTrustedOrganization internal _roninTrustedOrganizationContract;\\n\\n modifier onlyRoninTrustedOrganizationContract() {\\n if (roninTrustedOrganizationContract() != msg.sender) revert ErrCallerMustBeRoninTrustedOrgContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function roninTrustedOrganizationContract() public view override returns (address) {\\n return address(_roninTrustedOrganizationContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function setRoninTrustedOrganizationContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setRoninTrustedOrganizationContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function _setRoninTrustedOrganizationContract(address _addr) internal {\\n _roninTrustedOrganizationContract = IRoninTrustedOrganization(_addr);\\n emit RoninTrustedOrganizationContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x951fd730f4853d8c932da5484ea093f3094c8186735b603d31fb53035c395751\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/extensions/sequential-governance/CoreGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"../../libraries/Proposal.sol\\\";\\nimport \\\"../../libraries/GlobalProposal.sol\\\";\\nimport \\\"../../libraries/Ballot.sol\\\";\\nimport \\\"../../interfaces/consumers/ChainTypeConsumer.sol\\\";\\nimport \\\"../../interfaces/consumers/SignatureConsumer.sol\\\";\\nimport \\\"../../interfaces/consumers/VoteStatusConsumer.sol\\\";\\n\\nabstract contract CoreGovernance is SignatureConsumer, VoteStatusConsumer, ChainTypeConsumer {\\n using Proposal for Proposal.ProposalDetail;\\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\\n\\n struct ProposalVote {\\n VoteStatus status;\\n bytes32 hash;\\n uint256 againstVoteWeight; // Total weight of against votes\\n uint256 forVoteWeight; // Total weight of for votes\\n address[] forVoteds; // Array of addresses voting for\\n address[] againstVoteds; // Array of addresses voting against\\n uint256 expiryTimestamp;\\n mapping(address => Signature) sig;\\n mapping(address => bool) voted;\\n }\\n\\n /// @dev Emitted when a proposal is created\\n event ProposalCreated(\\n uint256 indexed chainId,\\n uint256 indexed round,\\n bytes32 indexed proposalHash,\\n Proposal.ProposalDetail proposal,\\n address creator\\n );\\n /// @dev Emitted when a proposal is created\\n event GlobalProposalCreated(\\n uint256 indexed round,\\n bytes32 indexed proposalHash,\\n Proposal.ProposalDetail proposal,\\n bytes32 globalProposalHash,\\n GlobalProposal.GlobalProposalDetail globalProposal,\\n address creator\\n );\\n /// @dev Emitted when the proposal is voted\\n event ProposalVoted(bytes32 indexed proposalHash, address indexed voter, Ballot.VoteType support, uint256 weight);\\n /// @dev Emitted when the proposal is approved\\n event ProposalApproved(bytes32 indexed proposalHash);\\n /// @dev Emitted when the vote is reject\\n event ProposalRejected(bytes32 indexed proposalHash);\\n /// @dev Emitted when the vote is expired\\n event ProposalExpired(bytes32 indexed proposalHash);\\n /// @dev Emitted when the proposal is executed\\n event ProposalExecuted(bytes32 indexed proposalHash, bool[] successCalls, bytes[] returnDatas);\\n\\n /// @dev Mapping from chain id => vote round\\n /// @notice chain id = 0 for global proposal\\n mapping(uint256 => uint256) public round;\\n /// @dev Mapping from chain id => vote round => proposal vote\\n mapping(uint256 => mapping(uint256 => ProposalVote)) public vote;\\n\\n uint256 private _proposalExpiryDuration;\\n\\n constructor(uint256 _expiryDuration) {\\n _setProposalExpiryDuration(_expiryDuration);\\n }\\n\\n /**\\n * @dev Creates new voting round by calculating the `_round` number of chain `_chainId`.\\n * Increases the `_round` number if the previous one is not expired. Delete the previous proposal\\n * if it is expired and not increase the `_round`.\\n */\\n function _createVotingRound(uint256 _chainId) internal returns (uint256 _round) {\\n _round = round[_chainId];\\n // Skip checking for the first ever round\\n if (_round == 0) {\\n _round = round[_chainId] = 1;\\n } else {\\n ProposalVote storage _latestProposalVote = vote[_chainId][_round];\\n bool _isExpired = _tryDeleteExpiredVotingRound(_latestProposalVote);\\n // Skip increasing round number if the latest round is expired, allow the vote to be overridden\\n if (!_isExpired) {\\n require(_latestProposalVote.status != VoteStatus.Pending, \\\"CoreGovernance: current proposal is not completed\\\");\\n _round = ++round[_chainId];\\n }\\n }\\n }\\n\\n /**\\n * @dev Saves new round voting for the proposal `_proposalHash` of chain `_chainId`.\\n */\\n function _saveVotingRound(\\n ProposalVote storage _vote,\\n bytes32 _proposalHash,\\n uint256 _expiryTimestamp\\n ) internal {\\n _vote.hash = _proposalHash;\\n _vote.expiryTimestamp = _expiryTimestamp;\\n }\\n\\n /**\\n * @dev Proposes for a new proposal.\\n *\\n * Requirements:\\n * - The chain id is not equal to 0.\\n *\\n * Emits the `ProposalCreated` event.\\n *\\n */\\n function _proposeProposal(\\n uint256 _chainId,\\n uint256 _expiryTimestamp,\\n address[] memory _targets,\\n uint256[] memory _values,\\n bytes[] memory _calldatas,\\n uint256[] memory _gasAmounts,\\n address _creator\\n ) internal virtual returns (Proposal.ProposalDetail memory _proposal) {\\n require(_chainId != 0, \\\"CoreGovernance: invalid chain id\\\");\\n uint256 _round = _createVotingRound(_chainId);\\n\\n _proposal = Proposal.ProposalDetail(_round, _chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts);\\n _proposal.validate(_proposalExpiryDuration);\\n\\n bytes32 _proposalHash = _proposal.hash();\\n _saveVotingRound(vote[_chainId][_round], _proposalHash, _expiryTimestamp);\\n emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator);\\n }\\n\\n /**\\n * @dev Proposes proposal struct.\\n *\\n * Requirements:\\n * - The chain id is not equal to 0.\\n * - The proposal nonce is equal to the new round.\\n *\\n * Emits the `ProposalCreated` event.\\n *\\n */\\n function _proposeProposalStruct(Proposal.ProposalDetail memory _proposal, address _creator)\\n internal\\n virtual\\n returns (uint256 _round)\\n {\\n uint256 _chainId = _proposal.chainId;\\n require(_chainId != 0, \\\"CoreGovernance: invalid chain id\\\");\\n _proposal.validate(_proposalExpiryDuration);\\n\\n bytes32 _proposalHash = _proposal.hash();\\n _round = _createVotingRound(_chainId);\\n _saveVotingRound(vote[_chainId][_round], _proposalHash, _proposal.expiryTimestamp);\\n require(_round == _proposal.nonce, \\\"CoreGovernance: invalid proposal nonce\\\");\\n emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator);\\n }\\n\\n /**\\n * @dev Proposes for a global proposal.\\n *\\n * Emits the `GlobalProposalCreated` event.\\n *\\n */\\n function _proposeGlobal(\\n uint256 _expiryTimestamp,\\n GlobalProposal.TargetOption[] calldata _targetOptions,\\n uint256[] memory _values,\\n bytes[] memory _calldatas,\\n uint256[] memory _gasAmounts,\\n address _roninTrustedOrganizationContract,\\n address _gatewayContract,\\n address _creator\\n ) internal virtual {\\n uint256 _round = _createVotingRound(0);\\n GlobalProposal.GlobalProposalDetail memory _globalProposal = GlobalProposal.GlobalProposalDetail(\\n _round,\\n _expiryTimestamp,\\n _targetOptions,\\n _values,\\n _calldatas,\\n _gasAmounts\\n );\\n Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail(\\n _roninTrustedOrganizationContract,\\n _gatewayContract\\n );\\n _proposal.validate(_proposalExpiryDuration);\\n\\n bytes32 _proposalHash = _proposal.hash();\\n _saveVotingRound(vote[0][_round], _proposalHash, _expiryTimestamp);\\n emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator);\\n }\\n\\n /**\\n * @dev Proposes global proposal struct.\\n *\\n * Requirements:\\n * - The proposal nonce is equal to the new round.\\n *\\n * Emits the `GlobalProposalCreated` event.\\n *\\n */\\n function _proposeGlobalStruct(\\n GlobalProposal.GlobalProposalDetail memory _globalProposal,\\n address _roninTrustedOrganizationContract,\\n address _gatewayContract,\\n address _creator\\n ) internal virtual returns (Proposal.ProposalDetail memory _proposal) {\\n _proposal = _globalProposal.into_proposal_detail(_roninTrustedOrganizationContract, _gatewayContract);\\n _proposal.validate(_proposalExpiryDuration);\\n\\n bytes32 _proposalHash = _proposal.hash();\\n uint256 _round = _createVotingRound(0);\\n _saveVotingRound(vote[0][_round], _proposalHash, _globalProposal.expiryTimestamp);\\n require(_round == _proposal.nonce, \\\"CoreGovernance: invalid proposal nonce\\\");\\n emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator);\\n }\\n\\n /**\\n * @dev Casts vote for the proposal with data and returns whether the voting is done.\\n *\\n * Requirements:\\n * - The proposal nonce is equal to the round.\\n * - The vote is not finalized.\\n * - The voter has not voted for the round.\\n *\\n * Emits the `ProposalVoted` event. Emits the `ProposalApproved`, `ProposalExecuted` or `ProposalRejected` once the\\n * proposal is approved, executed or rejected.\\n *\\n */\\n function _castVote(\\n Proposal.ProposalDetail memory _proposal,\\n Ballot.VoteType _support,\\n uint256 _minimumForVoteWeight,\\n uint256 _minimumAgainstVoteWeight,\\n address _voter,\\n Signature memory _signature,\\n uint256 _voterWeight\\n ) internal virtual returns (bool _done) {\\n uint256 _chainId = _proposal.chainId;\\n uint256 _round = _proposal.nonce;\\n ProposalVote storage _vote = vote[_chainId][_round];\\n\\n if (_tryDeleteExpiredVotingRound(_vote)) {\\n return true;\\n }\\n\\n require(round[_proposal.chainId] == _round, \\\"CoreGovernance: query for invalid proposal nonce\\\");\\n require(_vote.status == VoteStatus.Pending, \\\"CoreGovernance: the vote is finalized\\\");\\n if (_voted(_vote, _voter)) {\\n revert(string(abi.encodePacked(\\\"CoreGovernance: \\\", Strings.toHexString(uint160(_voter), 20), \\\" already voted\\\")));\\n }\\n\\n _vote.voted[_voter] = true;\\n // Stores the signature if it is not empty\\n if (_signature.r > 0 || _signature.s > 0 || _signature.v > 0) {\\n _vote.sig[_voter] = _signature;\\n }\\n emit ProposalVoted(_vote.hash, _voter, _support, _voterWeight);\\n\\n uint256 _forVoteWeight;\\n uint256 _againstVoteWeight;\\n if (_support == Ballot.VoteType.For) {\\n _vote.forVoteds.push(_voter);\\n _forVoteWeight = _vote.forVoteWeight += _voterWeight;\\n } else if (_support == Ballot.VoteType.Against) {\\n _vote.againstVoteds.push(_voter);\\n _againstVoteWeight = _vote.againstVoteWeight += _voterWeight;\\n } else {\\n revert(\\\"CoreGovernance: unsupported vote type\\\");\\n }\\n\\n if (_forVoteWeight >= _minimumForVoteWeight) {\\n _done = true;\\n _vote.status = VoteStatus.Approved;\\n emit ProposalApproved(_vote.hash);\\n _tryExecute(_vote, _proposal);\\n } else if (_againstVoteWeight >= _minimumAgainstVoteWeight) {\\n _done = true;\\n _vote.status = VoteStatus.Rejected;\\n emit ProposalRejected(_vote.hash);\\n }\\n }\\n\\n /**\\n * @dev When the contract is on Ronin chain, checks whether the proposal is expired and delete it if is expired.\\n *\\n * Emits the event `ProposalExpired` if the vote is expired.\\n *\\n * Note: This function assumes the vote `_proposalVote` is already created, consider verifying the vote's existence\\n * before or it will emit an unexpected event of `ProposalExpired`.\\n */\\n function _tryDeleteExpiredVotingRound(ProposalVote storage _proposalVote) internal returns (bool _isExpired) {\\n _isExpired =\\n _getChainType() == ChainType.RoninChain &&\\n _proposalVote.status == VoteStatus.Pending &&\\n _proposalVote.expiryTimestamp <= block.timestamp;\\n\\n if (_isExpired) {\\n emit ProposalExpired(_proposalVote.hash);\\n\\n for (uint256 _i; _i < _proposalVote.forVoteds.length; _i++) {\\n delete _proposalVote.voted[_proposalVote.forVoteds[_i]];\\n delete _proposalVote.sig[_proposalVote.forVoteds[_i]];\\n }\\n for (uint256 _i; _i < _proposalVote.againstVoteds.length; _i++) {\\n delete _proposalVote.voted[_proposalVote.againstVoteds[_i]];\\n delete _proposalVote.sig[_proposalVote.againstVoteds[_i]];\\n }\\n delete _proposalVote.status;\\n delete _proposalVote.hash;\\n delete _proposalVote.againstVoteWeight;\\n delete _proposalVote.forVoteWeight;\\n delete _proposalVote.forVoteds;\\n delete _proposalVote.againstVoteds;\\n delete _proposalVote.expiryTimestamp;\\n }\\n }\\n\\n /**\\n * @dev Executes the proposal and update the vote status once the proposal is executable.\\n */\\n function _tryExecute(ProposalVote storage _vote, Proposal.ProposalDetail memory _proposal) internal {\\n if (_proposal.executable()) {\\n _vote.status = VoteStatus.Executed;\\n (bool[] memory _successCalls, bytes[] memory _returnDatas) = _proposal.execute();\\n emit ProposalExecuted(_vote.hash, _successCalls, _returnDatas);\\n }\\n }\\n\\n /**\\n * @dev Sets the expiry duration for a new proposal.\\n */\\n function _setProposalExpiryDuration(uint256 _expiryDuration) internal {\\n _proposalExpiryDuration = _expiryDuration;\\n }\\n\\n /**\\n * @dev Returns whether the voter casted for the proposal.\\n */\\n function _voted(ProposalVote storage _vote, address _voter) internal view returns (bool) {\\n return _vote.voted[_voter];\\n }\\n\\n /**\\n * @dev Returns the expiry duration for a new proposal.\\n */\\n function _getProposalExpiryDuration() internal view returns (uint256) {\\n return _proposalExpiryDuration;\\n }\\n\\n /**\\n * @dev Returns total weight from validators.\\n */\\n function _getTotalWeights() internal view virtual returns (uint256);\\n\\n /**\\n * @dev Returns minimum vote to pass a proposal.\\n */\\n function _getMinimumVoteWeight() internal view virtual returns (uint256);\\n\\n /**\\n * @dev Returns current context is running on whether Ronin chain or on mainchain.\\n */\\n function _getChainType() internal view virtual returns (ChainType);\\n}\\n\",\"keccak256\":\"0x4c38499b2dcde8b53fa2c28efba0fdfd939a6225c660da265d45ab1cd93597f8\",\"license\":\"MIT\"},\"contracts/extensions/sequential-governance/GovernanceProposal.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./CoreGovernance.sol\\\";\\n\\nabstract contract GovernanceProposal is CoreGovernance {\\n using Proposal for Proposal.ProposalDetail;\\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\\n\\n /**\\n * @dev Casts votes by signatures.\\n *\\n * Note: This method does not verify the proposal hash with the vote hash. Please consider checking it before.\\n *\\n */\\n function _castVotesBySignatures(\\n Proposal.ProposalDetail memory _proposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures,\\n bytes32 _forDigest,\\n bytes32 _againstDigest\\n ) internal {\\n require(_supports.length > 0 && _supports.length == _signatures.length, \\\"GovernanceProposal: invalid array length\\\");\\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\\n\\n address _lastSigner;\\n address _signer;\\n Signature calldata _sig;\\n bool _hasValidVotes;\\n for (uint256 _i; _i < _signatures.length; _i++) {\\n _sig = _signatures[_i];\\n\\n if (_supports[_i] == Ballot.VoteType.For) {\\n _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s);\\n } else if (_supports[_i] == Ballot.VoteType.Against) {\\n _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s);\\n } else {\\n revert(\\\"GovernanceProposal: query for unsupported vote type\\\");\\n }\\n\\n require(_lastSigner < _signer, \\\"GovernanceProposal: invalid order\\\");\\n _lastSigner = _signer;\\n\\n uint256 _weight = _getWeight(_signer);\\n if (_weight > 0) {\\n _hasValidVotes = true;\\n if (\\n _castVote(_proposal, _supports[_i], _minimumForVoteWeight, _minimumAgainstVoteWeight, _signer, _sig, _weight)\\n ) {\\n return;\\n }\\n }\\n }\\n\\n require(_hasValidVotes, \\\"GovernanceProposal: invalid signatures\\\");\\n }\\n\\n /**\\n * @dev Proposes a proposal struct and casts votes by signature.\\n */\\n function _proposeProposalStructAndCastVotes(\\n Proposal.ProposalDetail calldata _proposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures,\\n bytes32 _domainSeparator,\\n address _creator\\n ) internal {\\n _proposeProposalStruct(_proposal, _creator);\\n bytes32 _proposalHash = _proposal.hash();\\n _castVotesBySignatures(\\n _proposal,\\n _supports,\\n _signatures,\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\\n );\\n }\\n\\n /**\\n * @dev Proposes a proposal struct and casts votes by signature.\\n */\\n function _castProposalBySignatures(\\n Proposal.ProposalDetail calldata _proposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures,\\n bytes32 _domainSeparator\\n ) internal {\\n bytes32 _proposalHash = _proposal.hash();\\n require(\\n vote[_proposal.chainId][_proposal.nonce].hash == _proposalHash,\\n \\\"GovernanceAdmin: cast vote for invalid proposal\\\"\\n );\\n _castVotesBySignatures(\\n _proposal,\\n _supports,\\n _signatures,\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\\n );\\n }\\n\\n /**\\n * @dev Proposes and votes by signature.\\n */\\n function _proposeGlobalProposalStructAndCastVotes(\\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures,\\n bytes32 _domainSeparator,\\n address _roninTrustedOrganizationContract,\\n address _gatewayContract,\\n address _creator\\n ) internal returns (Proposal.ProposalDetail memory _proposal) {\\n _proposal = _proposeGlobalStruct(_globalProposal, _roninTrustedOrganizationContract, _gatewayContract, _creator);\\n bytes32 _globalProposalHash = _globalProposal.hash();\\n _castVotesBySignatures(\\n _proposal,\\n _supports,\\n _signatures,\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\\n );\\n }\\n\\n /**\\n * @dev Proposes a global proposal struct and casts votes by signature.\\n */\\n function _castGlobalProposalBySignatures(\\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures,\\n bytes32 _domainSeparator,\\n address _roninTrustedOrganizationContract,\\n address _gatewayContract\\n ) internal {\\n Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail(\\n _roninTrustedOrganizationContract,\\n _gatewayContract\\n );\\n bytes32 _globalProposalHash = _globalProposal.hash();\\n require(vote[0][_proposal.nonce].hash == _proposal.hash(), \\\"GovernanceAdmin: cast vote for invalid proposal\\\");\\n _castVotesBySignatures(\\n _proposal,\\n _supports,\\n _signatures,\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\\n );\\n }\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function _getWeight(address _governor) internal view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x5ae6611dcf49152c8e84853772f4cbf4d538c91cb9d4c85a1b0be04a215fd6e0\",\"license\":\"MIT\"},\"contracts/interfaces/IBridge.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBridge {\\n /**\\n * @dev Replaces the old bridge operator list by the new one.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emitted the event `BridgeOperatorsReplaced`.\\n *\\n */\\n function replaceBridgeOperators(address[] calldata) external;\\n\\n /**\\n * @dev Returns the bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n}\\n\",\"keccak256\":\"0x614db701e54383b7d0a749bc9b0d2da95d42652cd673499bf71e25096548b96e\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x10f3b360430e6d03773c9959f54cbed6fb0346069645c05b05ef50cfb19f3753\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninGovernanceAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../libraries/BridgeOperatorsBallot.sol\\\";\\n\\ninterface IRoninGovernanceAdmin {\\n /// @dev Emitted when the bridge operators are approved.\\n event BridgeOperatorsApproved(uint256 _period, uint256 _epoch, address[] _operators);\\n /// @dev Emitted when an emergency exit poll is created.\\n event EmergencyExitPollCreated(\\n bytes32 _voteHash,\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n );\\n /// @dev Emitted when an emergency exit poll is approved.\\n event EmergencyExitPollApproved(bytes32 _voteHash);\\n /// @dev Emitted when an emergency exit poll is expired.\\n event EmergencyExitPollExpired(bytes32 _voteHash);\\n\\n /**\\n * @dev Returns the last voted block of the bridge voter.\\n */\\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256);\\n\\n /**\\n * @dev Returns the synced bridge operator set info.\\n */\\n function lastSyncedBridgeOperatorSetInfo()\\n external\\n view\\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory _bridgeOperatorSetInfo);\\n\\n /**\\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n */\\n function createEmergencyExitPoll(\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) external;\\n}\\n\",\"keccak256\":\"0x1aa218f9a8cad8fa9f865c179b257aa8f2614e034100dedebdd352da9a7d96d9\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeights() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganizations() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x1edb7a3f5d340e7efc141cb8d94c5499954dec869f026d3998ad92cbc714d604\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasBridgeContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasBridgeContract is IHasContract {\\n /// @dev Emitted when the bridge contract is updated.\\n event BridgeContractUpdated(address);\\n\\n /// @dev Error of method caller must be bridge contract.\\n error ErrCallerMustBeBridgeContract();\\n\\n /**\\n * @dev Returns the bridge contract.\\n */\\n function bridgeContract() external view returns (address);\\n\\n /**\\n * @dev Sets the bridge contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `BridgeContractUpdated`.\\n *\\n */\\n function setBridgeContract(address) external;\\n}\\n\",\"keccak256\":\"0xf3ab1830ba7797cb3b8011512af3a5e38a316549f62140b0c10e0b4dcb67f773\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\\n /// @dev Emitted when the ronin trusted organization contract is updated.\\n event RoninTrustedOrganizationContractUpdated(address);\\n\\n /// @dev Error of method caller must be Ronin trusted org contract.\\n error ErrCallerMustBeRoninTrustedOrgContract();\\n\\n /**\\n * @dev Returns the ronin trusted organization contract.\\n */\\n function roninTrustedOrganizationContract() external view returns (address);\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function setRoninTrustedOrganizationContract(address) external;\\n}\\n\",\"keccak256\":\"0x7d0a0b1d658e9cf4d69f4934748e0a5c1d22183024d26927f5d621fc61aff0b2\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/ChainTypeConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface ChainTypeConsumer {\\n enum ChainType {\\n RoninChain,\\n Mainchain\\n }\\n}\\n\",\"keccak256\":\"0xe0d20e00c8d237f8e0fb881abf1ff1ef114173bcb428f06f689c581666a22db7\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/SignatureConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface SignatureConsumer {\\n struct Signature {\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n }\\n}\\n\",\"keccak256\":\"0xd370e350722067097dec1a5c31bda6e47e83417fa5c3288293bb910028cd136b\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/VoteStatusConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface VoteStatusConsumer {\\n enum VoteStatus {\\n Pending,\\n Approved,\\n Executed,\\n Rejected,\\n Expired\\n }\\n}\\n\",\"keccak256\":\"0xa5045232c0c053fcf31fb3fe71942344444159c48d5f1b2063dbb06b6a1c9752\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/Ballot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nlibrary Ballot {\\n using ECDSA for bytes32;\\n\\n enum VoteType {\\n For,\\n Against\\n }\\n\\n // keccak256(\\\"Ballot(bytes32 proposalHash,uint8 support)\\\");\\n bytes32 public constant BALLOT_TYPEHASH = 0xd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c2;\\n\\n function hash(bytes32 _proposalHash, VoteType _support) internal pure returns (bytes32) {\\n return keccak256(abi.encode(BALLOT_TYPEHASH, _proposalHash, _support));\\n }\\n}\\n\",\"keccak256\":\"0x28a0192db886307f30ada203bdb902749ee3f30d42710de4eaf303cba23c32c2\",\"license\":\"MIT\"},\"contracts/libraries/BridgeOperatorsBallot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nlibrary BridgeOperatorsBallot {\\n struct BridgeOperatorSet {\\n uint256 period;\\n uint256 epoch;\\n address[] operators;\\n }\\n\\n // keccak256(\\\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\\\");\\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\\n\\n /**\\n * @dev Verifies whether the ballot is valid or not.\\n *\\n * Requirements:\\n * - The ballot is not for an empty operator set.\\n * - The operator address list is in order.\\n *\\n */\\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\\n require(_ballot.operators.length > 0, \\\"BridgeOperatorsBallot: invalid array length\\\");\\n address _addr = _ballot.operators[0];\\n for (uint _i = 1; _i < _ballot.operators.length; _i++) {\\n require(_addr < _ballot.operators[_i], \\\"BridgeOperatorsBallot: invalid order of bridge operators\\\");\\n _addr = _ballot.operators[_i];\\n }\\n }\\n\\n /**\\n * @dev Returns hash of the ballot.\\n */\\n function hash(BridgeOperatorSet calldata _ballot) internal pure returns (bytes32) {\\n bytes32 _operatorsHash;\\n address[] memory _operators = _ballot.operators;\\n\\n assembly {\\n _operatorsHash := keccak256(add(_operators, 32), mul(mload(_operators), 32))\\n }\\n\\n return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\\n }\\n}\\n\",\"keccak256\":\"0x986425ebae2dcfcfa266c9ca825232ff300ec8ce796e8975da6714d87e921793\",\"license\":\"MIT\"},\"contracts/libraries/EmergencyExitBallot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nlibrary EmergencyExitBallot {\\n // keccak256(\\\"EmergencyExitBallot(address consensusAddress,address recipientAfterUnlockedFund,uint256 requestedAt,uint256 expiredAt)\\\");\\n bytes32 public constant EMERGENCY_EXIT_BALLOT_TYPEHASH =\\n 0x697acba4deaf1a718d8c2d93e42860488cb7812696f28ca10eed17bac41e7027;\\n\\n /**\\n * @dev Returns hash of the ballot.\\n */\\n function hash(\\n address _consensusAddress,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) internal pure returns (bytes32) {\\n return\\n keccak256(\\n abi.encode(\\n EMERGENCY_EXIT_BALLOT_TYPEHASH,\\n _consensusAddress,\\n _recipientAfterUnlockedFund,\\n _requestedAt,\\n _expiredAt\\n )\\n );\\n }\\n}\\n\",\"keccak256\":\"0xfee3f0b001f34b3760a06c7abcf4f7d35054dba0004221adfc4c5f5ede4a1114\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/GlobalProposal.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./Proposal.sol\\\";\\n\\nlibrary GlobalProposal {\\n enum TargetOption {\\n RoninTrustedOrganizationContract,\\n GatewayContract\\n }\\n\\n struct GlobalProposalDetail {\\n // Nonce to make sure proposals are executed in order\\n uint256 nonce;\\n uint256 expiryTimestamp;\\n TargetOption[] targetOptions;\\n uint256[] values;\\n bytes[] calldatas;\\n uint256[] gasAmounts;\\n }\\n\\n // keccak256(\\\"GlobalProposalDetail(uint256 nonce,uint256 expiryTimestamp,uint8[] targetOptions,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\\\");\\n bytes32 public constant TYPE_HASH = 0x1463f426c05aff2c1a7a0957a71c9898bc8b47142540538e79ee25ee91141350;\\n\\n /**\\n * @dev Returns struct hash of the proposal.\\n */\\n function hash(GlobalProposalDetail memory _proposal) internal pure returns (bytes32) {\\n bytes32 _targetsHash;\\n bytes32 _valuesHash;\\n bytes32 _calldatasHash;\\n bytes32 _gasAmountsHash;\\n\\n uint256[] memory _values = _proposal.values;\\n TargetOption[] memory _targets = _proposal.targetOptions;\\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\\n\\n for (uint256 _i; _i < _calldataHashList.length; _i++) {\\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\\n }\\n\\n assembly {\\n _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32))\\n _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32))\\n _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32))\\n _gasAmountsHash := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32))\\n }\\n\\n return\\n keccak256(\\n abi.encode(\\n TYPE_HASH,\\n _proposal.nonce,\\n _proposal.expiryTimestamp,\\n _targetsHash,\\n _valuesHash,\\n _calldatasHash,\\n _gasAmountsHash\\n )\\n );\\n }\\n\\n /**\\n * @dev Converts into the normal proposal.\\n */\\n function into_proposal_detail(\\n GlobalProposalDetail memory _proposal,\\n address _roninTrustedOrganizationContract,\\n address _gatewayContract\\n ) internal pure returns (Proposal.ProposalDetail memory _detail) {\\n _detail.nonce = _proposal.nonce;\\n _detail.expiryTimestamp = _proposal.expiryTimestamp;\\n _detail.chainId = 0;\\n _detail.targets = new address[](_proposal.targetOptions.length);\\n _detail.values = _proposal.values;\\n _detail.calldatas = _proposal.calldatas;\\n _detail.gasAmounts = _proposal.gasAmounts;\\n\\n for (uint256 _i; _i < _proposal.targetOptions.length; _i++) {\\n if (_proposal.targetOptions[_i] == TargetOption.GatewayContract) {\\n _detail.targets[_i] = _gatewayContract;\\n } else if (_proposal.targetOptions[_i] == TargetOption.RoninTrustedOrganizationContract) {\\n _detail.targets[_i] = _roninTrustedOrganizationContract;\\n } else {\\n revert(\\\"GlobalProposal: unsupported target\\\");\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x4749e811eebe029ac572b48e5c755bc852cc74e8234c5243a57f7536c3ed00e0\",\"license\":\"MIT\"},\"contracts/libraries/IsolatedGovernance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"../interfaces/consumers/VoteStatusConsumer.sol\\\";\\n\\nlibrary IsolatedGovernance {\\n struct Vote {\\n VoteStatusConsumer.VoteStatus status;\\n bytes32 finalHash;\\n /// @dev Mapping from voter => receipt hash\\n mapping(address => bytes32) voteHashOf;\\n /// @dev The timestamp that voting is expired (no expiration=0)\\n uint256 expiredAt;\\n /// @dev The timestamp that voting is created\\n uint256 createdAt;\\n /// @dev The list of voters\\n address[] voters;\\n }\\n\\n /**\\n * @dev Casts vote for the receipt with the receipt hash `_hash`.\\n *\\n * Requirements:\\n * - The voter has not voted for the round.\\n *\\n */\\n function castVote(\\n Vote storage _v,\\n address _voter,\\n bytes32 _hash\\n ) internal {\\n if (_v.expiredAt > 0 && _v.expiredAt <= block.timestamp) {\\n _v.status = VoteStatusConsumer.VoteStatus.Expired;\\n }\\n\\n if (voted(_v, _voter)) {\\n revert(\\n string(abi.encodePacked(\\\"IsolatedGovernance: \\\", Strings.toHexString(uint160(_voter), 20), \\\" already voted\\\"))\\n );\\n }\\n\\n _v.voteHashOf[_voter] = _hash;\\n _v.voters.push(_voter);\\n }\\n\\n /**\\n * @dev Updates vote with the requirement of minimum vote weight.\\n */\\n function syncVoteStatus(\\n Vote storage _v,\\n uint256 _minimumVoteWeight,\\n uint256 _votedWeightForHash,\\n uint256 _minimumTrustedVoteWeight,\\n uint256 _trustedVotedWeightForHash,\\n bytes32 _hash\\n ) internal returns (VoteStatusConsumer.VoteStatus _status) {\\n if (\\n _votedWeightForHash >= _minimumVoteWeight &&\\n _trustedVotedWeightForHash >= _minimumTrustedVoteWeight &&\\n _v.status == VoteStatusConsumer.VoteStatus.Pending\\n ) {\\n _v.status = VoteStatusConsumer.VoteStatus.Approved;\\n _v.finalHash = _hash;\\n }\\n\\n return _v.status;\\n }\\n\\n /**\\n * @dev Returns the list of vote's addresses that voted for the hash `_hash`.\\n */\\n function filterByHash(Vote storage _v, bytes32 _hash) internal view returns (address[] memory _voters) {\\n uint256 _count;\\n _voters = new address[](_v.voters.length);\\n\\n for (uint _i; _i < _voters.length; _i++) {\\n address _voter = _v.voters[_i];\\n if (_v.voteHashOf[_voter] == _hash) {\\n _voters[_count++] = _voter;\\n }\\n }\\n\\n assembly {\\n mstore(_voters, _count)\\n }\\n }\\n\\n /**\\n * @dev Returns whether the voter casted for the proposal.\\n */\\n function voted(Vote storage _v, address _voter) internal view returns (bool) {\\n return _v.voteHashOf[_voter] != bytes32(0);\\n }\\n}\\n\",\"keccak256\":\"0x7bdb18ce2c548b3241360370312ca12f168140217fc3ee9c983627b86506c73f\",\"license\":\"MIT\"},\"contracts/libraries/Proposal.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nlibrary Proposal {\\n struct ProposalDetail {\\n // Nonce to make sure proposals are executed in order\\n uint256 nonce;\\n // Value 0: all chain should run this proposal\\n // Other values: only specifc chain has to execute\\n uint256 chainId;\\n uint256 expiryTimestamp;\\n address[] targets;\\n uint256[] values;\\n bytes[] calldatas;\\n uint256[] gasAmounts;\\n }\\n\\n // keccak256(\\\"ProposalDetail(uint256 nonce,uint256 chainId,uint256 expiryTimestamp,address[] targets,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\\\");\\n bytes32 public constant TYPE_HASH = 0xd051578048e6ff0bbc9fca3b65a42088dbde10f36ca841de566711087ad9b08a;\\n\\n /**\\n * @dev Validates the proposal.\\n */\\n function validate(ProposalDetail memory _proposal, uint256 _maxExpiryDuration) internal view {\\n require(\\n _proposal.targets.length > 0 &&\\n _proposal.targets.length == _proposal.values.length &&\\n _proposal.targets.length == _proposal.calldatas.length &&\\n _proposal.targets.length == _proposal.gasAmounts.length,\\n \\\"Proposal: invalid array length\\\"\\n );\\n require(_proposal.expiryTimestamp <= block.timestamp + _maxExpiryDuration, \\\"Proposal: invalid expiry timestamp\\\");\\n }\\n\\n /**\\n * @dev Returns struct hash of the proposal.\\n */\\n function hash(ProposalDetail memory _proposal) internal pure returns (bytes32) {\\n bytes32 _targetsHash;\\n bytes32 _valuesHash;\\n bytes32 _calldatasHash;\\n bytes32 _gasAmountsHash;\\n\\n uint256[] memory _values = _proposal.values;\\n address[] memory _targets = _proposal.targets;\\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\\n\\n for (uint256 _i; _i < _calldataHashList.length; _i++) {\\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\\n }\\n\\n assembly {\\n _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32))\\n _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32))\\n _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32))\\n _gasAmountsHash := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32))\\n }\\n\\n return\\n keccak256(\\n abi.encode(\\n TYPE_HASH,\\n _proposal.nonce,\\n _proposal.chainId,\\n _proposal.expiryTimestamp,\\n _targetsHash,\\n _valuesHash,\\n _calldatasHash,\\n _gasAmountsHash\\n )\\n );\\n }\\n\\n /**\\n * @dev Returns whether the proposal is executable for the current chain.\\n *\\n * @notice Does not check whether the call result is successful or not. Please use `execute` instead.\\n *\\n */\\n function executable(ProposalDetail memory _proposal) internal view returns (bool _result) {\\n return _proposal.chainId == 0 || _proposal.chainId == block.chainid;\\n }\\n\\n /**\\n * @dev Executes the proposal.\\n */\\n function execute(ProposalDetail memory _proposal)\\n internal\\n returns (bool[] memory _successCalls, bytes[] memory _returnDatas)\\n {\\n require(executable(_proposal), \\\"Proposal: query for invalid chainId\\\");\\n _successCalls = new bool[](_proposal.targets.length);\\n _returnDatas = new bytes[](_proposal.targets.length);\\n for (uint256 _i = 0; _i < _proposal.targets.length; ++_i) {\\n require(gasleft() > _proposal.gasAmounts[_i], \\\"Proposal: insufficient gas\\\");\\n\\n (_successCalls[_i], _returnDatas[_i]) = _proposal.targets[_i].call{\\n value: _proposal.values[_i],\\n gas: _proposal.gasAmounts[_i]\\n }(_proposal.calldatas[_i]);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x96bf9eaea9a87a5eceed026a6eaedc74cf5dde6760f7e969d5b5974dad43ff80\",\"license\":\"MIT\"},\"contracts/ronin/RoninGovernanceAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../extensions/bridge-operator-governance/BOsGovernanceProposal.sol\\\";\\nimport \\\"../extensions/sequential-governance/GovernanceProposal.sol\\\";\\nimport \\\"../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../extensions/GovernanceAdmin.sol\\\";\\nimport \\\"../libraries/EmergencyExitBallot.sol\\\";\\nimport \\\"../interfaces/IRoninGovernanceAdmin.sol\\\";\\n\\ncontract RoninGovernanceAdmin is\\n IRoninGovernanceAdmin,\\n GovernanceAdmin,\\n GovernanceProposal,\\n BOsGovernanceProposal,\\n HasValidatorContract\\n{\\n using Proposal for Proposal.ProposalDetail;\\n using IsolatedGovernance for IsolatedGovernance.Vote;\\n\\n /// @dev Mapping from request hash => emergency poll\\n mapping(bytes32 => IsolatedGovernance.Vote) internal _emergencyExitPoll;\\n\\n modifier onlyGovernor() {\\n require(_getWeight(msg.sender) > 0, \\\"RoninGovernanceAdmin: sender is not governor\\\");\\n _;\\n }\\n\\n constructor(\\n uint256 _roninChainId,\\n address _roninTrustedOrganizationContract,\\n address _bridgeContract,\\n address _validatorContract,\\n uint256 _proposalExpiryDuration\\n ) GovernanceAdmin(_roninChainId, _roninTrustedOrganizationContract, _bridgeContract, _proposalExpiryDuration) {\\n _setValidatorContract(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external override onlySelfCall {\\n require(_addr.code.length > 0, \\\"RoninGovernanceAdmin: set to non-contract\\\");\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Returns the voted signatures for the proposals.\\n *\\n * Note: The signatures can be empty in case the proposal is voted on the current network.\\n *\\n */\\n function getProposalSignatures(uint256 _chainId, uint256 _round)\\n external\\n view\\n returns (\\n address[] memory _voters,\\n Ballot.VoteType[] memory _supports,\\n Signature[] memory _signatures\\n )\\n {\\n ProposalVote storage _vote = vote[_chainId][_round];\\n\\n uint256 _forLength = _vote.forVoteds.length;\\n uint256 _againstLength = _vote.againstVoteds.length;\\n uint256 _voterLength = _forLength + _againstLength;\\n\\n _supports = new Ballot.VoteType[](_voterLength);\\n _signatures = new Signature[](_voterLength);\\n _voters = new address[](_voterLength);\\n for (uint256 _i; _i < _forLength; _i++) {\\n _supports[_i] = Ballot.VoteType.For;\\n _signatures[_i] = vote[_chainId][_round].sig[_vote.forVoteds[_i]];\\n _voters[_i] = _vote.forVoteds[_i];\\n }\\n for (uint256 _i; _i < _againstLength; _i++) {\\n _supports[_i + _forLength] = Ballot.VoteType.Against;\\n _signatures[_i + _forLength] = vote[_chainId][_round].sig[_vote.againstVoteds[_i]];\\n _voters[_i + _forLength] = _vote.againstVoteds[_i];\\n }\\n }\\n\\n /**\\n * @dev Returns the voted signatures for bridge operators at a specific period.\\n */\\n function getBridgeOperatorVotingSignatures(uint256 _period, uint256 _epoch)\\n external\\n view\\n returns (address[] memory _voters, Signature[] memory _signatures)\\n {\\n mapping(address => Signature) storage _sigMap = _bridgeVoterSig[_period][_epoch];\\n _voters = _bridgeOperatorVote[_period][_epoch].voters;\\n _signatures = new Signature[](_voters.length);\\n for (uint _i; _i < _voters.length; _i++) {\\n _signatures[_i] = _sigMap[_voters[_i]];\\n }\\n }\\n\\n /**\\n * @dev Returns whether the voter `_voter` casted vote for the proposal.\\n */\\n function proposalVoted(\\n uint256 _chainId,\\n uint256 _round,\\n address _voter\\n ) external view returns (bool) {\\n return _voted(vote[_chainId][_round], _voter);\\n }\\n\\n /**\\n * @dev Returns whether the voter `_voter` casted vote for bridge operators at a specific period.\\n */\\n function bridgeOperatorsVoted(\\n uint256 _period,\\n uint256 _epoch,\\n address _voter\\n ) external view returns (bool) {\\n return _bridgeOperatorVote[_period][_epoch].voted(_voter);\\n }\\n\\n /**\\n * @dev Returns whether the voter casted vote for emergency exit poll.\\n */\\n function emergencyPollVoted(bytes32 _voteHash, address _voter) external view returns (bool) {\\n return _emergencyExitPoll[_voteHash].voted(_voter);\\n }\\n\\n /**\\n * @dev See `CoreGovernance-_proposeProposal`.\\n *\\n * Requirements:\\n * - The method caller is governor.\\n *\\n */\\n function propose(\\n uint256 _chainId,\\n uint256 _expiryTimestamp,\\n address[] calldata _targets,\\n uint256[] calldata _values,\\n bytes[] calldata _calldatas,\\n uint256[] calldata _gasAmounts\\n ) external onlyGovernor {\\n _proposeProposal(_chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts, msg.sender);\\n }\\n\\n /**\\n * @dev See `GovernanceProposal-_proposeProposalStructAndCastVotes`.\\n *\\n * Requirements:\\n * - The method caller is governor.\\n * - The proposal is for the current network.\\n *\\n */\\n function proposeProposalStructAndCastVotes(\\n Proposal.ProposalDetail calldata _proposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures\\n ) external onlyGovernor {\\n _proposeProposalStructAndCastVotes(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender);\\n }\\n\\n /**\\n * @dev Proposes and casts vote for a proposal on the current network.\\n *\\n * Requirements:\\n * - The method caller is governor.\\n * - The proposal is for the current network.\\n *\\n */\\n function proposeProposalForCurrentNetwork(\\n uint256 _expiryTimestamp,\\n address[] calldata _targets,\\n uint256[] calldata _values,\\n bytes[] calldata _calldatas,\\n uint256[] calldata _gasAmounts,\\n Ballot.VoteType _support\\n ) external onlyGovernor {\\n address _voter = msg.sender;\\n Proposal.ProposalDetail memory _proposal = _proposeProposal(\\n block.chainid,\\n _expiryTimestamp,\\n _targets,\\n _values,\\n _calldatas,\\n _gasAmounts,\\n _voter\\n );\\n _castProposalVoteForCurrentNetwork(_voter, _proposal, _support);\\n }\\n\\n /**\\n * @dev Casts vote for a proposal on the current network.\\n *\\n * Requirements:\\n * - The method caller is governor.\\n *\\n */\\n function castProposalVoteForCurrentNetwork(Proposal.ProposalDetail calldata _proposal, Ballot.VoteType _support)\\n external\\n onlyGovernor\\n {\\n _castProposalVoteForCurrentNetwork(msg.sender, _proposal, _support);\\n }\\n\\n /**\\n * @dev See `GovernanceProposal-_castProposalBySignatures`.\\n */\\n function castProposalBySignatures(\\n Proposal.ProposalDetail calldata _proposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures\\n ) external {\\n _castProposalBySignatures(_proposal, _supports, _signatures, DOMAIN_SEPARATOR);\\n }\\n\\n /**\\n * @dev See `CoreGovernance-_proposeGlobal`.\\n *\\n * Requirements:\\n * - The method caller is governor.\\n *\\n */\\n function proposeGlobal(\\n uint256 _expiryTimestamp,\\n GlobalProposal.TargetOption[] calldata _targetOptions,\\n uint256[] calldata _values,\\n bytes[] calldata _calldatas,\\n uint256[] calldata _gasAmounts\\n ) external onlyGovernor {\\n _proposeGlobal(\\n _expiryTimestamp,\\n _targetOptions,\\n _values,\\n _calldatas,\\n _gasAmounts,\\n roninTrustedOrganizationContract(),\\n bridgeContract(),\\n msg.sender\\n );\\n }\\n\\n /**\\n * @dev See `GovernanceProposal-_proposeGlobalProposalStructAndCastVotes`.\\n *\\n * Requirements:\\n * - The method caller is governor.\\n *\\n */\\n function proposeGlobalProposalStructAndCastVotes(\\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures\\n ) external onlyGovernor {\\n _proposeGlobalProposalStructAndCastVotes(\\n _globalProposal,\\n _supports,\\n _signatures,\\n DOMAIN_SEPARATOR,\\n roninTrustedOrganizationContract(),\\n bridgeContract(),\\n msg.sender\\n );\\n }\\n\\n /**\\n * @dev See `GovernanceProposal-_castGlobalProposalBySignatures`.\\n */\\n function castGlobalProposalBySignatures(\\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\\n Ballot.VoteType[] calldata _supports,\\n Signature[] calldata _signatures\\n ) external {\\n _castGlobalProposalBySignatures(\\n _globalProposal,\\n _supports,\\n _signatures,\\n DOMAIN_SEPARATOR,\\n roninTrustedOrganizationContract(),\\n bridgeContract()\\n );\\n }\\n\\n /**\\n * @dev Deletes the expired proposal by its chainId and nonce, without creating a new proposal.\\n *\\n * Requirements:\\n * - The proposal is already created.\\n *\\n */\\n function deleteExpired(uint256 _chainId, uint256 _round) external {\\n ProposalVote storage _vote = vote[_chainId][_round];\\n require(_vote.hash != bytes32(0), \\\"RoninGovernanceAdmin: query for empty voting\\\");\\n _tryDeleteExpiredVotingRound(_vote);\\n }\\n\\n /**\\n * @dev See `BOsGovernanceProposal-_castVotesBySignatures`.\\n */\\n function voteBridgeOperatorsBySignatures(\\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\\n Signature[] calldata _signatures\\n ) external {\\n _castBOVotesBySignatures(_ballot, _signatures, _getMinimumVoteWeight(), DOMAIN_SEPARATOR);\\n IsolatedGovernance.Vote storage _v = _bridgeOperatorVote[_ballot.period][_ballot.epoch];\\n if (_v.status == VoteStatus.Approved) {\\n _lastSyncedBridgeOperatorSetInfo = _ballot;\\n emit BridgeOperatorsApproved(_ballot.period, _ballot.epoch, _ballot.operators);\\n _v.status = VoteStatus.Executed;\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninGovernanceAdmin\\n */\\n function createEmergencyExitPoll(\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) external onlyValidatorContract {\\n bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\\n IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash];\\n _v.createdAt = block.timestamp;\\n _v.expiredAt = _expiredAt;\\n emit EmergencyExitPollCreated(_hash, _consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\\n }\\n\\n /**\\n * @dev Votes for an emergency exit. Executes to unlock fund for the emergency exit's requester.\\n *\\n * Requirements:\\n * - The voter is governor.\\n * - The voting is existent.\\n * - The voting is not expired yet.\\n *\\n */\\n function voteEmergencyExit(\\n bytes32 _voteHash,\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) external onlyGovernor {\\n address _voter = msg.sender;\\n bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\\n require(_voteHash == _hash, \\\"RoninGovernanceAdmin: invalid vote hash\\\");\\n\\n IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash];\\n require(_v.createdAt > 0, \\\"RoninGovernanceAdmin: query for non-existent vote\\\");\\n require(_v.status != VoteStatus.Expired, \\\"RoninGovernanceAdmin: query for expired vote\\\");\\n\\n _v.castVote(_voter, _hash);\\n address[] memory _voters = _v.filterByHash(_hash);\\n VoteStatus _stt = _v.syncVoteStatus(_getMinimumVoteWeight(), _sumGovernorWeights(_voters), 0, 0, _hash);\\n if (_stt == VoteStatus.Approved) {\\n _execReleaseLockedFundForEmergencyExitRequest(_consensusAddr, _recipientAfterUnlockedFund);\\n emit EmergencyExitPollApproved(_hash);\\n _v.status = VoteStatus.Executed;\\n } else if (_stt == VoteStatus.Expired) {\\n emit EmergencyExitPollExpired(_hash);\\n }\\n }\\n\\n /**\\n * @inheritdoc GovernanceProposal\\n */\\n function _getWeight(address _governor) internal view virtual override returns (uint256) {\\n bytes4 _selector = IRoninTrustedOrganization.getGovernorWeight.selector;\\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\\n abi.encodeWithSelector(\\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\\n 0x4bb5274a,\\n abi.encodeWithSelector(_selector, _governor)\\n )\\n );\\n if (!_success) revert ErrProxyCallFailed(_selector);\\n return abi.decode(_returndata, (uint256));\\n }\\n\\n /**\\n * @dev Returns the total weight of a list address of governors.\\n */\\n function _sumGovernorWeights(address[] memory _governors) internal view virtual returns (uint256) {\\n bytes4 _selector = IRoninTrustedOrganization.sumGovernorWeights.selector;\\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\\n abi.encodeWithSelector(\\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\\n 0x4bb5274a,\\n abi.encodeWithSelector(_selector, _governors)\\n )\\n );\\n if (!_success) revert ErrProxyCallFailed(_selector);\\n return abi.decode(_returndata, (uint256));\\n }\\n\\n /**\\n * @dev Returns the bridge voter weight.\\n */\\n function _getBridgeVoterWeight(address _governor) internal view virtual returns (uint256) {\\n bytes4 _selector = IRoninTrustedOrganization.getBridgeVoterWeight.selector;\\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\\n abi.encodeWithSelector(\\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\\n 0x4bb5274a,\\n abi.encodeWithSelector(_selector, _governor)\\n )\\n );\\n if (!_success) revert ErrProxyCallFailed(_selector);\\n return abi.decode(_returndata, (uint256));\\n }\\n\\n /**\\n * @inheritdoc BOsGovernanceProposal\\n */\\n function _isBridgeVoter(address _addr) internal view virtual override returns (bool) {\\n return _getBridgeVoterWeight(_addr) > 0;\\n }\\n\\n /**\\n * @inheritdoc BOsGovernanceProposal\\n */\\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual override returns (uint256) {\\n bytes4 _selector = IRoninTrustedOrganization.sumBridgeVoterWeights.selector;\\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\\n abi.encodeWithSelector(\\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\\n 0x4bb5274a,\\n abi.encodeWithSelector(_selector, _bridgeVoters)\\n )\\n );\\n if (!_success) revert ErrProxyCallFailed(_selector);\\n return abi.decode(_returndata, (uint256));\\n }\\n\\n /**\\n * @dev Trigger function from validator contract to unlock fund for emeregency exit request.\\n */\\n function _execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address _recipientAfterUnlockedFund)\\n internal\\n virtual\\n {\\n bytes4 _selector = _validatorContract.execReleaseLockedFundForEmergencyExitRequest.selector;\\n (bool _success, ) = validatorContract().call(\\n abi.encodeWithSelector(\\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\\n 0x4bb5274a,\\n abi.encodeWithSelector(_selector, _consensusAddr, _recipientAfterUnlockedFund)\\n )\\n );\\n if (!_success) revert ErrProxyCallFailed(_selector);\\n }\\n\\n /**\\n * @dev See `CoreGovernance-_getChainType`.\\n */\\n function _getChainType() internal pure override returns (ChainType) {\\n return ChainType.RoninChain;\\n }\\n\\n /**\\n * @dev See `castProposalVoteForCurrentNetwork`.\\n */\\n function _castProposalVoteForCurrentNetwork(\\n address _voter,\\n Proposal.ProposalDetail memory _proposal,\\n Ballot.VoteType _support\\n ) internal {\\n require(_proposal.chainId == block.chainid, \\\"RoninGovernanceAdmin: invalid chain id\\\");\\n require(\\n vote[_proposal.chainId][_proposal.nonce].hash == _proposal.hash(),\\n \\\"RoninGovernanceAdmin: cast vote for invalid proposal\\\"\\n );\\n\\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\\n Signature memory _emptySignature;\\n _castVote(\\n _proposal,\\n _support,\\n _minimumForVoteWeight,\\n _minimumAgainstVoteWeight,\\n _voter,\\n _emptySignature,\\n _getWeight(_voter)\\n );\\n }\\n}\\n\",\"keccak256\":\"0xc4564ec6a528a613ea7949bed7c947fa1f87e96c2fdc93ae287ed8940ec312a2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162005cd138038062005cd183398101604081905262000034916200027f565b84848483806200004381600255565b506005849055604080516020808201839052601660608301527f524f4e494e5f474f5645524e414e43455f41444d494e000000000000000000006080808401919091528284018890528351808403909101815260a0830184528051908201207f599a80fcaa47b95e2323ab4d34d34e0cc9feda4b843edafcc30c7bdf60ea15bf60c08401527f7e7935007966eb860f4a2ee3dcc9fd53fb3205ce2aa86b0126d4893d4d4c14b960e08401527fad7c5bef027816a800da1736444fb58a807ef4c9603b7848673f7e3a68eb14a561010084015261012080840191909152835180840390910181526101409092019092528051910120600655620001458362000170565b6200015082620001c8565b5050505062000165826200021560201b60201c565b5050505050620002f1565b600380546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d790620001bd908390620002dd565b60405180910390a150565b600480546001600160a01b0319166001600160a01b0383161790556040517f5cbd8a0bb00196365d5eb3457c6734e7f06666c3c78e5469b4c9deec7edae04890620001bd908390620002dd565b600d80546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990620001bd908390620002dd565b80516001600160a01b03811681146200027a57600080fd5b919050565b600080600080600060a086880312156200029857600080fd5b85519450620002aa6020870162000262565b9350620002ba6040870162000262565b9250620002ca6060870162000262565b9150608086015190509295509295909350565b6001600160a01b0391909116815260200190565b6159d080620003016000396000f3fe608060405234801561001057600080fd5b50600436106101955760003560e01c80624054b81461019a57806309fcd8c7146101af5780630b26cf66146101c25780630b881830146101d557806317ce2dd4146101e85780631c905e39146102045780631e23e04814610226578063204e1c7a146102475780632b5df351146102675780632c5e65201461028a5780632e96a6fb1461029d5780632faf925d146102b057806334d5f37b146102c35780633644e515146102e35780635511cde1146102ec57806360911e8e146102f457806362e52e5f14610307578063663ac0111461031c5780637eff275e1461032f578063988ef53c14610342578063994390891461036b5780639a7d3382146103735780639e0dc0b314610386578063a1819f9a14610399578063a2fae570146103ac578063a8a0e32c146103bf578063b384abef146103d2578063b5e337de1461042d578063bc96180b14610440578063cd59658314610448578063cdf64a7614610450578063dcc3eb1914610463578063f3b7dead14610476578063fb4f637114610489575b600080fd5b6101ad6101a83660046143ab565b61049c565b005b6101ad6101bd36600461443f565b6104e5565b6101ad6101d0366004614523565b6105a9565b6101ad6101e33660046143ab565b6105fe565b6101f160055481565b6040519081526020015b60405180910390f35b610217610212366004614540565b61060e565b6040516101fb93929190614615565b610239610234366004614540565b6109f9565b6040516101fb929190614688565b61025a610255366004614523565b610b7d565b6040516101fb91906146ad565b61027a6102753660046146c1565b610c49565b60405190151581526020016101fb565b61027a6102983660046146c1565b610c74565b6101ad6102ab3660046146fa565b610c97565b6101ad6102be366004614713565b610cbf565b6101f16102d13660046146fa565b60006020819052908152604090205481565b6101f160065481565b61025a610cdf565b6101ad61030236600461476c565b610cee565b61030f610dae565b6040516101fb91906147dc565b6101ad61032a366004614823565b610e50565b6101ad61033d366004614900565b610f5c565b6101f1610350366004614523565b6001600160a01b03166000908152600b602052604090205490565b61025a611049565b6101ad610381366004614540565b611058565b6101ad610394366004614939565b6110ce565b6101ad6103a736600461498b565b611331565b6101ad6103ba366004614a64565b611417565b6101ad6103cd366004614aaa565b6114bd565b61041c6103e0366004614540565b600160208181526000938452604080852090915291835291208054918101546002820154600383015460069093015460ff909416939192909185565b6040516101fb959493929190614af0565b6101ad61043b366004614523565b6114fc565b6101f161154e565b61025a61155e565b6101ad61045e366004614523565b61156d565b61027a610471366004614b25565b611601565b61025a610484366004614523565b611622565b6101ad610497366004614713565b61166c565b60006104a7336116bd565b116104cd5760405162461bcd60e51b81526004016104c490614b4a565b60405180910390fd5b6104de8585858585600654336117e4565b5050505050565b60006104f0336116bd565b1161050d5760405162461bcd60e51b81526004016104c490614b4a565b61059e89898989898080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061055392508a91508b9050614d19565b8787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506105909250610cdf915050565b61059861155e565b3361184e565b505050505050505050565b3330146105c85760405162461bcd60e51b81526004016104c490614d26565b6000816001600160a01b03163b116105f25760405162461bcd60e51b81526004016104c490614d6d565b6105fb8161195d565b50565b6104de85858585856006546119b3565b600082815260016020908152604080832084845290915281206004810154600582015460609384938493909290916106468284614dc7565b9050806001600160401b0381111561066057610660614b96565b604051908082528060200260200182016040528015610689578160200160208202803683370190505b509550806001600160401b038111156106a4576106a4614b96565b6040519080825280602002602001820160405280156106dd57816020015b6106ca614275565b8152602001906001900390816106c25790505b509450806001600160401b038111156106f8576106f8614b96565b604051908082528060200260200182016040528015610721578160200160208202803683370190505b50965060005b8381101561088057600087828151811061074357610743614dda565b6020026020010190600181111561075c5761075c6145a6565b9081600181111561076f5761076f6145a6565b90525060008a81526001602090815260408083208c8452909152812060048701805460079092019291849081106107a8576107a8614dda565b60009182526020808320909101546001600160a01b0316835282810193909352604091820190208151606081018352815460ff1681526001820154938101939093526002015490820152865187908390811061080657610806614dda565b602002602001018190525084600401818154811061082657610826614dda565b9060005260206000200160009054906101000a90046001600160a01b031688828151811061085657610856614dda565b6001600160a01b03909216602092830291909101909101528061087881614df0565b915050610727565b5060005b828110156109ed576001876108998684614dc7565b815181106108a9576108a9614dda565b602002602001019060018111156108c2576108c26145a6565b908160018111156108d5576108d56145a6565b90525060008a81526001602090815260408083208c84529091528120600587018054600790920192918490811061090e5761090e614dda565b60009182526020808320909101546001600160a01b0316835282810193909352604091820190208151606081018352815460ff1681526001820154938101939093526002015490820152866109638684614dc7565b8151811061097357610973614dda565b602002602001018190525084600501818154811061099357610993614dda565b6000918252602090912001546001600160a01b0316886109b38684614dc7565b815181106109c3576109c3614dda565b6001600160a01b0390921660209283029190910190910152806109e581614df0565b915050610884565b50505050509250925092565b6000828152600c602090815260408083208484528252808320858452600a8352818420858552835292819020600501805482518185028101850190935280835260609485949093929190830182828015610a7c57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610a5e575b5050505050925082516001600160401b03811115610a9c57610a9c614b96565b604051908082528060200260200182016040528015610ad557816020015b610ac2614275565b815260200190600190039081610aba5790505b50915060005b8351811015610b7457816000858381518110610af957610af9614dda565b6020908102919091018101516001600160a01b031682528181019290925260409081016000208151606081018352815460ff16815260018201549381019390935260020154908201528351849083908110610b5657610b56614dda565b60200260200101819052508080610b6c90614df0565b915050610adb565b50509250929050565b60408051600481526024810182526020810180516001600160e01b0316635c60da1b60e01b908117909152915160009291839182916001600160a01b03871691610bc79190614e2d565b600060405180830381855afa9150503d8060008114610c02576040519150601f19603f3d011682016040523d82523d6000602084013e610c07565b606091505b509150915081610c2c578260405163411471c360e11b81526004016104c49190614e49565b80806020019051810190610c409190614e5e565b95945050505050565b6000838152600a602090815260408083208584529091528120610c6c9083611a3a565b949350505050565b60008381526001602090815260408083208584529091528120610c6c9083611a5b565b333014610cb65760405162461bcd60e51b81526004016104c490614d26565b6105fb81600255565b6104de8585858585600654610cd2610cdf565b610cda61155e565b611a7d565b6003546001600160a01b031690565b610d04838383610cfc611b1f565b600654611c39565b82356000908152600a6020908152604080832082870135845290915290206001815460ff166004811115610d3a57610d3a6145a6565b03610da857836007610d4c8282614ee8565b507f7c45875370690698791a915954b9c69729cc5f9373edc5a2e04436c07589f30d905084356020860135610d846040880188614e7b565b604051610d949493929190614fb6565b60405180910390a1805460ff191660021781555b50505050565b610dd260405180606001604052806000815260200160008152602001606081525090565b60408051606081018252600780548252600854602080840191909152600980548551818402810184018752818152949593949386019392830182828015610e4257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610e24575b505050505081525050905090565b6000610e5b336116bd565b11610e785760405162461bcd60e51b81526004016104c490614b4a565b60003390506000610f41468d8d8d80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508c8c80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610f0692508d91508e9050614d19565b8a8a808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b9250611f4d915050565b9050610f4e828285612035565b505050505050505050505050565b333014610f7b5760405162461bcd60e51b81526004016104c490614d26565b6040516308f2839760e41b906000906001600160a01b038516908390610fa59086906024016146ad565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051610fe39190614e2d565b6000604051808303816000865af19150503d8060008114611020576040519150601f19603f3d011682016040523d82523d6000602084013e611025565b606091505b5050905080610da8578160405163411471c360e11b81526004016104c49190614e49565b600d546001600160a01b031690565b6000828152600160208181526040808420858552909152909120908101546110c55760405162461bcd60e51b815260206004820152602c602482015260008051602061591b83398151915260448201526b656d70747920766f74696e6760a01b60648201526084016104c4565b610da881612178565b60006110d9336116bd565b116110f65760405162461bcd60e51b81526004016104c490614b4a565b3360006111058686868661239a565b90508087146111665760405162461bcd60e51b815260206004820152602760248201527f526f6e696e476f7665726e616e636541646d696e3a20696e76616c696420766f6044820152660e8ca40d0c2e6d60cb1b60648201526084016104c4565b6000818152600e6020526040902060048101546111cd5760405162461bcd60e51b8152602060048201526031602482015260008051602061591b8339815191526044820152706e6f6e2d6578697374656e7420766f746560781b60648201526084016104c4565b6004815460ff1660048111156111e5576111e56145a6565b036112355760405162461bcd60e51b815260206004820152602c602482015260008051602061591b83398151915260448201526b6578706972656420766f746560a01b60648201526084016104c4565b6112408184846123f6565b600061124c82846124c1565b9050600061127061125b611b1f565b611264846125be565b859190600080896125f2565b90506001816004811115611286576112866145a6565b036112d857611295898961264c565b6040518481527fd3500576a0d4923326fbb893cf2169273e0df93f3cb6b94b83f2ca2e0ecb681b9060200160405180910390a1825460ff19166002178355611325565b60048160048111156112ec576112ec6145a6565b03611325576040518481527feecb3148acc573548e89cb64eb5f2023a61171f1c413ed8bf0fe506c19aeebe49060200160405180910390a15b50505050505050505050565b600061133c336116bd565b116113595760405162461bcd60e51b81526004016104c490614b4a565b61140a8a8a8a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808e0282810182019093528d82529093508d92508c9182918501908490808284376000920191909152506113cf92508a91508b9050614d19565b878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250339250611f4d915050565b5050505050505050505050565b33611420611049565b6001600160a01b03161461144757604051630e6444a160e31b815260040160405180910390fd5b60006114558585858561239a565b6000818152600e602052604090819020426004820155600381018590559051919250907f18ea835340bb2973a31996158138f109e9c5b9cfdb2424e999e6b1a9ce565de8906114ad9084908990899089908990615015565b60405180910390a1505050505050565b60006114c8336116bd565b116114e55760405162461bcd60e51b81526004016104c490614b4a565b6114f8336114f28461512e565b83612035565b5050565b33301461151b5760405162461bcd60e51b81526004016104c490614d26565b6000816001600160a01b03163b116115455760405162461bcd60e51b81526004016104c490614d6d565b6105fb8161270f565b600061155960025490565b905090565b6004546001600160a01b031690565b33301461158c5760405162461bcd60e51b81526004016104c490614d26565b6000816001600160a01b03163b116115f85760405162461bcd60e51b815260206004820152602960248201527f526f6e696e476f7665726e616e636541646d696e3a2073657420746f206e6f6e6044820152680b58dbdb9d1c9858dd60ba1b60648201526084016104c4565b6105fb8161275a565b6000828152600e602052604081206116199083611a3a565b90505b92915050565b60408051600481526024810182526020810180516001600160e01b03166303e1469160e61b908117909152915160009291839182916001600160a01b03871691610bc79190614e2d565b6000611677336116bd565b116116945760405162461bcd60e51b81526004016104c490614b4a565b6116b585858585856006546116a7610cdf565b6116af61155e565b336127a5565b505050505050565b6000631af0725f60e31b81806116d1610cdf565b6001600160a01b0316634bb5274a84876040516024016116f191906146ad565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611732919060240161522e565b6040516020818303038152906040529060e01b6020820180516001600160e01b03838183161783525050505060405161176b9190614e2d565b600060405180830381855afa9150503d80600081146117a6576040519150601f19603f3d011682016040523d82523d6000602084013e6117ab565b606091505b5091509150816117d0578260405163411471c360e11b81526004016104c49190614e49565b80806020019051810190610c409190615241565b6117f66117f08861512e565b82612807565b50600061180a6118058961512e565b6128d1565b90506118446118188961512e565b888888886118308961182b896000612a70565b612ac6565b61183f8a61182b8a6001612a70565b612aed565b5050505050505050565b600061185a6000612e26565b905060006040518060c001604052808381526020018c81526020018b8b808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505050602082018b9052604082018a905260609091018890529091506118ce828787612f29565b90506118e5600254826130f790919063ffffffff16565b60006118f0826128d1565b60008581526000805160206158fb8339815191526020526040902090915061191990828f6131f3565b808460008051602061597b8339815191528461193487613203565b878a604051611946949392919061535f565b60405180910390a350505050505050505050505050565b600480546001600160a01b0319166001600160a01b0383161790556040517f5cbd8a0bb00196365d5eb3457c6734e7f06666c3c78e5469b4c9deec7edae048906119a89083906146ad565b60405180910390a150565b60006119c16118058861512e565b6020808901356000908152600180835260408083208c35845290935291902001549091508114611a035760405162461bcd60e51b81526004016104c490615446565b611a31611a0f8861512e565b87878787611a228861182b896000612a70565b61183f8961182b8a6001612a70565b50505050505050565b6001600160a01b031660009081526002919091016020526040902054151590565b6001600160a01b03166000908152600891909101602052604090205460ff1690565b6000611a948383611a8d8c6154f9565b9190612f29565b90506000611aa9611aa48b6154f9565b613203565b9050611ab4826128d1565b600080805260016020818152855183526000805160206158fb83398151915290526040909120015414611af95760405162461bcd60e51b81526004016104c490615446565b611325828a8a8a8a611b108b61182b896000612a70565b61183f8c61182b8a6001612a70565b6000637de5dedd60e01b8180611b33610cdf565b6040805160048152602480820183526020820180516001600160e01b03166001600160e01b0319891617905291516001600160a01b039390931692634bb5274a92611b7f92910161522e565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051611bb89190614e2d565b600060405180830381855afa9150503d8060008114611bf3576040519150601f19603f3d011682016040523d82523d6000602084013e611bf8565b606091505b509150915081611c1d578260405163411471c360e11b81526004016104c49190614e49565b80806020019051810190611c319190615241565b935050505090565b600754853510801590611c525750600854602086013510155b611cc45760405162461bcd60e51b815260206004820152603d60248201527f424f73476f7665726e616e636550726f706f73616c3a20717565727920666f7260448201527f206f7574646174656420627269646765206f70657261746f722073657400000060648201526084016104c4565b611ccd8561335d565b82611d2e5760405162461bcd60e51b815260206004820152602b60248201527f424f73476f7665726e616e636550726f706f73616c3a20696e76616c6964206160448201526a0e4e4c2f240d8cadccee8d60ab1b60648201526084016104c4565b6000806000611d3c8861351d565b90506000611d4a8583612ac6565b89356000818152600a60209081526040808320828f0135808552908352818420948452600c83528184209084529091528120929350909190805b8a811015611ec857368c8c83818110611d9f57611d9f614dda565b606002919091019150611dca905086611dbb60208401846155d2565b836020013584604001356135cf565b9850886001600160a01b0316886001600160a01b031610611e2f5760405162461bcd60e51b815260206004820152602b602482015260008051602061595b83398151915260448201526a34b3b732b91037b93232b960a91b60648201526084016104c4565b88975050611e3c886135f7565b15611eb6576001600160a01b0388166000908152600b60205260409020439055600191508b8b82818110611e7257611e72614dda565b9050606002018360008a6001600160a01b03166001600160a01b031681526020019081526020016000208181611ea891906155ef565b50611eb690508489886123f6565b80611ec081614df0565b915050611d84565b5080611f165760405162461bcd60e51b8152602060048201526029602482015260008051602061595b83398151915260448201526869676e61747572657360b81b60648201526084016104c4565b6000611f2284876124c1565b9050611f3d8a611f318361360a565b8691906000808b6125f2565b5050505050505050505050505050565b611f55614295565b87600003611f755760405162461bcd60e51b81526004016104c490615620565b6000611f8089612e26565b90506040518060e001604052808281526020018a8152602001898152602001888152602001878152602001868152602001858152509150611fcc600254836130f790919063ffffffff16565b6000611fd7836128d1565b60008b81526001602090815260408083208684529091529020909150611ffe90828b6131f3565b80828b60008051602061593b8339815191528688604051612020929190615655565b60405180910390a45050979650505050505050565b468260200151146120975760405162461bcd60e51b815260206004820152602660248201527f526f6e696e476f7665726e616e636541646d696e3a20696e76616c6964206368604482015265185a5b881a5960d21b60648201526084016104c4565b6120a0826128d1565b6020808401516000908152600180835260408083208751845290935291902001541461212b5760405162461bcd60e51b815260206004820152603460248201527f526f6e696e476f7665726e616e636541646d696e3a206361737420766f746520604482015273199bdc881a5b9d985b1a59081c1c9bdc1bdcd85b60621b60648201526084016104c4565b6000612135611b1f565b905060008161214261361e565b61214c919061567f565b612157906001614dc7565b9050612161614275565b611a31858585858a866121738d6116bd565b613632565b600080825460ff166004811115612191576121916145a6565b1480156121a2575042826006015411155b905080156123955760018201546040517f58f98006a7f2f253f8ae8f8b7cec9008ca05359633561cd7c22f3005682d4a5590600090a260005b60048301548110156122945782600801600084600401838154811061220257612202614dda565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff19169055600484018054600786019291908490811061224b5761224b614dda565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff1916815560018101829055600201558061228c81614df0565b9150506121db565b5060005b6005830154811015612351578260080160008460050183815481106122bf576122bf614dda565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff19169055600584018054600786019291908490811061230857612308614dda565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff1916815560018101829055600201558061234981614df0565b915050612298565b50815460ff19168255600060018301819055600283018190556003830181905561237f9060048401906142d2565b61238d6005830160006142d2565b600060068301555b919050565b6040516000906123d6907f697acba4deaf1a718d8c2d93e42860488cb7812696f28ca10eed17bac41e7027908790879087908790602001615015565b604051602081830303815290604052805190602001209050949350505050565b6000836003015411801561240e575042836003015411155b1561241f57825460ff191660041783555b6124298383611a3a565b1561247857612442826001600160a01b03166014613a39565b6040516020016124529190615692565b60408051601f198184030181529082905262461bcd60e51b82526104c49160040161522e565b6001600160a01b039091166000818152600284016020908152604082209390935560059093018054600181018255908452919092200180546001600160a01b0319169091179055565b60058201546060906000906001600160401b038111156124e3576124e3614b96565b60405190808252806020026020018201604052801561250c578160200160208202803683370190505b50915060005b82518110156125b557600085600501828154811061253257612532614dda565b60009182526020808320909101546001600160a01b0316808352600289019091526040909120549091508590036125a25780848461256f81614df0565b95508151811061258157612581614dda565b60200260200101906001600160a01b031690816001600160a01b0316815250505b50806125ad81614df0565b915050612512565b50815292915050565b6000635f14a1c360e01b81806125d2610cdf565b6001600160a01b0316634bb5274a84876040516024016116f191906156e6565b60008585101580156126045750838310155b801561262557506000875460ff166004811115612623576126236145a6565b145b1561263d57865460ff19166001908117885587018290555b5050935460ff16949350505050565b6361e45aeb60e11b600061265e611049565b6001600160a01b0316634bb5274a8386866040516024016126959291906001600160a01b0392831681529116602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516126d6919060240161522e565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051610fe39190614e2d565b600380546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d7906119a89083906146ad565b600d80546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906119a89083906146ad565b6127ad614295565b6127c16127b98b6154f9565b858585613bd4565b905060006127d1611aa48c6154f9565b90506127f9828b8b8b8b6127ea8c61182b896000612a70565b61183f8d61182b8a6001612a70565b509998505050505050505050565b602082015160009080820361282e5760405162461bcd60e51b81526004016104c490615620565b60025461283c9085906130f7565b6000612847856128d1565b905061285282612e26565b6000838152600160209081526040808320848452909152908190209087015191945061287f9183906131f3565b8451831461289f5760405162461bcd60e51b81526004016104c4906156f9565b80838360008051602061593b83398151915288886040516128c1929190615655565b60405180910390a4505092915050565b6000806000806000808660800151905060008760600151905060008860a00151516001600160401b0381111561290957612909614b96565b604051908082528060200260200182016040528015612932578160200160208202803683370190505b5060c08a015190915060005b825181101561299b578a60a00151818151811061295d5761295d614dda565b60200260200101518051906020012083828151811061297e5761297e614dda565b60209081029190910101528061299381614df0565b91505061293e565b506020835102602084012097506020845102602085012096506020825102602083012095506020815102602082012094507fd051578048e6ff0bbc9fca3b65a42088dbde10f36ca841de566711087ad9b08a60001b8a600001518b602001518c604001518b8b8b8b604051602001612a4b989796959493929190978852602088019690965260408701949094526060860192909252608085015260a084015260c083015260e08201526101000190565b6040516020818303038152906040528051906020012098505050505050505050919050565b604051600090612aa8907fd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c2908590859060200161573f565b60405160208183030381529060405280519060200120905092915050565b60405161190160f01b60208201526022810183905260428101829052600090606201612aa8565b8415801590612afb57508483145b612b585760405162461bcd60e51b815260206004820152602860248201527f476f7665726e616e636550726f706f73616c3a20696e76616c696420617272616044820152670f240d8cadccee8d60c31b60648201526084016104c4565b6000612b62611b1f565b9050600081612b6f61361e565b612b79919061567f565b612b84906001614dc7565b9050600080366000805b89811015612dba578a8a82818110612ba857612ba8614dda565b606002919091019350600090508d8d83818110612bc757612bc7614dda565b9050602002016020810190612bdc9190615764565b6001811115612bed57612bed6145a6565b03612c1957612c1289612c0360208601866155d2565b856020013586604001356135cf565b9350612ccd565b60018d8d83818110612c2d57612c2d614dda565b9050602002016020810190612c429190615764565b6001811115612c5357612c536145a6565b03612c6957612c1288612c0360208601866155d2565b60405162461bcd60e51b815260206004820152603360248201527f476f7665726e616e636550726f706f73616c3a20717565727920666f7220756e604482015272737570706f7274656420766f7465207479706560681b60648201526084016104c4565b836001600160a01b0316856001600160a01b031610612d385760405162461bcd60e51b815260206004820152602160248201527f476f7665726e616e636550726f706f73616c3a20696e76616c6964206f7264656044820152603960f91b60648201526084016104c4565b8394506000612d46856116bd565b90508015612da75760019250612d958f8f8f85818110612d6857612d68614dda565b9050602002016020810190612d7d9190615764565b8a8a89612d8f368b90038b018b615781565b87613632565b15612da7575050505050505050611a31565b5080612db281614df0565b915050612b8e565b5080612e175760405162461bcd60e51b815260206004820152602660248201527f476f7665726e616e636550726f706f73616c3a20696e76616c6964207369676e60448201526561747572657360d01b60648201526084016104c4565b50505050505050505050505050565b60008181526020819052604081205490819003612e555750600090815260208190526040902060019081905590565b6000828152600160209081526040808320848452909152812090612e7882612178565b905080612f22576000825460ff166004811115612e9757612e976145a6565b03612efe5760405162461bcd60e51b815260206004820152603160248201527f436f7265476f7665726e616e63653a2063757272656e742070726f706f73616c604482015270081a5cc81b9bdd0818dbdb5c1b195d1959607a1b60648201526084016104c4565b60008481526020819052604081208054909190612f1a90614df0565b918290555092505b5050919050565b612f31614295565b83518152602080850151604080840191909152600091830191909152840151516001600160401b03811115612f6857612f68614b96565b604051908082528060200260200182016040528015612f91578160200160208202803683370190505b5060608083019190915284015160808083019190915284015160a08083019190915284015160c082015260005b8460400151518110156130ef57600185604001518281518110612fe357612fe3614dda565b60200260200101516001811115612ffc57612ffc6145a6565b0361303d57828260600151828151811061301857613018614dda565b60200260200101906001600160a01b031690816001600160a01b0316815250506130dd565b60008560400151828151811061305557613055614dda565b6020026020010151600181111561306e5761306e6145a6565b0361308a57838260600151828151811061301857613018614dda565b60405162461bcd60e51b815260206004820152602260248201527f476c6f62616c50726f706f73616c3a20756e737570706f727465642074617267604482015261195d60f21b60648201526084016104c4565b806130e781614df0565b915050612fbe565b509392505050565b60008260600151511180156131155750816080015151826060015151145b801561312a57508160a0015151826060015151145b801561313f57508160c0015151826060015151145b61318b5760405162461bcd60e51b815260206004820152601e60248201527f50726f706f73616c3a20696e76616c6964206172726179206c656e677468000060448201526064016104c4565b6131958142614dc7565b826040015111156114f85760405162461bcd60e51b815260206004820152602260248201527f50726f706f73616c3a20696e76616c6964206578706972792074696d6573746160448201526106d760f41b60648201526084016104c4565b6001830191909155600690910155565b6000806000806000808660600151905060008760400151905060008860800151516001600160401b0381111561323b5761323b614b96565b604051908082528060200260200182016040528015613264578160200160208202803683370190505b5060a08a015190915060005b82518110156132cd578a60800151818151811061328f5761328f614dda565b6020026020010151805190602001208382815181106132b0576132b0614dda565b6020908102919091010152806132c581614df0565b915050613270565b5082516020908102848201208551820286830120845183028584012084518402858501208e518f860151604080517f1463f426c05aff2c1a7a0957a71c9898bc8b47142540538e79ee25ee911413509881019890985287019190915260608601526080850184905260a0850183905260c0850182905260e08501819052929b509099509750955061010001612a4b565b600061336c6040830183614e7b565b9050116133cf5760405162461bcd60e51b815260206004820152602b60248201527f4272696467654f70657261746f727342616c6c6f743a20696e76616c6964206160448201526a0e4e4c2f240d8cadccee8d60ab1b60648201526084016104c4565b60006133de6040830183614e7b565b60008181106133ef576133ef614dda565b90506020020160208101906134049190614523565b905060015b6134166040840184614e7b565b90508110156135185761342c6040840184614e7b565b8281811061343c5761343c614dda565b90506020020160208101906134519190614523565b6001600160a01b0316826001600160a01b0316106134d25760405162461bcd60e51b815260206004820152603860248201527f4272696467654f70657261746f727342616c6c6f743a20696e76616c6964206f60448201527772646572206f6620627269646765206f70657261746f727360401b60648201526084016104c4565b6134df6040840184614e7b565b828181106134ef576134ef614dda565b90506020020160208101906135049190614523565b91508061351081614df0565b915050613409565b505050565b6000808061352e6040850185614e7b565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250508251602090810293810193909320604080517fd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a818701528935818301529885013560608a01526080808a01929092528051808a03909201825260a0909801909752505084519401939093209392505050565b60008060006135e087878787613ca6565b915091506135ed81613d89565b5095945050505050565b60008061360383613f3a565b1192915050565b600063d9d5dadb60e01b81806125d2610cdf565b600063926323d560e01b8180611b33610cdf565b6020808801518851600082815260018452604080822083835290945292832061365a81612178565b1561366b5760019350505050613a2e565b6020808c0151600090815290819052604090205482146136e65760405162461bcd60e51b815260206004820152603060248201527f436f7265476f7665726e616e63653a20717565727920666f7220696e76616c6960448201526f642070726f706f73616c206e6f6e636560801b60648201526084016104c4565b6000815460ff1660048111156136fe576136fe6145a6565b146137595760405162461bcd60e51b815260206004820152602560248201527f436f7265476f7665726e616e63653a2074686520766f74652069732066696e616044820152641b1a5e995960da1b60648201526084016104c4565b6137638188611a5b565b1561378c5761377c876001600160a01b03166014613a39565b60405160200161245291906157e2565b6001600160a01b03871660009081526008820160209081526040909120805460ff191660011790558601511515806137c75750604086015115155b806137d55750855160ff1615155b1561381c576001600160a01b03871660009081526007820160209081526040918290208851815460ff191660ff909116178155908801516001820155908701516002909101555b866001600160a01b031681600101547f1203f9e81c814a35f5f4cc24087b2a24c6fb7986a9f1406b68a9484882c93a238c8860405161385c929190615832565b60405180910390a3600080808c600181111561387a5761387a6145a6565b036138cf576004830180546001810182556000918252602082200180546001600160a01b0319166001600160a01b038c161790556003840180548992906138c2908490614dc7565b925050819055915061398e565b60018c60018111156138e3576138e36145a6565b03613938576005830180546001810182556000918252602082200180546001600160a01b0319166001600160a01b038c1617905560028401805489929061392b908490614dc7565b925050819055905061398e565b60405162461bcd60e51b815260206004820152602560248201527f436f7265476f7665726e616e63653a20756e737570706f7274656420766f7465604482015264207479706560d81b60648201526084016104c4565b8a82106139e257825460ff19166001908117845580840154604051919750907f5c819725ea53655a3b898f3df59b66489761935454e9212ca1e5ebd759953d0b90600090a26139dd838e613f4e565b613a28565b898110613a2857825460ff19166003178355600180840154604051919750907f55295d4ce992922fa2e5ffbf3a3dcdb367de0a15e125ace083456017fd22060f90600090a25b50505050505b979650505050505050565b60606000613a48836002614ec4565b613a53906002614dc7565b6001600160401b03811115613a6a57613a6a614b96565b6040519080825280601f01601f191660200182016040528015613a94576020820181803683370190505b509050600360fc1b81600081518110613aaf57613aaf614dda565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613ade57613ade614dda565b60200101906001600160f81b031916908160001a9053506000613b02846002614ec4565b613b0d906001614dc7565b90505b6001811115613b85576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613b4157613b41614dda565b1a60f81b828281518110613b5757613b57614dda565b60200101906001600160f81b031916908160001a90535060049490941c93613b7e81615849565b9050613b10565b5083156116195760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104c4565b613bdc614295565b613be7858585612f29565b9050613bfe600254826130f790919063ffffffff16565b6000613c09826128d1565b90506000613c176000612e26565b60008181526000805160206158fb8339815191526020908152604090912090890151919250613c479184906131f3565b82518114613c675760405162461bcd60e51b81526004016104c4906156f9565b818160008051602061597b83398151915285613c828b613203565b8b89604051613c94949392919061535f565b60405180910390a35050949350505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613cd35750600090506003613d80565b8460ff16601b14158015613ceb57508460ff16601c14155b15613cfc5750600090506004613d80565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613d50573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613d7957600060019250925050613d80565b9150600090505b94509492505050565b6000816004811115613d9d57613d9d6145a6565b03613da55750565b6001816004811115613db957613db96145a6565b03613e015760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016104c4565b6002816004811115613e1557613e156145a6565b03613e625760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104c4565b6003816004811115613e7657613e766145a6565b03613ece5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104c4565b6004816004811115613ee257613ee26145a6565b036105fb5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016104c4565b6000635624191160e01b81806116d1610cdf565b613f5781613fbb565b156114f857815460ff19166002178255600080613f7383613fd5565b9150915083600101547fe134987599ae266ec90edeff1b26125b287dbb57b10822649432d1bb26537fba8383604051613fad929190615860565b60405180910390a250505050565b600081602001516000148061161c57505060200151461490565b606080613fe183613fbb565b6140395760405162461bcd60e51b815260206004820152602360248201527f50726f706f73616c3a20717565727920666f7220696e76616c696420636861696044820152621b925960ea1b60648201526084016104c4565b8260600151516001600160401b0381111561405657614056614b96565b60405190808252806020026020018201604052801561407f578160200160208202803683370190505b5091508260600151516001600160401b0381111561409f5761409f614b96565b6040519080825280602002602001820160405280156140d257816020015b60608152602001906001900390816140bd5790505b50905060005b83606001515181101561426f578360c0015181815181106140fb576140fb614dda565b60200260200101515a1161414e5760405162461bcd60e51b815260206004820152601a60248201527950726f706f73616c3a20696e73756666696369656e742067617360301b60448201526064016104c4565b8360600151818151811061416457614164614dda565b60200260200101516001600160a01b03168460800151828151811061418b5761418b614dda565b60200260200101518560c0015183815181106141a9576141a9614dda565b6020026020010151908660a0015184815181106141c8576141c8614dda565b60200260200101516040516141dd9190614e2d565b600060405180830381858888f193505050503d806000811461421b576040519150601f19603f3d011682016040523d82523d6000602084013e614220565b606091505b5084838151811061423357614233614dda565b6020026020010184848151811061424c5761424c614dda565b6020908102919091010191909152901515905261426881614df0565b90506140d8565b50915091565b604080516060810182526000808252602082018190529181019190915290565b6040518060e00160405280600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b50805460008255906000526020600020908101906105fb91905b8082111561430057600081556001016142ec565b5090565b600060e0828403121561431657600080fd5b50919050565b60008083601f84011261432e57600080fd5b5081356001600160401b0381111561434557600080fd5b6020830191508360208260051b850101111561436057600080fd5b9250929050565b60008083601f84011261437957600080fd5b5081356001600160401b0381111561439057600080fd5b60208301915083602060608302850101111561436057600080fd5b6000806000806000606086880312156143c357600080fd5b85356001600160401b03808211156143da57600080fd5b6143e689838a01614304565b965060208801359150808211156143fc57600080fd5b61440889838a0161431c565b9096509450604088013591508082111561442157600080fd5b5061442e88828901614367565b969995985093965092949392505050565b600080600080600080600080600060a08a8c03121561445d57600080fd5b8935985060208a01356001600160401b038082111561447b57600080fd5b6144878d838e0161431c565b909a50985060408c01359150808211156144a057600080fd5b6144ac8d838e0161431c565b909850965060608c01359150808211156144c557600080fd5b6144d18d838e0161431c565b909650945060808c01359150808211156144ea57600080fd5b506144f78c828d0161431c565b915080935050809150509295985092959850929598565b6001600160a01b03811681146105fb57600080fd5b60006020828403121561453557600080fd5b81356116198161450e565b6000806040838503121561455357600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b8381101561459b5781516001600160a01b031687529582019590820190600101614576565b509495945050505050565b634e487b7160e01b600052602160045260246000fd5b600281106105fb576105fb6145a6565b600081518084526020808501945080840160005b8381101561459b578151805160ff168852838101518489015260409081015190880152606090960195908201906001016145e0565b6060815260006146286060830186614562565b82810360208481019190915285518083528682019282019060005b81811015614668578451614656816145bc565b83529383019391830191600101614643565b5050848103604086015261467c81876145cc565b98975050505050505050565b60408152600061469b6040830185614562565b8281036020840152610c4081856145cc565b6001600160a01b0391909116815260200190565b6000806000606084860312156146d657600080fd5b833592506020840135915060408401356146ef8161450e565b809150509250925092565b60006020828403121561470c57600080fd5b5035919050565b60008060008060006060868803121561472b57600080fd5b85356001600160401b038082111561474257600080fd5b9087019060c0828a03121561475657600080fd5b909550602087013590808211156143fc57600080fd5b60008060006040848603121561478157600080fd5b83356001600160401b038082111561479857600080fd5b90850190606082880312156147ac57600080fd5b909350602085013590808211156147c257600080fd5b506147cf86828701614367565b9497909650939450505050565b60208152815160208201526020820151604082015260006040830151606080840152610c6c6080840182614562565b600281106105fb57600080fd5b80356123958161480b565b60008060008060008060008060008060c08b8d03121561484257600080fd5b8a35995060208b01356001600160401b038082111561486057600080fd5b61486c8e838f0161431c565b909b50995060408d013591508082111561488557600080fd5b6148918e838f0161431c565b909950975060608d01359150808211156148aa57600080fd5b6148b68e838f0161431c565b909750955060808d01359150808211156148cf57600080fd5b506148dc8d828e0161431c565b90945092506148ef905060a08c01614818565b90509295989b9194979a5092959850565b6000806040838503121561491357600080fd5b823561491e8161450e565b9150602083013561492e8161450e565b809150509250929050565b600080600080600060a0868803121561495157600080fd5b8535945060208601356149638161450e565b935060408601356149738161450e565b94979396509394606081013594506080013592915050565b60008060008060008060008060008060c08b8d0312156149aa57600080fd5b8a35995060208b0135985060408b01356001600160401b03808211156149cf57600080fd5b6149db8e838f0161431c565b909a50985060608d01359150808211156149f457600080fd5b614a008e838f0161431c565b909850965060808d0135915080821115614a1957600080fd5b614a258e838f0161431c565b909650945060a08d0135915080821115614a3e57600080fd5b50614a4b8d828e0161431c565b915080935050809150509295989b9194979a5092959850565b60008060008060808587031215614a7a57600080fd5b8435614a858161450e565b93506020850135614a958161450e565b93969395505050506040820135916060013590565b60008060408385031215614abd57600080fd5b82356001600160401b03811115614ad357600080fd5b614adf85828601614304565b925050602083013561492e8161480b565b60a0810160058710614b0457614b046145a6565b95815260208101949094526040840192909252606083015260809091015290565b60008060408385031215614b3857600080fd5b82359150602083013561492e8161450e565b6020808252602c908201527f526f6e696e476f7665726e616e636541646d696e3a2073656e6465722069732060408201526b3737ba1033b7bb32b93737b960a11b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715614bce57614bce614b96565b60405290565b60405160c081016001600160401b0381118282101715614bce57614bce614b96565b604051601f8201601f191681016001600160401b0381118282101715614c1e57614c1e614b96565b604052919050565b60006001600160401b03821115614c3f57614c3f614b96565b5060051b60200190565b6000614c5c614c5784614c26565b614bf6565b8381529050602080820190600585901b840186811115614c7b57600080fd5b845b81811015614d0e5780356001600160401b0380821115614c9d5760008081fd5b8188019150601f8a81840112614cb35760008081fd5b823582811115614cc557614cc5614b96565b614cd6818301601f19168801614bf6565b92508083528b87828601011115614cef57600091508182fd5b8087850188850137600090830187015250855250928201928201614c7d565b505050509392505050565b6000611619368484614c49565b60208082526027908201527f476f7665726e616e636541646d696e3a206f6e6c7920616c6c6f7765642073656040820152661b198b58d85b1b60ca1b606082015260800190565b60208082526024908201527f476f7665726e616e636541646d696e3a2073657420746f206e6f6e2d636f6e746040820152631c9858dd60e21b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561161c5761161c614db1565b634e487b7160e01b600052603260045260246000fd5b600060018201614e0257614e02614db1565b5060010190565b60005b83811015614e24578181015183820152602001614e0c565b50506000910152565b60008251614e3f818460208701614e09565b9190910192915050565b6001600160e01b031991909116815260200190565b600060208284031215614e7057600080fd5b81516116198161450e565b6000808335601e19843603018112614e9257600080fd5b8301803591506001600160401b03821115614eac57600080fd5b6020019150600581901b360382131561436057600080fd5b808202811582820484141761161c5761161c614db1565b6000813561161c8161450e565b81358155600160208084013582840155600283016040850135601e19863603018112614f1357600080fd5b850180356001600160401b03811115614f2b57600080fd5b83820191508060051b3603821315614f4257600080fd5b600160401b811115614f5657614f56614b96565b825481845580821015614f8a5760008481528581208381019083015b80821015614f865782825590880190614f72565b5050505b50600092835260208320925b8181101561184457614fa783614edb565b84820155918401918501614f96565b84815260208082018590526060604083018190528201839052600090849060808401835b86811015615008578335614fed8161450e565b6001600160a01b031682529282019290820190600101614fda565b5098975050505050505050565b9485526001600160a01b0393841660208601529190921660408401526060830191909152608082015260a00190565b600082601f83011261505557600080fd5b81356020615065614c5783614c26565b82815260059290921b8401810191818101908684111561508457600080fd5b8286015b848110156150a857803561509b8161450e565b8352918301918301615088565b509695505050505050565b600082601f8301126150c457600080fd5b813560206150d4614c5783614c26565b82815260059290921b840181019181810190868411156150f357600080fd5b8286015b848110156150a857803583529183019183016150f7565b600082601f83011261511f57600080fd5b61161983833560208501614c49565b600060e0823603121561514057600080fd5b615148614bac565b82358152602080840135908201526040808401359082015260608301356001600160401b038082111561517a57600080fd5b61518636838701615044565b6060840152608085013591508082111561519f57600080fd5b6151ab368387016150b3565b608084015260a08501359150808211156151c457600080fd5b6151d03683870161510e565b60a084015260c08501359150808211156151e957600080fd5b506151f6368286016150b3565b60c08301525092915050565b6000815180845261521a816020860160208601614e09565b601f01601f19169290920160200192915050565b6020815260006116196020830184615202565b60006020828403121561525357600080fd5b5051919050565b600081518084526020808501945080840160005b8381101561459b5781518752958201959082019060010161526e565b600081518084526020808501808196508360051b8101915082860160005b858110156152d25782840389526152c0848351615202565b988501989350908401906001016152a8565b5091979650505050505050565b8051825260208101516020830152604081015160408301526000606082015160e0606085015261531260e0850182614562565b90506080830151848203608086015261532b828261525a565b91505060a083015184820360a0860152615345828261528a565b91505060c083015184820360c0860152610c40828261525a565b60808152600061537260808301876152df565b60208681850152838203604085015260c08201865183528187015182840152604087015160c0604085015281815180845260e0860191508483019350600092505b808310156153dc5783516153c6816145bc565b82529284019260019290920191908401906153b3565b506060890151935084810360608601526153f6818561525a565b935050505060808601518282036080840152615412828261528a565b91505060a086015182820360a084015261542c828261525a565b9350505050610c4060608301846001600160a01b03169052565b6020808252602f908201527f476f7665726e616e636541646d696e3a206361737420766f746520666f72206960408201526e1b9d985b1a59081c1c9bdc1bdcd85b608a1b606082015260800190565b600082601f8301126154a657600080fd5b813560206154b6614c5783614c26565b82815260059290921b840181019181810190868411156154d557600080fd5b8286015b848110156150a85780356154ec8161480b565b83529183019183016154d9565b600060c0823603121561550b57600080fd5b615513614bd4565b823581526020808401359082015260408301356001600160401b038082111561553b57600080fd5b61554736838701615495565b6040840152606085013591508082111561556057600080fd5b61556c368387016150b3565b6060840152608085013591508082111561558557600080fd5b6155913683870161510e565b608084015260a08501359150808211156155aa57600080fd5b506155b7368286016150b3565b60a08301525092915050565b60ff811681146105fb57600080fd5b6000602082840312156155e457600080fd5b8135611619816155c3565b81356155fa816155c3565b60ff811660ff198354161782555060208201356001820155604082013560028201555050565b6020808252818101527f436f7265476f7665726e616e63653a20696e76616c696420636861696e206964604082015260600190565b60408152600061566860408301856152df565b905060018060a01b03831660208301529392505050565b8181038181111561161c5761161c614db1565b73024b9b7b630ba32b223b7bb32b93730b731b29d160651b8152600082516156c1816014850160208701614e09565b6d08185b1c9958591e481d9bdd195960921b6014939091019283015250602201919050565b6020815260006116196020830184614562565b60208082526026908201527f436f7265476f7665726e616e63653a20696e76616c69642070726f706f73616c604082015265206e6f6e636560d01b606082015260800190565b8381526020810183905260608101615756836145bc565b826040830152949350505050565b60006020828403121561577657600080fd5b81356116198161480b565b60006060828403121561579357600080fd5b604051606081016001600160401b03811182821017156157b5576157b5614b96565b60405282356157c3816155c3565b8152602083810135908201526040928301359281019290925250919050565b6f021b7b932a3b7bb32b93730b731b29d160851b81526000825161580d816010850160208701614e09565b6d08185b1c9958591e481d9bdd195960921b6010939091019283015250601e01919050565b6040810161583f846145bc565b9281526020015290565b60008161585857615858614db1565b506000190190565b604080825283519082018190526000906020906060840190828701845b8281101561589b57815115158452928401929084019060010161587d565b50505083810382850152845180825282820190600581901b8301840187850160005b838110156158eb57601f198684030185526158d9838351615202565b948701949250908601906001016158bd565b5090999850505050505050505056fea6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49526f6e696e476f7665726e616e636541646d696e3a20717565727920666f7220a57d40f1496988cf60ab7c9d5ba4ff83647f67d3898d441a3aaf21b651678fd9424f73476f7665726e616e636550726f706f73616c3a20696e76616c69642073771d78ae9e5fca95a532fb0971d575d0ce9b59d14823c063e08740137e0e0ecaa26469706673582212203defabe961291433baeb9e8dd4fcccf64e643b8f67b50068aac2a8da95c3cb1d64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101955760003560e01c80624054b81461019a57806309fcd8c7146101af5780630b26cf66146101c25780630b881830146101d557806317ce2dd4146101e85780631c905e39146102045780631e23e04814610226578063204e1c7a146102475780632b5df351146102675780632c5e65201461028a5780632e96a6fb1461029d5780632faf925d146102b057806334d5f37b146102c35780633644e515146102e35780635511cde1146102ec57806360911e8e146102f457806362e52e5f14610307578063663ac0111461031c5780637eff275e1461032f578063988ef53c14610342578063994390891461036b5780639a7d3382146103735780639e0dc0b314610386578063a1819f9a14610399578063a2fae570146103ac578063a8a0e32c146103bf578063b384abef146103d2578063b5e337de1461042d578063bc96180b14610440578063cd59658314610448578063cdf64a7614610450578063dcc3eb1914610463578063f3b7dead14610476578063fb4f637114610489575b600080fd5b6101ad6101a83660046143ab565b61049c565b005b6101ad6101bd36600461443f565b6104e5565b6101ad6101d0366004614523565b6105a9565b6101ad6101e33660046143ab565b6105fe565b6101f160055481565b6040519081526020015b60405180910390f35b610217610212366004614540565b61060e565b6040516101fb93929190614615565b610239610234366004614540565b6109f9565b6040516101fb929190614688565b61025a610255366004614523565b610b7d565b6040516101fb91906146ad565b61027a6102753660046146c1565b610c49565b60405190151581526020016101fb565b61027a6102983660046146c1565b610c74565b6101ad6102ab3660046146fa565b610c97565b6101ad6102be366004614713565b610cbf565b6101f16102d13660046146fa565b60006020819052908152604090205481565b6101f160065481565b61025a610cdf565b6101ad61030236600461476c565b610cee565b61030f610dae565b6040516101fb91906147dc565b6101ad61032a366004614823565b610e50565b6101ad61033d366004614900565b610f5c565b6101f1610350366004614523565b6001600160a01b03166000908152600b602052604090205490565b61025a611049565b6101ad610381366004614540565b611058565b6101ad610394366004614939565b6110ce565b6101ad6103a736600461498b565b611331565b6101ad6103ba366004614a64565b611417565b6101ad6103cd366004614aaa565b6114bd565b61041c6103e0366004614540565b600160208181526000938452604080852090915291835291208054918101546002820154600383015460069093015460ff909416939192909185565b6040516101fb959493929190614af0565b6101ad61043b366004614523565b6114fc565b6101f161154e565b61025a61155e565b6101ad61045e366004614523565b61156d565b61027a610471366004614b25565b611601565b61025a610484366004614523565b611622565b6101ad610497366004614713565b61166c565b60006104a7336116bd565b116104cd5760405162461bcd60e51b81526004016104c490614b4a565b60405180910390fd5b6104de8585858585600654336117e4565b5050505050565b60006104f0336116bd565b1161050d5760405162461bcd60e51b81526004016104c490614b4a565b61059e89898989898080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061055392508a91508b9050614d19565b8787808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506105909250610cdf915050565b61059861155e565b3361184e565b505050505050505050565b3330146105c85760405162461bcd60e51b81526004016104c490614d26565b6000816001600160a01b03163b116105f25760405162461bcd60e51b81526004016104c490614d6d565b6105fb8161195d565b50565b6104de85858585856006546119b3565b600082815260016020908152604080832084845290915281206004810154600582015460609384938493909290916106468284614dc7565b9050806001600160401b0381111561066057610660614b96565b604051908082528060200260200182016040528015610689578160200160208202803683370190505b509550806001600160401b038111156106a4576106a4614b96565b6040519080825280602002602001820160405280156106dd57816020015b6106ca614275565b8152602001906001900390816106c25790505b509450806001600160401b038111156106f8576106f8614b96565b604051908082528060200260200182016040528015610721578160200160208202803683370190505b50965060005b8381101561088057600087828151811061074357610743614dda565b6020026020010190600181111561075c5761075c6145a6565b9081600181111561076f5761076f6145a6565b90525060008a81526001602090815260408083208c8452909152812060048701805460079092019291849081106107a8576107a8614dda565b60009182526020808320909101546001600160a01b0316835282810193909352604091820190208151606081018352815460ff1681526001820154938101939093526002015490820152865187908390811061080657610806614dda565b602002602001018190525084600401818154811061082657610826614dda565b9060005260206000200160009054906101000a90046001600160a01b031688828151811061085657610856614dda565b6001600160a01b03909216602092830291909101909101528061087881614df0565b915050610727565b5060005b828110156109ed576001876108998684614dc7565b815181106108a9576108a9614dda565b602002602001019060018111156108c2576108c26145a6565b908160018111156108d5576108d56145a6565b90525060008a81526001602090815260408083208c84529091528120600587018054600790920192918490811061090e5761090e614dda565b60009182526020808320909101546001600160a01b0316835282810193909352604091820190208151606081018352815460ff1681526001820154938101939093526002015490820152866109638684614dc7565b8151811061097357610973614dda565b602002602001018190525084600501818154811061099357610993614dda565b6000918252602090912001546001600160a01b0316886109b38684614dc7565b815181106109c3576109c3614dda565b6001600160a01b0390921660209283029190910190910152806109e581614df0565b915050610884565b50505050509250925092565b6000828152600c602090815260408083208484528252808320858452600a8352818420858552835292819020600501805482518185028101850190935280835260609485949093929190830182828015610a7c57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610a5e575b5050505050925082516001600160401b03811115610a9c57610a9c614b96565b604051908082528060200260200182016040528015610ad557816020015b610ac2614275565b815260200190600190039081610aba5790505b50915060005b8351811015610b7457816000858381518110610af957610af9614dda565b6020908102919091018101516001600160a01b031682528181019290925260409081016000208151606081018352815460ff16815260018201549381019390935260020154908201528351849083908110610b5657610b56614dda565b60200260200101819052508080610b6c90614df0565b915050610adb565b50509250929050565b60408051600481526024810182526020810180516001600160e01b0316635c60da1b60e01b908117909152915160009291839182916001600160a01b03871691610bc79190614e2d565b600060405180830381855afa9150503d8060008114610c02576040519150601f19603f3d011682016040523d82523d6000602084013e610c07565b606091505b509150915081610c2c578260405163411471c360e11b81526004016104c49190614e49565b80806020019051810190610c409190614e5e565b95945050505050565b6000838152600a602090815260408083208584529091528120610c6c9083611a3a565b949350505050565b60008381526001602090815260408083208584529091528120610c6c9083611a5b565b333014610cb65760405162461bcd60e51b81526004016104c490614d26565b6105fb81600255565b6104de8585858585600654610cd2610cdf565b610cda61155e565b611a7d565b6003546001600160a01b031690565b610d04838383610cfc611b1f565b600654611c39565b82356000908152600a6020908152604080832082870135845290915290206001815460ff166004811115610d3a57610d3a6145a6565b03610da857836007610d4c8282614ee8565b507f7c45875370690698791a915954b9c69729cc5f9373edc5a2e04436c07589f30d905084356020860135610d846040880188614e7b565b604051610d949493929190614fb6565b60405180910390a1805460ff191660021781555b50505050565b610dd260405180606001604052806000815260200160008152602001606081525090565b60408051606081018252600780548252600854602080840191909152600980548551818402810184018752818152949593949386019392830182828015610e4257602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311610e24575b505050505081525050905090565b6000610e5b336116bd565b11610e785760405162461bcd60e51b81526004016104c490614b4a565b60003390506000610f41468d8d8d80806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050508c8c80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250610f0692508d91508e9050614d19565b8a8a808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508b9250611f4d915050565b9050610f4e828285612035565b505050505050505050505050565b333014610f7b5760405162461bcd60e51b81526004016104c490614d26565b6040516308f2839760e41b906000906001600160a01b038516908390610fa59086906024016146ad565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051610fe39190614e2d565b6000604051808303816000865af19150503d8060008114611020576040519150601f19603f3d011682016040523d82523d6000602084013e611025565b606091505b5050905080610da8578160405163411471c360e11b81526004016104c49190614e49565b600d546001600160a01b031690565b6000828152600160208181526040808420858552909152909120908101546110c55760405162461bcd60e51b815260206004820152602c602482015260008051602061591b83398151915260448201526b656d70747920766f74696e6760a01b60648201526084016104c4565b610da881612178565b60006110d9336116bd565b116110f65760405162461bcd60e51b81526004016104c490614b4a565b3360006111058686868661239a565b90508087146111665760405162461bcd60e51b815260206004820152602760248201527f526f6e696e476f7665726e616e636541646d696e3a20696e76616c696420766f6044820152660e8ca40d0c2e6d60cb1b60648201526084016104c4565b6000818152600e6020526040902060048101546111cd5760405162461bcd60e51b8152602060048201526031602482015260008051602061591b8339815191526044820152706e6f6e2d6578697374656e7420766f746560781b60648201526084016104c4565b6004815460ff1660048111156111e5576111e56145a6565b036112355760405162461bcd60e51b815260206004820152602c602482015260008051602061591b83398151915260448201526b6578706972656420766f746560a01b60648201526084016104c4565b6112408184846123f6565b600061124c82846124c1565b9050600061127061125b611b1f565b611264846125be565b859190600080896125f2565b90506001816004811115611286576112866145a6565b036112d857611295898961264c565b6040518481527fd3500576a0d4923326fbb893cf2169273e0df93f3cb6b94b83f2ca2e0ecb681b9060200160405180910390a1825460ff19166002178355611325565b60048160048111156112ec576112ec6145a6565b03611325576040518481527feecb3148acc573548e89cb64eb5f2023a61171f1c413ed8bf0fe506c19aeebe49060200160405180910390a15b50505050505050505050565b600061133c336116bd565b116113595760405162461bcd60e51b81526004016104c490614b4a565b61140a8a8a8a8a8080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050604080516020808e0282810182019093528d82529093508d92508c9182918501908490808284376000920191909152506113cf92508a91508b9050614d19565b878780806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250339250611f4d915050565b5050505050505050505050565b33611420611049565b6001600160a01b03161461144757604051630e6444a160e31b815260040160405180910390fd5b60006114558585858561239a565b6000818152600e602052604090819020426004820155600381018590559051919250907f18ea835340bb2973a31996158138f109e9c5b9cfdb2424e999e6b1a9ce565de8906114ad9084908990899089908990615015565b60405180910390a1505050505050565b60006114c8336116bd565b116114e55760405162461bcd60e51b81526004016104c490614b4a565b6114f8336114f28461512e565b83612035565b5050565b33301461151b5760405162461bcd60e51b81526004016104c490614d26565b6000816001600160a01b03163b116115455760405162461bcd60e51b81526004016104c490614d6d565b6105fb8161270f565b600061155960025490565b905090565b6004546001600160a01b031690565b33301461158c5760405162461bcd60e51b81526004016104c490614d26565b6000816001600160a01b03163b116115f85760405162461bcd60e51b815260206004820152602960248201527f526f6e696e476f7665726e616e636541646d696e3a2073657420746f206e6f6e6044820152680b58dbdb9d1c9858dd60ba1b60648201526084016104c4565b6105fb8161275a565b6000828152600e602052604081206116199083611a3a565b90505b92915050565b60408051600481526024810182526020810180516001600160e01b03166303e1469160e61b908117909152915160009291839182916001600160a01b03871691610bc79190614e2d565b6000611677336116bd565b116116945760405162461bcd60e51b81526004016104c490614b4a565b6116b585858585856006546116a7610cdf565b6116af61155e565b336127a5565b505050505050565b6000631af0725f60e31b81806116d1610cdf565b6001600160a01b0316634bb5274a84876040516024016116f191906146ad565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051611732919060240161522e565b6040516020818303038152906040529060e01b6020820180516001600160e01b03838183161783525050505060405161176b9190614e2d565b600060405180830381855afa9150503d80600081146117a6576040519150601f19603f3d011682016040523d82523d6000602084013e6117ab565b606091505b5091509150816117d0578260405163411471c360e11b81526004016104c49190614e49565b80806020019051810190610c409190615241565b6117f66117f08861512e565b82612807565b50600061180a6118058961512e565b6128d1565b90506118446118188961512e565b888888886118308961182b896000612a70565b612ac6565b61183f8a61182b8a6001612a70565b612aed565b5050505050505050565b600061185a6000612e26565b905060006040518060c001604052808381526020018c81526020018b8b808060200260200160405190810160405280939291908181526020018383602002808284376000920182905250938552505050602082018b9052604082018a905260609091018890529091506118ce828787612f29565b90506118e5600254826130f790919063ffffffff16565b60006118f0826128d1565b60008581526000805160206158fb8339815191526020526040902090915061191990828f6131f3565b808460008051602061597b8339815191528461193487613203565b878a604051611946949392919061535f565b60405180910390a350505050505050505050505050565b600480546001600160a01b0319166001600160a01b0383161790556040517f5cbd8a0bb00196365d5eb3457c6734e7f06666c3c78e5469b4c9deec7edae048906119a89083906146ad565b60405180910390a150565b60006119c16118058861512e565b6020808901356000908152600180835260408083208c35845290935291902001549091508114611a035760405162461bcd60e51b81526004016104c490615446565b611a31611a0f8861512e565b87878787611a228861182b896000612a70565b61183f8961182b8a6001612a70565b50505050505050565b6001600160a01b031660009081526002919091016020526040902054151590565b6001600160a01b03166000908152600891909101602052604090205460ff1690565b6000611a948383611a8d8c6154f9565b9190612f29565b90506000611aa9611aa48b6154f9565b613203565b9050611ab4826128d1565b600080805260016020818152855183526000805160206158fb83398151915290526040909120015414611af95760405162461bcd60e51b81526004016104c490615446565b611325828a8a8a8a611b108b61182b896000612a70565b61183f8c61182b8a6001612a70565b6000637de5dedd60e01b8180611b33610cdf565b6040805160048152602480820183526020820180516001600160e01b03166001600160e01b0319891617905291516001600160a01b039390931692634bb5274a92611b7f92910161522e565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051611bb89190614e2d565b600060405180830381855afa9150503d8060008114611bf3576040519150601f19603f3d011682016040523d82523d6000602084013e611bf8565b606091505b509150915081611c1d578260405163411471c360e11b81526004016104c49190614e49565b80806020019051810190611c319190615241565b935050505090565b600754853510801590611c525750600854602086013510155b611cc45760405162461bcd60e51b815260206004820152603d60248201527f424f73476f7665726e616e636550726f706f73616c3a20717565727920666f7260448201527f206f7574646174656420627269646765206f70657261746f722073657400000060648201526084016104c4565b611ccd8561335d565b82611d2e5760405162461bcd60e51b815260206004820152602b60248201527f424f73476f7665726e616e636550726f706f73616c3a20696e76616c6964206160448201526a0e4e4c2f240d8cadccee8d60ab1b60648201526084016104c4565b6000806000611d3c8861351d565b90506000611d4a8583612ac6565b89356000818152600a60209081526040808320828f0135808552908352818420948452600c83528184209084529091528120929350909190805b8a811015611ec857368c8c83818110611d9f57611d9f614dda565b606002919091019150611dca905086611dbb60208401846155d2565b836020013584604001356135cf565b9850886001600160a01b0316886001600160a01b031610611e2f5760405162461bcd60e51b815260206004820152602b602482015260008051602061595b83398151915260448201526a34b3b732b91037b93232b960a91b60648201526084016104c4565b88975050611e3c886135f7565b15611eb6576001600160a01b0388166000908152600b60205260409020439055600191508b8b82818110611e7257611e72614dda565b9050606002018360008a6001600160a01b03166001600160a01b031681526020019081526020016000208181611ea891906155ef565b50611eb690508489886123f6565b80611ec081614df0565b915050611d84565b5080611f165760405162461bcd60e51b8152602060048201526029602482015260008051602061595b83398151915260448201526869676e61747572657360b81b60648201526084016104c4565b6000611f2284876124c1565b9050611f3d8a611f318361360a565b8691906000808b6125f2565b5050505050505050505050505050565b611f55614295565b87600003611f755760405162461bcd60e51b81526004016104c490615620565b6000611f8089612e26565b90506040518060e001604052808281526020018a8152602001898152602001888152602001878152602001868152602001858152509150611fcc600254836130f790919063ffffffff16565b6000611fd7836128d1565b60008b81526001602090815260408083208684529091529020909150611ffe90828b6131f3565b80828b60008051602061593b8339815191528688604051612020929190615655565b60405180910390a45050979650505050505050565b468260200151146120975760405162461bcd60e51b815260206004820152602660248201527f526f6e696e476f7665726e616e636541646d696e3a20696e76616c6964206368604482015265185a5b881a5960d21b60648201526084016104c4565b6120a0826128d1565b6020808401516000908152600180835260408083208751845290935291902001541461212b5760405162461bcd60e51b815260206004820152603460248201527f526f6e696e476f7665726e616e636541646d696e3a206361737420766f746520604482015273199bdc881a5b9d985b1a59081c1c9bdc1bdcd85b60621b60648201526084016104c4565b6000612135611b1f565b905060008161214261361e565b61214c919061567f565b612157906001614dc7565b9050612161614275565b611a31858585858a866121738d6116bd565b613632565b600080825460ff166004811115612191576121916145a6565b1480156121a2575042826006015411155b905080156123955760018201546040517f58f98006a7f2f253f8ae8f8b7cec9008ca05359633561cd7c22f3005682d4a5590600090a260005b60048301548110156122945782600801600084600401838154811061220257612202614dda565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff19169055600484018054600786019291908490811061224b5761224b614dda565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff1916815560018101829055600201558061228c81614df0565b9150506121db565b5060005b6005830154811015612351578260080160008460050183815481106122bf576122bf614dda565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff19169055600584018054600786019291908490811061230857612308614dda565b60009182526020808320909101546001600160a01b031683528201929092526040018120805460ff1916815560018101829055600201558061234981614df0565b915050612298565b50815460ff19168255600060018301819055600283018190556003830181905561237f9060048401906142d2565b61238d6005830160006142d2565b600060068301555b919050565b6040516000906123d6907f697acba4deaf1a718d8c2d93e42860488cb7812696f28ca10eed17bac41e7027908790879087908790602001615015565b604051602081830303815290604052805190602001209050949350505050565b6000836003015411801561240e575042836003015411155b1561241f57825460ff191660041783555b6124298383611a3a565b1561247857612442826001600160a01b03166014613a39565b6040516020016124529190615692565b60408051601f198184030181529082905262461bcd60e51b82526104c49160040161522e565b6001600160a01b039091166000818152600284016020908152604082209390935560059093018054600181018255908452919092200180546001600160a01b0319169091179055565b60058201546060906000906001600160401b038111156124e3576124e3614b96565b60405190808252806020026020018201604052801561250c578160200160208202803683370190505b50915060005b82518110156125b557600085600501828154811061253257612532614dda565b60009182526020808320909101546001600160a01b0316808352600289019091526040909120549091508590036125a25780848461256f81614df0565b95508151811061258157612581614dda565b60200260200101906001600160a01b031690816001600160a01b0316815250505b50806125ad81614df0565b915050612512565b50815292915050565b6000635f14a1c360e01b81806125d2610cdf565b6001600160a01b0316634bb5274a84876040516024016116f191906156e6565b60008585101580156126045750838310155b801561262557506000875460ff166004811115612623576126236145a6565b145b1561263d57865460ff19166001908117885587018290555b5050935460ff16949350505050565b6361e45aeb60e11b600061265e611049565b6001600160a01b0316634bb5274a8386866040516024016126959291906001600160a01b0392831681529116602082015260400190565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516126d6919060240161522e565b6040516020818303038152906040529060e01b6020820180516001600160e01b038381831617835250505050604051610fe39190614e2d565b600380546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d7906119a89083906146ad565b600d80546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906119a89083906146ad565b6127ad614295565b6127c16127b98b6154f9565b858585613bd4565b905060006127d1611aa48c6154f9565b90506127f9828b8b8b8b6127ea8c61182b896000612a70565b61183f8d61182b8a6001612a70565b509998505050505050505050565b602082015160009080820361282e5760405162461bcd60e51b81526004016104c490615620565b60025461283c9085906130f7565b6000612847856128d1565b905061285282612e26565b6000838152600160209081526040808320848452909152908190209087015191945061287f9183906131f3565b8451831461289f5760405162461bcd60e51b81526004016104c4906156f9565b80838360008051602061593b83398151915288886040516128c1929190615655565b60405180910390a4505092915050565b6000806000806000808660800151905060008760600151905060008860a00151516001600160401b0381111561290957612909614b96565b604051908082528060200260200182016040528015612932578160200160208202803683370190505b5060c08a015190915060005b825181101561299b578a60a00151818151811061295d5761295d614dda565b60200260200101518051906020012083828151811061297e5761297e614dda565b60209081029190910101528061299381614df0565b91505061293e565b506020835102602084012097506020845102602085012096506020825102602083012095506020815102602082012094507fd051578048e6ff0bbc9fca3b65a42088dbde10f36ca841de566711087ad9b08a60001b8a600001518b602001518c604001518b8b8b8b604051602001612a4b989796959493929190978852602088019690965260408701949094526060860192909252608085015260a084015260c083015260e08201526101000190565b6040516020818303038152906040528051906020012098505050505050505050919050565b604051600090612aa8907fd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c2908590859060200161573f565b60405160208183030381529060405280519060200120905092915050565b60405161190160f01b60208201526022810183905260428101829052600090606201612aa8565b8415801590612afb57508483145b612b585760405162461bcd60e51b815260206004820152602860248201527f476f7665726e616e636550726f706f73616c3a20696e76616c696420617272616044820152670f240d8cadccee8d60c31b60648201526084016104c4565b6000612b62611b1f565b9050600081612b6f61361e565b612b79919061567f565b612b84906001614dc7565b9050600080366000805b89811015612dba578a8a82818110612ba857612ba8614dda565b606002919091019350600090508d8d83818110612bc757612bc7614dda565b9050602002016020810190612bdc9190615764565b6001811115612bed57612bed6145a6565b03612c1957612c1289612c0360208601866155d2565b856020013586604001356135cf565b9350612ccd565b60018d8d83818110612c2d57612c2d614dda565b9050602002016020810190612c429190615764565b6001811115612c5357612c536145a6565b03612c6957612c1288612c0360208601866155d2565b60405162461bcd60e51b815260206004820152603360248201527f476f7665726e616e636550726f706f73616c3a20717565727920666f7220756e604482015272737570706f7274656420766f7465207479706560681b60648201526084016104c4565b836001600160a01b0316856001600160a01b031610612d385760405162461bcd60e51b815260206004820152602160248201527f476f7665726e616e636550726f706f73616c3a20696e76616c6964206f7264656044820152603960f91b60648201526084016104c4565b8394506000612d46856116bd565b90508015612da75760019250612d958f8f8f85818110612d6857612d68614dda565b9050602002016020810190612d7d9190615764565b8a8a89612d8f368b90038b018b615781565b87613632565b15612da7575050505050505050611a31565b5080612db281614df0565b915050612b8e565b5080612e175760405162461bcd60e51b815260206004820152602660248201527f476f7665726e616e636550726f706f73616c3a20696e76616c6964207369676e60448201526561747572657360d01b60648201526084016104c4565b50505050505050505050505050565b60008181526020819052604081205490819003612e555750600090815260208190526040902060019081905590565b6000828152600160209081526040808320848452909152812090612e7882612178565b905080612f22576000825460ff166004811115612e9757612e976145a6565b03612efe5760405162461bcd60e51b815260206004820152603160248201527f436f7265476f7665726e616e63653a2063757272656e742070726f706f73616c604482015270081a5cc81b9bdd0818dbdb5c1b195d1959607a1b60648201526084016104c4565b60008481526020819052604081208054909190612f1a90614df0565b918290555092505b5050919050565b612f31614295565b83518152602080850151604080840191909152600091830191909152840151516001600160401b03811115612f6857612f68614b96565b604051908082528060200260200182016040528015612f91578160200160208202803683370190505b5060608083019190915284015160808083019190915284015160a08083019190915284015160c082015260005b8460400151518110156130ef57600185604001518281518110612fe357612fe3614dda565b60200260200101516001811115612ffc57612ffc6145a6565b0361303d57828260600151828151811061301857613018614dda565b60200260200101906001600160a01b031690816001600160a01b0316815250506130dd565b60008560400151828151811061305557613055614dda565b6020026020010151600181111561306e5761306e6145a6565b0361308a57838260600151828151811061301857613018614dda565b60405162461bcd60e51b815260206004820152602260248201527f476c6f62616c50726f706f73616c3a20756e737570706f727465642074617267604482015261195d60f21b60648201526084016104c4565b806130e781614df0565b915050612fbe565b509392505050565b60008260600151511180156131155750816080015151826060015151145b801561312a57508160a0015151826060015151145b801561313f57508160c0015151826060015151145b61318b5760405162461bcd60e51b815260206004820152601e60248201527f50726f706f73616c3a20696e76616c6964206172726179206c656e677468000060448201526064016104c4565b6131958142614dc7565b826040015111156114f85760405162461bcd60e51b815260206004820152602260248201527f50726f706f73616c3a20696e76616c6964206578706972792074696d6573746160448201526106d760f41b60648201526084016104c4565b6001830191909155600690910155565b6000806000806000808660600151905060008760400151905060008860800151516001600160401b0381111561323b5761323b614b96565b604051908082528060200260200182016040528015613264578160200160208202803683370190505b5060a08a015190915060005b82518110156132cd578a60800151818151811061328f5761328f614dda565b6020026020010151805190602001208382815181106132b0576132b0614dda565b6020908102919091010152806132c581614df0565b915050613270565b5082516020908102848201208551820286830120845183028584012084518402858501208e518f860151604080517f1463f426c05aff2c1a7a0957a71c9898bc8b47142540538e79ee25ee911413509881019890985287019190915260608601526080850184905260a0850183905260c0850182905260e08501819052929b509099509750955061010001612a4b565b600061336c6040830183614e7b565b9050116133cf5760405162461bcd60e51b815260206004820152602b60248201527f4272696467654f70657261746f727342616c6c6f743a20696e76616c6964206160448201526a0e4e4c2f240d8cadccee8d60ab1b60648201526084016104c4565b60006133de6040830183614e7b565b60008181106133ef576133ef614dda565b90506020020160208101906134049190614523565b905060015b6134166040840184614e7b565b90508110156135185761342c6040840184614e7b565b8281811061343c5761343c614dda565b90506020020160208101906134519190614523565b6001600160a01b0316826001600160a01b0316106134d25760405162461bcd60e51b815260206004820152603860248201527f4272696467654f70657261746f727342616c6c6f743a20696e76616c6964206f60448201527772646572206f6620627269646765206f70657261746f727360401b60648201526084016104c4565b6134df6040840184614e7b565b828181106134ef576134ef614dda565b90506020020160208101906135049190614523565b91508061351081614df0565b915050613409565b505050565b6000808061352e6040850185614e7b565b80806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250508251602090810293810193909320604080517fd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a818701528935818301529885013560608a01526080808a01929092528051808a03909201825260a0909801909752505084519401939093209392505050565b60008060006135e087878787613ca6565b915091506135ed81613d89565b5095945050505050565b60008061360383613f3a565b1192915050565b600063d9d5dadb60e01b81806125d2610cdf565b600063926323d560e01b8180611b33610cdf565b6020808801518851600082815260018452604080822083835290945292832061365a81612178565b1561366b5760019350505050613a2e565b6020808c0151600090815290819052604090205482146136e65760405162461bcd60e51b815260206004820152603060248201527f436f7265476f7665726e616e63653a20717565727920666f7220696e76616c6960448201526f642070726f706f73616c206e6f6e636560801b60648201526084016104c4565b6000815460ff1660048111156136fe576136fe6145a6565b146137595760405162461bcd60e51b815260206004820152602560248201527f436f7265476f7665726e616e63653a2074686520766f74652069732066696e616044820152641b1a5e995960da1b60648201526084016104c4565b6137638188611a5b565b1561378c5761377c876001600160a01b03166014613a39565b60405160200161245291906157e2565b6001600160a01b03871660009081526008820160209081526040909120805460ff191660011790558601511515806137c75750604086015115155b806137d55750855160ff1615155b1561381c576001600160a01b03871660009081526007820160209081526040918290208851815460ff191660ff909116178155908801516001820155908701516002909101555b866001600160a01b031681600101547f1203f9e81c814a35f5f4cc24087b2a24c6fb7986a9f1406b68a9484882c93a238c8860405161385c929190615832565b60405180910390a3600080808c600181111561387a5761387a6145a6565b036138cf576004830180546001810182556000918252602082200180546001600160a01b0319166001600160a01b038c161790556003840180548992906138c2908490614dc7565b925050819055915061398e565b60018c60018111156138e3576138e36145a6565b03613938576005830180546001810182556000918252602082200180546001600160a01b0319166001600160a01b038c1617905560028401805489929061392b908490614dc7565b925050819055905061398e565b60405162461bcd60e51b815260206004820152602560248201527f436f7265476f7665726e616e63653a20756e737570706f7274656420766f7465604482015264207479706560d81b60648201526084016104c4565b8a82106139e257825460ff19166001908117845580840154604051919750907f5c819725ea53655a3b898f3df59b66489761935454e9212ca1e5ebd759953d0b90600090a26139dd838e613f4e565b613a28565b898110613a2857825460ff19166003178355600180840154604051919750907f55295d4ce992922fa2e5ffbf3a3dcdb367de0a15e125ace083456017fd22060f90600090a25b50505050505b979650505050505050565b60606000613a48836002614ec4565b613a53906002614dc7565b6001600160401b03811115613a6a57613a6a614b96565b6040519080825280601f01601f191660200182016040528015613a94576020820181803683370190505b509050600360fc1b81600081518110613aaf57613aaf614dda565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613ade57613ade614dda565b60200101906001600160f81b031916908160001a9053506000613b02846002614ec4565b613b0d906001614dc7565b90505b6001811115613b85576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613b4157613b41614dda565b1a60f81b828281518110613b5757613b57614dda565b60200101906001600160f81b031916908160001a90535060049490941c93613b7e81615849565b9050613b10565b5083156116195760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e7460448201526064016104c4565b613bdc614295565b613be7858585612f29565b9050613bfe600254826130f790919063ffffffff16565b6000613c09826128d1565b90506000613c176000612e26565b60008181526000805160206158fb8339815191526020908152604090912090890151919250613c479184906131f3565b82518114613c675760405162461bcd60e51b81526004016104c4906156f9565b818160008051602061597b83398151915285613c828b613203565b8b89604051613c94949392919061535f565b60405180910390a35050949350505050565b6000806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115613cd35750600090506003613d80565b8460ff16601b14158015613ceb57508460ff16601c14155b15613cfc5750600090506004613d80565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613d50573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613d7957600060019250925050613d80565b9150600090505b94509492505050565b6000816004811115613d9d57613d9d6145a6565b03613da55750565b6001816004811115613db957613db96145a6565b03613e015760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b60448201526064016104c4565b6002816004811115613e1557613e156145a6565b03613e625760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016104c4565b6003816004811115613e7657613e766145a6565b03613ece5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016104c4565b6004816004811115613ee257613ee26145a6565b036105fb5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016104c4565b6000635624191160e01b81806116d1610cdf565b613f5781613fbb565b156114f857815460ff19166002178255600080613f7383613fd5565b9150915083600101547fe134987599ae266ec90edeff1b26125b287dbb57b10822649432d1bb26537fba8383604051613fad929190615860565b60405180910390a250505050565b600081602001516000148061161c57505060200151461490565b606080613fe183613fbb565b6140395760405162461bcd60e51b815260206004820152602360248201527f50726f706f73616c3a20717565727920666f7220696e76616c696420636861696044820152621b925960ea1b60648201526084016104c4565b8260600151516001600160401b0381111561405657614056614b96565b60405190808252806020026020018201604052801561407f578160200160208202803683370190505b5091508260600151516001600160401b0381111561409f5761409f614b96565b6040519080825280602002602001820160405280156140d257816020015b60608152602001906001900390816140bd5790505b50905060005b83606001515181101561426f578360c0015181815181106140fb576140fb614dda565b60200260200101515a1161414e5760405162461bcd60e51b815260206004820152601a60248201527950726f706f73616c3a20696e73756666696369656e742067617360301b60448201526064016104c4565b8360600151818151811061416457614164614dda565b60200260200101516001600160a01b03168460800151828151811061418b5761418b614dda565b60200260200101518560c0015183815181106141a9576141a9614dda565b6020026020010151908660a0015184815181106141c8576141c8614dda565b60200260200101516040516141dd9190614e2d565b600060405180830381858888f193505050503d806000811461421b576040519150601f19603f3d011682016040523d82523d6000602084013e614220565b606091505b5084838151811061423357614233614dda565b6020026020010184848151811061424c5761424c614dda565b6020908102919091010191909152901515905261426881614df0565b90506140d8565b50915091565b604080516060810182526000808252602082018190529181019190915290565b6040518060e00160405280600081526020016000815260200160008152602001606081526020016060815260200160608152602001606081525090565b50805460008255906000526020600020908101906105fb91905b8082111561430057600081556001016142ec565b5090565b600060e0828403121561431657600080fd5b50919050565b60008083601f84011261432e57600080fd5b5081356001600160401b0381111561434557600080fd5b6020830191508360208260051b850101111561436057600080fd5b9250929050565b60008083601f84011261437957600080fd5b5081356001600160401b0381111561439057600080fd5b60208301915083602060608302850101111561436057600080fd5b6000806000806000606086880312156143c357600080fd5b85356001600160401b03808211156143da57600080fd5b6143e689838a01614304565b965060208801359150808211156143fc57600080fd5b61440889838a0161431c565b9096509450604088013591508082111561442157600080fd5b5061442e88828901614367565b969995985093965092949392505050565b600080600080600080600080600060a08a8c03121561445d57600080fd5b8935985060208a01356001600160401b038082111561447b57600080fd5b6144878d838e0161431c565b909a50985060408c01359150808211156144a057600080fd5b6144ac8d838e0161431c565b909850965060608c01359150808211156144c557600080fd5b6144d18d838e0161431c565b909650945060808c01359150808211156144ea57600080fd5b506144f78c828d0161431c565b915080935050809150509295985092959850929598565b6001600160a01b03811681146105fb57600080fd5b60006020828403121561453557600080fd5b81356116198161450e565b6000806040838503121561455357600080fd5b50508035926020909101359150565b600081518084526020808501945080840160005b8381101561459b5781516001600160a01b031687529582019590820190600101614576565b509495945050505050565b634e487b7160e01b600052602160045260246000fd5b600281106105fb576105fb6145a6565b600081518084526020808501945080840160005b8381101561459b578151805160ff168852838101518489015260409081015190880152606090960195908201906001016145e0565b6060815260006146286060830186614562565b82810360208481019190915285518083528682019282019060005b81811015614668578451614656816145bc565b83529383019391830191600101614643565b5050848103604086015261467c81876145cc565b98975050505050505050565b60408152600061469b6040830185614562565b8281036020840152610c4081856145cc565b6001600160a01b0391909116815260200190565b6000806000606084860312156146d657600080fd5b833592506020840135915060408401356146ef8161450e565b809150509250925092565b60006020828403121561470c57600080fd5b5035919050565b60008060008060006060868803121561472b57600080fd5b85356001600160401b038082111561474257600080fd5b9087019060c0828a03121561475657600080fd5b909550602087013590808211156143fc57600080fd5b60008060006040848603121561478157600080fd5b83356001600160401b038082111561479857600080fd5b90850190606082880312156147ac57600080fd5b909350602085013590808211156147c257600080fd5b506147cf86828701614367565b9497909650939450505050565b60208152815160208201526020820151604082015260006040830151606080840152610c6c6080840182614562565b600281106105fb57600080fd5b80356123958161480b565b60008060008060008060008060008060c08b8d03121561484257600080fd5b8a35995060208b01356001600160401b038082111561486057600080fd5b61486c8e838f0161431c565b909b50995060408d013591508082111561488557600080fd5b6148918e838f0161431c565b909950975060608d01359150808211156148aa57600080fd5b6148b68e838f0161431c565b909750955060808d01359150808211156148cf57600080fd5b506148dc8d828e0161431c565b90945092506148ef905060a08c01614818565b90509295989b9194979a5092959850565b6000806040838503121561491357600080fd5b823561491e8161450e565b9150602083013561492e8161450e565b809150509250929050565b600080600080600060a0868803121561495157600080fd5b8535945060208601356149638161450e565b935060408601356149738161450e565b94979396509394606081013594506080013592915050565b60008060008060008060008060008060c08b8d0312156149aa57600080fd5b8a35995060208b0135985060408b01356001600160401b03808211156149cf57600080fd5b6149db8e838f0161431c565b909a50985060608d01359150808211156149f457600080fd5b614a008e838f0161431c565b909850965060808d0135915080821115614a1957600080fd5b614a258e838f0161431c565b909650945060a08d0135915080821115614a3e57600080fd5b50614a4b8d828e0161431c565b915080935050809150509295989b9194979a5092959850565b60008060008060808587031215614a7a57600080fd5b8435614a858161450e565b93506020850135614a958161450e565b93969395505050506040820135916060013590565b60008060408385031215614abd57600080fd5b82356001600160401b03811115614ad357600080fd5b614adf85828601614304565b925050602083013561492e8161480b565b60a0810160058710614b0457614b046145a6565b95815260208101949094526040840192909252606083015260809091015290565b60008060408385031215614b3857600080fd5b82359150602083013561492e8161450e565b6020808252602c908201527f526f6e696e476f7665726e616e636541646d696e3a2073656e6465722069732060408201526b3737ba1033b7bb32b93737b960a11b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b60405160e081016001600160401b0381118282101715614bce57614bce614b96565b60405290565b60405160c081016001600160401b0381118282101715614bce57614bce614b96565b604051601f8201601f191681016001600160401b0381118282101715614c1e57614c1e614b96565b604052919050565b60006001600160401b03821115614c3f57614c3f614b96565b5060051b60200190565b6000614c5c614c5784614c26565b614bf6565b8381529050602080820190600585901b840186811115614c7b57600080fd5b845b81811015614d0e5780356001600160401b0380821115614c9d5760008081fd5b8188019150601f8a81840112614cb35760008081fd5b823582811115614cc557614cc5614b96565b614cd6818301601f19168801614bf6565b92508083528b87828601011115614cef57600091508182fd5b8087850188850137600090830187015250855250928201928201614c7d565b505050509392505050565b6000611619368484614c49565b60208082526027908201527f476f7665726e616e636541646d696e3a206f6e6c7920616c6c6f7765642073656040820152661b198b58d85b1b60ca1b606082015260800190565b60208082526024908201527f476f7665726e616e636541646d696e3a2073657420746f206e6f6e2d636f6e746040820152631c9858dd60e21b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b8082018082111561161c5761161c614db1565b634e487b7160e01b600052603260045260246000fd5b600060018201614e0257614e02614db1565b5060010190565b60005b83811015614e24578181015183820152602001614e0c565b50506000910152565b60008251614e3f818460208701614e09565b9190910192915050565b6001600160e01b031991909116815260200190565b600060208284031215614e7057600080fd5b81516116198161450e565b6000808335601e19843603018112614e9257600080fd5b8301803591506001600160401b03821115614eac57600080fd5b6020019150600581901b360382131561436057600080fd5b808202811582820484141761161c5761161c614db1565b6000813561161c8161450e565b81358155600160208084013582840155600283016040850135601e19863603018112614f1357600080fd5b850180356001600160401b03811115614f2b57600080fd5b83820191508060051b3603821315614f4257600080fd5b600160401b811115614f5657614f56614b96565b825481845580821015614f8a5760008481528581208381019083015b80821015614f865782825590880190614f72565b5050505b50600092835260208320925b8181101561184457614fa783614edb565b84820155918401918501614f96565b84815260208082018590526060604083018190528201839052600090849060808401835b86811015615008578335614fed8161450e565b6001600160a01b031682529282019290820190600101614fda565b5098975050505050505050565b9485526001600160a01b0393841660208601529190921660408401526060830191909152608082015260a00190565b600082601f83011261505557600080fd5b81356020615065614c5783614c26565b82815260059290921b8401810191818101908684111561508457600080fd5b8286015b848110156150a857803561509b8161450e565b8352918301918301615088565b509695505050505050565b600082601f8301126150c457600080fd5b813560206150d4614c5783614c26565b82815260059290921b840181019181810190868411156150f357600080fd5b8286015b848110156150a857803583529183019183016150f7565b600082601f83011261511f57600080fd5b61161983833560208501614c49565b600060e0823603121561514057600080fd5b615148614bac565b82358152602080840135908201526040808401359082015260608301356001600160401b038082111561517a57600080fd5b61518636838701615044565b6060840152608085013591508082111561519f57600080fd5b6151ab368387016150b3565b608084015260a08501359150808211156151c457600080fd5b6151d03683870161510e565b60a084015260c08501359150808211156151e957600080fd5b506151f6368286016150b3565b60c08301525092915050565b6000815180845261521a816020860160208601614e09565b601f01601f19169290920160200192915050565b6020815260006116196020830184615202565b60006020828403121561525357600080fd5b5051919050565b600081518084526020808501945080840160005b8381101561459b5781518752958201959082019060010161526e565b600081518084526020808501808196508360051b8101915082860160005b858110156152d25782840389526152c0848351615202565b988501989350908401906001016152a8565b5091979650505050505050565b8051825260208101516020830152604081015160408301526000606082015160e0606085015261531260e0850182614562565b90506080830151848203608086015261532b828261525a565b91505060a083015184820360a0860152615345828261528a565b91505060c083015184820360c0860152610c40828261525a565b60808152600061537260808301876152df565b60208681850152838203604085015260c08201865183528187015182840152604087015160c0604085015281815180845260e0860191508483019350600092505b808310156153dc5783516153c6816145bc565b82529284019260019290920191908401906153b3565b506060890151935084810360608601526153f6818561525a565b935050505060808601518282036080840152615412828261528a565b91505060a086015182820360a084015261542c828261525a565b9350505050610c4060608301846001600160a01b03169052565b6020808252602f908201527f476f7665726e616e636541646d696e3a206361737420766f746520666f72206960408201526e1b9d985b1a59081c1c9bdc1bdcd85b608a1b606082015260800190565b600082601f8301126154a657600080fd5b813560206154b6614c5783614c26565b82815260059290921b840181019181810190868411156154d557600080fd5b8286015b848110156150a85780356154ec8161480b565b83529183019183016154d9565b600060c0823603121561550b57600080fd5b615513614bd4565b823581526020808401359082015260408301356001600160401b038082111561553b57600080fd5b61554736838701615495565b6040840152606085013591508082111561556057600080fd5b61556c368387016150b3565b6060840152608085013591508082111561558557600080fd5b6155913683870161510e565b608084015260a08501359150808211156155aa57600080fd5b506155b7368286016150b3565b60a08301525092915050565b60ff811681146105fb57600080fd5b6000602082840312156155e457600080fd5b8135611619816155c3565b81356155fa816155c3565b60ff811660ff198354161782555060208201356001820155604082013560028201555050565b6020808252818101527f436f7265476f7665726e616e63653a20696e76616c696420636861696e206964604082015260600190565b60408152600061566860408301856152df565b905060018060a01b03831660208301529392505050565b8181038181111561161c5761161c614db1565b73024b9b7b630ba32b223b7bb32b93730b731b29d160651b8152600082516156c1816014850160208701614e09565b6d08185b1c9958591e481d9bdd195960921b6014939091019283015250602201919050565b6020815260006116196020830184614562565b60208082526026908201527f436f7265476f7665726e616e63653a20696e76616c69642070726f706f73616c604082015265206e6f6e636560d01b606082015260800190565b8381526020810183905260608101615756836145bc565b826040830152949350505050565b60006020828403121561577657600080fd5b81356116198161480b565b60006060828403121561579357600080fd5b604051606081016001600160401b03811182821017156157b5576157b5614b96565b60405282356157c3816155c3565b8152602083810135908201526040928301359281019290925250919050565b6f021b7b932a3b7bb32b93730b731b29d160851b81526000825161580d816010850160208701614e09565b6d08185b1c9958591e481d9bdd195960921b6010939091019283015250601e01919050565b6040810161583f846145bc565b9281526020015290565b60008161585857615858614db1565b506000190190565b604080825283519082018190526000906020906060840190828701845b8281101561589b57815115158452928401929084019060010161587d565b50505083810382850152845180825282820190600581901b8301840187850160005b838110156158eb57601f198684030185526158d9838351615202565b948701949250908601906001016158bd565b5090999850505050505050505056fea6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49526f6e696e476f7665726e616e636541646d696e3a20717565727920666f7220a57d40f1496988cf60ab7c9d5ba4ff83647f67d3898d441a3aaf21b651678fd9424f73476f7665726e616e636550726f706f73616c3a20696e76616c69642073771d78ae9e5fca95a532fb0971d575d0ce9b59d14823c063e08740137e0e0ecaa26469706673582212203defabe961291433baeb9e8dd4fcccf64e643b8f67b50068aac2a8da95c3cb1d64736f6c63430008110033", "devdoc": { "errors": { "ErrCallerMustBeBridgeContract()": [ @@ -1649,7 +1660,7 @@ "details": "Returns whether the voter casted vote for emergency exit poll." }, "getBridgeOperatorVotingSignatures(uint256,uint256)": { - "details": "Returns the voted signatures for bridge operators at a specific period. Note: Does not verify whether the voter casted vote for the proposal and the returned signature can be empty. Please consider filtering for empty signatures after calling this function." + "details": "Returns the voted signatures for bridge operators at a specific period." }, "getProposalExpiryDuration()": { "details": "Returns the proposal expiry duration." @@ -1731,7 +1742,7 @@ "storageLayout": { "storage": [ { - "astId": 7471, + "astId": 7413, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "round", "offset": 0, @@ -1739,15 +1750,15 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 7479, + "astId": 7421, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "vote", "offset": 0, "slot": "1", - "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7397_storage))" + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage))" }, { - "astId": 7481, + "astId": 7423, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "_proposalExpiryDuration", "offset": 0, @@ -1755,23 +1766,23 @@ "type": "t_uint256" }, { - "astId": 6146, + "astId": 6735, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "_roninTrustedOrganizationContract", "offset": 0, "slot": "3", - "type": "t_contract(IRoninTrustedOrganization)10196" + "type": "t_contract(IRoninTrustedOrganization)10182" }, { - "astId": 5797, + "astId": 6386, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "_bridgeContract", "offset": 0, "slot": "4", - "type": "t_contract(IBridge)9270" + "type": "t_contract(IBridge)9212" }, { - "astId": 4506, + "astId": 4545, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "roninChainId", "offset": 0, @@ -1779,7 +1790,7 @@ "type": "t_uint256" }, { - "astId": 4509, + "astId": 4548, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "DOMAIN_SEPARATOR", "offset": 0, @@ -1787,23 +1798,23 @@ "type": "t_bytes32" }, { - "astId": 6877, + "astId": 5882, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "_lastSyncedBridgeOperatorSetInfo", "offset": 0, "slot": "7", - "type": "t_struct(BridgeOperatorSet)12471_storage" + "type": "t_struct(BridgeOperatorSet)12484_storage" }, { - "astId": 6885, + "astId": 5890, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", - "label": "_vote", + "label": "_bridgeOperatorVote", "offset": 0, "slot": "10", - "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(IsolatedVote)6717_storage))" + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)12985_storage))" }, { - "astId": 6890, + "astId": 5895, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "_lastVotedBlock", "offset": 0, @@ -1811,28 +1822,28 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 6898, + "astId": 5905, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "_bridgeVoterSig", "offset": 0, "slot": "12", - "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(VotingSignature)6873_storage))" + "type": "t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_struct(Signature)10562_storage)))" }, { - "astId": 6462, + "astId": 7051, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "_validatorContract", "offset": 0, "slot": "13", - "type": "t_contract(IRoninValidatorSet)11978" + "type": "t_contract(IRoninValidatorSet)11973" }, { - "astId": 23134, + "astId": 21520, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "_emergencyExitPoll", "offset": 0, "slot": "14", - "type": "t_mapping(t_bytes32,t_struct(IsolatedVote)6717_storage)" + "type": "t_mapping(t_bytes32,t_struct(Vote)12985_storage)" } ], "types": { @@ -1857,22 +1868,22 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(IBridge)9270": { + "t_contract(IBridge)9212": { "encoding": "inplace", "label": "contract IBridge", "numberOfBytes": "20" }, - "t_contract(IRoninTrustedOrganization)10196": { + "t_contract(IRoninTrustedOrganization)10182": { "encoding": "inplace", "label": "contract IRoninTrustedOrganization", "numberOfBytes": "20" }, - "t_contract(IRoninValidatorSet)11978": { + "t_contract(IRoninValidatorSet)11973": { "encoding": "inplace", "label": "contract IRoninValidatorSet", "numberOfBytes": "20" }, - "t_enum(VoteStatus)10585": { + "t_enum(VoteStatus)10571": { "encoding": "inplace", "label": "enum VoteStatusConsumer.VoteStatus", "numberOfBytes": "1" @@ -1891,12 +1902,12 @@ "numberOfBytes": "32", "value": "t_bytes32" }, - "t_mapping(t_address,t_struct(Signature)10576_storage)": { + "t_mapping(t_address,t_struct(Signature)10562_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct SignatureConsumer.Signature)", "numberOfBytes": "32", - "value": "t_struct(Signature)10576_storage" + "value": "t_struct(Signature)10562_storage" }, "t_mapping(t_address,t_uint256)": { "encoding": "mapping", @@ -1905,61 +1916,54 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_mapping(t_bytes32,t_struct(IsolatedVote)6717_storage)": { - "encoding": "mapping", - "key": "t_bytes32", - "label": "mapping(bytes32 => struct IsolatedGovernance.IsolatedVote)", - "numberOfBytes": "32", - "value": "t_struct(IsolatedVote)6717_storage" - }, - "t_mapping(t_bytes32,t_uint256)": { + "t_mapping(t_bytes32,t_struct(Vote)12985_storage)": { "encoding": "mapping", "key": "t_bytes32", - "label": "mapping(bytes32 => uint256)", + "label": "mapping(bytes32 => struct IsolatedGovernance.Vote)", "numberOfBytes": "32", - "value": "t_uint256" + "value": "t_struct(Vote)12985_storage" }, - "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(IsolatedVote)6717_storage))": { + "t_mapping(t_uint256,t_mapping(t_address,t_struct(Signature)10562_storage))": { "encoding": "mapping", "key": "t_uint256", - "label": "mapping(uint256 => mapping(uint256 => struct IsolatedGovernance.IsolatedVote))", + "label": "mapping(uint256 => mapping(address => struct SignatureConsumer.Signature))", "numberOfBytes": "32", - "value": "t_mapping(t_uint256,t_struct(IsolatedVote)6717_storage)" + "value": "t_mapping(t_address,t_struct(Signature)10562_storage)" }, - "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7397_storage))": { + "t_mapping(t_uint256,t_mapping(t_uint256,t_mapping(t_address,t_struct(Signature)10562_storage)))": { "encoding": "mapping", "key": "t_uint256", - "label": "mapping(uint256 => mapping(uint256 => struct CoreGovernance.ProposalVote))", + "label": "mapping(uint256 => mapping(uint256 => mapping(address => struct SignatureConsumer.Signature)))", "numberOfBytes": "32", - "value": "t_mapping(t_uint256,t_struct(ProposalVote)7397_storage)" + "value": "t_mapping(t_uint256,t_mapping(t_address,t_struct(Signature)10562_storage))" }, - "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(VotingSignature)6873_storage))": { + "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(ProposalVote)7339_storage))": { "encoding": "mapping", "key": "t_uint256", - "label": "mapping(uint256 => mapping(uint256 => struct BOsGovernanceProposal.VotingSignature))", + "label": "mapping(uint256 => mapping(uint256 => struct CoreGovernance.ProposalVote))", "numberOfBytes": "32", - "value": "t_mapping(t_uint256,t_struct(VotingSignature)6873_storage)" + "value": "t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)" }, - "t_mapping(t_uint256,t_struct(IsolatedVote)6717_storage)": { + "t_mapping(t_uint256,t_mapping(t_uint256,t_struct(Vote)12985_storage))": { "encoding": "mapping", "key": "t_uint256", - "label": "mapping(uint256 => struct IsolatedGovernance.IsolatedVote)", + "label": "mapping(uint256 => mapping(uint256 => struct IsolatedGovernance.Vote))", "numberOfBytes": "32", - "value": "t_struct(IsolatedVote)6717_storage" + "value": "t_mapping(t_uint256,t_struct(Vote)12985_storage)" }, - "t_mapping(t_uint256,t_struct(ProposalVote)7397_storage)": { + "t_mapping(t_uint256,t_struct(ProposalVote)7339_storage)": { "encoding": "mapping", "key": "t_uint256", "label": "mapping(uint256 => struct CoreGovernance.ProposalVote)", "numberOfBytes": "32", - "value": "t_struct(ProposalVote)7397_storage" + "value": "t_struct(ProposalVote)7339_storage" }, - "t_mapping(t_uint256,t_struct(VotingSignature)6873_storage)": { + "t_mapping(t_uint256,t_struct(Vote)12985_storage)": { "encoding": "mapping", "key": "t_uint256", - "label": "mapping(uint256 => struct BOsGovernanceProposal.VotingSignature)", + "label": "mapping(uint256 => struct IsolatedGovernance.Vote)", "numberOfBytes": "32", - "value": "t_struct(VotingSignature)6873_storage" + "value": "t_struct(Vote)12985_storage" }, "t_mapping(t_uint256,t_uint256)": { "encoding": "mapping", @@ -1968,12 +1972,12 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(BridgeOperatorSet)12471_storage": { + "t_struct(BridgeOperatorSet)12484_storage": { "encoding": "inplace", "label": "struct BridgeOperatorsBallot.BridgeOperatorSet", "members": [ { - "astId": 12465, + "astId": 12478, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "period", "offset": 0, @@ -1981,7 +1985,7 @@ "type": "t_uint256" }, { - "astId": 12467, + "astId": 12480, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "epoch", "offset": 0, @@ -1989,7 +1993,7 @@ "type": "t_uint256" }, { - "astId": 12470, + "astId": 12483, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "operators", "offset": 0, @@ -1999,75 +2003,20 @@ ], "numberOfBytes": "96" }, - "t_struct(IsolatedVote)6717_storage": { - "encoding": "inplace", - "label": "struct IsolatedGovernance.IsolatedVote", - "members": [ - { - "astId": 6698, - "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", - "label": "status", - "offset": 0, - "slot": "0", - "type": "t_enum(VoteStatus)10585" - }, - { - "astId": 6700, - "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", - "label": "finalHash", - "offset": 0, - "slot": "1", - "type": "t_bytes32" - }, - { - "astId": 6705, - "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", - "label": "voteHashOf", - "offset": 0, - "slot": "2", - "type": "t_mapping(t_address,t_bytes32)" - }, - { - "astId": 6710, - "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", - "label": "weight", - "offset": 0, - "slot": "3", - "type": "t_mapping(t_bytes32,t_uint256)" - }, - { - "astId": 6713, - "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", - "label": "expiredAt", - "offset": 0, - "slot": "4", - "type": "t_uint256" - }, - { - "astId": 6716, - "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", - "label": "createdAt", - "offset": 0, - "slot": "5", - "type": "t_uint256" - } - ], - "numberOfBytes": "192" - }, - "t_struct(ProposalVote)7397_storage": { + "t_struct(ProposalVote)7339_storage": { "encoding": "inplace", "label": "struct CoreGovernance.ProposalVote", "members": [ { - "astId": 7373, + "astId": 7315, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "status", "offset": 0, "slot": "0", - "type": "t_enum(VoteStatus)10585" + "type": "t_enum(VoteStatus)10571" }, { - "astId": 7375, + "astId": 7317, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "hash", "offset": 0, @@ -2075,7 +2024,7 @@ "type": "t_bytes32" }, { - "astId": 7377, + "astId": 7319, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "againstVoteWeight", "offset": 0, @@ -2083,7 +2032,7 @@ "type": "t_uint256" }, { - "astId": 7379, + "astId": 7321, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "forVoteWeight", "offset": 0, @@ -2091,7 +2040,7 @@ "type": "t_uint256" }, { - "astId": 7382, + "astId": 7324, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "forVoteds", "offset": 0, @@ -2099,7 +2048,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 7385, + "astId": 7327, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "againstVoteds", "offset": 0, @@ -2107,7 +2056,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 7387, + "astId": 7329, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "expiryTimestamp", "offset": 0, @@ -2115,15 +2064,15 @@ "type": "t_uint256" }, { - "astId": 7392, + "astId": 7334, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "sig", "offset": 0, "slot": "7", - "type": "t_mapping(t_address,t_struct(Signature)10576_storage)" + "type": "t_mapping(t_address,t_struct(Signature)10562_storage)" }, { - "astId": 7396, + "astId": 7338, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "voted", "offset": 0, @@ -2133,12 +2082,12 @@ ], "numberOfBytes": "288" }, - "t_struct(Signature)10576_storage": { + "t_struct(Signature)10562_storage": { "encoding": "inplace", "label": "struct SignatureConsumer.Signature", "members": [ { - "astId": 10571, + "astId": 10557, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "v", "offset": 0, @@ -2146,7 +2095,7 @@ "type": "t_uint8" }, { - "astId": 10573, + "astId": 10559, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "r", "offset": 0, @@ -2154,7 +2103,7 @@ "type": "t_bytes32" }, { - "astId": 10575, + "astId": 10561, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", "label": "s", "offset": 0, @@ -2164,28 +2113,60 @@ ], "numberOfBytes": "96" }, - "t_struct(VotingSignature)6873_storage": { + "t_struct(Vote)12985_storage": { "encoding": "inplace", - "label": "struct BOsGovernanceProposal.VotingSignature", + "label": "struct IsolatedGovernance.Vote", "members": [ { - "astId": 6869, + "astId": 12967, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", - "label": "signatureOf", + "label": "status", "offset": 0, "slot": "0", - "type": "t_mapping(t_address,t_struct(Signature)10576_storage)" + "type": "t_enum(VoteStatus)10571" }, { - "astId": 6872, + "astId": 12969, "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", - "label": "voters", + "label": "finalHash", "offset": 0, "slot": "1", + "type": "t_bytes32" + }, + { + "astId": 12974, + "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", + "label": "voteHashOf", + "offset": 0, + "slot": "2", + "type": "t_mapping(t_address,t_bytes32)" + }, + { + "astId": 12977, + "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", + "label": "expiredAt", + "offset": 0, + "slot": "3", + "type": "t_uint256" + }, + { + "astId": 12980, + "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", + "label": "createdAt", + "offset": 0, + "slot": "4", + "type": "t_uint256" + }, + { + "astId": 12984, + "contract": "contracts/ronin/RoninGovernanceAdmin.sol:RoninGovernanceAdmin", + "label": "voters", + "offset": 0, + "slot": "5", "type": "t_array(t_address)dyn_storage" } ], - "numberOfBytes": "64" + "numberOfBytes": "192" }, "t_uint256": { "encoding": "inplace", diff --git a/deployments/ronin-testnet/RoninTrustedOrganizationLogic.json b/deployments/ronin-testnet/RoninTrustedOrganizationLogic.json index 7feff4c2a..9125256c7 100644 --- a/deployments/ronin-testnet/RoninTrustedOrganizationLogic.json +++ b/deployments/ronin-testnet/RoninTrustedOrganizationLogic.json @@ -1,5 +1,5 @@ { - "address": "0x5287d51b50cBB42a91b5C2d6440BA448c48EAa82", + "address": "0x99eb65715BD3A13895f0AAa669F36524c050DC03", "abi": [ { "anonymous": false, @@ -696,28 +696,28 @@ "type": "function" } ], - "transactionHash": "0xb8b7d04a95a9de1595f9ef5f2a4221fd37160a7eff516100ec65e7420f3ca368", + "transactionHash": "0x093a7750490af75118453207403059a2d488c80ecb717ad1a700ce5054b94415", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0x5287d51b50cBB42a91b5C2d6440BA448c48EAa82", + "contractAddress": "0x99eb65715BD3A13895f0AAa669F36524c050DC03", "transactionIndex": 0, - "gasUsed": "2150239", + "gasUsed": "2119207", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x945c950ac24e299690a534a8aecc91f083ed849f5e251b97a3bfc2ff757111be", - "transactionHash": "0xb8b7d04a95a9de1595f9ef5f2a4221fd37160a7eff516100ec65e7420f3ca368", + "blockHash": "0xfbf1fc87e855712266fd372cb21ecebf6458d46c08408e2ab78470bb42e0d1df", + "transactionHash": "0x093a7750490af75118453207403059a2d488c80ecb717ad1a700ce5054b94415", "logs": [], - "blockNumber": 14747619, - "cumulativeGasUsed": "2150239", + "blockNumber": 16816861, + "cumulativeGasUsed": "2119207", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 4, - "solcInputHash": "3c352db0d062e062f7c0c18610e9070b", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"numerator\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"denominator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousNumerator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousDenominator\",\"type\":\"uint256\"}],\"name\":\"ThresholdUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"orgs\",\"type\":\"tuple[]\"}],\"name\":\"TrustedOrganizationsAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"orgs\",\"type\":\"address[]\"}],\"name\":\"TrustedOrganizationsRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"orgs\",\"type\":\"tuple[]\"}],\"name\":\"TrustedOrganizationsUpdated\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"name\":\"addTrustedOrganizations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_voteWeight\",\"type\":\"uint256\"}],\"name\":\"checkThreshold\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"countTrustedOrganizations\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllTrustedOrganizations\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"getBridgeVoterWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"getBridgeVoterWeights\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_res\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getConsensusWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"getConsensusWeights\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_res\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"getGovernorWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"getGovernorWeights\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_res\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"num_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"denom_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getTrustedOrganization\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_idx\",\"type\":\"uint256\"}],\"name\":\"getTrustedOrganizationAt\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_trustedOrgs\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"__num\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__denom\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minimumVoteWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"removeTrustedOrganizations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numerator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_denominator\",\"type\":\"uint256\"}],\"name\":\"setThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"sumBridgeVoterWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_res\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"sumConsensusWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_res\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"sumGovernorWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_res\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"name\":\"updateTrustedOrganizations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"addTrustedOrganizations((address,address,address,uint256,uint256)[])\":{\"details\":\"Adds a list of addresses into the trusted organization. Requirements: - The weights should larger than 0. - The method caller is admin. - The field `addedBlock` should be blank. Emits the event `TrustedOrganizationAdded` once an organization is added.\"},\"checkThreshold(uint256)\":{\"details\":\"Checks whether the `_voteWeight` passes the threshold.\"},\"countTrustedOrganizations()\":{\"details\":\"Returns the number of trusted organizations.\"},\"getAllTrustedOrganizations()\":{\"details\":\"Returns all of the trusted organizations.\"},\"getBridgeVoterWeight(address)\":{\"details\":\"Returns the weight of a bridge voter.\"},\"getBridgeVoterWeights(address[])\":{\"details\":\"Returns the weights of a list of bridge voter addresses.\"},\"getConsensusWeight(address)\":{\"details\":\"Returns the weight of a consensus.\"},\"getConsensusWeights(address[])\":{\"details\":\"Returns the weights of a list of consensus addresses.\"},\"getGovernorWeight(address)\":{\"details\":\"Returns the weight of a governor.\"},\"getGovernorWeights(address[])\":{\"details\":\"Returns the weights of a list of governor addresses.\"},\"getThreshold()\":{\"details\":\"Returns the threshold.\"},\"getTrustedOrganization(address)\":{\"details\":\"Returns the trusted organization by consensus address. Reverts once the consensus address is non-existent.\"},\"getTrustedOrganizationAt(uint256)\":{\"details\":\"Returns the trusted organization at `_index`.\"},\"initialize((address,address,address,uint256,uint256)[],uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"minimumVoteWeight()\":{\"details\":\"Returns the minimum vote weight to pass the threshold.\"},\"removeTrustedOrganizations(address[])\":{\"details\":\"Removes a list of addresses from the trusted organization. Requirements: - The method caller is admin. Emits the event `TrustedOrganizationRemoved` once an organization is removed.\",\"params\":{\"_consensusAddrs\":\"The list of consensus addresses linked to corresponding trusted organization that to be removed.\"}},\"setThreshold(uint256,uint256)\":{\"details\":\"Sets the threshold. Requirements: - The method caller is admin. Emits the `ThresholdUpdated` event.\"},\"sumBridgeVoterWeights(address[])\":{\"details\":\"Returns total weights of the bridge voter list.\"},\"sumConsensusWeights(address[])\":{\"details\":\"Returns total weights of the consensus list.\"},\"sumGovernorWeights(address[])\":{\"details\":\"Returns total weights of the governor list.\"},\"totalWeights()\":{\"details\":\"Returns total weights.\"},\"updateTrustedOrganizations((address,address,address,uint256,uint256)[])\":{\"details\":\"Updates weights for a list of existent trusted organization. Requirements: - The weights should larger than 0. - The method caller is admin. Emits the `TrustedOrganizationUpdated` event.\"}},\"stateVariables\":{\"_addedBlock\":{\"details\":\"Mapping from consensus address => added block\"},\"_bridgeVoterList\":{\"details\":\"Bridge voters array\"},\"_bridgeVoterWeight\":{\"details\":\"Mapping from bridge voter address => weight\"},\"_consensusList\":{\"details\":\"Consensus array\"},\"_consensusWeight\":{\"details\":\"Mapping from consensus address => weight\"},\"_governorList\":{\"details\":\"Governors array\"},\"_governorWeight\":{\"details\":\"Mapping from governor address => weight\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/multi-chains/RoninTrustedOrganization.sol\":\"RoninTrustedOrganization\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x10f3b360430e6d03773c9959f54cbed6fb0346069645c05b05ef50cfb19f3753\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeights() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganizations() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x1edb7a3f5d340e7efc141cb8d94c5499954dec869f026d3998ad92cbc714d604\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool) {\\n bytes32 _thisHash;\\n bytes32 _otherHash;\\n\\n assembly {\\n _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n }\\n\\n return _thisHash == _otherHash;\\n }\\n}\\n\",\"keccak256\":\"0xea4ac2b0783926a0e6ae257bc069fa37ea864ce77bfb25dd327d4727a38ad0ea\",\"license\":\"UNLICENSED\"},\"contracts/multi-chains/RoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport \\\"../interfaces/IRoninTrustedOrganization.sol\\\";\\nimport \\\"../extensions/collections/HasProxyAdmin.sol\\\";\\n\\ncontract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, Initializable {\\n uint256 internal _num;\\n uint256 internal _denom;\\n uint256 internal _totalWeight;\\n uint256 internal _nonce;\\n\\n /// @dev Mapping from consensus address => weight\\n mapping(address => uint256) internal _consensusWeight;\\n /// @dev Mapping from governor address => weight\\n mapping(address => uint256) internal _governorWeight;\\n /// @dev Mapping from bridge voter address => weight\\n mapping(address => uint256) internal _bridgeVoterWeight;\\n\\n /// @dev Mapping from consensus address => added block\\n mapping(address => uint256) internal _addedBlock;\\n\\n /// @dev Consensus array\\n address[] internal _consensusList;\\n /// @dev Governors array\\n address[] internal _governorList;\\n /// @dev Bridge voters array\\n address[] internal _bridgeVoterList;\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n TrustedOrganization[] calldata _trustedOrgs,\\n uint256 __num,\\n uint256 __denom\\n ) external initializer {\\n if (_trustedOrgs.length > 0) {\\n _addTrustedOrganizations(_trustedOrgs);\\n }\\n _setThreshold(__num, __denom);\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\\n return (_num, _denom);\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\\n return _voteWeight * _denom >= _num * _totalWeight;\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function minimumVoteWeight() external view virtual returns (uint256) {\\n return (_num * _totalWeight + _denom - 1) / _denom;\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n override\\n onlyAdmin\\n returns (uint256, uint256)\\n {\\n return _setThreshold(_numerator, _denominator);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\\n _addTrustedOrganizations(_list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\\n require(_list.length > 0, \\\"RoninTrustedOrganization: invalid array length\\\");\\n for (uint256 _i; _i < _list.length; _i++) {\\n _updateTrustedOrganization(_list[_i]);\\n }\\n emit TrustedOrganizationsUpdated(_list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function removeTrustedOrganizations(address[] calldata _list) external override onlyAdmin {\\n require(_list.length > 0, \\\"RoninTrustedOrganization: invalid array length\\\");\\n for (uint _i = 0; _i < _list.length; _i++) {\\n _removeTrustedOrganization(_list[_i]);\\n }\\n emit TrustedOrganizationsRemoved(_list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function totalWeights() external view virtual returns (uint256) {\\n return _totalWeight;\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256) {\\n return _consensusWeight[_consensusAddr];\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256) {\\n return _governorWeight[_governor];\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256) {\\n return _bridgeVoterWeight[_addr];\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\\n _res = new uint256[](_list.length);\\n for (uint _i = 0; _i < _res.length; _i++) {\\n _res[_i] = _consensusWeight[_list[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\\n _res = new uint256[](_list.length);\\n for (uint _i = 0; _i < _res.length; _i++) {\\n _res[_i] = _governorWeight[_list[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\\n _res = new uint256[](_list.length);\\n for (uint _i = 0; _i < _res.length; _i++) {\\n _res[_i] = _bridgeVoterWeight[_list[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res) {\\n for (uint _i = 0; _i < _list.length; _i++) {\\n _res += _consensusWeight[_list[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res) {\\n for (uint _i = 0; _i < _list.length; _i++) {\\n _res += _governorWeight[_list[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res) {\\n for (uint _i = 0; _i < _list.length; _i++) {\\n _res += _bridgeVoterWeight[_list[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function countTrustedOrganizations() external view override returns (uint256) {\\n return _consensusList.length;\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getAllTrustedOrganizations() external view override returns (TrustedOrganization[] memory _list) {\\n _list = new TrustedOrganization[](_consensusList.length);\\n address _addr;\\n for (uint256 _i; _i < _list.length; _i++) {\\n _addr = _consensusList[_i];\\n _list[_i].consensusAddr = _addr;\\n _list[_i].governor = _governorList[_i];\\n _list[_i].bridgeVoter = _bridgeVoterList[_i];\\n _list[_i].weight = _consensusWeight[_addr];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory) {\\n for (uint _i = 0; _i < _consensusList.length; _i++) {\\n if (_consensusList[_i] == _consensusAddr) {\\n return getTrustedOrganizationAt(_i);\\n }\\n }\\n revert(\\\"RoninTrustedOrganization: query for non-existent consensus address\\\");\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getTrustedOrganizationAt(uint256 _idx) public view override returns (TrustedOrganization memory) {\\n address _addr = _consensusList[_idx];\\n return\\n TrustedOrganization(\\n _addr,\\n _governorList[_idx],\\n _bridgeVoterList[_idx],\\n _consensusWeight[_addr],\\n _addedBlock[_addr]\\n );\\n }\\n\\n /**\\n * @dev Adds a list of trusted organizations.\\n */\\n function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {\\n for (uint256 _i; _i < _list.length; _i++) {\\n _addTrustedOrganization(_list[_i]);\\n }\\n emit TrustedOrganizationsAdded(_list);\\n }\\n\\n /**\\n * @dev Adds a trusted organization.\\n *\\n * Requirements:\\n * - The weight is larger than 0.\\n * - The consensus address is not added.\\n * - The govenor address is not added.\\n * - The bridge voter address is not added.\\n *\\n */\\n function _addTrustedOrganization(TrustedOrganization memory _v) internal virtual {\\n require(_v.addedBlock == 0, \\\"RoninTrustedOrganization: invalid request\\\");\\n _sanityCheckTrustedOrganizationData(_v);\\n\\n if (_consensusWeight[_v.consensusAddr] > 0) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"RoninTrustedOrganization: consensus address \\\",\\n Strings.toHexString(uint160(_v.consensusAddr), 20),\\n \\\" is added already\\\"\\n )\\n )\\n );\\n }\\n\\n if (_governorWeight[_v.governor] > 0) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"RoninTrustedOrganization: govenor address \\\",\\n Strings.toHexString(uint160(_v.governor), 20),\\n \\\" is added already\\\"\\n )\\n )\\n );\\n }\\n\\n if (_bridgeVoterWeight[_v.bridgeVoter] > 0) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"RoninTrustedOrganization: bridge voter address \\\",\\n Strings.toHexString(uint160(_v.bridgeVoter), 20),\\n \\\" is added already\\\"\\n )\\n )\\n );\\n }\\n\\n _consensusList.push(_v.consensusAddr);\\n _consensusWeight[_v.consensusAddr] = _v.weight;\\n\\n _governorList.push(_v.governor);\\n _governorWeight[_v.governor] = _v.weight;\\n\\n _bridgeVoterList.push(_v.bridgeVoter);\\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\\n\\n _addedBlock[_v.consensusAddr] = block.number;\\n\\n _totalWeight += _v.weight;\\n }\\n\\n /**\\n * @dev Updates a trusted organization.\\n *\\n * Requirements:\\n * - The weight is larger than 0.\\n * - The consensus address is already added.\\n *\\n */\\n function _updateTrustedOrganization(TrustedOrganization memory _v) internal virtual {\\n _sanityCheckTrustedOrganizationData(_v);\\n\\n uint256 _weight = _consensusWeight[_v.consensusAddr];\\n if (_weight == 0) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"RoninTrustedOrganization: consensus address \\\",\\n Strings.toHexString(uint160(_v.consensusAddr), 20),\\n \\\" is not added\\\"\\n )\\n )\\n );\\n }\\n\\n uint256 _count = _consensusList.length;\\n for (uint256 _i = 0; _i < _count; _i++) {\\n if (_consensusList[_i] == _v.consensusAddr) {\\n _totalWeight -= _weight;\\n _totalWeight += _v.weight;\\n\\n if (_governorList[_i] != _v.governor) {\\n require(_governorWeight[_v.governor] == 0, \\\"RoninTrustedOrganization: query for duplicated governor\\\");\\n delete _governorWeight[_governorList[_i]];\\n _governorList[_i] = _v.governor;\\n }\\n\\n if (_bridgeVoterList[_i] != _v.bridgeVoter) {\\n require(\\n _bridgeVoterWeight[_v.bridgeVoter] == 0,\\n \\\"RoninTrustedOrganization: query for duplicated bridge voter\\\"\\n );\\n delete _bridgeVoterWeight[_bridgeVoterList[_i]];\\n _bridgeVoterList[_i] = _v.bridgeVoter;\\n }\\n\\n _consensusWeight[_v.consensusAddr] = _v.weight;\\n _governorWeight[_v.governor] = _v.weight;\\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\\n return;\\n }\\n }\\n }\\n\\n /**\\n * @dev Removes a trusted organization.\\n *\\n * Requirements:\\n * - The consensus address is added.\\n *\\n */\\n function _removeTrustedOrganization(address _addr) internal virtual {\\n uint256 _weight = _consensusWeight[_addr];\\n if (_weight == 0) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"RoninTrustedOrganization: consensus address \\\",\\n Strings.toHexString(uint160(_addr), 20),\\n \\\" is not added\\\"\\n )\\n )\\n );\\n }\\n\\n uint256 _index;\\n uint256 _count = _consensusList.length;\\n for (uint256 _i = 0; _i < _count; _i++) {\\n if (_consensusList[_i] == _addr) {\\n _index = _i;\\n break;\\n }\\n }\\n\\n _totalWeight -= _weight;\\n\\n delete _addedBlock[_addr];\\n delete _consensusWeight[_addr];\\n _consensusList[_index] = _consensusList[_count - 1];\\n _consensusList.pop();\\n\\n delete _governorWeight[_governorList[_index]];\\n _governorList[_index] = _governorList[_count - 1];\\n _governorList.pop();\\n\\n delete _bridgeVoterWeight[_bridgeVoterList[_index]];\\n _bridgeVoterList[_index] = _bridgeVoterList[_count - 1];\\n _bridgeVoterList.pop();\\n }\\n\\n /**\\n * @dev Sets threshold and returns the old one.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function _setThreshold(uint256 _numerator, uint256 _denominator)\\n internal\\n virtual\\n returns (uint256 _previousNum, uint256 _previousDenom)\\n {\\n require(_numerator <= _denominator, \\\"RoninTrustedOrganization: invalid threshold\\\");\\n _previousNum = _num;\\n _previousDenom = _denom;\\n _num = _numerator;\\n _denom = _denominator;\\n emit ThresholdUpdated(_nonce++, _numerator, _denominator, _previousNum, _previousDenom);\\n }\\n\\n /**\\n * @dev Hook that checks trusted organization's data. Reverts if the requirements are not met.\\n *\\n * Requirements:\\n * - The weight must be larger than 0.\\n * - The consensus address, governor address, and bridge voter address are different.\\n */\\n function _sanityCheckTrustedOrganizationData(TrustedOrganization memory _v) private pure {\\n require(_v.weight > 0, \\\"RoninTrustedOrganization: invalid weight\\\");\\n\\n address[] memory _addresses = new address[](3);\\n _addresses[0] = _v.consensusAddr;\\n _addresses[1] = _v.governor;\\n _addresses[2] = _v.bridgeVoter;\\n require(!AddressArrayUtils.hasDuplicate(_addresses), \\\"RoninTrustedOrganization: three addresses must be distinct\\\");\\n }\\n}\\n\",\"keccak256\":\"0xcdc122c399d55a5c7ff9bb96a2e7c99c99b3814edcd1a4e24c6e021bacd15c32\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b506125ef806100206000396000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063b505a07c116100b8578063d9d5dadb1161007c578063d9d5dadb146102d5578063dafae408146102e8578063db6693a21461030b578063e75235b81461032b578063e8c0685e14610336578063f09267c21461034957600080fd5b8063b505a07c14610256578063b9c3620914610269578063cacf8fb514610291578063cc7e6b3b14610299578063d78392f8146102ac57600080fd5b80635f14a1c31161010a5780635f14a1c3146101fa578063708236251461020d5780637c37103c146102205780637de5dedd14610233578063926323d51461023b578063a85c7d6e1461024357600080fd5b80630ed285df14610147578063150740051461015c57806341feed1c1461017a578063520fce62146101b157806356241911146101d1575b600080fd5b61015a610155366004611e89565b61035c565b005b6101646103ab565b6040516101719190611f08565b60405180910390f35b6101a3610188366004611f72565b6001600160a01b031660009081526005602052604090205490565b604051908152602001610171565b6101c46101bf366004611f8d565b6105a1565b6040516101719190612002565b6101a36101df366004611f72565b6001600160a01b031660009081526007602052604090205490565b6101a3610208366004611f8d565b610676565b6101c461021b366004611f8d565b6106e5565b61015a61022e36600461203a565b6107b3565b6101a36108dc565b6003546101a3565b61015a610251366004611f8d565b610919565b61015a610264366004611e89565b6109f8565b61027c61027736600461208b565b610acc565b60408051928352602083019190915201610171565b6009546101a3565b6101c46102a7366004611f8d565b610b1d565b6101a36102ba366004611f72565b6001600160a01b031660009081526006602052604090205490565b6101a36102e3366004611f8d565b610beb565b6102fb6102f63660046120ad565b610c5a565b6040519015158152602001610171565b61031e610319366004611f72565b610c81565b60405161017191906120c6565b60015460025461027c565b6101a3610344366004611f8d565b610d8a565b61031e6103573660046120ad565b610df9565b610364610eff565b6001600160a01b0316336001600160a01b03161461039d5760405162461bcd60e51b8152600401610394906120d4565b60405180910390fd5b6103a78282610f2d565b5050565b60095460609067ffffffffffffffff8111156103c9576103c9612116565b60405190808252806020026020018201604052801561042257816020015b6040805160a0810182526000808252602080830182905292820181905260608201819052608082015282526000199092019101816103e75790505b5090506000805b825181101561059c57600981815481106104455761044561212c565b9060005260206000200160009054906101000a90046001600160a01b03169150818382815181106104785761047861212c565b60209081029190910101516001600160a01b039091169052600a8054829081106104a4576104a461212c565b9060005260206000200160009054906101000a90046001600160a01b03168382815181106104d4576104d461212c565b6020026020010151602001906001600160a01b031690816001600160a01b031681525050600b818154811061050b5761050b61212c565b9060005260206000200160009054906101000a90046001600160a01b031683828151811061053b5761053b61212c565b6020908102919091018101516001600160a01b03928316604091820152918416600090815260059091522054835184908390811061057b5761057b61212c565b6020908102919091010151606001528061059481612158565b915050610429565b505090565b60608167ffffffffffffffff8111156105bc576105bc612116565b6040519080825280602002602001820160405280156105e5578160200160208202803683370190505b50905060005b815181101561066f576005600085858481811061060a5761060a61212c565b905060200201602081019061061f9190611f72565b6001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106106525761065261212c565b60209081029190910101528061066781612158565b9150506105eb565b5092915050565b6000805b8281101561066f57600660008585848181106106985761069861212c565b90506020020160208101906106ad9190611f72565b6001600160a01b031681526020810191909152604001600020546106d19083612171565b9150806106dd81612158565b91505061067a565b60608167ffffffffffffffff81111561070057610700612116565b604051908082528060200260200182016040528015610729578160200160208202803683370190505b50905060005b815181101561066f576007600085858481811061074e5761074e61212c565b90506020020160208101906107639190611f72565b6001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106107965761079661212c565b6020908102919091010152806107ab81612158565b91505061072f565b600054610100900460ff16158080156107d35750600054600160ff909116105b806107ed5750303b1580156107ed575060005460ff166001145b6108505760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610394565b6000805460ff191660011790558015610873576000805461ff0019166101001790555b8315610883576108838585610f2d565b61088d8383610fac565b505080156108d5576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b600060025460016002546003546001546108f69190612184565b6109009190612171565b61090a919061219b565b61091491906121ae565b905090565b610921610eff565b6001600160a01b0316336001600160a01b0316146109515760405162461bcd60e51b8152600401610394906120d4565b8061096e5760405162461bcd60e51b8152600401610394906121d0565b60005b818110156109ba576109a883838381811061098e5761098e61212c565b90506020020160208101906109a39190611f72565b61106d565b806109b281612158565b915050610971565b507f121945697ac30ee0fc67821492cb685c65f0ea4d7f1b710fde44d6e2237f43a782826040516109ec92919061220c565b60405180910390a15050565b610a00610eff565b6001600160a01b0316336001600160a01b031614610a305760405162461bcd60e51b8152600401610394906120d4565b80610a4d5760405162461bcd60e51b8152600401610394906121d0565b60005b81811015610a9a57610a88838383818110610a6d57610a6d61212c565b905060a00201803603810190610a839190612258565b6113ff565b80610a9281612158565b915050610a50565b507fe887c8106c09d1770c0ef0bf8ca62c54766f18b07506801865501783376cbeda82826040516109ec9291906122e9565b600080610ad7610eff565b6001600160a01b0316336001600160a01b031614610b075760405162461bcd60e51b8152600401610394906120d4565b610b118484610fac565b915091505b9250929050565b60608167ffffffffffffffff811115610b3857610b38612116565b604051908082528060200260200182016040528015610b61578160200160208202803683370190505b50905060005b815181101561066f5760066000858584818110610b8657610b8661212c565b9050602002016020810190610b9b9190611f72565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110610bce57610bce61212c565b602090810291909101015280610be381612158565b915050610b67565b6000805b8281101561066f5760076000858584818110610c0d57610c0d61212c565b9050602002016020810190610c229190611f72565b6001600160a01b03168152602081019190915260400160002054610c469083612171565b915080610c5281612158565b915050610bef565b6000600354600154610c6c9190612184565b600254610c799084612184565b101592915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101829052905b600954811015610d1057826001600160a01b031660098281548110610cd457610cd461212c565b6000918252602090912001546001600160a01b031603610cfe57610cf781610df9565b9392505050565b80610d0881612158565b915050610cad565b5060405162461bcd60e51b815260206004820152604260248201527f526f6e696e547275737465644f7267616e697a6174696f6e3a2071756572792060448201527f666f72206e6f6e2d6578697374656e7420636f6e73656e737573206164647265606482015261737360f01b608482015260a401610394565b6000805b8281101561066f5760056000858584818110610dac57610dac61212c565b9050602002016020810190610dc19190611f72565b6001600160a01b03168152602081019190915260400160002054610de59083612171565b915080610df181612158565b915050610d8e565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152600060098381548110610e3957610e3961212c565b9060005260206000200160009054906101000a90046001600160a01b031690506040518060a00160405280826001600160a01b03168152602001600a8581548110610e8657610e8661212c565b600091825260209182902001546001600160a01b03168252600b8054929091019186908110610eb757610eb761212c565b60009182526020808320909101546001600160a01b03908116845294909416808252600585526040808320548487015290825260089094528390205492019190915292915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b60005b81811015610f7a57610f68838383818110610f4d57610f4d61212c565b905060a00201803603810190610f639190612258565b6117c9565b80610f7281612158565b915050610f30565b507fc753dbf7952c70ff6b9fa7b626403aa1d2230d97136b635bd5e85bec72bcca6c82826040516109ec9291906122e9565b600080828411156110015760405162461bcd60e51b815260206004820152602b602482015260008051602061259a83398151915260448201526a19081d1a1c995cda1bdb1960aa1b6064820152608401610394565b5050600180546002805492859055839055600480549192918491869190600061102983612158565b9091555060408051868152602081018690527f976f8a9c5bdf8248dec172376d6e2b80a8e3df2f0328e381c6db8e1cf138c0f8910160405180910390a49250929050565b6001600160a01b038116600090815260056020526040812054908190036110d8576110a2826001600160a01b03166014611a3e565b6040516020016110b291906123d4565b60408051601f198184030181529082905262461bcd60e51b82526103949160040161240f565b600954600090815b8181101561113957846001600160a01b0316600982815481106111055761110561212c565b6000918252602090912001546001600160a01b03160361112757809250611139565b8061113181612158565b9150506110e0565b50826003600082825461114c919061219b565b90915550506001600160a01b03841660009081526008602090815260408083208390556005909152812055600961118460018361219b565b815481106111945761119461212c565b600091825260209091200154600980546001600160a01b0390921691849081106111c0576111c061212c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060098054806111ff576111ff612442565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560066000600a848154811061123e5761123e61212c565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600a61127060018361219b565b815481106112805761128061212c565b600091825260209091200154600a80546001600160a01b0390921691849081106112ac576112ac61212c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600a8054806112eb576112eb612442565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560076000600b848154811061132a5761132a61212c565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600b61135c60018361219b565b8154811061136c5761136c61212c565b600091825260209091200154600b80546001600160a01b0390921691849081106113985761139861212c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b8054806113d7576113d7612442565b600082815260209020810160001990810180546001600160a01b031916905501905550505050565b61140881611be3565b80516001600160a01b0316600090815260056020526040812054908190036114405781516110a2906001600160a01b03166014611a3e565b60095460005b818110156117c35783600001516001600160a01b03166009828154811061146f5761146f61212c565b6000918252602090912001546001600160a01b0316036117b157826003600082825461149b919061219b565b90915550506060840151600380546000906114b7908490612171565b9250508190555083602001516001600160a01b0316600a82815481106114df576114df61212c565b6000918252602090912001546001600160a01b03161461160f576020808501516001600160a01b03166000908152600690915260409020541561158a5760405162461bcd60e51b815260206004820152603760248201527f526f6e696e547275737465644f7267616e697a6174696f6e3a2071756572792060448201527f666f72206475706c69636174656420676f7665726e6f720000000000000000006064820152608401610394565b60066000600a83815481106115a1576115a161212c565b60009182526020808320909101546001600160a01b03168352828101939093526040909101812055840151600a8054839081106115e0576115e061212c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b83604001516001600160a01b0316600b82815481106116305761163061212c565b6000918252602090912001546001600160a01b03161461175f576040808501516001600160a01b0316600090815260076020522054156116d85760405162461bcd60e51b815260206004820152603b60248201527f526f6e696e547275737465644f7267616e697a6174696f6e3a2071756572792060448201527f666f72206475706c6963617465642062726964676520766f74657200000000006064820152608401610394565b60076000600b83815481106116ef576116ef61212c565b60009182526020808320909101546001600160a01b031683528201929092526040908101822091909155840151600b8054839081106117305761173061212c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b50505060608101805182516001600160a01b0390811660009081526005602090815260408083209490945584518187015184168352600682528483205593519483015190911681526007909252902055565b806117bb81612158565b915050611446565b50505050565b60808101511561181b5760405162461bcd60e51b8152602060048201526029602482015260008051602061259a83398151915260448201526819081c995c5d595cdd60ba1b6064820152608401610394565b61182481611be3565b80516001600160a01b031660009081526005602052604090205415611869578051611859906001600160a01b03166014611a3e565b6040516020016110b29190612458565b6020808201516001600160a01b0316600090815260069091526040902054156118b4576118a481602001516001600160a01b03166014611a3e565b6040516020016110b29190612497565b6040808201516001600160a01b0316600090815260076020522054156118fc576118ec81604001516001600160a01b03166014611a3e565b6040516020016110b2919061250a565b8051600980546001808201835560009283527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af90910180546001600160a01b03199081166001600160a01b0395861617909155606085018051865186168552600560209081526040808720929092558088018051600a805480890182559089527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180548716918a16919091179055835190518816875260068252828720558188018051600b8054978801815588527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9909601805490951695881695909517909355815193518616855260078352808520939093558551909416835260089052812043905590516003805491929091611a36908490612171565b909155505050565b60606000611a4d836002612184565b611a58906002612171565b67ffffffffffffffff811115611a7057611a70612116565b6040519080825280601f01601f191660200182016040528015611a9a576020820181803683370190505b509050600360fc1b81600081518110611ab557611ab561212c565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611ae457611ae461212c565b60200101906001600160f81b031916908160001a9053506000611b08846002612184565b611b13906001612171565b90505b6001811115611b8b576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611b4757611b4761212c565b1a60f81b828281518110611b5d57611b5d61212c565b60200101906001600160f81b031916908160001a90535060049490941c93611b8481612582565b9050611b16565b508315611bda5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610394565b90505b92915050565b6000816060015111611c365760405162461bcd60e51b8152602060048201526028602482015260008051602061259a83398151915260448201526719081dd95a59da1d60c21b6064820152608401610394565b6040805160038082526080820190925260009160208201606080368337019050509050816000015181600081518110611c7157611c7161212c565b60200260200101906001600160a01b031690816001600160a01b031681525050816020015181600181518110611ca957611ca961212c565b60200260200101906001600160a01b031690816001600160a01b031681525050816040015181600281518110611ce157611ce161212c565b60200260200101906001600160a01b031690816001600160a01b031681525050611d0a81611d7d565b156103a75760405162461bcd60e51b815260206004820152603a60248201527f526f6e696e547275737465644f7267616e697a6174696f6e3a2074687265652060448201527f616464726573736573206d7573742062652064697374696e63740000000000006064820152608401610394565b60008151600003611d9057506000919050565b60005b60018351611da1919061219b565b811015611e3b576000611db5826001612171565b90505b8351811015611e2857838181518110611dd357611dd361212c565b60200260200101516001600160a01b0316848381518110611df657611df661212c565b60200260200101516001600160a01b031603611e16575060019392505050565b80611e2081612158565b915050611db8565b5080611e3381612158565b915050611d93565b50600092915050565b60008083601f840112611e5657600080fd5b50813567ffffffffffffffff811115611e6e57600080fd5b60208301915083602060a083028501011115610b1657600080fd5b60008060208385031215611e9c57600080fd5b823567ffffffffffffffff811115611eb357600080fd5b611ebf85828601611e44565b90969095509350505050565b80516001600160a01b0390811683526020808301518216908401526040808301519091169083015260608082015190830152608090810151910152565b6020808252825182820181905260009190848201906040850190845b81811015611f4a57611f37838551611ecb565b9284019260a09290920191600101611f24565b50909695505050505050565b80356001600160a01b0381168114611f6d57600080fd5b919050565b600060208284031215611f8457600080fd5b610cf782611f56565b60008060208385031215611fa057600080fd5b823567ffffffffffffffff80821115611fb857600080fd5b818501915085601f830112611fcc57600080fd5b813581811115611fdb57600080fd5b8660208260051b8501011115611ff057600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015611f4a5783518352928401929184019160010161201e565b6000806000806060858703121561205057600080fd5b843567ffffffffffffffff81111561206757600080fd5b61207387828801611e44565b90989097506020870135966040013595509350505050565b6000806040838503121561209e57600080fd5b50508035926020909101359150565b6000602082840312156120bf57600080fd5b5035919050565b60a08101611bdd8284611ecb565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161216a5761216a612142565b5060010190565b80820180821115611bdd57611bdd612142565b8082028115828204841417611bdd57611bdd612142565b81810381811115611bdd57611bdd612142565b6000826121cb57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602e9082015260008051602061259a83398151915260408201526d0c840c2e4e4c2f240d8cadccee8d60931b606082015260800190565b60208082528181018390526000908460408401835b8681101561224d576001600160a01b0361223a84611f56565b1682529183019190830190600101612221565b509695505050505050565b600060a0828403121561226a57600080fd5b60405160a0810181811067ffffffffffffffff8211171561229b57634e487b7160e01b600052604160045260246000fd5b6040526122a783611f56565b81526122b560208401611f56565b60208201526122c660408401611f56565b604082015260608301356060820152608083013560808201528091505092915050565b6020808252818101839052600090604080840186845b87811015612365576001600160a01b038061231984611f56565b16845280612328878501611f56565b168685015280612339868501611f56565b168486015250606082810135908401526080808301359084015260a092830192909101906001016122ff565b5090979650505050505050565b7f526f6e696e547275737465644f7267616e697a6174696f6e3a20636f6e73656e81526b039bab99030b2323932b9b9960a51b6020820152602c0190565b60005b838110156123cb5781810151838201526020016123b3565b50506000910152565b60006123df82612372565b83516123ef8183602088016123b0565b6c081a5cc81b9bdd081859191959609a1b9101908152600d019392505050565b602081526000825180602084015261242e8160408501602087016123b0565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603160045260246000fd5b600061246382612372565b83516124738183602088016123b0565b7020697320616464656420616c726561647960781b91019081526011019392505050565b7f526f6e696e547275737465644f7267616e697a6174696f6e3a20676f76656e6f8152690391030b2323932b9b9960b51b6020820152600082516124e281602a8501602087016123b0565b7020697320616464656420616c726561647960781b602a939091019283015250603b01919050565b7f526f6e696e547275737465644f7267616e697a6174696f6e3a2062726964676581526e0103b37ba32b91030b2323932b9b99608d1b60208201526000825161255a81602f8501602087016123b0565b7020697320616464656420616c726561647960781b602f939091019283015250604001919050565b60008161259157612591612142565b50600019019056fe526f6e696e547275737465644f7267616e697a6174696f6e3a20696e76616c69a2646970667358221220dd0b211d7a8efade08b354c61fa326bb2e69125fa48d6300a169823eb0a7d58b64736f6c63430008110033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063b505a07c116100b8578063d9d5dadb1161007c578063d9d5dadb146102d5578063dafae408146102e8578063db6693a21461030b578063e75235b81461032b578063e8c0685e14610336578063f09267c21461034957600080fd5b8063b505a07c14610256578063b9c3620914610269578063cacf8fb514610291578063cc7e6b3b14610299578063d78392f8146102ac57600080fd5b80635f14a1c31161010a5780635f14a1c3146101fa578063708236251461020d5780637c37103c146102205780637de5dedd14610233578063926323d51461023b578063a85c7d6e1461024357600080fd5b80630ed285df14610147578063150740051461015c57806341feed1c1461017a578063520fce62146101b157806356241911146101d1575b600080fd5b61015a610155366004611e89565b61035c565b005b6101646103ab565b6040516101719190611f08565b60405180910390f35b6101a3610188366004611f72565b6001600160a01b031660009081526005602052604090205490565b604051908152602001610171565b6101c46101bf366004611f8d565b6105a1565b6040516101719190612002565b6101a36101df366004611f72565b6001600160a01b031660009081526007602052604090205490565b6101a3610208366004611f8d565b610676565b6101c461021b366004611f8d565b6106e5565b61015a61022e36600461203a565b6107b3565b6101a36108dc565b6003546101a3565b61015a610251366004611f8d565b610919565b61015a610264366004611e89565b6109f8565b61027c61027736600461208b565b610acc565b60408051928352602083019190915201610171565b6009546101a3565b6101c46102a7366004611f8d565b610b1d565b6101a36102ba366004611f72565b6001600160a01b031660009081526006602052604090205490565b6101a36102e3366004611f8d565b610beb565b6102fb6102f63660046120ad565b610c5a565b6040519015158152602001610171565b61031e610319366004611f72565b610c81565b60405161017191906120c6565b60015460025461027c565b6101a3610344366004611f8d565b610d8a565b61031e6103573660046120ad565b610df9565b610364610eff565b6001600160a01b0316336001600160a01b03161461039d5760405162461bcd60e51b8152600401610394906120d4565b60405180910390fd5b6103a78282610f2d565b5050565b60095460609067ffffffffffffffff8111156103c9576103c9612116565b60405190808252806020026020018201604052801561042257816020015b6040805160a0810182526000808252602080830182905292820181905260608201819052608082015282526000199092019101816103e75790505b5090506000805b825181101561059c57600981815481106104455761044561212c565b9060005260206000200160009054906101000a90046001600160a01b03169150818382815181106104785761047861212c565b60209081029190910101516001600160a01b039091169052600a8054829081106104a4576104a461212c565b9060005260206000200160009054906101000a90046001600160a01b03168382815181106104d4576104d461212c565b6020026020010151602001906001600160a01b031690816001600160a01b031681525050600b818154811061050b5761050b61212c565b9060005260206000200160009054906101000a90046001600160a01b031683828151811061053b5761053b61212c565b6020908102919091018101516001600160a01b03928316604091820152918416600090815260059091522054835184908390811061057b5761057b61212c565b6020908102919091010151606001528061059481612158565b915050610429565b505090565b60608167ffffffffffffffff8111156105bc576105bc612116565b6040519080825280602002602001820160405280156105e5578160200160208202803683370190505b50905060005b815181101561066f576005600085858481811061060a5761060a61212c565b905060200201602081019061061f9190611f72565b6001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106106525761065261212c565b60209081029190910101528061066781612158565b9150506105eb565b5092915050565b6000805b8281101561066f57600660008585848181106106985761069861212c565b90506020020160208101906106ad9190611f72565b6001600160a01b031681526020810191909152604001600020546106d19083612171565b9150806106dd81612158565b91505061067a565b60608167ffffffffffffffff81111561070057610700612116565b604051908082528060200260200182016040528015610729578160200160208202803683370190505b50905060005b815181101561066f576007600085858481811061074e5761074e61212c565b90506020020160208101906107639190611f72565b6001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106107965761079661212c565b6020908102919091010152806107ab81612158565b91505061072f565b600054610100900460ff16158080156107d35750600054600160ff909116105b806107ed5750303b1580156107ed575060005460ff166001145b6108505760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610394565b6000805460ff191660011790558015610873576000805461ff0019166101001790555b8315610883576108838585610f2d565b61088d8383610fac565b505080156108d5576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b600060025460016002546003546001546108f69190612184565b6109009190612171565b61090a919061219b565b61091491906121ae565b905090565b610921610eff565b6001600160a01b0316336001600160a01b0316146109515760405162461bcd60e51b8152600401610394906120d4565b8061096e5760405162461bcd60e51b8152600401610394906121d0565b60005b818110156109ba576109a883838381811061098e5761098e61212c565b90506020020160208101906109a39190611f72565b61106d565b806109b281612158565b915050610971565b507f121945697ac30ee0fc67821492cb685c65f0ea4d7f1b710fde44d6e2237f43a782826040516109ec92919061220c565b60405180910390a15050565b610a00610eff565b6001600160a01b0316336001600160a01b031614610a305760405162461bcd60e51b8152600401610394906120d4565b80610a4d5760405162461bcd60e51b8152600401610394906121d0565b60005b81811015610a9a57610a88838383818110610a6d57610a6d61212c565b905060a00201803603810190610a839190612258565b6113ff565b80610a9281612158565b915050610a50565b507fe887c8106c09d1770c0ef0bf8ca62c54766f18b07506801865501783376cbeda82826040516109ec9291906122e9565b600080610ad7610eff565b6001600160a01b0316336001600160a01b031614610b075760405162461bcd60e51b8152600401610394906120d4565b610b118484610fac565b915091505b9250929050565b60608167ffffffffffffffff811115610b3857610b38612116565b604051908082528060200260200182016040528015610b61578160200160208202803683370190505b50905060005b815181101561066f5760066000858584818110610b8657610b8661212c565b9050602002016020810190610b9b9190611f72565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110610bce57610bce61212c565b602090810291909101015280610be381612158565b915050610b67565b6000805b8281101561066f5760076000858584818110610c0d57610c0d61212c565b9050602002016020810190610c229190611f72565b6001600160a01b03168152602081019190915260400160002054610c469083612171565b915080610c5281612158565b915050610bef565b6000600354600154610c6c9190612184565b600254610c799084612184565b101592915050565b6040805160a0810182526000808252602082018190529181018290526060810182905260808101829052905b600954811015610d1057826001600160a01b031660098281548110610cd457610cd461212c565b6000918252602090912001546001600160a01b031603610cfe57610cf781610df9565b9392505050565b80610d0881612158565b915050610cad565b5060405162461bcd60e51b815260206004820152604260248201527f526f6e696e547275737465644f7267616e697a6174696f6e3a2071756572792060448201527f666f72206e6f6e2d6578697374656e7420636f6e73656e737573206164647265606482015261737360f01b608482015260a401610394565b6000805b8281101561066f5760056000858584818110610dac57610dac61212c565b9050602002016020810190610dc19190611f72565b6001600160a01b03168152602081019190915260400160002054610de59083612171565b915080610df181612158565b915050610d8e565b6040805160a081018252600080825260208201819052918101829052606081018290526080810191909152600060098381548110610e3957610e3961212c565b9060005260206000200160009054906101000a90046001600160a01b031690506040518060a00160405280826001600160a01b03168152602001600a8581548110610e8657610e8661212c565b600091825260209182902001546001600160a01b03168252600b8054929091019186908110610eb757610eb761212c565b60009182526020808320909101546001600160a01b03908116845294909416808252600585526040808320548487015290825260089094528390205492019190915292915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b60005b81811015610f7a57610f68838383818110610f4d57610f4d61212c565b905060a00201803603810190610f639190612258565b6117c9565b80610f7281612158565b915050610f30565b507fc753dbf7952c70ff6b9fa7b626403aa1d2230d97136b635bd5e85bec72bcca6c82826040516109ec9291906122e9565b600080828411156110015760405162461bcd60e51b815260206004820152602b602482015260008051602061259a83398151915260448201526a19081d1a1c995cda1bdb1960aa1b6064820152608401610394565b5050600180546002805492859055839055600480549192918491869190600061102983612158565b9091555060408051868152602081018690527f976f8a9c5bdf8248dec172376d6e2b80a8e3df2f0328e381c6db8e1cf138c0f8910160405180910390a49250929050565b6001600160a01b038116600090815260056020526040812054908190036110d8576110a2826001600160a01b03166014611a3e565b6040516020016110b291906123d4565b60408051601f198184030181529082905262461bcd60e51b82526103949160040161240f565b600954600090815b8181101561113957846001600160a01b0316600982815481106111055761110561212c565b6000918252602090912001546001600160a01b03160361112757809250611139565b8061113181612158565b9150506110e0565b50826003600082825461114c919061219b565b90915550506001600160a01b03841660009081526008602090815260408083208390556005909152812055600961118460018361219b565b815481106111945761119461212c565b600091825260209091200154600980546001600160a01b0390921691849081106111c0576111c061212c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555060098054806111ff576111ff612442565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560066000600a848154811061123e5761123e61212c565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600a61127060018361219b565b815481106112805761128061212c565b600091825260209091200154600a80546001600160a01b0390921691849081106112ac576112ac61212c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600a8054806112eb576112eb612442565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560076000600b848154811061132a5761132a61212c565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600b61135c60018361219b565b8154811061136c5761136c61212c565b600091825260209091200154600b80546001600160a01b0390921691849081106113985761139861212c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b8054806113d7576113d7612442565b600082815260209020810160001990810180546001600160a01b031916905501905550505050565b61140881611be3565b80516001600160a01b0316600090815260056020526040812054908190036114405781516110a2906001600160a01b03166014611a3e565b60095460005b818110156117c35783600001516001600160a01b03166009828154811061146f5761146f61212c565b6000918252602090912001546001600160a01b0316036117b157826003600082825461149b919061219b565b90915550506060840151600380546000906114b7908490612171565b9250508190555083602001516001600160a01b0316600a82815481106114df576114df61212c565b6000918252602090912001546001600160a01b03161461160f576020808501516001600160a01b03166000908152600690915260409020541561158a5760405162461bcd60e51b815260206004820152603760248201527f526f6e696e547275737465644f7267616e697a6174696f6e3a2071756572792060448201527f666f72206475706c69636174656420676f7665726e6f720000000000000000006064820152608401610394565b60066000600a83815481106115a1576115a161212c565b60009182526020808320909101546001600160a01b03168352828101939093526040909101812055840151600a8054839081106115e0576115e061212c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b83604001516001600160a01b0316600b82815481106116305761163061212c565b6000918252602090912001546001600160a01b03161461175f576040808501516001600160a01b0316600090815260076020522054156116d85760405162461bcd60e51b815260206004820152603b60248201527f526f6e696e547275737465644f7267616e697a6174696f6e3a2071756572792060448201527f666f72206475706c6963617465642062726964676520766f74657200000000006064820152608401610394565b60076000600b83815481106116ef576116ef61212c565b60009182526020808320909101546001600160a01b031683528201929092526040908101822091909155840151600b8054839081106117305761173061212c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b50505060608101805182516001600160a01b0390811660009081526005602090815260408083209490945584518187015184168352600682528483205593519483015190911681526007909252902055565b806117bb81612158565b915050611446565b50505050565b60808101511561181b5760405162461bcd60e51b8152602060048201526029602482015260008051602061259a83398151915260448201526819081c995c5d595cdd60ba1b6064820152608401610394565b61182481611be3565b80516001600160a01b031660009081526005602052604090205415611869578051611859906001600160a01b03166014611a3e565b6040516020016110b29190612458565b6020808201516001600160a01b0316600090815260069091526040902054156118b4576118a481602001516001600160a01b03166014611a3e565b6040516020016110b29190612497565b6040808201516001600160a01b0316600090815260076020522054156118fc576118ec81604001516001600160a01b03166014611a3e565b6040516020016110b2919061250a565b8051600980546001808201835560009283527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af90910180546001600160a01b03199081166001600160a01b0395861617909155606085018051865186168552600560209081526040808720929092558088018051600a805480890182559089527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180548716918a16919091179055835190518816875260068252828720558188018051600b8054978801815588527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db9909601805490951695881695909517909355815193518616855260078352808520939093558551909416835260089052812043905590516003805491929091611a36908490612171565b909155505050565b60606000611a4d836002612184565b611a58906002612171565b67ffffffffffffffff811115611a7057611a70612116565b6040519080825280601f01601f191660200182016040528015611a9a576020820181803683370190505b509050600360fc1b81600081518110611ab557611ab561212c565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611ae457611ae461212c565b60200101906001600160f81b031916908160001a9053506000611b08846002612184565b611b13906001612171565b90505b6001811115611b8b576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611b4757611b4761212c565b1a60f81b828281518110611b5d57611b5d61212c565b60200101906001600160f81b031916908160001a90535060049490941c93611b8481612582565b9050611b16565b508315611bda5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610394565b90505b92915050565b6000816060015111611c365760405162461bcd60e51b8152602060048201526028602482015260008051602061259a83398151915260448201526719081dd95a59da1d60c21b6064820152608401610394565b6040805160038082526080820190925260009160208201606080368337019050509050816000015181600081518110611c7157611c7161212c565b60200260200101906001600160a01b031690816001600160a01b031681525050816020015181600181518110611ca957611ca961212c565b60200260200101906001600160a01b031690816001600160a01b031681525050816040015181600281518110611ce157611ce161212c565b60200260200101906001600160a01b031690816001600160a01b031681525050611d0a81611d7d565b156103a75760405162461bcd60e51b815260206004820152603a60248201527f526f6e696e547275737465644f7267616e697a6174696f6e3a2074687265652060448201527f616464726573736573206d7573742062652064697374696e63740000000000006064820152608401610394565b60008151600003611d9057506000919050565b60005b60018351611da1919061219b565b811015611e3b576000611db5826001612171565b90505b8351811015611e2857838181518110611dd357611dd361212c565b60200260200101516001600160a01b0316848381518110611df657611df661212c565b60200260200101516001600160a01b031603611e16575060019392505050565b80611e2081612158565b915050611db8565b5080611e3381612158565b915050611d93565b50600092915050565b60008083601f840112611e5657600080fd5b50813567ffffffffffffffff811115611e6e57600080fd5b60208301915083602060a083028501011115610b1657600080fd5b60008060208385031215611e9c57600080fd5b823567ffffffffffffffff811115611eb357600080fd5b611ebf85828601611e44565b90969095509350505050565b80516001600160a01b0390811683526020808301518216908401526040808301519091169083015260608082015190830152608090810151910152565b6020808252825182820181905260009190848201906040850190845b81811015611f4a57611f37838551611ecb565b9284019260a09290920191600101611f24565b50909695505050505050565b80356001600160a01b0381168114611f6d57600080fd5b919050565b600060208284031215611f8457600080fd5b610cf782611f56565b60008060208385031215611fa057600080fd5b823567ffffffffffffffff80821115611fb857600080fd5b818501915085601f830112611fcc57600080fd5b813581811115611fdb57600080fd5b8660208260051b8501011115611ff057600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015611f4a5783518352928401929184019160010161201e565b6000806000806060858703121561205057600080fd5b843567ffffffffffffffff81111561206757600080fd5b61207387828801611e44565b90989097506020870135966040013595509350505050565b6000806040838503121561209e57600080fd5b50508035926020909101359150565b6000602082840312156120bf57600080fd5b5035919050565b60a08101611bdd8284611ecb565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161216a5761216a612142565b5060010190565b80820180821115611bdd57611bdd612142565b8082028115828204841417611bdd57611bdd612142565b81810381811115611bdd57611bdd612142565b6000826121cb57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602e9082015260008051602061259a83398151915260408201526d0c840c2e4e4c2f240d8cadccee8d60931b606082015260800190565b60208082528181018390526000908460408401835b8681101561224d576001600160a01b0361223a84611f56565b1682529183019190830190600101612221565b509695505050505050565b600060a0828403121561226a57600080fd5b60405160a0810181811067ffffffffffffffff8211171561229b57634e487b7160e01b600052604160045260246000fd5b6040526122a783611f56565b81526122b560208401611f56565b60208201526122c660408401611f56565b604082015260608301356060820152608083013560808201528091505092915050565b6020808252818101839052600090604080840186845b87811015612365576001600160a01b038061231984611f56565b16845280612328878501611f56565b168685015280612339868501611f56565b168486015250606082810135908401526080808301359084015260a092830192909101906001016122ff565b5090979650505050505050565b7f526f6e696e547275737465644f7267616e697a6174696f6e3a20636f6e73656e81526b039bab99030b2323932b9b9960a51b6020820152602c0190565b60005b838110156123cb5781810151838201526020016123b3565b50506000910152565b60006123df82612372565b83516123ef8183602088016123b0565b6c081a5cc81b9bdd081859191959609a1b9101908152600d019392505050565b602081526000825180602084015261242e8160408501602087016123b0565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603160045260246000fd5b600061246382612372565b83516124738183602088016123b0565b7020697320616464656420616c726561647960781b91019081526011019392505050565b7f526f6e696e547275737465644f7267616e697a6174696f6e3a20676f76656e6f8152690391030b2323932b9b9960b51b6020820152600082516124e281602a8501602087016123b0565b7020697320616464656420616c726561647960781b602a939091019283015250603b01919050565b7f526f6e696e547275737465644f7267616e697a6174696f6e3a2062726964676581526e0103b37ba32b91030b2323932b9b99608d1b60208201526000825161255a81602f8501602087016123b0565b7020697320616464656420616c726561647960781b602f939091019283015250604001919050565b60008161259157612591612142565b50600019019056fe526f6e696e547275737465644f7267616e697a6174696f6e3a20696e76616c69a2646970667358221220dd0b211d7a8efade08b354c61fa326bb2e69125fa48d6300a169823eb0a7d58b64736f6c63430008110033", + "numDeployments": 5, + "solcInputHash": "85b953b22882c536a643bf4b61b3153b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"nonce\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"numerator\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"denominator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousNumerator\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"previousDenominator\",\"type\":\"uint256\"}],\"name\":\"ThresholdUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"orgs\",\"type\":\"tuple[]\"}],\"name\":\"TrustedOrganizationsAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"orgs\",\"type\":\"address[]\"}],\"name\":\"TrustedOrganizationsRemoved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"orgs\",\"type\":\"tuple[]\"}],\"name\":\"TrustedOrganizationsUpdated\",\"type\":\"event\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"name\":\"addTrustedOrganizations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_voteWeight\",\"type\":\"uint256\"}],\"name\":\"checkThreshold\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"countTrustedOrganizations\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getAllTrustedOrganizations\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"getBridgeVoterWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"getBridgeVoterWeights\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_res\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getConsensusWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"getConsensusWeights\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_res\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_governor\",\"type\":\"address\"}],\"name\":\"getGovernorWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"getGovernorWeights\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_res\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"num_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"denom_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getTrustedOrganization\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_idx\",\"type\":\"uint256\"}],\"name\":\"getTrustedOrganizationAt\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_trustedOrgs\",\"type\":\"tuple[]\"},{\"internalType\":\"uint256\",\"name\":\"__num\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__denom\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minimumVoteWeight\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"removeTrustedOrganizations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numerator\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_denominator\",\"type\":\"uint256\"}],\"name\":\"setThreshold\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"sumBridgeVoterWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_res\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"sumConsensusWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_res\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_list\",\"type\":\"address[]\"}],\"name\":\"sumGovernorWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_res\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalWeights\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"governor\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeVoter\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"weight\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"addedBlock\",\"type\":\"uint256\"}],\"internalType\":\"struct IRoninTrustedOrganization.TrustedOrganization[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"name\":\"updateTrustedOrganizations\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"addTrustedOrganizations((address,address,address,uint256,uint256)[])\":{\"details\":\"Adds a list of addresses into the trusted organization. Requirements: - The weights should larger than 0. - The method caller is admin. - The field `addedBlock` should be blank. Emits the event `TrustedOrganizationAdded` once an organization is added.\"},\"checkThreshold(uint256)\":{\"details\":\"Checks whether the `_voteWeight` passes the threshold.\"},\"countTrustedOrganizations()\":{\"details\":\"Returns the number of trusted organizations.\"},\"getAllTrustedOrganizations()\":{\"details\":\"Returns all of the trusted organizations.\"},\"getBridgeVoterWeight(address)\":{\"details\":\"Returns the weight of a bridge voter.\"},\"getBridgeVoterWeights(address[])\":{\"details\":\"Returns the weights of a list of bridge voter addresses.\"},\"getConsensusWeight(address)\":{\"details\":\"Returns the weight of a consensus.\"},\"getConsensusWeights(address[])\":{\"details\":\"Returns the weights of a list of consensus addresses.\"},\"getGovernorWeight(address)\":{\"details\":\"Returns the weight of a governor.\"},\"getGovernorWeights(address[])\":{\"details\":\"Returns the weights of a list of governor addresses.\"},\"getThreshold()\":{\"details\":\"Returns the threshold.\"},\"getTrustedOrganization(address)\":{\"details\":\"Returns the trusted organization by consensus address. Reverts once the consensus address is non-existent.\"},\"getTrustedOrganizationAt(uint256)\":{\"details\":\"Returns the trusted organization at `_index`.\"},\"initialize((address,address,address,uint256,uint256)[],uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"minimumVoteWeight()\":{\"details\":\"Returns the minimum vote weight to pass the threshold.\"},\"removeTrustedOrganizations(address[])\":{\"details\":\"Removes a list of addresses from the trusted organization. Requirements: - The method caller is admin. Emits the event `TrustedOrganizationRemoved` once an organization is removed.\",\"params\":{\"_consensusAddrs\":\"The list of consensus addresses linked to corresponding trusted organization that to be removed.\"}},\"setThreshold(uint256,uint256)\":{\"details\":\"Sets the threshold. Requirements: - The method caller is admin. Emits the `ThresholdUpdated` event.\"},\"sumBridgeVoterWeights(address[])\":{\"details\":\"Returns total weights of the bridge voter list.\"},\"sumConsensusWeights(address[])\":{\"details\":\"Returns total weights of the consensus list.\"},\"sumGovernorWeights(address[])\":{\"details\":\"Returns total weights of the governor list.\"},\"totalWeights()\":{\"details\":\"Returns total weights.\"},\"updateTrustedOrganizations((address,address,address,uint256,uint256)[])\":{\"details\":\"Updates weights for a list of existent trusted organization. Requirements: - The weights should larger than 0. - The method caller is admin. Emits the `TrustedOrganizationUpdated` event.\"}},\"stateVariables\":{\"_addedBlock\":{\"details\":\"Mapping from consensus address => added block\"},\"_bridgeVoterList\":{\"details\":\"Bridge voters array\"},\"_bridgeVoterWeight\":{\"details\":\"Mapping from bridge voter address => weight\"},\"_consensusList\":{\"details\":\"Consensus array\"},\"_consensusWeight\":{\"details\":\"Mapping from consensus address => weight\"},\"_governorList\":{\"details\":\"Governors array\"},\"_governorWeight\":{\"details\":\"Mapping from governor address => weight\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/multi-chains/RoninTrustedOrganization.sol\":\"RoninTrustedOrganization\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x10f3b360430e6d03773c9959f54cbed6fb0346069645c05b05ef50cfb19f3753\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeights() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganizations() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x1edb7a3f5d340e7efc141cb8d94c5499954dec869f026d3998ad92cbc714d604\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool) {\\n bytes32 _thisHash;\\n bytes32 _otherHash;\\n\\n assembly {\\n _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n }\\n\\n return _thisHash == _otherHash;\\n }\\n}\\n\",\"keccak256\":\"0xea4ac2b0783926a0e6ae257bc069fa37ea864ce77bfb25dd327d4727a38ad0ea\",\"license\":\"UNLICENSED\"},\"contracts/multi-chains/RoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/utils/Strings.sol\\\";\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../libraries/AddressArrayUtils.sol\\\";\\nimport \\\"../interfaces/IRoninTrustedOrganization.sol\\\";\\nimport \\\"../extensions/collections/HasProxyAdmin.sol\\\";\\n\\ncontract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, Initializable {\\n uint256 internal _num;\\n uint256 internal _denom;\\n uint256 internal _totalWeight;\\n uint256 internal _nonce;\\n\\n /// @dev Mapping from consensus address => weight\\n mapping(address => uint256) internal _consensusWeight;\\n /// @dev Mapping from governor address => weight\\n mapping(address => uint256) internal _governorWeight;\\n /// @dev Mapping from bridge voter address => weight\\n mapping(address => uint256) internal _bridgeVoterWeight;\\n\\n /// @dev Mapping from consensus address => added block\\n mapping(address => uint256) internal _addedBlock;\\n\\n /// @dev Consensus array\\n address[] internal _consensusList;\\n /// @dev Governors array\\n address[] internal _governorList;\\n /// @dev Bridge voters array\\n address[] internal _bridgeVoterList;\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n TrustedOrganization[] calldata _trustedOrgs,\\n uint256 __num,\\n uint256 __denom\\n ) external initializer {\\n if (_trustedOrgs.length > 0) {\\n _addTrustedOrganizations(_trustedOrgs);\\n }\\n _setThreshold(__num, __denom);\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\\n return (_num, _denom);\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\\n return _voteWeight * _denom >= _num * _totalWeight;\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function minimumVoteWeight() external view virtual returns (uint256) {\\n return (_num * _totalWeight + _denom - 1) / _denom;\\n }\\n\\n /**\\n * @inheritdoc IQuorum\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n override\\n onlyAdmin\\n returns (uint256, uint256)\\n {\\n return _setThreshold(_numerator, _denominator);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\\n _addTrustedOrganizations(_list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\\n require(_list.length > 0, \\\"RoninTrustedOrganization: invalid array length\\\");\\n for (uint256 _i; _i < _list.length; _i++) {\\n _updateTrustedOrganization(_list[_i]);\\n }\\n emit TrustedOrganizationsUpdated(_list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function removeTrustedOrganizations(address[] calldata _list) external override onlyAdmin {\\n require(_list.length > 0, \\\"RoninTrustedOrganization: invalid array length\\\");\\n for (uint _i = 0; _i < _list.length; _i++) {\\n _removeTrustedOrganization(_list[_i]);\\n }\\n emit TrustedOrganizationsRemoved(_list);\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function totalWeights() external view virtual returns (uint256) {\\n return _totalWeight;\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256) {\\n return _consensusWeight[_consensusAddr];\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256) {\\n return _governorWeight[_governor];\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256) {\\n return _bridgeVoterWeight[_addr];\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\\n _res = new uint256[](_list.length);\\n for (uint _i = 0; _i < _res.length; _i++) {\\n _res[_i] = _consensusWeight[_list[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\\n _res = new uint256[](_list.length);\\n for (uint _i = 0; _i < _res.length; _i++) {\\n _res[_i] = _governorWeight[_list[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\\n _res = new uint256[](_list.length);\\n for (uint _i = 0; _i < _res.length; _i++) {\\n _res[_i] = _bridgeVoterWeight[_list[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res) {\\n for (uint _i = 0; _i < _list.length; _i++) {\\n _res += _consensusWeight[_list[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res) {\\n for (uint _i = 0; _i < _list.length; _i++) {\\n _res += _governorWeight[_list[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res) {\\n for (uint _i = 0; _i < _list.length; _i++) {\\n _res += _bridgeVoterWeight[_list[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function countTrustedOrganizations() external view override returns (uint256) {\\n return _consensusList.length;\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getAllTrustedOrganizations() external view override returns (TrustedOrganization[] memory _list) {\\n _list = new TrustedOrganization[](_consensusList.length);\\n address _addr;\\n for (uint256 _i; _i < _list.length; _i++) {\\n _addr = _consensusList[_i];\\n _list[_i].consensusAddr = _addr;\\n _list[_i].governor = _governorList[_i];\\n _list[_i].bridgeVoter = _bridgeVoterList[_i];\\n _list[_i].weight = _consensusWeight[_addr];\\n }\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory) {\\n for (uint _i = 0; _i < _consensusList.length; _i++) {\\n if (_consensusList[_i] == _consensusAddr) {\\n return getTrustedOrganizationAt(_i);\\n }\\n }\\n revert(\\\"RoninTrustedOrganization: query for non-existent consensus address\\\");\\n }\\n\\n /**\\n * @inheritdoc IRoninTrustedOrganization\\n */\\n function getTrustedOrganizationAt(uint256 _idx) public view override returns (TrustedOrganization memory) {\\n address _addr = _consensusList[_idx];\\n return\\n TrustedOrganization(\\n _addr,\\n _governorList[_idx],\\n _bridgeVoterList[_idx],\\n _consensusWeight[_addr],\\n _addedBlock[_addr]\\n );\\n }\\n\\n /**\\n * @dev Adds a list of trusted organizations.\\n */\\n function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {\\n for (uint256 _i; _i < _list.length; _i++) {\\n _addTrustedOrganization(_list[_i]);\\n }\\n emit TrustedOrganizationsAdded(_list);\\n }\\n\\n /**\\n * @dev Adds a trusted organization.\\n *\\n * Requirements:\\n * - The weight is larger than 0.\\n * - The consensus address is not added.\\n * - The govenor address is not added.\\n * - The bridge voter address is not added.\\n *\\n */\\n function _addTrustedOrganization(TrustedOrganization memory _v) internal virtual {\\n require(_v.addedBlock == 0, \\\"RoninTrustedOrganization: invalid request\\\");\\n _sanityCheckTrustedOrganizationData(_v);\\n\\n if (_consensusWeight[_v.consensusAddr] > 0) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"RoninTrustedOrganization: consensus address \\\",\\n Strings.toHexString(uint160(_v.consensusAddr), 20),\\n \\\" is added already\\\"\\n )\\n )\\n );\\n }\\n\\n if (_governorWeight[_v.governor] > 0) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"RoninTrustedOrganization: govenor address \\\",\\n Strings.toHexString(uint160(_v.governor), 20),\\n \\\" is added already\\\"\\n )\\n )\\n );\\n }\\n\\n if (_bridgeVoterWeight[_v.bridgeVoter] > 0) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"RoninTrustedOrganization: bridge voter address \\\",\\n Strings.toHexString(uint160(_v.bridgeVoter), 20),\\n \\\" is added already\\\"\\n )\\n )\\n );\\n }\\n\\n _consensusList.push(_v.consensusAddr);\\n _consensusWeight[_v.consensusAddr] = _v.weight;\\n\\n _governorList.push(_v.governor);\\n _governorWeight[_v.governor] = _v.weight;\\n\\n _bridgeVoterList.push(_v.bridgeVoter);\\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\\n\\n _addedBlock[_v.consensusAddr] = block.number;\\n\\n _totalWeight += _v.weight;\\n }\\n\\n /**\\n * @dev Updates a trusted organization.\\n *\\n * Requirements:\\n * - The weight is larger than 0.\\n * - The consensus address is already added.\\n *\\n */\\n function _updateTrustedOrganization(TrustedOrganization memory _v) internal virtual {\\n _sanityCheckTrustedOrganizationData(_v);\\n\\n uint256 _weight = _consensusWeight[_v.consensusAddr];\\n if (_weight == 0) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"RoninTrustedOrganization: consensus address \\\",\\n Strings.toHexString(uint160(_v.consensusAddr), 20),\\n \\\" is not added\\\"\\n )\\n )\\n );\\n }\\n\\n uint256 _count = _consensusList.length;\\n for (uint256 _i = 0; _i < _count; _i++) {\\n if (_consensusList[_i] == _v.consensusAddr) {\\n _totalWeight -= _weight;\\n _totalWeight += _v.weight;\\n\\n if (_governorList[_i] != _v.governor) {\\n require(_governorWeight[_v.governor] == 0, \\\"RoninTrustedOrganization: query for duplicated governor\\\");\\n delete _governorWeight[_governorList[_i]];\\n _governorList[_i] = _v.governor;\\n }\\n\\n if (_bridgeVoterList[_i] != _v.bridgeVoter) {\\n require(\\n _bridgeVoterWeight[_v.bridgeVoter] == 0,\\n \\\"RoninTrustedOrganization: query for duplicated bridge voter\\\"\\n );\\n delete _bridgeVoterWeight[_bridgeVoterList[_i]];\\n _bridgeVoterList[_i] = _v.bridgeVoter;\\n }\\n\\n _consensusWeight[_v.consensusAddr] = _v.weight;\\n _governorWeight[_v.governor] = _v.weight;\\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\\n return;\\n }\\n }\\n }\\n\\n /**\\n * @dev Removes a trusted organization.\\n *\\n * Requirements:\\n * - The consensus address is added.\\n *\\n */\\n function _removeTrustedOrganization(address _addr) internal virtual {\\n uint256 _weight = _consensusWeight[_addr];\\n if (_weight == 0) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"RoninTrustedOrganization: consensus address \\\",\\n Strings.toHexString(uint160(_addr), 20),\\n \\\" is not added\\\"\\n )\\n )\\n );\\n }\\n\\n uint256 _index;\\n uint256 _count = _consensusList.length;\\n for (uint256 _i = 0; _i < _count; _i++) {\\n if (_consensusList[_i] == _addr) {\\n _index = _i;\\n break;\\n }\\n }\\n\\n _totalWeight -= _weight;\\n\\n delete _addedBlock[_addr];\\n delete _consensusWeight[_addr];\\n _consensusList[_index] = _consensusList[_count - 1];\\n _consensusList.pop();\\n\\n delete _governorWeight[_governorList[_index]];\\n _governorList[_index] = _governorList[_count - 1];\\n _governorList.pop();\\n\\n delete _bridgeVoterWeight[_bridgeVoterList[_index]];\\n _bridgeVoterList[_index] = _bridgeVoterList[_count - 1];\\n _bridgeVoterList.pop();\\n }\\n\\n /**\\n * @dev Sets threshold and returns the old one.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function _setThreshold(uint256 _numerator, uint256 _denominator)\\n internal\\n virtual\\n returns (uint256 _previousNum, uint256 _previousDenom)\\n {\\n require(_numerator <= _denominator, \\\"RoninTrustedOrganization: invalid threshold\\\");\\n _previousNum = _num;\\n _previousDenom = _denom;\\n _num = _numerator;\\n _denom = _denominator;\\n emit ThresholdUpdated(_nonce++, _numerator, _denominator, _previousNum, _previousDenom);\\n }\\n\\n /**\\n * @dev Hook that checks trusted organization's data. Reverts if the requirements are not met.\\n *\\n * Requirements:\\n * - The weight must be larger than 0.\\n * - The consensus address, governor address, and bridge voter address are different.\\n */\\n function _sanityCheckTrustedOrganizationData(TrustedOrganization memory _v) private pure {\\n require(_v.weight > 0, \\\"RoninTrustedOrganization: invalid weight\\\");\\n\\n address[] memory _addresses = new address[](3);\\n _addresses[0] = _v.consensusAddr;\\n _addresses[1] = _v.governor;\\n _addresses[2] = _v.bridgeVoter;\\n require(!AddressArrayUtils.hasDuplicate(_addresses), \\\"RoninTrustedOrganization: three addresses must be distinct\\\");\\n }\\n}\\n\",\"keccak256\":\"0xcdc122c399d55a5c7ff9bb96a2e7c99c99b3814edcd1a4e24c6e021bacd15c32\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061255e806100206000396000f3fe608060405234801561001057600080fd5b50600436106101125760003560e01c80630ed285df14610117578063150740051461012c57806341feed1c1461014a578063520fce621461018157806356241911146101a15780635f14a1c3146101ca57806370823625146101dd5780637c37103c146101f05780637de5dedd14610203578063926323d51461020b578063a85c7d6e14610213578063b505a07c14610226578063b9c3620914610239578063cacf8fb514610261578063cc7e6b3b14610269578063d78392f81461027c578063d9d5dadb146102a5578063dafae408146102b8578063db6693a2146102db578063e75235b8146102fb578063e8c0685e14610306578063f09267c214610319575b600080fd5b61012a610125366004611ddc565b61032c565b005b61013461037b565b6040516101419190611e5a565b60405180910390f35b610173610158366004611ec4565b6001600160a01b031660009081526005602052604090205490565b604051908152602001610141565b61019461018f366004611edf565b610550565b6040516101419190611f53565b6101736101af366004611ec4565b6001600160a01b031660009081526007602052604090205490565b6101736101d8366004611edf565b610624565b6101946101eb366004611edf565b610693565b61012a6101fe366004611f8b565b610760565b610173610889565b600354610173565b61012a610221366004611edf565b6108c6565b61012a610234366004611ddc565b6109a5565b61024c610247366004611fdb565b610a79565b60408051928352602083019190915201610141565b600954610173565b610194610277366004611edf565b610aca565b61017361028a366004611ec4565b6001600160a01b031660009081526006602052604090205490565b6101736102b3366004611edf565b610b97565b6102cb6102c6366004611ffd565b610c06565b6040519015158152602001610141565b6102ee6102e9366004611ec4565b610c2d565b6040516101419190612016565b60015460025461024c565b610173610314366004611edf565b610d03565b6102ee610327366004611ffd565b610d72565b610334610e55565b6001600160a01b0316336001600160a01b03161461036d5760405162461bcd60e51b815260040161036490612024565b60405180910390fd5b6103778282610e83565b5050565b6009546060906001600160401b0381111561039857610398612066565b6040519080825280602002602001820160405280156103d157816020015b6103be611d6a565b8152602001906001900390816103b65790505b5090506000805b825181101561054b57600981815481106103f4576103f461207c565b9060005260206000200160009054906101000a90046001600160a01b03169150818382815181106104275761042761207c565b60209081029190910101516001600160a01b039091169052600a8054829081106104535761045361207c565b9060005260206000200160009054906101000a90046001600160a01b03168382815181106104835761048361207c565b6020026020010151602001906001600160a01b031690816001600160a01b031681525050600b81815481106104ba576104ba61207c565b9060005260206000200160009054906101000a90046001600160a01b03168382815181106104ea576104ea61207c565b6020908102919091018101516001600160a01b03928316604091820152918416600090815260059091522054835184908390811061052a5761052a61207c565b60209081029190910101516060015280610543816120a8565b9150506103d8565b505090565b6060816001600160401b0381111561056a5761056a612066565b604051908082528060200260200182016040528015610593578160200160208202803683370190505b50905060005b815181101561061d57600560008585848181106105b8576105b861207c565b90506020020160208101906105cd9190611ec4565b6001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106106005761060061207c565b602090810291909101015280610615816120a8565b915050610599565b5092915050565b6000805b8281101561061d57600660008585848181106106465761064661207c565b905060200201602081019061065b9190611ec4565b6001600160a01b0316815260208101919091526040016000205461067f90836120c1565b91508061068b816120a8565b915050610628565b6060816001600160401b038111156106ad576106ad612066565b6040519080825280602002602001820160405280156106d6578160200160208202803683370190505b50905060005b815181101561061d57600760008585848181106106fb576106fb61207c565b90506020020160208101906107109190611ec4565b6001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106107435761074361207c565b602090810291909101015280610758816120a8565b9150506106dc565b600054610100900460ff16158080156107805750600054600160ff909116105b8061079a5750303b15801561079a575060005460ff166001145b6107fd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610364565b6000805460ff191660011790558015610820576000805461ff0019166101001790555b8315610830576108308585610e83565b61083a8383610f02565b50508015610882576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b600060025460016002546003546001546108a391906120d4565b6108ad91906120c1565b6108b791906120eb565b6108c191906120fe565b905090565b6108ce610e55565b6001600160a01b0316336001600160a01b0316146108fe5760405162461bcd60e51b815260040161036490612024565b8061091b5760405162461bcd60e51b815260040161036490612120565b60005b818110156109675761095583838381811061093b5761093b61207c565b90506020020160208101906109509190611ec4565b610fc3565b8061095f816120a8565b91505061091e565b507f121945697ac30ee0fc67821492cb685c65f0ea4d7f1b710fde44d6e2237f43a7828260405161099992919061215c565b60405180910390a15050565b6109ad610e55565b6001600160a01b0316336001600160a01b0316146109dd5760405162461bcd60e51b815260040161036490612024565b806109fa5760405162461bcd60e51b815260040161036490612120565b60005b81811015610a4757610a35838383818110610a1a57610a1a61207c565b905060a00201803603810190610a3091906121a8565b611355565b80610a3f816120a8565b9150506109fd565b507fe887c8106c09d1770c0ef0bf8ca62c54766f18b07506801865501783376cbeda8282604051610999929190612238565b600080610a84610e55565b6001600160a01b0316336001600160a01b031614610ab45760405162461bcd60e51b815260040161036490612024565b610abe8484610f02565b915091505b9250929050565b6060816001600160401b03811115610ae457610ae4612066565b604051908082528060200260200182016040528015610b0d578160200160208202803683370190505b50905060005b815181101561061d5760066000858584818110610b3257610b3261207c565b9050602002016020810190610b479190611ec4565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110610b7a57610b7a61207c565b602090810291909101015280610b8f816120a8565b915050610b13565b6000805b8281101561061d5760076000858584818110610bb957610bb961207c565b9050602002016020810190610bce9190611ec4565b6001600160a01b03168152602081019190915260400160002054610bf290836120c1565b915080610bfe816120a8565b915050610b9b565b6000600354600154610c1891906120d4565b600254610c2590846120d4565b101592915050565b610c35611d6a565b60005b600954811015610c9b57826001600160a01b031660098281548110610c5f57610c5f61207c565b6000918252602090912001546001600160a01b031603610c8957610c8281610d72565b9392505050565b80610c93816120a8565b915050610c38565b5060405162461bcd60e51b8152602060048201526042602482015260008051602061250983398151915260448201527f666f72206e6f6e2d6578697374656e7420636f6e73656e737573206164647265606482015261737360f01b608482015260a401610364565b6000805b8281101561061d5760056000858584818110610d2557610d2561207c565b9050602002016020810190610d3a9190611ec4565b6001600160a01b03168152602081019190915260400160002054610d5e90836120c1565b915080610d6a816120a8565b915050610d07565b610d7a611d6a565b600060098381548110610d8f57610d8f61207c565b9060005260206000200160009054906101000a90046001600160a01b031690506040518060a00160405280826001600160a01b03168152602001600a8581548110610ddc57610ddc61207c565b600091825260209182902001546001600160a01b03168252600b8054929091019186908110610e0d57610e0d61207c565b60009182526020808320909101546001600160a01b03908116845294909416808252600585526040808320548487015290825260089094528390205492019190915292915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b60005b81811015610ed057610ebe838383818110610ea357610ea361207c565b905060a00201803603810190610eb991906121a8565b6116f3565b80610ec8816120a8565b915050610e86565b507fc753dbf7952c70ff6b9fa7b626403aa1d2230d97136b635bd5e85bec72bcca6c8282604051610999929190612238565b60008082841115610f575760405162461bcd60e51b815260206004820152602b60248201526000805160206124e983398151915260448201526a19081d1a1c995cda1bdb1960aa1b6064820152608401610364565b50506001805460028054928590558390556004805491929184918691906000610f7f836120a8565b9091555060408051868152602081018690527f976f8a9c5bdf8248dec172376d6e2b80a8e3df2f0328e381c6db8e1cf138c0f8910160405180910390a49250929050565b6001600160a01b0381166000908152600560205260408120549081900361102e57610ff8826001600160a01b03166014611968565b6040516020016110089190612323565b60408051601f198184030181529082905262461bcd60e51b82526103649160040161235e565b600954600090815b8181101561108f57846001600160a01b03166009828154811061105b5761105b61207c565b6000918252602090912001546001600160a01b03160361107d5780925061108f565b80611087816120a8565b915050611036565b5082600360008282546110a291906120eb565b90915550506001600160a01b0384166000908152600860209081526040808320839055600590915281205560096110da6001836120eb565b815481106110ea576110ea61207c565b600091825260209091200154600980546001600160a01b0390921691849081106111165761111661207c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600980548061115557611155612391565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560066000600a84815481106111945761119461207c565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600a6111c66001836120eb565b815481106111d6576111d661207c565b600091825260209091200154600a80546001600160a01b0390921691849081106112025761120261207c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600a80548061124157611241612391565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560076000600b84815481106112805761128061207c565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600b6112b26001836120eb565b815481106112c2576112c261207c565b600091825260209091200154600b80546001600160a01b0390921691849081106112ee576112ee61207c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b80548061132d5761132d612391565b600082815260209020810160001990810180546001600160a01b031916905501905550505050565b61135e81611b0c565b80516001600160a01b031660009081526005602052604081205490819003611396578151610ff8906001600160a01b03166014611968565b60095460005b818110156116ed5783600001516001600160a01b0316600982815481106113c5576113c561207c565b6000918252602090912001546001600160a01b0316036116db5782600360008282546113f191906120eb565b909155505060608401516003805460009061140d9084906120c1565b9250508190555083602001516001600160a01b0316600a82815481106114355761143561207c565b6000918252602090912001546001600160a01b03161461154d576020808501516001600160a01b0316600090815260069091526040902054156114c85760405162461bcd60e51b815260206004820152603760248201526000805160206125098339815191526044820152763337b910323ab83634b1b0ba32b21033b7bb32b93737b960491b6064820152608401610364565b60066000600a83815481106114df576114df61207c565b60009182526020808320909101546001600160a01b03168352828101939093526040909101812055840151600a80548390811061151e5761151e61207c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b83604001516001600160a01b0316600b828154811061156e5761156e61207c565b6000918252602090912001546001600160a01b031614611689576040808501516001600160a01b0316600090815260076020522054156116025760405162461bcd60e51b815260206004820152603b602482015260008051602061250983398151915260448201527a3337b910323ab83634b1b0ba32b210313934b233b2903b37ba32b960291b6064820152608401610364565b60076000600b83815481106116195761161961207c565b60009182526020808320909101546001600160a01b031683528201929092526040908101822091909155840151600b80548390811061165a5761165a61207c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b50505060608101805182516001600160a01b0390811660009081526005602090815260408083209490945584518187015184168352600682528483205593519483015190911681526007909252902055565b806116e5816120a8565b91505061139c565b50505050565b6080810151156117455760405162461bcd60e51b815260206004820152602960248201526000805160206124e983398151915260448201526819081c995c5d595cdd60ba1b6064820152608401610364565b61174e81611b0c565b80516001600160a01b031660009081526005602052604090205415611793578051611783906001600160a01b03166014611968565b60405160200161100891906123a7565b6020808201516001600160a01b0316600090815260069091526040902054156117de576117ce81602001516001600160a01b03166014611968565b60405160200161100891906123e6565b6040808201516001600160a01b0316600090815260076020522054156118265761181681604001516001600160a01b03166014611968565b6040516020016110089190612459565b8051600980546001808201835560009283527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af90910180546001600160a01b03199081166001600160a01b0395861617909155606085018051865186168552600560209081526040808720929092558088018051600a805480890182559089527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180548716918a16919091179055835190518816875260068252828720558188018051600b8054978801815588527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db99096018054909516958816959095179093558151935186168552600783528085209390935585519094168352600890528120439055905160038054919290916119609084906120c1565b909155505050565b606060006119778360026120d4565b6119829060026120c1565b6001600160401b0381111561199957611999612066565b6040519080825280601f01601f1916602001820160405280156119c3576020820181803683370190505b509050600360fc1b816000815181106119de576119de61207c565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611a0d57611a0d61207c565b60200101906001600160f81b031916908160001a9053506000611a318460026120d4565b611a3c9060016120c1565b90505b6001811115611ab4576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611a7057611a7061207c565b1a60f81b828281518110611a8657611a8661207c565b60200101906001600160f81b031916908160001a90535060049490941c93611aad816124d1565b9050611a3f565b508315611b035760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610364565b90505b92915050565b6000816060015111611b5f5760405162461bcd60e51b815260206004820152602860248201526000805160206124e983398151915260448201526719081dd95a59da1d60c21b6064820152608401610364565b6040805160038082526080820190925260009160208201606080368337019050509050816000015181600081518110611b9a57611b9a61207c565b60200260200101906001600160a01b031690816001600160a01b031681525050816020015181600181518110611bd257611bd261207c565b60200260200101906001600160a01b031690816001600160a01b031681525050816040015181600281518110611c0a57611c0a61207c565b60200260200101906001600160a01b031690816001600160a01b031681525050611c3381611ca3565b156103775760405162461bcd60e51b815260206004820152603a60248201527f526f6e696e547275737465644f7267616e697a6174696f6e3a207468726565206044820152791859191c995cdcd95cc81b5d5cdd08189948191a5cdd1a5b98dd60321b6064820152608401610364565b60008151600003611cb657506000919050565b60005b60018351611cc791906120eb565b811015611d61576000611cdb8260016120c1565b90505b8351811015611d4e57838181518110611cf957611cf961207c565b60200260200101516001600160a01b0316848381518110611d1c57611d1c61207c565b60200260200101516001600160a01b031603611d3c575060019392505050565b80611d46816120a8565b915050611cde565b5080611d59816120a8565b915050611cb9565b50600092915050565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b60008083601f840112611daa57600080fd5b5081356001600160401b03811115611dc157600080fd5b60208301915083602060a083028501011115610ac357600080fd5b60008060208385031215611def57600080fd5b82356001600160401b03811115611e0557600080fd5b611e1185828601611d98565b90969095509350505050565b80516001600160a01b0390811683526020808301518216908401526040808301519091169083015260608082015190830152608090810151910152565b6020808252825182820181905260009190848201906040850190845b81811015611e9c57611e89838551611e1d565b9284019260a09290920191600101611e76565b50909695505050505050565b80356001600160a01b0381168114611ebf57600080fd5b919050565b600060208284031215611ed657600080fd5b610c8282611ea8565b60008060208385031215611ef257600080fd5b82356001600160401b0380821115611f0957600080fd5b818501915085601f830112611f1d57600080fd5b813581811115611f2c57600080fd5b8660208260051b8501011115611f4157600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015611e9c57835183529284019291840191600101611f6f565b60008060008060608587031215611fa157600080fd5b84356001600160401b03811115611fb757600080fd5b611fc387828801611d98565b90989097506020870135966040013595509350505050565b60008060408385031215611fee57600080fd5b50508035926020909101359150565b60006020828403121561200f57600080fd5b5035919050565b60a08101611b068284611e1d565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016120ba576120ba612092565b5060010190565b80820180821115611b0657611b06612092565b8082028115828204841417611b0657611b06612092565b81810381811115611b0657611b06612092565b60008261211b57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602e908201526000805160206124e983398151915260408201526d0c840c2e4e4c2f240d8cadccee8d60931b606082015260800190565b60208082528181018390526000908460408401835b8681101561219d576001600160a01b0361218a84611ea8565b1682529183019190830190600101612171565b509695505050505050565b600060a082840312156121ba57600080fd5b60405160a081016001600160401b03811182821017156121ea57634e487b7160e01b600052604160045260246000fd5b6040526121f683611ea8565b815261220460208401611ea8565b602082015261221560408401611ea8565b604082015260608301356060820152608083013560808201528091505092915050565b6020808252818101839052600090604080840186845b878110156122b4576001600160a01b038061226884611ea8565b16845280612277878501611ea8565b168685015280612288868501611ea8565b168486015250606082810135908401526080808301359084015260a0928301929091019060010161224e565b5090979650505050505050565b7f526f6e696e547275737465644f7267616e697a6174696f6e3a20636f6e73656e81526b039bab99030b2323932b9b9960a51b6020820152602c0190565b60005b8381101561231a578181015183820152602001612302565b50506000910152565b600061232e826122c1565b835161233e8183602088016122ff565b6c081a5cc81b9bdd081859191959609a1b9101908152600d019392505050565b602081526000825180602084015261237d8160408501602087016122ff565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603160045260246000fd5b60006123b2826122c1565b83516123c28183602088016122ff565b7020697320616464656420616c726561647960781b91019081526011019392505050565b7f526f6e696e547275737465644f7267616e697a6174696f6e3a20676f76656e6f8152690391030b2323932b9b9960b51b60208201526000825161243181602a8501602087016122ff565b7020697320616464656420616c726561647960781b602a939091019283015250603b01919050565b7f526f6e696e547275737465644f7267616e697a6174696f6e3a2062726964676581526e0103b37ba32b91030b2323932b9b99608d1b6020820152600082516124a981602f8501602087016122ff565b7020697320616464656420616c726561647960781b602f939091019283015250604001919050565b6000816124e0576124e0612092565b50600019019056fe526f6e696e547275737465644f7267616e697a6174696f6e3a20696e76616c69526f6e696e547275737465644f7267616e697a6174696f6e3a20717565727920a2646970667358221220171fedbb4d0e07d0f093c403c3df05c9996d7e7a3d24de0b489d3201b599112464736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101125760003560e01c80630ed285df14610117578063150740051461012c57806341feed1c1461014a578063520fce621461018157806356241911146101a15780635f14a1c3146101ca57806370823625146101dd5780637c37103c146101f05780637de5dedd14610203578063926323d51461020b578063a85c7d6e14610213578063b505a07c14610226578063b9c3620914610239578063cacf8fb514610261578063cc7e6b3b14610269578063d78392f81461027c578063d9d5dadb146102a5578063dafae408146102b8578063db6693a2146102db578063e75235b8146102fb578063e8c0685e14610306578063f09267c214610319575b600080fd5b61012a610125366004611ddc565b61032c565b005b61013461037b565b6040516101419190611e5a565b60405180910390f35b610173610158366004611ec4565b6001600160a01b031660009081526005602052604090205490565b604051908152602001610141565b61019461018f366004611edf565b610550565b6040516101419190611f53565b6101736101af366004611ec4565b6001600160a01b031660009081526007602052604090205490565b6101736101d8366004611edf565b610624565b6101946101eb366004611edf565b610693565b61012a6101fe366004611f8b565b610760565b610173610889565b600354610173565b61012a610221366004611edf565b6108c6565b61012a610234366004611ddc565b6109a5565b61024c610247366004611fdb565b610a79565b60408051928352602083019190915201610141565b600954610173565b610194610277366004611edf565b610aca565b61017361028a366004611ec4565b6001600160a01b031660009081526006602052604090205490565b6101736102b3366004611edf565b610b97565b6102cb6102c6366004611ffd565b610c06565b6040519015158152602001610141565b6102ee6102e9366004611ec4565b610c2d565b6040516101419190612016565b60015460025461024c565b610173610314366004611edf565b610d03565b6102ee610327366004611ffd565b610d72565b610334610e55565b6001600160a01b0316336001600160a01b03161461036d5760405162461bcd60e51b815260040161036490612024565b60405180910390fd5b6103778282610e83565b5050565b6009546060906001600160401b0381111561039857610398612066565b6040519080825280602002602001820160405280156103d157816020015b6103be611d6a565b8152602001906001900390816103b65790505b5090506000805b825181101561054b57600981815481106103f4576103f461207c565b9060005260206000200160009054906101000a90046001600160a01b03169150818382815181106104275761042761207c565b60209081029190910101516001600160a01b039091169052600a8054829081106104535761045361207c565b9060005260206000200160009054906101000a90046001600160a01b03168382815181106104835761048361207c565b6020026020010151602001906001600160a01b031690816001600160a01b031681525050600b81815481106104ba576104ba61207c565b9060005260206000200160009054906101000a90046001600160a01b03168382815181106104ea576104ea61207c565b6020908102919091018101516001600160a01b03928316604091820152918416600090815260059091522054835184908390811061052a5761052a61207c565b60209081029190910101516060015280610543816120a8565b9150506103d8565b505090565b6060816001600160401b0381111561056a5761056a612066565b604051908082528060200260200182016040528015610593578160200160208202803683370190505b50905060005b815181101561061d57600560008585848181106105b8576105b861207c565b90506020020160208101906105cd9190611ec4565b6001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106106005761060061207c565b602090810291909101015280610615816120a8565b915050610599565b5092915050565b6000805b8281101561061d57600660008585848181106106465761064661207c565b905060200201602081019061065b9190611ec4565b6001600160a01b0316815260208101919091526040016000205461067f90836120c1565b91508061068b816120a8565b915050610628565b6060816001600160401b038111156106ad576106ad612066565b6040519080825280602002602001820160405280156106d6578160200160208202803683370190505b50905060005b815181101561061d57600760008585848181106106fb576106fb61207c565b90506020020160208101906107109190611ec4565b6001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106107435761074361207c565b602090810291909101015280610758816120a8565b9150506106dc565b600054610100900460ff16158080156107805750600054600160ff909116105b8061079a5750303b15801561079a575060005460ff166001145b6107fd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610364565b6000805460ff191660011790558015610820576000805461ff0019166101001790555b8315610830576108308585610e83565b61083a8383610f02565b50508015610882576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050565b600060025460016002546003546001546108a391906120d4565b6108ad91906120c1565b6108b791906120eb565b6108c191906120fe565b905090565b6108ce610e55565b6001600160a01b0316336001600160a01b0316146108fe5760405162461bcd60e51b815260040161036490612024565b8061091b5760405162461bcd60e51b815260040161036490612120565b60005b818110156109675761095583838381811061093b5761093b61207c565b90506020020160208101906109509190611ec4565b610fc3565b8061095f816120a8565b91505061091e565b507f121945697ac30ee0fc67821492cb685c65f0ea4d7f1b710fde44d6e2237f43a7828260405161099992919061215c565b60405180910390a15050565b6109ad610e55565b6001600160a01b0316336001600160a01b0316146109dd5760405162461bcd60e51b815260040161036490612024565b806109fa5760405162461bcd60e51b815260040161036490612120565b60005b81811015610a4757610a35838383818110610a1a57610a1a61207c565b905060a00201803603810190610a3091906121a8565b611355565b80610a3f816120a8565b9150506109fd565b507fe887c8106c09d1770c0ef0bf8ca62c54766f18b07506801865501783376cbeda8282604051610999929190612238565b600080610a84610e55565b6001600160a01b0316336001600160a01b031614610ab45760405162461bcd60e51b815260040161036490612024565b610abe8484610f02565b915091505b9250929050565b6060816001600160401b03811115610ae457610ae4612066565b604051908082528060200260200182016040528015610b0d578160200160208202803683370190505b50905060005b815181101561061d5760066000858584818110610b3257610b3261207c565b9050602002016020810190610b479190611ec4565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110610b7a57610b7a61207c565b602090810291909101015280610b8f816120a8565b915050610b13565b6000805b8281101561061d5760076000858584818110610bb957610bb961207c565b9050602002016020810190610bce9190611ec4565b6001600160a01b03168152602081019190915260400160002054610bf290836120c1565b915080610bfe816120a8565b915050610b9b565b6000600354600154610c1891906120d4565b600254610c2590846120d4565b101592915050565b610c35611d6a565b60005b600954811015610c9b57826001600160a01b031660098281548110610c5f57610c5f61207c565b6000918252602090912001546001600160a01b031603610c8957610c8281610d72565b9392505050565b80610c93816120a8565b915050610c38565b5060405162461bcd60e51b8152602060048201526042602482015260008051602061250983398151915260448201527f666f72206e6f6e2d6578697374656e7420636f6e73656e737573206164647265606482015261737360f01b608482015260a401610364565b6000805b8281101561061d5760056000858584818110610d2557610d2561207c565b9050602002016020810190610d3a9190611ec4565b6001600160a01b03168152602081019190915260400160002054610d5e90836120c1565b915080610d6a816120a8565b915050610d07565b610d7a611d6a565b600060098381548110610d8f57610d8f61207c565b9060005260206000200160009054906101000a90046001600160a01b031690506040518060a00160405280826001600160a01b03168152602001600a8581548110610ddc57610ddc61207c565b600091825260209182902001546001600160a01b03168252600b8054929091019186908110610e0d57610e0d61207c565b60009182526020808320909101546001600160a01b03908116845294909416808252600585526040808320548487015290825260089094528390205492019190915292915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b60005b81811015610ed057610ebe838383818110610ea357610ea361207c565b905060a00201803603810190610eb991906121a8565b6116f3565b80610ec8816120a8565b915050610e86565b507fc753dbf7952c70ff6b9fa7b626403aa1d2230d97136b635bd5e85bec72bcca6c8282604051610999929190612238565b60008082841115610f575760405162461bcd60e51b815260206004820152602b60248201526000805160206124e983398151915260448201526a19081d1a1c995cda1bdb1960aa1b6064820152608401610364565b50506001805460028054928590558390556004805491929184918691906000610f7f836120a8565b9091555060408051868152602081018690527f976f8a9c5bdf8248dec172376d6e2b80a8e3df2f0328e381c6db8e1cf138c0f8910160405180910390a49250929050565b6001600160a01b0381166000908152600560205260408120549081900361102e57610ff8826001600160a01b03166014611968565b6040516020016110089190612323565b60408051601f198184030181529082905262461bcd60e51b82526103649160040161235e565b600954600090815b8181101561108f57846001600160a01b03166009828154811061105b5761105b61207c565b6000918252602090912001546001600160a01b03160361107d5780925061108f565b80611087816120a8565b915050611036565b5082600360008282546110a291906120eb565b90915550506001600160a01b0384166000908152600860209081526040808320839055600590915281205560096110da6001836120eb565b815481106110ea576110ea61207c565b600091825260209091200154600980546001600160a01b0390921691849081106111165761111661207c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600980548061115557611155612391565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560066000600a84815481106111945761119461207c565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600a6111c66001836120eb565b815481106111d6576111d661207c565b600091825260209091200154600a80546001600160a01b0390921691849081106112025761120261207c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600a80548061124157611241612391565b6001900381819060005260206000200160006101000a8154906001600160a01b030219169055905560076000600b84815481106112805761128061207c565b60009182526020808320909101546001600160a01b03168352820192909252604001812055600b6112b26001836120eb565b815481106112c2576112c261207c565b600091825260209091200154600b80546001600160a01b0390921691849081106112ee576112ee61207c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550600b80548061132d5761132d612391565b600082815260209020810160001990810180546001600160a01b031916905501905550505050565b61135e81611b0c565b80516001600160a01b031660009081526005602052604081205490819003611396578151610ff8906001600160a01b03166014611968565b60095460005b818110156116ed5783600001516001600160a01b0316600982815481106113c5576113c561207c565b6000918252602090912001546001600160a01b0316036116db5782600360008282546113f191906120eb565b909155505060608401516003805460009061140d9084906120c1565b9250508190555083602001516001600160a01b0316600a82815481106114355761143561207c565b6000918252602090912001546001600160a01b03161461154d576020808501516001600160a01b0316600090815260069091526040902054156114c85760405162461bcd60e51b815260206004820152603760248201526000805160206125098339815191526044820152763337b910323ab83634b1b0ba32b21033b7bb32b93737b960491b6064820152608401610364565b60066000600a83815481106114df576114df61207c565b60009182526020808320909101546001600160a01b03168352828101939093526040909101812055840151600a80548390811061151e5761151e61207c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b83604001516001600160a01b0316600b828154811061156e5761156e61207c565b6000918252602090912001546001600160a01b031614611689576040808501516001600160a01b0316600090815260076020522054156116025760405162461bcd60e51b815260206004820152603b602482015260008051602061250983398151915260448201527a3337b910323ab83634b1b0ba32b210313934b233b2903b37ba32b960291b6064820152608401610364565b60076000600b83815481106116195761161961207c565b60009182526020808320909101546001600160a01b031683528201929092526040908101822091909155840151600b80548390811061165a5761165a61207c565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b50505060608101805182516001600160a01b0390811660009081526005602090815260408083209490945584518187015184168352600682528483205593519483015190911681526007909252902055565b806116e5816120a8565b91505061139c565b50505050565b6080810151156117455760405162461bcd60e51b815260206004820152602960248201526000805160206124e983398151915260448201526819081c995c5d595cdd60ba1b6064820152608401610364565b61174e81611b0c565b80516001600160a01b031660009081526005602052604090205415611793578051611783906001600160a01b03166014611968565b60405160200161100891906123a7565b6020808201516001600160a01b0316600090815260069091526040902054156117de576117ce81602001516001600160a01b03166014611968565b60405160200161100891906123e6565b6040808201516001600160a01b0316600090815260076020522054156118265761181681604001516001600160a01b03166014611968565b6040516020016110089190612459565b8051600980546001808201835560009283527f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af90910180546001600160a01b03199081166001600160a01b0395861617909155606085018051865186168552600560209081526040808720929092558088018051600a805480890182559089527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80180548716918a16919091179055835190518816875260068252828720558188018051600b8054978801815588527f0175b7a638427703f0dbe7bb9bbf987a2551717b34e79f33b5b1008d1fa01db99096018054909516958816959095179093558151935186168552600783528085209390935585519094168352600890528120439055905160038054919290916119609084906120c1565b909155505050565b606060006119778360026120d4565b6119829060026120c1565b6001600160401b0381111561199957611999612066565b6040519080825280601f01601f1916602001820160405280156119c3576020820181803683370190505b509050600360fc1b816000815181106119de576119de61207c565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110611a0d57611a0d61207c565b60200101906001600160f81b031916908160001a9053506000611a318460026120d4565b611a3c9060016120c1565b90505b6001811115611ab4576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110611a7057611a7061207c565b1a60f81b828281518110611a8657611a8661207c565b60200101906001600160f81b031916908160001a90535060049490941c93611aad816124d1565b9050611a3f565b508315611b035760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610364565b90505b92915050565b6000816060015111611b5f5760405162461bcd60e51b815260206004820152602860248201526000805160206124e983398151915260448201526719081dd95a59da1d60c21b6064820152608401610364565b6040805160038082526080820190925260009160208201606080368337019050509050816000015181600081518110611b9a57611b9a61207c565b60200260200101906001600160a01b031690816001600160a01b031681525050816020015181600181518110611bd257611bd261207c565b60200260200101906001600160a01b031690816001600160a01b031681525050816040015181600281518110611c0a57611c0a61207c565b60200260200101906001600160a01b031690816001600160a01b031681525050611c3381611ca3565b156103775760405162461bcd60e51b815260206004820152603a60248201527f526f6e696e547275737465644f7267616e697a6174696f6e3a207468726565206044820152791859191c995cdcd95cc81b5d5cdd08189948191a5cdd1a5b98dd60321b6064820152608401610364565b60008151600003611cb657506000919050565b60005b60018351611cc791906120eb565b811015611d61576000611cdb8260016120c1565b90505b8351811015611d4e57838181518110611cf957611cf961207c565b60200260200101516001600160a01b0316848381518110611d1c57611d1c61207c565b60200260200101516001600160a01b031603611d3c575060019392505050565b80611d46816120a8565b915050611cde565b5080611d59816120a8565b915050611cb9565b50600092915050565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915290565b60008083601f840112611daa57600080fd5b5081356001600160401b03811115611dc157600080fd5b60208301915083602060a083028501011115610ac357600080fd5b60008060208385031215611def57600080fd5b82356001600160401b03811115611e0557600080fd5b611e1185828601611d98565b90969095509350505050565b80516001600160a01b0390811683526020808301518216908401526040808301519091169083015260608082015190830152608090810151910152565b6020808252825182820181905260009190848201906040850190845b81811015611e9c57611e89838551611e1d565b9284019260a09290920191600101611e76565b50909695505050505050565b80356001600160a01b0381168114611ebf57600080fd5b919050565b600060208284031215611ed657600080fd5b610c8282611ea8565b60008060208385031215611ef257600080fd5b82356001600160401b0380821115611f0957600080fd5b818501915085601f830112611f1d57600080fd5b813581811115611f2c57600080fd5b8660208260051b8501011115611f4157600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b81811015611e9c57835183529284019291840191600101611f6f565b60008060008060608587031215611fa157600080fd5b84356001600160401b03811115611fb757600080fd5b611fc387828801611d98565b90989097506020870135966040013595509350505050565b60008060408385031215611fee57600080fd5b50508035926020909101359150565b60006020828403121561200f57600080fd5b5035919050565b60a08101611b068284611e1d565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016120ba576120ba612092565b5060010190565b80820180821115611b0657611b06612092565b8082028115828204841417611b0657611b06612092565b81810381811115611b0657611b06612092565b60008261211b57634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602e908201526000805160206124e983398151915260408201526d0c840c2e4e4c2f240d8cadccee8d60931b606082015260800190565b60208082528181018390526000908460408401835b8681101561219d576001600160a01b0361218a84611ea8565b1682529183019190830190600101612171565b509695505050505050565b600060a082840312156121ba57600080fd5b60405160a081016001600160401b03811182821017156121ea57634e487b7160e01b600052604160045260246000fd5b6040526121f683611ea8565b815261220460208401611ea8565b602082015261221560408401611ea8565b604082015260608301356060820152608083013560808201528091505092915050565b6020808252818101839052600090604080840186845b878110156122b4576001600160a01b038061226884611ea8565b16845280612277878501611ea8565b168685015280612288868501611ea8565b168486015250606082810135908401526080808301359084015260a0928301929091019060010161224e565b5090979650505050505050565b7f526f6e696e547275737465644f7267616e697a6174696f6e3a20636f6e73656e81526b039bab99030b2323932b9b9960a51b6020820152602c0190565b60005b8381101561231a578181015183820152602001612302565b50506000910152565b600061232e826122c1565b835161233e8183602088016122ff565b6c081a5cc81b9bdd081859191959609a1b9101908152600d019392505050565b602081526000825180602084015261237d8160408501602087016122ff565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603160045260246000fd5b60006123b2826122c1565b83516123c28183602088016122ff565b7020697320616464656420616c726561647960781b91019081526011019392505050565b7f526f6e696e547275737465644f7267616e697a6174696f6e3a20676f76656e6f8152690391030b2323932b9b9960b51b60208201526000825161243181602a8501602087016122ff565b7020697320616464656420616c726561647960781b602a939091019283015250603b01919050565b7f526f6e696e547275737465644f7267616e697a6174696f6e3a2062726964676581526e0103b37ba32b91030b2323932b9b99608d1b6020820152600082516124a981602f8501602087016122ff565b7020697320616464656420616c726561647960781b602f939091019283015250604001919050565b6000816124e0576124e0612092565b50600019019056fe526f6e696e547275737465644f7267616e697a6174696f6e3a20696e76616c69526f6e696e547275737465644f7267616e697a6174696f6e3a20717565727920a2646970667358221220171fedbb4d0e07d0f093c403c3df05c9996d7e7a3d24de0b489d3201b599112464736f6c63430008110033", "devdoc": { "kind": "dev", "methods": { @@ -840,7 +840,7 @@ "type": "t_bool" }, { - "astId": 18794, + "astId": 19320, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_num", "offset": 0, @@ -848,7 +848,7 @@ "type": "t_uint256" }, { - "astId": 18796, + "astId": 19322, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_denom", "offset": 0, @@ -856,7 +856,7 @@ "type": "t_uint256" }, { - "astId": 18798, + "astId": 19324, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_totalWeight", "offset": 0, @@ -864,7 +864,7 @@ "type": "t_uint256" }, { - "astId": 18800, + "astId": 19326, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_nonce", "offset": 0, @@ -872,7 +872,7 @@ "type": "t_uint256" }, { - "astId": 18805, + "astId": 19331, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_consensusWeight", "offset": 0, @@ -880,7 +880,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 18810, + "astId": 19336, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_governorWeight", "offset": 0, @@ -888,7 +888,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 18815, + "astId": 19341, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_bridgeVoterWeight", "offset": 0, @@ -896,7 +896,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 18820, + "astId": 19346, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_addedBlock", "offset": 0, @@ -904,7 +904,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 18824, + "astId": 19350, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_consensusList", "offset": 0, @@ -912,7 +912,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 18828, + "astId": 19354, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_governorList", "offset": 0, @@ -920,7 +920,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 18832, + "astId": 19358, "contract": "contracts/multi-chains/RoninTrustedOrganization.sol:RoninTrustedOrganization", "label": "_bridgeVoterList", "offset": 0, diff --git a/deployments/ronin-testnet/RoninValidatorSetLogic.json b/deployments/ronin-testnet/RoninValidatorSetLogic.json index 7517f9701..c30d323b4 100644 --- a/deployments/ronin-testnet/RoninValidatorSetLogic.json +++ b/deployments/ronin-testnet/RoninValidatorSetLogic.json @@ -1,5 +1,5 @@ { - "address": "0x7eF866Cb4a917AfE4e8B415Bc1dE112e49217B90", + "address": "0xc64747f23478D04534345f28446FB804DE24a20c", "abi": [ { "inputs": [], @@ -175,6 +175,11 @@ "name": "ErrZeroCodeContract", "type": "error" }, + { + "inputs": [], + "name": "NonExistentRecyclingInfo", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -356,6 +361,12 @@ "name": "BridgeTrackingContractUpdated", "type": "event" }, + { + "anonymous": false, + "inputs": [], + "name": "BridgeTrackingIncorrectlyResponded", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -979,6 +990,32 @@ "stateMutability": "payable", "type": "fallback" }, + { + "inputs": [], + "name": "DEFAULT_ADDITION_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERIOD_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [], "name": "bridgeTrackingContract", @@ -1000,7 +1037,31 @@ "type": "address" } ], - "name": "checkBridgeRewardDeprecated", + "name": "checkBridgeRewardDeprecatedAtLatestPeriod", + "outputs": [ + { + "internalType": "bool", + "name": "_result", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_consensusAddr", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_period", + "type": "uint256" + } + ], + "name": "checkBridgeRewardDeprecatedAtPeriod", "outputs": [ { "internalType": "bool", @@ -1076,17 +1137,17 @@ { "inputs": [ { - "internalType": "address[]", - "name": "_blockProducers", - "type": "address[]" + "internalType": "address", + "name": "_blockProducer", + "type": "address" } ], "name": "checkMiningRewardDeprecated", "outputs": [ { - "internalType": "bool[]", + "internalType": "bool", "name": "_result", - "type": "bool[]" + "type": "bool" } ], "stateMutability": "view", @@ -1095,9 +1156,9 @@ { "inputs": [ { - "internalType": "address[]", - "name": "_blockProducers", - "type": "address[]" + "internalType": "address", + "name": "_blockProducer", + "type": "address" }, { "internalType": "uint256", @@ -1108,9 +1169,9 @@ "name": "checkMiningRewardDeprecatedAtPeriod", "outputs": [ { - "internalType": "bool[]", + "internalType": "bool", "name": "_result", - "type": "bool[]" + "type": "bool" } ], "stateMutability": "view", @@ -1672,6 +1733,16 @@ "internalType": "address[]", "name": "_validatorList", "type": "address[]" + }, + { + "internalType": "address[]", + "name": "_bridgeOperators", + "type": "address[]" + }, + { + "internalType": "enum EnumFlags.ValidatorFlag[]", + "name": "_flags", + "type": "uint8[]" } ], "stateMutability": "view", @@ -1776,7 +1847,7 @@ "outputs": [ { "internalType": "bool", - "name": "_result", + "name": "_isOperator", "type": "bool" } ], @@ -2284,41 +2355,41 @@ "type": "receive" } ], - "transactionHash": "0x0d946e371c19e5173bdfb4235dec1af229a6e298df27a6d2694dc2f4bbd284da", + "transactionHash": "0x302e4bf803a66e6c8f63a5d3026f9353a9a97c63e5c6feefb9c3ddda1a97c545", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0x7eF866Cb4a917AfE4e8B415Bc1dE112e49217B90", + "contractAddress": "0xc64747f23478D04534345f28446FB804DE24a20c", "transactionIndex": 0, - "gasUsed": "5355471", - "logsBloom": "0x00000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000080000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xd742850d93161eb5b12ddbc5faedb04d5a122ff82871528587d5653f87204c55", - "transactionHash": "0x0d946e371c19e5173bdfb4235dec1af229a6e298df27a6d2694dc2f4bbd284da", + "gasUsed": "5386803", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000001000000000000000000008000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xd4f1a34bfe96c9ff8d4efbee0c9a8a2d83a9b642a3b94cce1ade96d97df7de8c", + "transactionHash": "0x302e4bf803a66e6c8f63a5d3026f9353a9a97c63e5c6feefb9c3ddda1a97c545", "logs": [ { "transactionIndex": 0, - "blockNumber": 14747793, - "transactionHash": "0x0d946e371c19e5173bdfb4235dec1af229a6e298df27a6d2694dc2f4bbd284da", - "address": "0x7eF866Cb4a917AfE4e8B415Bc1dE112e49217B90", + "blockNumber": 16817126, + "transactionHash": "0x302e4bf803a66e6c8f63a5d3026f9353a9a97c63e5c6feefb9c3ddda1a97c545", + "address": "0xc64747f23478D04534345f28446FB804DE24a20c", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", "logIndex": 0, - "blockHash": "0xd742850d93161eb5b12ddbc5faedb04d5a122ff82871528587d5653f87204c55" + "blockHash": "0xd4f1a34bfe96c9ff8d4efbee0c9a8a2d83a9b642a3b94cce1ade96d97df7de8c" } ], - "blockNumber": 14747793, - "cumulativeGasUsed": "5355471", + "blockNumber": 16817126, + "cumulativeGasUsed": "5386803", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 7, - "solcInputHash": "1fd2739e5c5a547bccbf26ee45f48ee5", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedEmergencyExit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedRevokingCandidate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedUpdatingCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyWrappedEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAtEndOfEpochOnly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallPrecompiled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeBridgeTrackingContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeCoinbase\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeMaintenanceContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeRoninTrustedOrgContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeSlashIndicatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeStakingContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeStakingVestingContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"ErrCannotBailout\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExceedsMaxNumberOfCandidate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentBridgeOperator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExistentCandidate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdminAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentCandidateAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_treasuryAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidEffectiveDaysOnwards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMaxPrioritizedValidatorNumber\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMinEffectiveDaysOnwards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrNonExistentCandidate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrTrustedOrgCannotRenounce\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnauthorizedReceiveRON\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"BlockProducerSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coinbaseAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum ICoinbaseExecution.BlockRewardDeprecatedType\",\"name\":\"deprecatedType\",\"type\":\"uint8\"}],\"name\":\"BlockRewardDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coinbaseAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"submittedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bonusAmount\",\"type\":\"uint256\"}],\"name\":\"BlockRewardSubmitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"bridgeOperators\",\"type\":\"address[]\"}],\"name\":\"BridgeOperatorSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"BridgeTrackingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"}],\"name\":\"CandidateGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"}],\"name\":\"CandidateRevokingTimestampUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"name\":\"CandidateTopupDeadlineUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"CandidatesRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"effectiveTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateUpdateScheduled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"name\":\"DeprecatedRewardRecycleFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DeprecatedRewardRecycled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockedAmount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedFundReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedFundReleasingFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lockedAmount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExpiryDurationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"MaintenanceContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MaxPrioritizedValidatorNumberUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"MaxValidatorCandidateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MaxValidatorNumberUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"numOfDays\",\"type\":\"uint256\"}],\"name\":\"MinEffectiveDaysOnwardsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MiningRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"MiningRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"RoninTrustedOrganizationContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SlashIndicatorContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"StakingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"StakingRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"StakingVestingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailedUntil\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"deductedStakingAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"blockProducerRewardDeprecated\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"bridgeOperatorRewardDeprecated\",\"type\":\"bool\"}],\"name\":\"ValidatorPunished\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"ValidatorSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"ValidatorUnjailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"periodNumber\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochNumber\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"periodEnding\",\"type\":\"bool\"}],\"name\":\"WrappedUpEpoch\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"bridgeTrackingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkBridgeRewardDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"checkJailed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_blockNum\",\"type\":\"uint256\"}],\"name\":\"checkJailedAtBlock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"}],\"name\":\"checkManyJailed\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_result\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_blockProducers\",\"type\":\"address[]\"}],\"name\":\"checkMiningRewardDeprecated\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_result\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_blockProducers\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"checkMiningRewardDeprecatedAtPeriod\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_result\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentPeriodStartAtBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyExitLockedAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyExpiryDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"epochEndingAt\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"epochOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"execApplyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"execBailOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_secLeftToRevoke\",\"type\":\"uint256\"}],\"name\":\"execEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_recipient\",\"type\":\"address\"}],\"name\":\"execReleaseLockedFundForEmergencyExitRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_secsLeft\",\"type\":\"uint256\"}],\"name\":\"execRequestRenounceCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_effectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"execRequestUpdateCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_newJailedUntil\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"_cannotBailout\",\"type\":\"bool\"}],\"name\":\"execSlash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBlockProducers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBridgeOperators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validatorAddrs\",\"type\":\"address[]\"}],\"name\":\"getBridgeOperatorsOf\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCandidateInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.ValidatorCandidate\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCandidateInfos\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.ValidatorCandidate[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCommissionChangeSchedule\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"effectiveTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.CommissionSchedule\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getEmergencyExitInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"lockedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"recyclingAt\",\"type\":\"uint256\"}],\"internalType\":\"struct ICommonInfo.EmergencyExitInfo\",\"name\":\"_info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"getJailedTimeLeft\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isJailed_\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"blockLeft_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochLeft_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_blockNum\",\"type\":\"uint256\"}],\"name\":\"getJailedTimeLeftAtBlock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isJailed_\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"blockLeft_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochLeft_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastUpdatedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorCandidates\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_validatorList\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__slashIndicatorContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__stakingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__stakingVestingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__maintenanceContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninTrustedOrganizationContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__bridgeTrackingContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__maxValidatorNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxValidatorCandidate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxPrioritizedValidatorNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__minEffectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__numberOfBlocksInEpoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256[2]\",\"name\":\"__emergencyExitConfigs\",\"type\":\"uint256[2]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isBlockProducer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"}],\"name\":\"isBridgeOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"}],\"name\":\"isCandidateAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"isOperatingBridge\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isPeriodEnding\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isValidator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isValidatorCandidate\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maintenanceContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxPrioritizedValidatorNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maximumPrioritizedValidatorNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorCandidate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maximumValidatorNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minEffectiveDaysOnwards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfBlocksInEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfBlocks\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompilePickValidatorSetAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompileSortValidatorsAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninTrustedOrganizationContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setBridgeTrackingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_emergencyExitLockedAmount\",\"type\":\"uint256\"}],\"name\":\"setEmergencyExitLockedAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_emergencyExpiryDuration\",\"type\":\"uint256\"}],\"name\":\"setEmergencyExpiryDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setMaintenanceContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"name\":\"setMaxPrioritizedValidatorNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"name\":\"setMaxValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_max\",\"type\":\"uint256\"}],\"name\":\"setMaxValidatorNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numOfDays\",\"type\":\"uint256\"}],\"name\":\"setMinEffectiveDaysOnwards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setRoninTrustedOrganizationContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setSlashIndicatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setStakingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setStakingVestingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"slashIndicatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingVestingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"submitBlockReward\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBlockProducers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBridgeOperators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalDeprecatedReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"tryGetPeriodOfEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_filled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_periodNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wrapUpEpoch\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrAlreadyRequestedEmergencyExit()\":[{\"details\":\"Error of already requested emergency exit before.\"}],\"ErrAlreadyRequestedRevokingCandidate()\":[{\"details\":\"Error of already requested revoking candidate before.\"}],\"ErrAlreadyRequestedUpdatingCommissionRate()\":[{\"details\":\"Error of commission change schedule exists.\"}],\"ErrAlreadyWrappedEpoch()\":[{\"details\":\"Error of query for already wrapped up epoch\"}],\"ErrAtEndOfEpochOnly()\":[{\"details\":\"Error of only allowed at the end of epoch\"}],\"ErrCallPrecompiled()\":[{\"details\":\"Error of call to precompile fails.\"}],\"ErrCallerMustBeBridgeTrackingContract()\":[{\"details\":\"Error of method caller must be bridge tracking contract.\"}],\"ErrCallerMustBeCoinbase()\":[{\"details\":\"Error of method caller must be coinbase\"}],\"ErrCallerMustBeMaintenanceContract()\":[{\"details\":\"Error of method caller must be maintenance contract.\"}],\"ErrCallerMustBeRoninTrustedOrgContract()\":[{\"details\":\"Error of method caller must be Ronin trusted org contract.\"}],\"ErrCallerMustBeSlashIndicatorContract()\":[{\"details\":\"Error of method caller must be slash indicator contract.\"}],\"ErrCallerMustBeStakingContract()\":[{\"details\":\"Error of method caller must be staking contract.\"}],\"ErrCallerMustBeStakingVestingContract()\":[{\"details\":\"Error of method caller must be staking vesting contract.\"}],\"ErrCannotBailout(address)\":[{\"details\":\"Error of cannot bailout due to high tier slash.\"}],\"ErrExceedsMaxNumberOfCandidate()\":[{\"details\":\"Error of exceeding maximum number of candidates.\"}],\"ErrExistentBridgeOperator(address)\":[{\"details\":\"Error of bridge operator already exists.\"}],\"ErrExistentCandidate()\":[{\"details\":\"Error of querying for already existent candidate.\"}],\"ErrExistentCandidateAdmin(address)\":[{\"details\":\"Error of candidate admin already exists.\"}],\"ErrExistentTreasury(address)\":[{\"details\":\"Error of treasury already exists.\"}],\"ErrInsufficientBalance()\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrInvalidCommissionRate()\":[{\"details\":\"Error of invalid commission rate.\"}],\"ErrInvalidEffectiveDaysOnwards()\":[{\"details\":\"Error of invalid effective days onwards.\"}],\"ErrInvalidMaxPrioritizedValidatorNumber()\":[{\"details\":\"Error of number of prioritized greater than number of max validators.\"}],\"ErrInvalidMinEffectiveDaysOnwards()\":[{\"details\":\"Error of invalid min effective days onwards.\"}],\"ErrNonExistentCandidate()\":[{\"details\":\"Error of querying for non-existent candidate.\"}],\"ErrRecipientRevert()\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrTrustedOrgCannotRenounce()\":[{\"details\":\"Error of trusted org cannot renounce.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"bridgeTrackingContract()\":{\"details\":\"Returns the bridge tracking contract.\"},\"checkBridgeRewardDeprecated(address)\":{\"details\":\"Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the current period.\"},\"checkJailed(address)\":{\"details\":\"Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\"},\"checkJailedAtBlock(address,uint256)\":{\"details\":\"Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\"},\"checkManyJailed(address[])\":{\"details\":\"Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\"},\"checkMiningRewardDeprecated(address[])\":{\"details\":\"Returns whether the incoming reward of the block producers are deprecated during the current period.\"},\"checkMiningRewardDeprecatedAtPeriod(address[],uint256)\":{\"details\":\"Returns whether the incoming reward of the block producers are deprecated during a specific period.\"},\"currentPeriod()\":{\"details\":\"Returns the period index from the current block.\"},\"currentPeriodStartAtBlock()\":{\"details\":\"Returns the block number that the current period starts at.\"},\"emergencyExitLockedAmount()\":{\"details\":\"Returns the amount of RON to lock from a consensus address.\"},\"emergencyExpiryDuration()\":{\"details\":\"Returns the duration that an emergency request is expired and the fund will be recycled.\"},\"epochEndingAt(uint256)\":{\"details\":\"Returns whether the epoch ending is at the block number `_block`.\"},\"epochOf(uint256)\":{\"details\":\"Returns the epoch index from the block number.\"},\"execApplyValidatorCandidate(address,address,address,address,uint256)\":{\"details\":\"Grants a validator candidate. Requirements: - The method caller is staking contract. Emits the event `CandidateGranted`.\"},\"execBailOut(address,uint256)\":{\"details\":\"Finalize the bailout request from slash indicator contract. Requirements: - The method caller is slash indicator contract. Emits the event `ValidatorUnjailed`.\"},\"execEmergencyExit(address,uint256)\":{\"details\":\"Fallback function of `IStaking-requestEmergencyExit`. Requirements: - The method caller is staking contract.\"},\"execReleaseLockedFundForEmergencyExitRequest(address,address)\":{\"details\":\"Unlocks fund for emergency exit request. Requirements: - The method caller is admin. Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked. Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\"},\"execRequestRenounceCandidate(address,uint256)\":{\"details\":\"Requests to revoke a validator candidate in next `_secsLeft` seconds. Requirements: - The method caller is staking contract. Emits the event `CandidateRevokingTimestampUpdated`.\"},\"execRequestUpdateCommissionRate(address,uint256,uint256)\":{\"details\":\"Fallback function of `CandidateStaking-requestUpdateCommissionRate`. Requirements: - The method caller is the staking contract. - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdateScheduled`.\"},\"execSlash(address,uint256,uint256,bool)\":{\"details\":\"Finalize the slash request from slash indicator contract. Requirements: - The method caller is slash indicator contract. Emits the event `ValidatorPunished`.\"},\"getBlockProducers()\":{\"details\":\"Returns the current block producer list.\"},\"getBridgeOperators()\":{\"details\":\"Returns the current bridge operator list.\"},\"getBridgeOperatorsOf(address[])\":{\"details\":\"Returns the bridge operator list corresponding to validator address list.\"},\"getCandidateInfo(address)\":{\"details\":\"Returns the info of a candidate.\"},\"getCandidateInfos()\":{\"details\":\"Returns all candidate info.\"},\"getCommissionChangeSchedule(address)\":{\"details\":\"Returns the schedule of changing commission rate of a candidate address.\"},\"getEmergencyExitInfo(address)\":{\"details\":\"Returns the emergency exit request.\"},\"getJailedTimeLeft(address)\":{\"details\":\"Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\"},\"getJailedTimeLeftAtBlock(address,uint256)\":{\"details\":\"Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\"},\"getLastUpdatedBlock()\":{\"details\":\"Returns the block that validator set was updated.\"},\"getValidatorCandidates()\":{\"details\":\"Returns the validator candidate.\"},\"getValidators()\":{\"details\":\"Returns the current validator list.\"},\"initialize(address,address,address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256[2])\":{\"details\":\"Initializes the contract storage.\"},\"isBlockProducer(address)\":{\"details\":\"Returns whether the address is block producer or not.\"},\"isBridgeOperator(address)\":{\"details\":\"Returns whether the address is bridge operator or not.\"},\"isCandidateAdmin(address,address)\":{\"details\":\"Returns whether the address is the candidate admin.\"},\"isOperatingBridge(address)\":{\"details\":\"Returns whether the consensus address is operating the bridge or not.\"},\"isPeriodEnding()\":{\"details\":\"Returns whether the period ending at the current block number.\"},\"isValidator(address)\":{\"details\":\"Returns whether the address is either a bridge operator or a block producer.\"},\"isValidatorCandidate(address)\":{\"details\":\"Returns whether the address is a validator (candidate).\"},\"maintenanceContract()\":{\"details\":\"Returns the maintenance contract.\"},\"maxPrioritizedValidatorNumber()\":{\"details\":\"Returns the number of reserved slots for prioritized validators.\"},\"maxValidatorCandidate()\":{\"details\":\"Returns the maximum number of validator candidate.\"},\"maxValidatorNumber()\":{\"details\":\"Returns the maximum number of validators in the epoch.\"},\"minEffectiveDaysOnwards()\":{\"details\":\"Returns the minimum number of days to the effective date of commission rate change.\"},\"numberOfBlocksInEpoch()\":{\"details\":\"Returns the number of blocks in a epoch.\"},\"precompilePickValidatorSetAddress()\":{\"details\":\"Gets the address of the precompile of picking validator set\"},\"precompileSortValidatorsAddress()\":{\"details\":\"Gets the address of the precompile of sorting validators\"},\"roninTrustedOrganizationContract()\":{\"details\":\"Returns the ronin trusted organization contract.\"},\"setBridgeTrackingContract(address)\":{\"details\":\"Sets the bridge tracking contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `BridgeTrackingContractUpdated`.\"},\"setEmergencyExitLockedAmount(uint256)\":{\"details\":\"Sets the amount of RON to lock from a consensus address. Requirements: - The method caller is admin. Emits the event `EmergencyExitLockedAmountUpdated`.\"},\"setEmergencyExpiryDuration(uint256)\":{\"details\":\"Sets the duration that an emergency request is expired and the fund will be recycled. Requirements: - The method caller is admin. Emits the event `EmergencyExpiryDurationUpdated`.\"},\"setMaintenanceContract(address)\":{\"details\":\"Sets the maintenance contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `MaintenanceContractUpdated`.\"},\"setMaxPrioritizedValidatorNumber(uint256)\":{\"details\":\"Updates the number of reserved slots for prioritized validators Requirements: - The method caller is admin Emits the event `MaxPrioritizedValidatorNumberUpdated`\"},\"setMaxValidatorCandidate(uint256)\":{\"details\":\"Sets the maximum number of validator candidate. Requirements: - The method caller is admin. Emits the `MaxValidatorCandidateUpdated` event.\"},\"setMaxValidatorNumber(uint256)\":{\"details\":\"Updates the max validator number Requirements: - The method caller is admin Emits the event `MaxValidatorNumberUpdated`\"},\"setMinEffectiveDaysOnwards(uint256)\":{\"details\":\"Sets the minimum number of days to the effective date of commision rate change. Requirements: - The method caller is admin. Emits the `MinEffectiveDaysOnwardsUpdated` event.\"},\"setRoninTrustedOrganizationContract(address)\":{\"details\":\"Sets the ronin trusted organization contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `RoninTrustedOrganizationContractUpdated`.\"},\"setSlashIndicatorContract(address)\":{\"details\":\"Sets the slash indicator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `SlashIndicatorContractUpdated`.\"},\"setStakingContract(address)\":{\"details\":\"Sets the staking contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `StakingContractUpdated`.\"},\"setStakingVestingContract(address)\":{\"details\":\"Sets the staking vesting contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `StakingVestingContractUpdated`.\"},\"slashIndicatorContract()\":{\"details\":\"Returns the slash indicator contract.\"},\"stakingContract()\":{\"details\":\"Returns the staking contract.\"},\"stakingVestingContract()\":{\"details\":\"Returns the staking vesting contract.\"},\"submitBlockReward()\":{\"details\":\"Submits reward of the current block. Requirements: - The method caller is coinbase. Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer. Emits the event `BlockRewardSubmitted` for the valid call.\"},\"totalBlockProducers()\":{\"details\":\"Returns total numbers of the block producers.\"},\"totalBridgeOperators()\":{\"details\":\"Returns total numbers of the bridge operators.\"},\"totalDeprecatedReward()\":{\"details\":\"Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\"},\"tryGetPeriodOfEpoch(uint256)\":{\"details\":\"Tries to get the period index from the epoch number.\"},\"wrapUpEpoch()\":{\"details\":\"Wraps up the current epoch. Requirements: - The method must be called when the current epoch is ending. - The epoch is not wrapped yet. - The method caller is coinbase. Emits the event `MiningRewardDistributed` when some validator has reward distributed. Emits the event `StakingRewardDistributed` when some staking pool has reward distributed. Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up. Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending. Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated. Emits the event `WrappedUpEpoch`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/validator/RoninValidatorSet.sol\":\"RoninValidatorSet\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xdb7f5c28fc61cda0bd8ab60ce288e206b791643bcd3ba464a70cbec18895a2f5\",\"license\":\"MIT\"},\"contracts/extensions/RONTransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract RONTransferHelper {\\n /// @dev Error of recipient not accepting RON when transfer RON.\\n error ErrRecipientRevert();\\n /// @dev Error of sender has insufficient balance.\\n error ErrInsufficientBalance();\\n\\n /**\\n * @dev See `_sendRON`.\\n * Reverts if the recipient does not receive RON.\\n */\\n function _transferRON(address payable _recipient, uint256 _amount) internal {\\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\\n }\\n\\n /**\\n * @dev Send `_amount` RON to the address `_recipient`.\\n * Returns whether the recipient receives RON or not.\\n * Reverts once the contract balance is insufficient.\\n *\\n * Note: consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\\n return _unsafeSendRON(_recipient, _amount);\\n }\\n\\n /**\\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\\n * the call does not revert.\\n *\\n * Note:\\n * - Does not assert whether the balance of sender is sufficient.\\n * - Does not assert whether the recipient accepts RON.\\n * - Consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount }(\\\"\\\");\\n }\\n\\n /**\\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\\n */\\n function _unsafeSendRON(\\n address payable _recipient,\\n uint256 _amount,\\n uint256 _gas\\n ) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbf47d40b2431cf190fa737b803e4cb6fb55aee3f8804470da57a9e340f7914f8\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasBridgeTrackingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasBridgeTrackingContract.sol\\\";\\nimport \\\"../../interfaces/IBridgeTracking.sol\\\";\\n\\ncontract HasBridgeTrackingContract is IHasBridgeTrackingContract, HasProxyAdmin {\\n IBridgeTracking internal _bridgeTrackingContract;\\n\\n modifier onlyBridgeTrackingContract() {\\n if (bridgeTrackingContract() != msg.sender) revert ErrCallerMustBeBridgeTrackingContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeTrackingContract\\n */\\n function bridgeTrackingContract() public view override returns (address) {\\n return address(_bridgeTrackingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeTrackingContract\\n */\\n function setBridgeTrackingContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setBridgeTrackingContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the bridge tracking contract.\\n *\\n * Emits the event `BridgeTrackingContractUpdated`.\\n *\\n */\\n function _setBridgeTrackingContract(address _addr) internal {\\n _bridgeTrackingContract = IBridgeTracking(_addr);\\n emit BridgeTrackingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x195b0d3fc2305aa4620f5091ba161f3e983b4cef2272d80f5f5b180a8ab98a34\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasMaintenanceContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasMaintenanceContract.sol\\\";\\nimport \\\"../../interfaces/IMaintenance.sol\\\";\\n\\ncontract HasMaintenanceContract is IHasMaintenanceContract, HasProxyAdmin {\\n IMaintenance internal _maintenanceContract;\\n\\n modifier onlyMaintenanceContract() {\\n if (maintenanceContract() != msg.sender) revert ErrCallerMustBeMaintenanceContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasMaintenanceContract\\n */\\n function maintenanceContract() public view override returns (address) {\\n return address(_maintenanceContract);\\n }\\n\\n /**\\n * @inheritdoc IHasMaintenanceContract\\n */\\n function setMaintenanceContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setMaintenanceContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the scheduled maintenance contract.\\n *\\n * Emits the event `MaintenanceContractUpdated`.\\n *\\n */\\n function _setMaintenanceContract(address _addr) internal {\\n _maintenanceContract = IMaintenance(_addr);\\n emit MaintenanceContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x117a29d878d44a20350df8ab539d34335713ba0f3b2c768a58124f61efb74357\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\n\\ncontract HasRoninTrustedOrganizationContract is IHasRoninTrustedOrganizationContract, HasProxyAdmin {\\n IRoninTrustedOrganization internal _roninTrustedOrganizationContract;\\n\\n modifier onlyRoninTrustedOrganizationContract() {\\n if (roninTrustedOrganizationContract() != msg.sender) revert ErrCallerMustBeRoninTrustedOrgContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function roninTrustedOrganizationContract() public view override returns (address) {\\n return address(_roninTrustedOrganizationContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function setRoninTrustedOrganizationContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setRoninTrustedOrganizationContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function _setRoninTrustedOrganizationContract(address _addr) internal {\\n _roninTrustedOrganizationContract = IRoninTrustedOrganization(_addr);\\n emit RoninTrustedOrganizationContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x951fd730f4853d8c932da5484ea093f3094c8186735b603d31fb53035c395751\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasSlashIndicatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasSlashIndicatorContract.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashIndicator.sol\\\";\\n\\ncontract HasSlashIndicatorContract is IHasSlashIndicatorContract, HasProxyAdmin {\\n ISlashIndicator internal _slashIndicatorContract;\\n\\n modifier onlySlashIndicatorContract() {\\n if (slashIndicatorContract() != msg.sender) revert ErrCallerMustBeSlashIndicatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasSlashIndicatorContract\\n */\\n function slashIndicatorContract() public view override returns (address) {\\n return address(_slashIndicatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasSlashIndicatorContract\\n */\\n function setSlashIndicatorContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setSlashIndicatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the slash indicator contract.\\n *\\n * Emits the event `SlashIndicatorContractUpdated`.\\n *\\n */\\n function _setSlashIndicatorContract(address _addr) internal {\\n _slashIndicatorContract = ISlashIndicator(_addr);\\n emit SlashIndicatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x280c56e53c53bf1438cf7d3e71026baf383d24332359bce59282074c94abe5bb\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasStakingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasStakingContract.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\n\\ncontract HasStakingContract is IHasStakingContract, HasProxyAdmin {\\n IStaking internal _stakingContract;\\n\\n modifier onlyStakingContract() {\\n if (stakingContract() != msg.sender) revert ErrCallerMustBeStakingContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasStakingContract\\n */\\n function stakingContract() public view override returns (address) {\\n return address(_stakingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasStakingContract\\n */\\n function setStakingContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setStakingContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the staking contract.\\n *\\n * Emits the event `StakingContractUpdated`.\\n *\\n */\\n function _setStakingContract(address _addr) internal {\\n _stakingContract = IStaking(_addr);\\n emit StakingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x54d2a4608e0a8819ebd7fdb4ae784d3c709285e93f002034f9e2e787a6607923\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasStakingVestingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasStakingVestingContract.sol\\\";\\nimport \\\"../../interfaces/IStakingVesting.sol\\\";\\n\\ncontract HasStakingVestingContract is IHasStakingVestingContract, HasProxyAdmin {\\n IStakingVesting internal _stakingVestingContract;\\n\\n modifier onlyStakingVestingContract() {\\n if (stakingVestingContract() != msg.sender) revert ErrCallerMustBeStakingVestingContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasStakingVestingContract\\n */\\n function stakingVestingContract() public view override returns (address) {\\n return address(_stakingVestingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasStakingVestingContract\\n */\\n function setStakingVestingContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setStakingVestingContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the staking vesting contract.\\n *\\n * Emits the event `StakingVestingContractUpdated`.\\n *\\n */\\n function _setStakingVestingContract(address _addr) internal {\\n _stakingVestingContract = IStakingVesting(_addr);\\n emit StakingVestingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x1893fae5d612b0d78f6d66695194aa6b03817a3b92be602887918781fba29e37\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/IBridgeTracking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBridgeTracking {\\n enum VoteKind {\\n Deposit,\\n Withdrawal,\\n MainchainWithdrawal\\n }\\n\\n /**\\n * @dev Returns the total number of votes at the specific period `_period`.\\n */\\n function totalVotes(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots at the specific period `_period`.\\n */\\n function totalBallots(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\\n */\\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\\n */\\n function totalBallotsOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\\n\\n /**\\n * @dev Handles the request once it is approved.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\\n\\n /**\\n * @dev Records vote for a receipt and a operator.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function recordVote(\\n VoteKind _kind,\\n uint256 _requestId,\\n address _operator\\n ) external;\\n}\\n\",\"keccak256\":\"0xb2d5e9367c48a611f131c8b77f9034db8dd81df8c8bbb2c8e8d9a32286a5a8ae\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IMaintenance {\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\\n */\\n function checkScheduled(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr`\\n */\\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\\n */\\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedules() external view returns (uint256 _count);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedules() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4f06c8f3ad7ec8b863882c655ddf443675d557272445e51d8a1e1f3454089d09\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x10f3b360430e6d03773c9959f54cbed6fb0346069645c05b05ef50cfb19f3753\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninGovernanceAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../libraries/BridgeOperatorsBallot.sol\\\";\\n\\ninterface IRoninGovernanceAdmin {\\n /// @dev Emitted when the bridge operators are approved.\\n event BridgeOperatorsApproved(uint256 _period, uint256 _epoch, address[] _operators);\\n /// @dev Emitted when an emergency exit poll is created.\\n event EmergencyExitPollCreated(\\n bytes32 _voteHash,\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n );\\n /// @dev Emitted when an emergency exit poll is approved.\\n event EmergencyExitPollApproved(bytes32 _voteHash);\\n /// @dev Emitted when an emergency exit poll is expired.\\n event EmergencyExitPollExpired(bytes32 _voteHash);\\n\\n /**\\n * @dev Returns the last voted block of the bridge voter.\\n */\\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256);\\n\\n /**\\n * @dev Returns the synced bridge operator set info.\\n */\\n function lastSyncedBridgeOperatorSetInfo()\\n external\\n view\\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory _bridgeOperatorSetInfo);\\n\\n /**\\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n */\\n function createEmergencyExitPoll(\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) external;\\n}\\n\",\"keccak256\":\"0x1aa218f9a8cad8fa9f865c179b257aa8f2614e034100dedebdd352da9a7d96d9\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeights() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganizations() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x1edb7a3f5d340e7efc141cb8d94c5499954dec869f026d3998ad92cbc714d604\",\"license\":\"MIT\"},\"contracts/interfaces/IStakingVesting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IStakingVesting {\\n /// @dev Emitted when the block bonus for block producer is transferred.\\n event BonusTransferred(\\n uint256 indexed blockNumber,\\n address indexed recipient,\\n uint256 blockProducerAmount,\\n uint256 bridgeOperatorAmount\\n );\\n /// @dev Emitted when the transfer of block bonus for block producer is failed.\\n event BonusTransferFailed(\\n uint256 indexed blockNumber,\\n address indexed recipient,\\n uint256 blockProducerAmount,\\n uint256 bridgeOperatorAmount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the block bonus for block producer is updated\\n event BlockProducerBonusPerBlockUpdated(uint256);\\n /// @dev Emitted when the block bonus for bridge operator is updated\\n event BridgeOperatorBonusPerBlockUpdated(uint256);\\n\\n /**\\n * @dev Returns the bonus amount for the block producer at `_block`.\\n */\\n function blockProducerBlockBonus(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns the bonus amount for the bridge validator at `_block`.\\n */\\n function bridgeOperatorBlockBonus(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Receives RON from any address.\\n */\\n function receiveRON() external payable;\\n\\n /**\\n * @dev Returns the last block number that the staking vesting is sent.\\n */\\n function lastBlockSendingBonus() external view returns (uint256);\\n\\n /**\\n * @dev Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n * - The method must be called only once per block.\\n *\\n * Emits the event `BonusTransferred` or `BonusTransferFailed`.\\n *\\n * Notes:\\n * - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method\\n * will not be reverted, and the underlying nodes does not hang.\\n *\\n * @param _forBlockProducer Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\\n * @param _forBridgeOperator Indicates whether requesting the bonus for the bridge operator.\\n *\\n * @return _success Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\\n * @return _blockProducerBonus The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\\n * @return _bridgeOperatorBonus The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\\n *\\n */\\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\\n external\\n returns (\\n bool _success,\\n uint256 _blockProducerBonus,\\n uint256 _bridgeOperatorBonus\\n );\\n\\n /**\\n * @dev Sets the bonus amount per block for block producer.\\n *\\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n */\\n function setBlockProducerBonusPerBlock(uint256 _amount) external;\\n\\n /**\\n * @dev Sets the bonus amount per block for bridge operator.\\n *\\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n */\\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0x6705fdccf03c4acd34ceb1034c2ab556c901781d6d5597e63f257eafe75cf1ae\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasBridgeTrackingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasBridgeTrackingContract is IHasContract {\\n /// @dev Emitted when the bridge tracking contract is updated.\\n event BridgeTrackingContractUpdated(address);\\n\\n /// @dev Error of method caller must be bridge tracking contract.\\n error ErrCallerMustBeBridgeTrackingContract();\\n\\n /**\\n * @dev Returns the bridge tracking contract.\\n */\\n function bridgeTrackingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the bridge tracking contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `BridgeTrackingContractUpdated`.\\n *\\n */\\n function setBridgeTrackingContract(address) external;\\n}\\n\",\"keccak256\":\"0x2d1b7e356826bfe1c2a3348137d828f46ca931f7c2f48197379ad987e713714b\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasMaintenanceContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasMaintenanceContract is IHasContract {\\n /// @dev Emitted when the maintenance contract is updated.\\n event MaintenanceContractUpdated(address);\\n\\n /// @dev Error of method caller must be maintenance contract.\\n error ErrCallerMustBeMaintenanceContract();\\n\\n /**\\n * @dev Returns the maintenance contract.\\n */\\n function maintenanceContract() external view returns (address);\\n\\n /**\\n * @dev Sets the maintenance contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `MaintenanceContractUpdated`.\\n *\\n */\\n function setMaintenanceContract(address) external;\\n}\\n\",\"keccak256\":\"0x0a0ef6ba14e2929c7c8dda0642a7a831c9997d1b0d049eb83f64dfc21ff0e72e\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\\n /// @dev Emitted when the ronin trusted organization contract is updated.\\n event RoninTrustedOrganizationContractUpdated(address);\\n\\n /// @dev Error of method caller must be Ronin trusted org contract.\\n error ErrCallerMustBeRoninTrustedOrgContract();\\n\\n /**\\n * @dev Returns the ronin trusted organization contract.\\n */\\n function roninTrustedOrganizationContract() external view returns (address);\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function setRoninTrustedOrganizationContract(address) external;\\n}\\n\",\"keccak256\":\"0x7d0a0b1d658e9cf4d69f4934748e0a5c1d22183024d26927f5d621fc61aff0b2\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasSlashIndicatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasSlashIndicatorContract is IHasContract {\\n /// @dev Emitted when the slash indicator contract is updated.\\n event SlashIndicatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be slash indicator contract.\\n error ErrCallerMustBeSlashIndicatorContract();\\n\\n /**\\n * @dev Returns the slash indicator contract.\\n */\\n function slashIndicatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `SlashIndicatorContractUpdated`.\\n *\\n */\\n function setSlashIndicatorContract(address) external;\\n}\\n\",\"keccak256\":\"0xfaaeec87f74039a55fe451c07c341b88794e62a8a331c878a8d9e91f55f1ff45\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasStakingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasStakingContract is IHasContract {\\n /// @dev Emitted when the staking contract is updated.\\n event StakingContractUpdated(address);\\n\\n /// @dev Error of method caller must be staking contract.\\n error ErrCallerMustBeStakingContract();\\n\\n /**\\n * @dev Returns the staking contract.\\n */\\n function stakingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the staking contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `StakingContractUpdated`.\\n *\\n */\\n function setStakingContract(address) external;\\n}\\n\",\"keccak256\":\"0xd5e9b017f7ba0157fa41152a8bb166edbc6ef54a97fa3bb71a2a9b333d846c0b\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasStakingVestingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasStakingVestingContract is IHasContract {\\n /// @dev Emitted when the staking vesting contract is updated.\\n event StakingVestingContractUpdated(address);\\n\\n /// @dev Error of method caller must be staking vesting contract.\\n error ErrCallerMustBeStakingVestingContract();\\n\\n /**\\n * @dev Returns the staking vesting contract.\\n */\\n function stakingVestingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the staking vesting contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `StakingVestingContractUpdated`.\\n *\\n */\\n function setStakingVestingContract(address) external;\\n}\\n\",\"keccak256\":\"0xfc5f14854b15f81d5b535e4baaeca7cedca69b26813bfc6ade75fdabc4eaffcf\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface PeriodWrapperConsumer {\\n struct PeriodWrapper {\\n // Inner value.\\n uint256 inner;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n}\\n\",\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/IBaseSlash.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseSlash {\\n enum SlashType {\\n UNKNOWN,\\n UNAVAILABILITY_TIER_1,\\n UNAVAILABILITY_TIER_2,\\n DOUBLE_SIGNING,\\n BRIDGE_VOTING,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\\n UNAVAILABILITY_TIER_3\\n }\\n\\n /// @dev Emitted when the validator is slashed.\\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\\n}\\n\",\"keccak256\":\"0x04d449f2852840566dfff4e3673929f6e9b8d9b5fc5b29744bf4f344dc7f9bc0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ICreditScore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICreditScore {\\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\\n event CreditScoreConfigsUpdated(\\n uint256 gainCreditScore,\\n uint256 maxCreditScore,\\n uint256 bailOutCostMultiplier,\\n uint256 cutOffPercentageAfterBailout\\n );\\n /// @dev Emitted the credit score of validators is updated.\\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\\n /// @dev Emitted when a validator bailed out of jail.\\n event BailedOut(address indexed validator, uint256 period, uint256 usedCreditScore);\\n\\n /**\\n * @dev Updates the credit score for the validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function updateCreditScores(address[] calldata _validators, uint256 _period) external;\\n\\n /**\\n * @dev Resets the credit score for the revoked validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function execResetCreditScores(address[] calldata _validators) external;\\n\\n /**\\n * @dev A slashed validator use this method to get out of jail.\\n *\\n * Requirements:\\n * - The `_consensusAddr` must be a validator.\\n * - Only validator's admin can call this method.\\n *\\n * Emits the event `BailedOut`.\\n *\\n */\\n function bailOut(address _consensusAddr) external;\\n\\n /**\\n * @dev Sets the configs to credit score.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CreditScoreConfigsUpdated`.\\n *\\n * @param _gainScore The score to gain per period.\\n * @param _maxScore The max number of credit score that a validator can hold.\\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to credit score.\\n *\\n * @return _gainCreditScore The score to gain per period.\\n * @return _maxCreditScore The max number of credit score that a validator can hold.\\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function getCreditScoreConfigs()\\n external\\n view\\n returns (\\n uint256 _gainCreditScore,\\n uint256 _maxCreditScore,\\n uint256 _bailOutCostMultiplier,\\n uint256 _cutOffPercentageAfterBailout\\n );\\n\\n /**\\n * @dev Returns the current credit score of the validator.\\n */\\n function getCreditScore(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the current credit score of a list of validators.\\n */\\n function getManyCreditScores(address[] calldata _validators) external view returns (uint256[] memory _resultList);\\n\\n /**\\n * @dev Returns the whether the `_validator` has been bailed out at the `_period`.\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5364db88efb971f73aac569e27e5604758a123f28567af757b9933fdddd14f8\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeOperator is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method\\n * `getBridgeOperatorSlashingConfigs` for param details.\\n */\\n event BridgeOperatorSlashingConfigsUpdated(\\n uint256 missingVotesRatioTier1,\\n uint256 missingVotesRatioTier2,\\n uint256 jailDurationForMissingVotesRatioTier2,\\n uint256 skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\\n * @param _tier The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1`\\n * and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2`\\n *\\n * Requirements:\\n * - Only validator contract can invoke this method.\\n * - Should be called only at the end of period.\\n * - Should be called only when there is slash of bridge operator.\\n *\\n * Emits the event `Slashed`.\\n */\\n function execSlashBridgeOperator(\\n address _consensusAddr,\\n uint256 _tier,\\n uint256 _period\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to bridge operator slashing.\\n *\\n * @return _missingVotesRatioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio.\\n * @return _missingVotesRatioTier2 The bridge reward and mining reward will be deprecated and the corresponding\\n * block producer will be put in jail if (s)he misses more than this ratio.\\n * @return _jailDurationForMissingVotesRatioTier2 The number of blocks to jail the corresponding block producer when\\n * its bridge operator is slashed tier-2.\\n * @return _skipBridgeOperatorSlashingThreshold The threshold to skip slashing the bridge operator in case the total\\n * number of votes in the bridge is too small.\\n *\\n */\\n function getBridgeOperatorSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _missingVotesRatioTier1,\\n uint256 _missingVotesRatioTier2,\\n uint256 _jailDurationForMissingVotesRatioTier2,\\n uint256 _skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash bridge operators.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _ratioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map\\n * to 0%-100%.\\n * @param _ratioTier2 The bridge reward and mining reward will be deprecated and the corresponding block producer will\\n * be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\\n * @param _jailDurationTier2 The number of blocks to jail the corresponding block producer when its bridge operator is\\n * slashed tier-2.\\n * @param _skipSlashingThreshold The threshold to skip slashing the bridge operator in case the total number of votes\\n * in the bridge is too small.\\n *\\n */\\n function setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x5c09ac11ead005bfa25ae58e970c441144849b14d58fd5f53fadc3b9be16e5d6\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeVoting is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge voting is updated. See the method `getBridgeVotingSlashingConfigs` for param\\n * details.\\n */\\n event BridgeVotingSlashingConfigsUpdated(uint256 bridgeVotingThreshold, uint256 bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Slashes for bridge voter governance.\\n *\\n * Emits the event `Slashed`.\\n */\\n function slashBridgeVoting(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the configs related to bridge voting slashing.\\n *\\n * @return _bridgeVotingThreshold The threshold to slash when a trusted organization does not vote for bridge\\n * operators.\\n * @return _bridgeVotingSlashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function getBridgeVotingSlashingConfigs()\\n external\\n view\\n returns (uint256 _bridgeVotingThreshold, uint256 _bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Sets the configs to slash bridge voting.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeVotingSlashingConfigsUpdated`.\\n *\\n * @param _threshold The threshold to slash when a trusted organization does not vote for bridge operators.\\n * @param _slashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external;\\n}\\n\",\"keccak256\":\"0x72c3bcfe3c49f946651caa3066bd5296d007871c9a56fa113e2d3c0f3db7eb99\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashDoubleSign is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\\n * for param details.\\n */\\n event DoubleSignSlashingConfigsUpdated(\\n uint256 slashDoubleSignAmount,\\n uint256 doubleSigningJailUntilBlock,\\n uint256 doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Slashes for double signing.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\\n */\\n function slashDoubleSign(\\n address _validatorAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\\n * double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function getDoubleSignSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _slashDoubleSignAmount,\\n uint256 _doubleSigningJailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\\n *\\n * @param _slashAmount The amount of RON to slash double sign.\\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n ) external;\\n}\\n\",\"keccak256\":\"0xe72708c42d468b0c40ffa0c72b3386899f11273e4149425aab490a78d5312222\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashIndicator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashDoubleSign.sol\\\";\\nimport \\\"./ISlashBridgeVoting.sol\\\";\\nimport \\\"./ISlashBridgeOperator.sol\\\";\\nimport \\\"./ISlashUnavailability.sol\\\";\\nimport \\\"./ICreditScore.sol\\\";\\n\\ninterface ISlashIndicator is\\n ISlashDoubleSign,\\n ISlashBridgeVoting,\\n ISlashBridgeOperator,\\n ISlashUnavailability,\\n ICreditScore\\n{}\\n\",\"keccak256\":\"0xe8b8fde3af614735cb304bc1eb82b05d65ede4df804b5d555787e5d5ecb95ec0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashUnavailability.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashUnavailability is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\\n * for param details.\\n */\\n event UnavailabilitySlashingConfigsUpdated(\\n uint256 unavailabilityTier1Threshold,\\n uint256 unavailabilityTier2Threshold,\\n uint256 slashAmountForUnavailabilityTier2Threshold,\\n uint256 jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Returns the last block that a block producer is slashed for unavailability.\\n */\\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Slashes for unavailability by increasing the counter of block producer `_consensusAddr`.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` when the threshold is reached.\\n *\\n */\\n function slashUnavailability(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the current unavailability indicator of a block producer.\\n */\\n function currentUnavailabilityIndicator(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the unavailability indicator in the period `_period` of a block producer.\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\\n * @return _unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\\n * @return _slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\\n * producer when (s)he is slashed with tier-2 or tier-3.\\n * @return _jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\\n * slashed with tier-2 or tier-3.\\n *\\n */\\n function getUnavailabilitySlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _unavailabilityTier1Threshold,\\n uint256 _unavailabilityTier2Threshold,\\n uint256 _slashAmountForUnavailabilityTier2Threshold,\\n uint256 _jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\\n * @param _tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\\n * self-staking if (s)he misses more than this threshold.\\n * @param _slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\\n * is slashed tier-2.\\n * @param _jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\\n *\\n */\\n function setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x92f7d8e9c6f80d4fedab80515c68db0a46cf4f8da143f8d766bf5f7582aa0a21\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseStaking {\\n struct PoolDetail {\\n // Address of the pool i.e. consensus address of the validator\\n address addr;\\n // Pool admin address\\n address admin;\\n // Self-staking amount\\n uint256 stakingAmount;\\n // Total number of RON staking for the pool\\n uint256 stakingTotal;\\n // Mapping from delegator => delegating amount\\n mapping(address => uint256) delegatingAmount;\\n // Mapping from delegator => the last timestamp that delegator staked\\n mapping(address => uint256) lastDelegatingTimestamp;\\n }\\n\\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\\n event WaitingSecsToRevokeUpdated(uint256 secs);\\n\\n /// @dev Error of cannot transfer RON.\\n error ErrCannotTransferRON();\\n /// @dev Error of receiving zero message value.\\n error ErrZeroValue();\\n /// @dev Error of pool admin is not allowed to call.\\n error ErrPoolAdminForbidden();\\n /// @dev Error of no one is allowed to call but the pool's admin.\\n error ErrOnlyPoolAdminAllowed();\\n /// @dev Error of admin of any active pool cannot delegate.\\n error ErrAdminOfAnyActivePoolForbidden(address admin);\\n /// @dev Error of querying inactive pool.\\n error ErrInactivePool(address poolAddr);\\n /// @dev Error of length of input arrays are not of the same.\\n error ErrInvalidArrays();\\n\\n /**\\n * @dev Returns whether the `_poolAdminAddr` is currently active.\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the consensus address corresponding to the pool admin.\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\\n\\n /**\\n * @dev Returns the staking pool detail.\\n */\\n function getPoolDetail(address)\\n external\\n view\\n returns (\\n address _admin,\\n uint256 _stakingAmount,\\n uint256 _stakingTotal\\n );\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\\n */\\n function waitingSecsToRevoke() external view returns (uint256);\\n\\n /**\\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external;\\n}\\n\",\"keccak256\":\"0x008b3d42a3104820de7b7edb5ea4b21c75d4417767fc0791f89f00ac9a2cce8d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface ICandidateStaking is IRewardPool {\\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\\n event MinValidatorStakingAmountUpdated(uint256 threshold);\\n /// @dev Emitted when the max commission rate is updated.\\n event MaxCommissionRateUpdated(uint256 maxRate);\\n\\n /// @dev Emitted when the pool admin staked for themself.\\n event Staked(address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\\n event Unstaked(address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Emitted when the validator pool is approved.\\n event PoolApproved(address indexed validator, address indexed admin);\\n /// @dev Emitted when the validator pool is deprecated.\\n event PoolsDeprecated(address[] validator);\\n /// @dev Emitted when the staking amount transfer failed.\\n event StakingAmountTransferFailed(\\n address indexed validator,\\n address indexed admin,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\\n event StakingAmountDeductFailed(\\n address indexed validator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Error of cannot transfer RON to specified target.\\n error ErrCannotInitTransferRON(address addr, string extraInfo);\\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\\n error ErrThreeInteractionAddrsNotEqual();\\n /// @dev Error of three operation addresses must be distinct in applying for validator candidate.\\n error ErrThreeOperationAddrsNotDistinct();\\n /// @dev Error of unstaking zero amount.\\n error ErrUnstakeZeroAmount();\\n /// @dev Error of invalid staking amount left after deducted.\\n error ErrStakingAmountLeft();\\n /// @dev Error of insufficient staking amount for unstaking.\\n error ErrInsufficientStakingAmount();\\n /// @dev Error of unstaking too early.\\n error ErrUnstakeTooEarly();\\n /// @dev Error of setting commission rate exceeds max allowed.\\n error ErrInvalidCommissionRate();\\n\\n /**\\n * @dev Returns the minimum threshold for being a validator candidate.\\n */\\n function minValidatorStakingAmount() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max commission rate that the candidate can set.\\n */\\n function maxCommissionRate() external view returns (uint256);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function setMinValidatorStakingAmount(uint256) external;\\n\\n /**\\n * @dev Sets the max commission rate that a candidate can set.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxCommissionRateUpdated` event.\\n *\\n */\\n function setMaxCommissionRate(uint256 _maxRate) external;\\n\\n /**\\n * @dev Proposes a candidate to become a validator.\\n *\\n * Requirements:\\n * - The method caller is able to receive RON.\\n * - The treasury is able to receive RON.\\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\\n *\\n * Emits the event `PoolApproved`.\\n *\\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\\n * to its candidate, e.g. scheduling maintenance.\\n *\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external payable;\\n\\n /**\\n * @dev Deprecates the pool.\\n * - Deduct self-staking amount of the pool admin to zero.\\n * - Transfer the deducted amount to the pool admin.\\n * - Deactivate the pool admin address in the mapping of active pool admins\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\\n *\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\\n\\n /**\\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `msg.value` is larger than 0.\\n *\\n * Emits the event `Staked`.\\n *\\n */\\n function stake(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function unstake(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdated`.\\n *\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestRenounce(address _consensusAddr) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestEmergencyExit(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4160e8b8dc00df59a35823589d69dcbf5655d7024f5d8e17e823e243ffb44b9d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface IDelegatorStaking is IRewardPool {\\n /// @dev Emitted when the delegator staked for a validator candidate.\\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the delegator unstaked from a validator candidate.\\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Error of undelegating zero amount.\\n error ErrUndelegateZeroAmount();\\n /// @dev Error of undelegating insufficient amount.\\n error ErrInsufficientDelegatingAmount();\\n /// @dev Error of undelegating too early.\\n error ErrUndelegateTooEarly();\\n\\n /**\\n * @dev Stakes for a validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n */\\n function delegate(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Undelegated` event.\\n *\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Bulk unstakes from a list of candidates.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the events `Undelegated`.\\n *\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\\n\\n /**\\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `Undelegated` event and the `Delegated` event.\\n *\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external;\\n\\n /**\\n * @dev Returns the claimable reward of the user `_user`.\\n */\\n function getRewards(address _user, address[] calldata _poolAddrList)\\n external\\n view\\n returns (uint256[] memory _rewards);\\n\\n /**\\n * @dev Claims the reward of method caller.\\n *\\n * Emits the `RewardClaimed` event.\\n *\\n */\\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `RewardClaimed` event and the `Delegated` event.\\n *\\n */\\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\\n external\\n returns (uint256 _amount);\\n}\\n\",\"keccak256\":\"0x5ce840a920ed06139f9e33d306c8ee50b2a81e4bd2ac6ed24b47297c348576b8\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IRewardPool.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/consumers/PeriodWrapperConsumer.sol\\\";\\n\\ninterface IRewardPool is PeriodWrapperConsumer {\\n struct UserRewardFields {\\n // Recorded reward amount.\\n uint256 debited;\\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\\n uint256 aRps;\\n // Lowest staking amount in the period.\\n uint256 lowestAmount;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n\\n struct PoolFields {\\n // Accumulated of the amount rewards per share (one unit staking).\\n uint256 aRps;\\n // The staking total to share reward of the current period.\\n PeriodWrapper shares;\\n }\\n\\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\\n /// @dev Emitted when the user claimed their reward\\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\\n\\n /// @dev Emitted when the pool shares are updated\\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\\n /// @dev Emitted when the pools are updated\\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\\n /// @dev Emitted when the contract fails when updating the pools\\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\\n /// @dev Emitted when the contract fails when updating the pools that already set\\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\\n\\n /// @dev Error of invalid pool share.\\n error ErrInvalidPoolShare();\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amount of an user.\\n */\\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amounts of the users.\\n */\\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total staking amount of all users for a pool.\\n */\\n function getStakingTotal(address _poolAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\\n */\\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\\n}\\n\",\"keccak256\":\"0x92315ca9d6d93f55a7752adf2567adb86745f708198bfcd74b9a626b6570208f\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseStaking.sol\\\";\\nimport \\\"./ICandidateStaking.sol\\\";\\nimport \\\"./IDelegatorStaking.sol\\\";\\n\\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable;\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\\n external\\n returns (uint256 _actualDeductingAmount);\\n}\\n\",\"keccak256\":\"0xb7942c5032c16ea567ac0bfc07ecacd84840d6de134735ea538aa22fc6da05a5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0xe4060b7e3b04a0043bd334011fe4ba67c990b0484dad52d7f14b35040989b6ab\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n // Error thrown when receives RON from neither staking vesting contract nor staking contract\\\"\\n error ErrUnauthorizedReceiveRON();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0x4e81a61359a3f8bcc9d452615e3df7b0d0201823ce88f763530ddd4f00c2fc48\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address[] calldata _blockProducers) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address[] calldata _blockProducers, uint256 _period)\\n external\\n view\\n returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the current period.\\n */\\n\\n function checkBridgeRewardDeprecated(address _consensusAddr) external view returns (bool _result);\\n}\\n\",\"keccak256\":\"0x853e7d0ac33ad868721733fc2ab4b78f2e613973a579eb0ea485cbdaa750e057\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator or not.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0xbd10b0207a749e3a7a2aadcb6e93784cb17343a5266d056a3d0b79acb7c5c93d\",\"license\":\"MIT\"},\"contracts/libraries/BridgeOperatorsBallot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nlibrary BridgeOperatorsBallot {\\n struct BridgeOperatorSet {\\n uint256 period;\\n uint256 epoch;\\n address[] operators;\\n }\\n\\n // keccak256(\\\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\\\");\\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\\n\\n /**\\n * @dev Verifies whether the ballot is valid or not.\\n *\\n * Requirements:\\n * - The ballot is not for an empty operator set.\\n * - The operator address list is in order.\\n *\\n */\\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\\n require(_ballot.operators.length > 0, \\\"BridgeOperatorsBallot: invalid array length\\\");\\n address _addr = _ballot.operators[0];\\n for (uint _i = 1; _i < _ballot.operators.length; _i++) {\\n require(_addr < _ballot.operators[_i], \\\"BridgeOperatorsBallot: invalid order of bridge operators\\\");\\n _addr = _ballot.operators[_i];\\n }\\n }\\n\\n /**\\n * @dev Returns hash of the ballot.\\n */\\n function hash(BridgeOperatorSet calldata _ballot) internal pure returns (bytes32) {\\n bytes32 _operatorsHash;\\n address[] memory _operators = _ballot.operators;\\n\\n assembly {\\n _operatorsHash := keccak256(add(_operators, 32), mul(mload(_operators), 32))\\n }\\n\\n return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\\n }\\n}\\n\",\"keccak256\":\"0x986425ebae2dcfcfa266c9ca825232ff300ec8ce796e8975da6714d87e921793\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - min(a, b);\\n }\\n}\\n\",\"keccak256\":\"0xa9e2a3ad43d7999a3cdbfb040b0f2dec282eae91ff8fe6ad26fdd19087121ce7\",\"license\":\"UNLICENSED\"},\"contracts/precompile-usages/PCUPickValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUPickValidatorSet is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of picking validator set\\n function precompilePickValidatorSetAddress() public view virtual returns (address) {\\n return address(0x68);\\n }\\n\\n /**\\n * @dev Sorts and arranges to return a new validator set.\\n *\\n * Note: The recover process is done by pre-compiled contract. This function is marked as\\n * virtual for implementing mocking contract for testing purpose.\\n */\\n function _pcPickValidatorSet(\\n address[] memory _candidates,\\n uint256[] memory _weights,\\n uint256[] memory _trustedWeights,\\n uint256 _maxValidatorNumber,\\n uint256 _maxPrioritizedValidatorNumber\\n ) internal view virtual returns (address[] memory _result, uint256 _newValidatorCount) {\\n address _smc = precompilePickValidatorSetAddress();\\n bytes memory _payload = abi.encodeWithSignature(\\n \\\"pickValidatorSet(address[],uint256[],uint256[],uint256,uint256)\\\",\\n _candidates,\\n _weights,\\n _trustedWeights,\\n _maxValidatorNumber,\\n _maxPrioritizedValidatorNumber\\n );\\n bool _success = true;\\n\\n uint256 _payloadLength = _payload.length;\\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\\n\\n assembly {\\n let _payloadStart := add(_payload, 0x20)\\n\\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\\n _success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n _success := 0\\n }\\n\\n _result := add(_result, 0x20)\\n }\\n\\n if (!_success) revert ErrCallPrecompiled();\\n\\n _newValidatorCount = _result.length;\\n }\\n}\\n\",\"keccak256\":\"0xcb57a021897a773d11be9d98a195e0653f2124b7e95e84c4832b57d9d36d67e1\",\"license\":\"MIT\"},\"contracts/precompile-usages/PCUSortValidators.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUSortValidators is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of sorting validators\\n function precompileSortValidatorsAddress() public view virtual returns (address) {\\n return address(0x66);\\n }\\n\\n /**\\n * @dev Sorts candidates descending by their weights by calling precompile contract.\\n *\\n * Note: This function is marked as virtual for being wrapping in mock contract for testing purpose.\\n */\\n function _pcSortCandidates(address[] memory _candidates, uint256[] memory _weights)\\n internal\\n view\\n virtual\\n returns (address[] memory _result)\\n {\\n address _smc = precompileSortValidatorsAddress();\\n bool _success = true;\\n\\n bytes memory _payload = abi.encodeWithSignature(\\\"sortValidators(address[],uint256[])\\\", _candidates, _weights);\\n uint256 _payloadLength = _payload.length;\\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\\n\\n assembly {\\n let _payloadStart := add(_payload, 0x20)\\n\\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\\n _success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n _success := 0\\n }\\n\\n _result := add(_result, 0x20)\\n }\\n\\n if (!_success) revert ErrCallPrecompiled();\\n }\\n}\\n\",\"keccak256\":\"0xc779a5a5e29fb4416450b2eb6608a09e2cf63f6d9af5b2c1eec130dd16b0d22a\",\"license\":\"MIT\"},\"contracts/precompile-usages/PrecompiledUsage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PrecompiledUsage {\\n /// @dev Error of call to precompile fails.\\n error ErrCallPrecompiled();\\n}\\n\",\"keccak256\":\"0x76facc3f3a8dd573c826bbbfedaa5cd8ef30963fbabd8c163c0c72b6efea5551\",\"license\":\"MIT\"},\"contracts/ronin/validator/CandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasStakingContract.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../interfaces/validator/ICandidateManager.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\n\\nabstract contract CandidateManager is ICandidateManager, PercentageConsumer, HasStakingContract {\\n /// @dev Maximum number of validator candidate\\n uint256 private _maxValidatorCandidate;\\n\\n /// @dev The validator candidate array\\n address[] internal _candidates;\\n /// @dev Mapping from candidate consensus address => bitwise negation of validator index in `_candidates`\\n mapping(address => uint256) internal _candidateIndex;\\n /// @dev Mapping from candidate consensus address => their info\\n mapping(address => ValidatorCandidate) internal _candidateInfo;\\n\\n /**\\n * @dev The minimum offset in day from current date to the effective date of a new commission schedule.\\n * Value of 1 means the change gets affected at the beginning of the following day.\\n **/\\n uint256 internal _minEffectiveDaysOnwards;\\n /// @dev Mapping from candidate consensus address => schedule commission change.\\n mapping(address => CommissionSchedule) internal _candidateCommissionChangeSchedule;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] private ______gap;\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function maxValidatorCandidate() public view override returns (uint256) {\\n return _maxValidatorCandidate;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function minEffectiveDaysOnwards() external view override returns (uint256) {\\n return _minEffectiveDaysOnwards;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function setMaxValidatorCandidate(uint256 _number) external override onlyAdmin {\\n _setMaxValidatorCandidate(_number);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external override onlyAdmin {\\n _setMinEffectiveDaysOnwards(_numOfDays);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function execApplyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external override onlyStakingContract {\\n uint256 _length = _candidates.length;\\n if (_length >= maxValidatorCandidate()) revert ErrExceedsMaxNumberOfCandidate();\\n if (isValidatorCandidate(_consensusAddr)) revert ErrExistentCandidate();\\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\\n\\n for (uint _i = 0; _i < _candidates.length; _i++) {\\n ValidatorCandidate storage existentInfo = _candidateInfo[_candidates[_i]];\\n if (_candidateAdmin == existentInfo.admin) revert ErrExistentCandidateAdmin(_candidateAdmin);\\n if (_treasuryAddr == existentInfo.treasuryAddr) revert ErrExistentTreasury(_treasuryAddr);\\n if (_bridgeOperatorAddr == existentInfo.bridgeOperatorAddr) revert ErrExistentBridgeOperator(_bridgeOperatorAddr);\\n }\\n\\n _candidateIndex[_consensusAddr] = ~_length;\\n _candidates.push(_consensusAddr);\\n\\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\\n _info.admin = _candidateAdmin;\\n _info.consensusAddr = _consensusAddr;\\n _info.treasuryAddr = _treasuryAddr;\\n _info.bridgeOperatorAddr = _bridgeOperatorAddr;\\n _info.commissionRate = _commissionRate;\\n emit CandidateGranted(_consensusAddr, _treasuryAddr, _candidateAdmin, _bridgeOperatorAddr);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function execRequestRenounceCandidate(address _consensusAddr, uint256 _secsLeft)\\n external\\n override\\n onlyStakingContract\\n {\\n if (_isTrustedOrg(_consensusAddr)) revert ErrTrustedOrgCannotRenounce();\\n\\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\\n if (_info.revokingTimestamp != 0) revert ErrAlreadyRequestedRevokingCandidate();\\n _setRevokingTimestamp(_info, block.timestamp + _secsLeft);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external override onlyStakingContract {\\n if (_candidateCommissionChangeSchedule[_consensusAddr].effectiveTimestamp != 0) {\\n revert ErrAlreadyRequestedUpdatingCommissionRate();\\n }\\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\\n if (_effectiveDaysOnwards < _minEffectiveDaysOnwards) revert ErrInvalidEffectiveDaysOnwards();\\n\\n CommissionSchedule storage _schedule = _candidateCommissionChangeSchedule[_consensusAddr];\\n uint256 _effectiveTimestamp = ((block.timestamp / 1 days) + _effectiveDaysOnwards) * 1 days;\\n _schedule.effectiveTimestamp = _effectiveTimestamp;\\n _schedule.commissionRate = _commissionRate;\\n\\n emit CommissionRateUpdateScheduled(_consensusAddr, _effectiveTimestamp, _commissionRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function isValidatorCandidate(address _addr) public view override returns (bool) {\\n return _candidateIndex[_addr] != 0;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getCandidateInfos() external view override returns (ValidatorCandidate[] memory _list) {\\n _list = new ValidatorCandidate[](_candidates.length);\\n for (uint _i = 0; _i < _list.length; _i++) {\\n _list[_i] = _candidateInfo[_candidates[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getCandidateInfo(address _candidate) external view override returns (ValidatorCandidate memory) {\\n if (!isValidatorCandidate(_candidate)) revert ErrNonExistentCandidate();\\n return _candidateInfo[_candidate];\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getValidatorCandidates() public view override returns (address[] memory) {\\n return _candidates;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getCommissionChangeSchedule(address _candidate) external view override returns (CommissionSchedule memory) {\\n return _candidateCommissionChangeSchedule[_candidate];\\n }\\n\\n /**\\n * @dev Removes unsastisfied candidates, the ones who have insufficient minimum candidate staking amount,\\n * or the ones who requested to renounce their candidate role.\\n *\\n * Emits the event `CandidatesRevoked` when a candidate is revoked.\\n *\\n */\\n function _syncCandidateSet(uint256 _nextPeriod) internal returns (address[] memory _unsatisfiedCandidates) {\\n IStaking _staking = _stakingContract;\\n uint256 _waitingSecsToRevoke = _staking.waitingSecsToRevoke();\\n uint256 _minStakingAmount = _staking.minValidatorStakingAmount();\\n uint256[] memory _selfStakings = _staking.getManySelfStakings(_candidates);\\n\\n uint256 _length = _candidates.length;\\n uint256 _unsatisfiedCount;\\n _unsatisfiedCandidates = new address[](_length);\\n\\n {\\n uint256 _i;\\n address _addr;\\n ValidatorCandidate storage _info;\\n while (_i < _length) {\\n _addr = _candidates[_i];\\n _info = _candidateInfo[_addr];\\n\\n // Checks for under-balance status of candidates\\n bool _hasTopupDeadline = _info.topupDeadline != 0;\\n if (_selfStakings[_i] < _minStakingAmount) {\\n // Updates deadline on the first time unsatisfied the staking amount condition\\n if (!_hasTopupDeadline) {\\n uint256 _topupDeadline = block.timestamp + _waitingSecsToRevoke;\\n _info.topupDeadline = _topupDeadline;\\n emit CandidateTopupDeadlineUpdated(_addr, _topupDeadline);\\n }\\n } else if (_hasTopupDeadline) {\\n // Removes the deadline if the staking amount condition is satisfied\\n delete _info.topupDeadline;\\n emit CandidateTopupDeadlineUpdated(_addr, 0);\\n }\\n\\n // Removes unsastisfied candidates\\n bool _revokingActivated = (_info.revokingTimestamp != 0 && _info.revokingTimestamp <= block.timestamp) ||\\n _emergencyExitLockedFundReleased(_addr);\\n bool _topupDeadlineMissed = _info.topupDeadline != 0 && _info.topupDeadline <= block.timestamp;\\n if (_revokingActivated || _topupDeadlineMissed) {\\n _selfStakings[_i] = _selfStakings[--_length];\\n _unsatisfiedCandidates[_unsatisfiedCount++] = _addr;\\n _removeCandidate(_addr);\\n continue;\\n }\\n\\n // Checks for schedule of commission change and updates commission rate\\n uint256 _scheduleTimestamp = _candidateCommissionChangeSchedule[_addr].effectiveTimestamp;\\n if (_scheduleTimestamp != 0 && _scheduleTimestamp <= block.timestamp) {\\n uint256 _commisionRate = _candidateCommissionChangeSchedule[_addr].commissionRate;\\n delete _candidateCommissionChangeSchedule[_addr];\\n _info.commissionRate = _commisionRate;\\n emit CommissionRateUpdated(_addr, _commisionRate);\\n }\\n\\n _i++;\\n }\\n }\\n\\n if (_unsatisfiedCount > 0) {\\n assembly {\\n mstore(_unsatisfiedCandidates, _unsatisfiedCount)\\n }\\n emit CandidatesRevoked(_unsatisfiedCandidates);\\n _staking.execDeprecatePools(_unsatisfiedCandidates, _nextPeriod);\\n }\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view override returns (bool) {\\n return _candidateInfo[_candidate].admin == _admin;\\n }\\n\\n /**\\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\\n */\\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address) {\\n return _candidateInfo[_consensusAddr].bridgeOperatorAddr;\\n }\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function _setMaxValidatorCandidate(uint256 _threshold) internal {\\n _maxValidatorCandidate = _threshold;\\n emit MaxValidatorCandidateUpdated(_threshold);\\n }\\n\\n /**\\n * @dev Sets the minimum number of days onwards to the effective date of commission rate change.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function _setMinEffectiveDaysOnwards(uint256 _numOfDays) internal {\\n if (_numOfDays < 1) revert ErrInvalidMinEffectiveDaysOnwards();\\n _minEffectiveDaysOnwards = _numOfDays;\\n emit MinEffectiveDaysOnwardsUpdated(_numOfDays);\\n }\\n\\n /**\\n * @dev Removes the candidate.\\n */\\n function _removeCandidate(address _addr) internal virtual {\\n uint256 _idx = _candidateIndex[_addr];\\n if (_idx == 0) {\\n return;\\n }\\n\\n delete _candidateInfo[_addr];\\n delete _candidateIndex[_addr];\\n delete _candidateCommissionChangeSchedule[_addr];\\n\\n address _lastCandidate = _candidates[_candidates.length - 1];\\n if (_lastCandidate != _addr) {\\n _candidateIndex[_lastCandidate] = _idx;\\n _candidates[~_idx] = _lastCandidate;\\n }\\n\\n _candidates.pop();\\n }\\n\\n /**\\n * @dev Sets timestamp to revoke a candidate.\\n */\\n function _setRevokingTimestamp(ValidatorCandidate storage _candidate, uint256 _timestamp) internal {\\n if (!isValidatorCandidate(_candidate.consensusAddr)) revert ErrNonExistentCandidate();\\n _candidate.revokingTimestamp = _timestamp;\\n emit CandidateRevokingTimestampUpdated(_candidate.consensusAddr, _timestamp);\\n }\\n\\n /**\\n * @dev Returns a flag indicating whether the fund is unlocked.\\n */\\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual returns (bool);\\n\\n /**\\n * @dev Returns whether the consensus address is a trusted org or not.\\n */\\n function _isTrustedOrg(address _consensusAddr) internal virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xc0c0a923c6315c40160ba4c6ad5eb006e3adc50bdbcbabc09018459e9da826c9\",\"license\":\"MIT\"},\"contracts/ronin/validator/CoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasBridgeTrackingContract.sol\\\";\\nimport \\\"../../extensions/collections/HasMaintenanceContract.sol\\\";\\nimport \\\"../../extensions/collections/HasSlashIndicatorContract.sol\\\";\\nimport \\\"../../extensions/collections/HasStakingVestingContract.sol\\\";\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../interfaces/validator/ICoinbaseExecution.sol\\\";\\nimport \\\"../../libraries/EnumFlags.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"../../precompile-usages/PCUSortValidators.sol\\\";\\nimport \\\"../../precompile-usages/PCUPickValidatorSet.sol\\\";\\nimport \\\"./storage-fragments/CommonStorage.sol\\\";\\nimport \\\"./CandidateManager.sol\\\";\\nimport \\\"./EmergencyExit.sol\\\";\\n\\nabstract contract CoinbaseExecution is\\n ICoinbaseExecution,\\n RONTransferHelper,\\n PCUSortValidators,\\n PCUPickValidatorSet,\\n HasStakingVestingContract,\\n HasBridgeTrackingContract,\\n HasMaintenanceContract,\\n HasSlashIndicatorContract,\\n EmergencyExit\\n{\\n using EnumFlags for EnumFlags.ValidatorFlag;\\n\\n modifier onlyCoinbase() {\\n if (msg.sender != block.coinbase) revert ErrCallerMustBeCoinbase();\\n _;\\n }\\n\\n modifier whenEpochEnding() {\\n if (!epochEndingAt(block.number)) revert ErrAtEndOfEpochOnly();\\n _;\\n }\\n\\n modifier oncePerEpoch() {\\n if (epochOf(_lastUpdatedBlock) >= epochOf(block.number)) revert ErrAlreadyWrappedEpoch();\\n _lastUpdatedBlock = block.number;\\n _;\\n }\\n\\n /**\\n * @inheritdoc ICoinbaseExecution\\n */\\n function submitBlockReward() external payable override onlyCoinbase {\\n uint256 _submittedReward = msg.value;\\n address _coinbaseAddr = msg.sender;\\n bool _requestForBlockProducer = isBlockProducer(_coinbaseAddr) &&\\n !_jailed(_coinbaseAddr) &&\\n !_miningRewardDeprecated(_coinbaseAddr, currentPeriod());\\n bool _requestForBridgeOperator = true;\\n\\n (, uint256 _blockProducerBonus, uint256 _bridgeOperatorBonus) = _stakingVestingContract.requestBonus(\\n _requestForBlockProducer,\\n _requestForBridgeOperator\\n );\\n\\n _totalBridgeReward += _bridgeOperatorBonus;\\n\\n // Deprecates reward for non-validator or slashed validator\\n if (!_requestForBlockProducer) {\\n _totalDeprecatedReward += _submittedReward;\\n emit BlockRewardDeprecated(_coinbaseAddr, _submittedReward, BlockRewardDeprecatedType.UNAVAILABILITY);\\n return;\\n }\\n\\n emit BlockRewardSubmitted(_coinbaseAddr, _submittedReward, _blockProducerBonus);\\n\\n uint256 _period = currentPeriod();\\n uint256 _reward = _submittedReward + _blockProducerBonus;\\n uint256 _cutOffReward;\\n if (_miningRewardBailoutCutOffAtPeriod[_coinbaseAddr][_period]) {\\n (, , , uint256 _cutOffPercentage) = _slashIndicatorContract.getCreditScoreConfigs();\\n _cutOffReward = (_reward * _cutOffPercentage) / _MAX_PERCENTAGE;\\n _totalDeprecatedReward += _cutOffReward;\\n emit BlockRewardDeprecated(_coinbaseAddr, _cutOffReward, BlockRewardDeprecatedType.AFTER_BAILOUT);\\n }\\n\\n _reward -= _cutOffReward;\\n uint256 _maxRate = _stakingContract.maxCommissionRate();\\n uint256 _rate = Math.min(_candidateInfo[_coinbaseAddr].commissionRate, _maxRate);\\n uint256 _miningAmount = (_rate * _reward) / _MAX_PERCENTAGE;\\n _miningReward[_coinbaseAddr] += _miningAmount;\\n\\n uint256 _delegatingAmount = _reward - _miningAmount;\\n _delegatingReward[_coinbaseAddr] += _delegatingAmount;\\n }\\n\\n /**\\n * @inheritdoc ICoinbaseExecution\\n */\\n function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {\\n uint256 _newPeriod = _computePeriod(block.timestamp);\\n bool _periodEnding = _isPeriodEnding(_newPeriod);\\n\\n address[] memory _currentValidators = getValidators();\\n address[] memory _revokedCandidates;\\n uint256 _epoch = epochOf(block.number);\\n uint256 _nextEpoch = _epoch + 1;\\n uint256 _lastPeriod = currentPeriod();\\n\\n if (_periodEnding) {\\n _syncBridgeOperatingReward(_lastPeriod, _currentValidators);\\n (\\n uint256 _totalDelegatingReward,\\n uint256[] memory _delegatingRewards\\n ) = _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(_lastPeriod, _currentValidators);\\n _settleAndTransferDelegatingRewards(_lastPeriod, _currentValidators, _totalDelegatingReward, _delegatingRewards);\\n _tryRecycleLockedFundsFromEmergencyExits();\\n _recycleDeprecatedRewards();\\n _slashIndicatorContract.updateCreditScores(_currentValidators, _lastPeriod);\\n (_currentValidators, _revokedCandidates) = _syncValidatorSet(_newPeriod);\\n if (_revokedCandidates.length > 0) {\\n _slashIndicatorContract.execResetCreditScores(_revokedCandidates);\\n }\\n _currentPeriodStartAtBlock = block.number + 1;\\n }\\n _revampRoles(_newPeriod, _nextEpoch, _currentValidators);\\n emit WrappedUpEpoch(_lastPeriod, _epoch, _periodEnding);\\n _periodOf[_nextEpoch] = _newPeriod;\\n _lastUpdatedPeriod = _newPeriod;\\n }\\n\\n /**\\n * @dev This loop over the all current validators to sync the bridge operating reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _syncBridgeOperatingReward(uint256 _lastPeriod, address[] memory _currentValidators) internal {\\n IBridgeTracking _bridgeTracking = _bridgeTrackingContract;\\n uint256 _totalBridgeBallots = _bridgeTracking.totalBallots(_lastPeriod);\\n uint256 _totalBridgeVotes = _bridgeTracking.totalVotes(_lastPeriod);\\n address[] memory _correspondingBridgeOperators = getBridgeOperatorsOf(_currentValidators);\\n uint256[] memory _bridgeBallots = _bridgeTracking.getManyTotalBallots(_lastPeriod, _correspondingBridgeOperators);\\n (\\n uint256 _missingVotesRatioTier1,\\n uint256 _missingVotesRatioTier2,\\n uint256 _jailDurationForMissingVotesRatioTier2,\\n uint256 _skipBridgeOperatorSlashingThreshold\\n ) = _slashIndicatorContract.getBridgeOperatorSlashingConfigs();\\n for (uint _i = 0; _i < _currentValidators.length; _i++) {\\n _updateValidatorRewardBaseOnBridgeOperatingPerformance(\\n _lastPeriod,\\n _currentValidators[_i],\\n _bridgeBallots[_i],\\n _totalBridgeVotes,\\n _totalBridgeBallots,\\n _missingVotesRatioTier1,\\n _missingVotesRatioTier2,\\n _jailDurationForMissingVotesRatioTier2,\\n _skipBridgeOperatorSlashingThreshold\\n );\\n }\\n }\\n\\n /**\\n * @dev Updates validator reward based on the corresponding bridge operator performance.\\n */\\n function _updateValidatorRewardBaseOnBridgeOperatingPerformance(\\n uint256 _period,\\n address _validator,\\n uint256 _validatorBallots,\\n uint256 _totalVotes,\\n uint256 _totalBallots,\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipBridgeOperatorSlashingThreshold\\n ) internal {\\n // Shares equally in case the bridge has nothing to votes\\n bool _emptyBallot = _totalBallots == 0;\\n if (_emptyBallot && _totalVotes == 0) {\\n _bridgeOperatingReward[_validator] = _totalBridgeReward / totalBridgeOperators();\\n return;\\n } else if (_emptyBallot) {\\n return;\\n }\\n\\n // Skips slashing in case the total number of votes is too small\\n if (_totalVotes <= _skipBridgeOperatorSlashingThreshold) {\\n _bridgeOperatingReward[_validator] = (_totalBridgeReward * _validatorBallots) / _totalBallots;\\n return;\\n }\\n\\n uint256 _votedRatio = (_validatorBallots * _MAX_PERCENTAGE) / _totalVotes;\\n uint256 _missedRatio = _MAX_PERCENTAGE - _votedRatio;\\n if (_missedRatio >= _ratioTier2) {\\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\\n _miningRewardDeprecatedAtPeriod[_validator][_period] = true;\\n\\n // Cannot saving gas by temp variable here due to too deep stack.\\n _blockProducerJailedBlock[_validator] = Math.max(\\n block.number + _jailDurationTier2,\\n _blockProducerJailedBlock[_validator]\\n );\\n _cannotBailoutUntilBlock[_validator] = Math.max(\\n block.number + _jailDurationTier2,\\n _cannotBailoutUntilBlock[_validator]\\n );\\n\\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 2, _period);\\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, true, true);\\n } else if (_missedRatio >= _ratioTier1) {\\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 1, _period);\\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, false, true);\\n } else if (_totalBallots > 0) {\\n _bridgeOperatingReward[_validator] = (_totalBridgeReward * _validatorBallots) / _totalBallots;\\n }\\n }\\n\\n /**\\n * @dev This loops over all current validators to:\\n * - Update delegating reward for and calculate total delegating rewards to be sent to the staking contract,\\n * - Distribute the reward of block producers and bridge operators to their treasury addresses,\\n * - Update the total deprecated reward if the two previous conditions do not sastify.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(\\n uint256 _lastPeriod,\\n address[] memory _currentValidators\\n ) private returns (uint256 _totalDelegatingReward, uint256[] memory _delegatingRewards) {\\n address _consensusAddr;\\n address payable _treasury;\\n _delegatingRewards = new uint256[](_currentValidators.length);\\n for (uint _i = 0; _i < _currentValidators.length; _i++) {\\n _consensusAddr = _currentValidators[_i];\\n _treasury = _candidateInfo[_consensusAddr].treasuryAddr;\\n\\n if (!_bridgeRewardDeprecated(_consensusAddr, _lastPeriod)) {\\n _distributeBridgeOperatingReward(_consensusAddr, _candidateInfo[_consensusAddr].bridgeOperatorAddr, _treasury);\\n } else {\\n _totalDeprecatedReward += _bridgeOperatingReward[_consensusAddr];\\n }\\n\\n if (!_jailed(_consensusAddr) && !_miningRewardDeprecated(_consensusAddr, _lastPeriod)) {\\n _totalDelegatingReward += _delegatingReward[_consensusAddr];\\n _delegatingRewards[_i] = _delegatingReward[_consensusAddr];\\n _distributeMiningReward(_consensusAddr, _treasury);\\n } else {\\n _totalDeprecatedReward += _miningReward[_consensusAddr] + _delegatingReward[_consensusAddr];\\n }\\n\\n delete _delegatingReward[_consensusAddr];\\n delete _miningReward[_consensusAddr];\\n delete _bridgeOperatingReward[_consensusAddr];\\n }\\n delete _totalBridgeReward;\\n }\\n\\n /**\\n * @dev Distributes bonus of staking vesting and mining fee for the block producer.\\n *\\n * Emits the `MiningRewardDistributed` once the reward is distributed successfully.\\n * Emits the `MiningRewardDistributionFailed` once the contract fails to distribute reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _distributeMiningReward(address _consensusAddr, address payable _treasury) private {\\n uint256 _amount = _miningReward[_consensusAddr];\\n if (_amount > 0) {\\n if (_unsafeSendRON(_treasury, _amount, 3500)) {\\n emit MiningRewardDistributed(_consensusAddr, _treasury, _amount);\\n return;\\n }\\n\\n emit MiningRewardDistributionFailed(_consensusAddr, _treasury, _amount, address(this).balance);\\n }\\n }\\n\\n /**\\n * @dev Distribute bonus of staking vesting for the bridge operator.\\n *\\n * Emits the `BridgeOperatorRewardDistributed` once the reward is distributed successfully.\\n * Emits the `BridgeOperatorRewardDistributionFailed` once the contract fails to distribute reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _distributeBridgeOperatingReward(\\n address _consensusAddr,\\n address _bridgeOperator,\\n address payable _treasury\\n ) private {\\n uint256 _amount = _bridgeOperatingReward[_consensusAddr];\\n if (_amount > 0) {\\n if (_unsafeSendRON(_treasury, _amount, 3500)) {\\n emit BridgeOperatorRewardDistributed(_consensusAddr, _bridgeOperator, _treasury, _amount);\\n return;\\n }\\n\\n emit BridgeOperatorRewardDistributionFailed(\\n _consensusAddr,\\n _bridgeOperator,\\n _treasury,\\n _amount,\\n address(this).balance\\n );\\n }\\n }\\n\\n /**\\n * @dev Helper function to settle rewards for delegators of `_currentValidators` at the end of each period,\\n * then transfer the rewards from this contract to the staking contract, in order to finalize a period.\\n *\\n * Emits the `StakingRewardDistributed` once the reward is distributed successfully.\\n * Emits the `StakingRewardDistributionFailed` once the contract fails to distribute reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _settleAndTransferDelegatingRewards(\\n uint256 _period,\\n address[] memory _currentValidators,\\n uint256 _totalDelegatingReward,\\n uint256[] memory _delegatingRewards\\n ) private {\\n IStaking _staking = _stakingContract;\\n if (_totalDelegatingReward > 0) {\\n if (_unsafeSendRON(payable(address(_staking)), _totalDelegatingReward)) {\\n _staking.execRecordRewards(_currentValidators, _delegatingRewards, _period);\\n emit StakingRewardDistributed(_totalDelegatingReward, _currentValidators, _delegatingRewards);\\n return;\\n }\\n\\n emit StakingRewardDistributionFailed(\\n _totalDelegatingReward,\\n _currentValidators,\\n _delegatingRewards,\\n address(this).balance\\n );\\n }\\n }\\n\\n /**\\n * @dev Transfer the deprecated rewards e.g. the rewards that get deprecated when validator is slashed/maintained,\\n * to the staking vesting contract\\n *\\n * Note: This method should be called once in the end of each period.\\n */\\n function _recycleDeprecatedRewards() private {\\n uint256 _withdrawAmount = _totalDeprecatedReward;\\n\\n if (_withdrawAmount != 0) {\\n address _withdrawTarget = stakingVestingContract();\\n\\n delete _totalDeprecatedReward;\\n\\n (bool _success, ) = _withdrawTarget.call{ value: _withdrawAmount }(\\n abi.encodeWithSelector(IStakingVesting.receiveRON.selector)\\n );\\n\\n if (_success) {\\n emit DeprecatedRewardRecycled(_withdrawTarget, _withdrawAmount);\\n } else {\\n emit DeprecatedRewardRecycleFailed(_withdrawTarget, _withdrawAmount, address(this).balance);\\n }\\n }\\n }\\n\\n /**\\n * @dev Updates the validator set based on the validator candidates from the Staking contract.\\n *\\n * Emits the `ValidatorSetUpdated` event.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _syncValidatorSet(uint256 _newPeriod)\\n private\\n returns (address[] memory _newValidators, address[] memory _unsastifiedCandidates)\\n {\\n _unsastifiedCandidates = _syncCandidateSet(_newPeriod);\\n uint256[] memory _weights = _stakingContract.getManyStakingTotals(_candidates);\\n uint256[] memory _trustedWeights = _roninTrustedOrganizationContract.getConsensusWeights(_candidates);\\n uint256 _newValidatorCount;\\n (_newValidators, _newValidatorCount) = _pcPickValidatorSet(\\n _candidates,\\n _weights,\\n _trustedWeights,\\n _maxValidatorNumber,\\n _maxPrioritizedValidatorNumber\\n );\\n _setNewValidatorSet(_newValidators, _newValidatorCount, _newPeriod);\\n }\\n\\n /**\\n * @dev Private helper function helps writing the new validator set into the contract storage.\\n *\\n * Emits the `ValidatorSetUpdated` event.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _setNewValidatorSet(\\n address[] memory _newValidators,\\n uint256 _newValidatorCount,\\n uint256 _newPeriod\\n ) private {\\n // Remove exceeding validators in the current set\\n for (uint256 _i = _newValidatorCount; _i < validatorCount; _i++) {\\n delete _validatorMap[_validators[_i]];\\n delete _validators[_i];\\n }\\n\\n // Remove flag for all validator in the current set\\n for (uint _i = 0; _i < _newValidatorCount; _i++) {\\n delete _validatorMap[_validators[_i]];\\n }\\n\\n // Update new validator set and set flag correspondingly.\\n for (uint256 _i = 0; _i < _newValidatorCount; _i++) {\\n address _newValidator = _newValidators[_i];\\n _validatorMap[_newValidator] = EnumFlags.ValidatorFlag.Both;\\n _validators[_i] = _newValidator;\\n }\\n\\n validatorCount = _newValidatorCount;\\n emit ValidatorSetUpdated(_newPeriod, _newValidators);\\n }\\n\\n /**\\n * @dev Activate/Deactivate the validators from producing blocks, based on their in jail status and maintenance status.\\n *\\n * Requirements:\\n * - This method is called at the end of each epoch\\n *\\n * Emits the `BlockProducerSetUpdated` event.\\n * Emits the `BridgeOperatorSetUpdated` event.\\n *\\n */\\n function _revampRoles(\\n uint256 _newPeriod,\\n uint256 _nextEpoch,\\n address[] memory _currentValidators\\n ) private {\\n bool[] memory _maintainedList = _maintenanceContract.checkManyMaintained(_currentValidators, block.number + 1);\\n\\n for (uint _i = 0; _i < _currentValidators.length; _i++) {\\n address _validator = _currentValidators[_i];\\n bool _emergencyExitRequested = block.timestamp <= _emergencyExitJailedTimestamp[_validator];\\n bool _isProducerBefore = isBlockProducer(_validator);\\n bool _isProducerAfter = !(_jailed(_validator) || _maintainedList[_i] || _emergencyExitRequested);\\n\\n if (!_isProducerBefore && _isProducerAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BlockProducer);\\n } else if (_isProducerBefore && !_isProducerAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BlockProducer);\\n }\\n\\n bool _isBridgeOperatorBefore = isOperatingBridge(_validator);\\n bool _isBridgeOperatorAfter = !_emergencyExitRequested;\\n if (!_isBridgeOperatorBefore && _isBridgeOperatorAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BridgeOperator);\\n } else if (_isBridgeOperatorBefore && !_isBridgeOperatorAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BridgeOperator);\\n }\\n }\\n\\n emit BlockProducerSetUpdated(_newPeriod, _nextEpoch, getBlockProducers());\\n emit BridgeOperatorSetUpdated(_newPeriod, _nextEpoch, getBridgeOperators());\\n }\\n\\n /**\\n * @dev Override `CandidateManager-_isTrustedOrg`.\\n */\\n function _isTrustedOrg(address _consensusAddr) internal view override returns (bool) {\\n return _roninTrustedOrganizationContract.getConsensusWeight(_consensusAddr) > 0;\\n }\\n}\\n\",\"keccak256\":\"0x401382e40fd85a6eaa98e6b622e9743c43dfc7f8d2aec6f2bda006435c5a79c6\",\"license\":\"MIT\"},\"contracts/ronin/validator/EmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../interfaces/IRoninGovernanceAdmin.sol\\\";\\nimport \\\"../../interfaces/validator/IEmergencyExit.sol\\\";\\nimport \\\"./storage-fragments/CommonStorage.sol\\\";\\nimport \\\"./CandidateManager.sol\\\";\\n\\nabstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateManager, CommonStorage {\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function emergencyExitLockedAmount() external view returns (uint256) {\\n return _emergencyExitLockedAmount;\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function emergencyExpiryDuration() external view returns (uint256) {\\n return _emergencyExpiryDuration;\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external onlyStakingContract {\\n EmergencyExitInfo storage _info = _exitInfo[_consensusAddr];\\n if (_info.recyclingAt != 0) revert ErrAlreadyRequestedEmergencyExit();\\n\\n uint256 _revokingTimestamp = block.timestamp + _secLeftToRevoke;\\n _setRevokingTimestamp(_candidateInfo[_consensusAddr], _revokingTimestamp);\\n _emergencyExitJailedTimestamp[_consensusAddr] = _revokingTimestamp;\\n\\n uint256 _deductedAmount = _stakingContract.execDeductStakingAmount(_consensusAddr, _emergencyExitLockedAmount);\\n if (_deductedAmount > 0) {\\n uint256 _recyclingAt = block.timestamp + _emergencyExpiryDuration;\\n _lockedConsensusList.push(_consensusAddr);\\n _info.lockedAmount = _deductedAmount;\\n _info.recyclingAt = _recyclingAt;\\n IRoninGovernanceAdmin(_getAdmin()).createEmergencyExitPoll(\\n _consensusAddr,\\n _candidateInfo[_consensusAddr].treasuryAddr,\\n block.timestamp,\\n _recyclingAt\\n );\\n }\\n emit EmergencyExitRequested(_consensusAddr, _deductedAmount);\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external onlyAdmin {\\n _setEmergencyExitLockedAmount(_emergencyExitLockedAmount);\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external onlyAdmin {\\n _setEmergencyExpiryDuration(_emergencyExpiryDuration);\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient)\\n external\\n onlyAdmin\\n {\\n if (_exitInfo[_consensusAddr].recyclingAt == 0) {\\n return;\\n }\\n\\n uint256 _length = _lockedConsensusList.length;\\n uint256 _index = _length;\\n\\n for (uint _i = 0; _i < _length; _i++) {\\n if (_lockedConsensusList[_i] == _consensusAddr) {\\n _index = _i;\\n break;\\n }\\n }\\n\\n // The locked amount might be recycled\\n if (_index == _length) {\\n return;\\n }\\n\\n uint256 _amount = _exitInfo[_consensusAddr].lockedAmount;\\n if (_amount > 0) {\\n delete _exitInfo[_consensusAddr];\\n if (_length > 1) {\\n _lockedConsensusList[_index] = _lockedConsensusList[_length - 1];\\n }\\n _lockedConsensusList.pop();\\n\\n _lockedFundReleased[_consensusAddr] = true;\\n if (_unsafeSendRON(_recipient, _amount, 3500)) {\\n emit EmergencyExitLockedFundReleased(_consensusAddr, _recipient, _amount);\\n return;\\n }\\n\\n emit EmergencyExitLockedFundReleasingFailed(_consensusAddr, _recipient, _amount, address(this).balance);\\n }\\n }\\n\\n /**\\n * @dev Tries to recycle the locked funds from emergency exit requests.\\n */\\n function _tryRecycleLockedFundsFromEmergencyExits() internal {\\n uint256 _length = _lockedConsensusList.length;\\n\\n uint256 _i;\\n address _addr;\\n EmergencyExitInfo storage _info;\\n\\n while (_i < _length) {\\n _addr = _lockedConsensusList[_i];\\n _info = _exitInfo[_addr];\\n\\n if (_info.recyclingAt <= block.timestamp) {\\n _totalDeprecatedReward += _info.lockedAmount;\\n\\n delete _exitInfo[_addr];\\n if (--_length > 0) {\\n _lockedConsensusList[_i] = _lockedConsensusList[_length];\\n }\\n _lockedConsensusList.pop();\\n continue;\\n }\\n\\n _i++;\\n }\\n }\\n\\n /**\\n * @dev Override `CandidateManager-_emergencyExitLockedFundReleased`.\\n */\\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {\\n return _lockedFundReleased[_consensusAddr];\\n }\\n\\n /**\\n * @dev Override `CandidateManager-_removeCandidate`.\\n */\\n function _removeCandidate(address _consensusAddr) internal override {\\n delete _lockedFundReleased[_consensusAddr];\\n super._removeCandidate(_consensusAddr);\\n }\\n\\n /**\\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\\n */\\n function _bridgeOperatorOf(address _consensusAddr)\\n internal\\n view\\n virtual\\n override(CandidateManager, ValidatorInfoStorage)\\n returns (address)\\n {\\n return CandidateManager._bridgeOperatorOf(_consensusAddr);\\n }\\n\\n /**\\n * @dev See `setEmergencyExitLockedAmount.\\n */\\n function _setEmergencyExitLockedAmount(uint256 _amount) internal {\\n _emergencyExitLockedAmount = _amount;\\n emit EmergencyExitLockedAmountUpdated(_amount);\\n }\\n\\n /**\\n * @dev See `setEmergencyExpiryDuration`.\\n */\\n function _setEmergencyExpiryDuration(uint256 _duration) internal {\\n _emergencyExpiryDuration = _duration;\\n emit EmergencyExpiryDurationUpdated(_duration);\\n }\\n}\\n\",\"keccak256\":\"0x710fc39363de3b8a4659ee6dd9cb9fc68e8ac9dc24ea97f0666b087539c73c54\",\"license\":\"MIT\"},\"contracts/ronin/validator/RoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"./CoinbaseExecution.sol\\\";\\nimport \\\"./SlashingExecution.sol\\\";\\n\\ncontract RoninValidatorSet is Initializable, CoinbaseExecution, SlashingExecution {\\n constructor() {\\n _disableInitializers();\\n }\\n\\n fallback() external payable {\\n _fallback();\\n }\\n\\n receive() external payable {\\n _fallback();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __slashIndicatorContract,\\n address __stakingContract,\\n address __stakingVestingContract,\\n address __maintenanceContract,\\n address __roninTrustedOrganizationContract,\\n address __bridgeTrackingContract,\\n uint256 __maxValidatorNumber,\\n uint256 __maxValidatorCandidate,\\n uint256 __maxPrioritizedValidatorNumber,\\n uint256 __minEffectiveDaysOnwards,\\n uint256 __numberOfBlocksInEpoch,\\n // __emergencyExitConfigs[0]: emergencyExitLockedAmount\\n // __emergencyExitConfigs[1]: emergencyExpiryDuration\\n uint256[2] calldata __emergencyExitConfigs\\n ) external initializer {\\n _setSlashIndicatorContract(__slashIndicatorContract);\\n _setStakingContract(__stakingContract);\\n _setStakingVestingContract(__stakingVestingContract);\\n _setMaintenanceContract(__maintenanceContract);\\n _setBridgeTrackingContract(__bridgeTrackingContract);\\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\\n _setMaxValidatorNumber(__maxValidatorNumber);\\n _setMaxValidatorCandidate(__maxValidatorCandidate);\\n _setMaxPrioritizedValidatorNumber(__maxPrioritizedValidatorNumber);\\n _setMinEffectiveDaysOnwards(__minEffectiveDaysOnwards);\\n _setEmergencyExitLockedAmount(__emergencyExitConfigs[0]);\\n _setEmergencyExpiryDuration(__emergencyExitConfigs[1]);\\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\\n }\\n\\n /**\\n * @dev Only receives RON from staking vesting contract (for topping up bonus), and from staking contract (for transferring\\n * deducting amount on slashing).\\n */\\n function _fallback() internal view {\\n if (msg.sender != stakingVestingContract() && msg.sender != stakingContract()) revert ErrUnauthorizedReceiveRON();\\n }\\n\\n /**\\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\\n */\\n function _bridgeOperatorOf(address _consensusAddr)\\n internal\\n view\\n override(EmergencyExit, ValidatorInfoStorage)\\n returns (address)\\n {\\n return super._bridgeOperatorOf(_consensusAddr);\\n }\\n}\\n\",\"keccak256\":\"0xd7a2ac4d3a2c8edbd1bbfb1ef3549ef0a019b4c9b4f1c12f1fd07b116b1adab3\",\"license\":\"MIT\"},\"contracts/ronin/validator/SlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasSlashIndicatorContract.sol\\\";\\nimport \\\"../../extensions/collections/HasStakingContract.sol\\\";\\nimport \\\"../../interfaces/validator/ISlashingExecution.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"./storage-fragments/CommonStorage.sol\\\";\\n\\nabstract contract SlashingExecution is\\n ISlashingExecution,\\n HasSlashIndicatorContract,\\n HasStakingContract,\\n CommonStorage\\n{\\n /**\\n * @inheritdoc ISlashingExecution\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external override onlySlashIndicatorContract {\\n uint256 _period = currentPeriod();\\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = true;\\n\\n _totalDeprecatedReward += _miningReward[_validatorAddr] + _delegatingReward[_validatorAddr];\\n\\n delete _miningReward[_validatorAddr];\\n delete _delegatingReward[_validatorAddr];\\n\\n _blockProducerJailedBlock[_validatorAddr] = Math.max(_newJailedUntil, _blockProducerJailedBlock[_validatorAddr]);\\n\\n if (_slashAmount > 0) {\\n uint256 _actualAmount = _stakingContract.execDeductStakingAmount(_validatorAddr, _slashAmount);\\n _totalDeprecatedReward += _actualAmount;\\n }\\n\\n if (_cannotBailout) {\\n _cannotBailoutUntilBlock[_validatorAddr] = Math.max(_newJailedUntil, _cannotBailoutUntilBlock[_validatorAddr]);\\n }\\n\\n emit ValidatorPunished(\\n _validatorAddr,\\n _period,\\n _blockProducerJailedBlock[_validatorAddr],\\n _slashAmount,\\n true,\\n false\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashingExecution\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external override onlySlashIndicatorContract {\\n if (block.number <= _cannotBailoutUntilBlock[_validatorAddr]) revert ErrCannotBailout(_validatorAddr);\\n\\n // Note: Removing rewards of validator in `bailOut` function is not needed, since the rewards have been\\n // removed previously in the `slash` function.\\n _miningRewardBailoutCutOffAtPeriod[_validatorAddr][_period] = true;\\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = false;\\n _blockProducerJailedBlock[_validatorAddr] = block.number - 1;\\n\\n emit ValidatorUnjailed(_validatorAddr, _period);\\n }\\n}\\n\",\"keccak256\":\"0xf10b8566c1397e3dc86c6c16dcd20bf91011726b01dbff7da3a9d9a59bdee9b0\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/CommonStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../interfaces/validator/info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./JailingStorage.sol\\\";\\nimport \\\"./TimingStorage.sol\\\";\\nimport \\\"./ValidatorInfoStorage.sol\\\";\\n\\nabstract contract CommonStorage is ICommonInfo, TimingStorage, JailingStorage, ValidatorInfoStorage {\\n /// @dev Mapping from consensus address => pending reward from producing block\\n mapping(address => uint256) internal _miningReward;\\n /// @dev Mapping from consensus address => pending reward from delegating\\n mapping(address => uint256) internal _delegatingReward;\\n\\n /// @dev The total reward for bridge operators\\n uint256 internal _totalBridgeReward;\\n /// @dev Mapping from consensus address => pending reward for being bridge operator\\n mapping(address => uint256) internal _bridgeOperatingReward;\\n\\n /// @dev The deprecated reward that has not been withdrawn by admin\\n uint256 internal _totalDeprecatedReward;\\n\\n /// @dev The amount of RON to lock from a consensus address.\\n uint256 internal _emergencyExitLockedAmount;\\n /// @dev The duration that an emergency request is expired and the fund will be recycled.\\n uint256 internal _emergencyExpiryDuration;\\n /// @dev The address list of consensus addresses that being locked fund.\\n address[] internal _lockedConsensusList;\\n /// @dev Mapping from consensus => request exist info\\n mapping(address => EmergencyExitInfo) internal _exitInfo;\\n /// @dev Mapping from consensus => flag indicating whether the locked fund is released\\n mapping(address => bool) internal _lockedFundReleased;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[44] private ______gap;\\n\\n /**\\n * @inheritdoc ICommonInfo\\n */\\n function getEmergencyExitInfo(address _consensusAddr)\\n external\\n view\\n override\\n returns (EmergencyExitInfo memory _info)\\n {\\n _info = _exitInfo[_consensusAddr];\\n require(_info.recyclingAt > 0, \\\"CommonStorage: non-existent info\\\");\\n }\\n\\n /**\\n * @inheritdoc ICommonInfo\\n */\\n function totalDeprecatedReward() external view override returns (uint256) {\\n return _totalDeprecatedReward;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function epochOf(uint256 _block)\\n public\\n view\\n virtual\\n override(ITimingInfo, JailingStorage, TimingStorage)\\n returns (uint256)\\n {\\n return TimingStorage.epochOf(_block);\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function currentPeriod() public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) {\\n return TimingStorage.currentPeriod();\\n }\\n}\\n\",\"keccak256\":\"0x3eecd5f27c0e4654ceac91669b480698af93f8dfc6c7cff8f475cab76bd20c36\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/JailingStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../interfaces/validator/info-fragments/IJailingInfo.sol\\\";\\nimport \\\"./TimingStorage.sol\\\";\\n\\nabstract contract JailingStorage is IJailingInfo {\\n /// @dev Mapping from consensus address => period number => block producer has no pending reward.\\n mapping(address => mapping(uint256 => bool)) internal _miningRewardDeprecatedAtPeriod;\\n /// @dev Mapping from consensus address => period number => whether the block producer get cut off reward, due to bailout.\\n mapping(address => mapping(uint256 => bool)) internal _miningRewardBailoutCutOffAtPeriod;\\n /// @dev Mapping from consensus address => period number => block operator has no pending reward.\\n mapping(address => mapping(uint256 => bool)) internal _bridgeRewardDeprecatedAtPeriod;\\n\\n /// @dev Mapping from consensus address => the last block that the block producer is jailed.\\n mapping(address => uint256) internal _blockProducerJailedBlock;\\n /// @dev Mapping from consensus address => the last timestamp that the bridge operator is jailed.\\n mapping(address => uint256) internal _emergencyExitJailedTimestamp;\\n /// @dev Mapping from consensus address => the last block that the block producer cannot bailout.\\n mapping(address => uint256) internal _cannotBailoutUntilBlock;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] private ______gap;\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkJailed(address _addr) external view override returns (bool) {\\n return checkJailedAtBlock(_addr, block.number);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n override\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n )\\n {\\n return getJailedTimeLeftAtBlock(_addr, block.number);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) public view override returns (bool) {\\n return _jailedAtBlock(_addr, _blockNum);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n public\\n view\\n override\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n )\\n {\\n uint256 _jailedBlock = _blockProducerJailedBlock[_addr];\\n if (_jailedBlock < _blockNum) {\\n return (false, 0, 0);\\n }\\n\\n isJailed_ = true;\\n blockLeft_ = _jailedBlock - _blockNum + 1;\\n epochLeft_ = epochOf(_jailedBlock) - epochOf(_blockNum) + 1;\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkManyJailed(address[] calldata _addrList) external view override returns (bool[] memory _result) {\\n _result = new bool[](_addrList.length);\\n for (uint256 _i; _i < _addrList.length; _i++) {\\n _result[_i] = _jailed(_addrList[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkMiningRewardDeprecated(address[] calldata _blockProducers)\\n external\\n view\\n override\\n returns (bool[] memory _result)\\n {\\n _result = new bool[](_blockProducers.length);\\n uint256 _period = currentPeriod();\\n for (uint256 _i; _i < _blockProducers.length; _i++) {\\n _result[_i] = _miningRewardDeprecated(_blockProducers[_i], _period);\\n }\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address[] calldata _blockProducers, uint256 _period)\\n external\\n view\\n override\\n returns (bool[] memory _result)\\n {\\n _result = new bool[](_blockProducers.length);\\n for (uint256 _i; _i < _blockProducers.length; _i++) {\\n _result[_i] = _miningRewardDeprecated(_blockProducers[_i], _period);\\n }\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkBridgeRewardDeprecated(address _consensusAddr) external view override returns (bool _result) {\\n uint256 _period = currentPeriod();\\n return _bridgeRewardDeprecated(_consensusAddr, _period);\\n }\\n\\n /**\\n * @dev See `ITimingInfo-epochOf`\\n */\\n function epochOf(uint256 _block) public view virtual returns (uint256);\\n\\n /**\\n * @dev See `ITimingInfo-currentPeriod`\\n */\\n function currentPeriod() public view virtual returns (uint256);\\n\\n /**\\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) during the current period.\\n */\\n function _jailed(address _validatorAddr) internal view returns (bool) {\\n return _jailedAtBlock(_validatorAddr, block.number);\\n }\\n\\n /**\\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) at a specific block.\\n */\\n function _jailedAtBlock(address _validatorAddr, uint256 _blockNum) internal view returns (bool) {\\n return _blockNum <= _blockProducerJailedBlock[_validatorAddr];\\n }\\n\\n /**\\n * @dev Returns whether the block producer has no pending reward in that period.\\n */\\n function _miningRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\\n return _miningRewardDeprecatedAtPeriod[_validatorAddr][_period];\\n }\\n\\n /**\\n * @dev Returns whether the bridge operator has no pending reward in the period.\\n */\\n function _bridgeRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\\n return _bridgeRewardDeprecatedAtPeriod[_validatorAddr][_period];\\n }\\n}\\n\",\"keccak256\":\"0x2fc32e0620caf841ac519fb68b8f18cd0413eac9bc2430e20bd4c61ed298ae75\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/TimingStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../interfaces/validator/info-fragments/ITimingInfo.sol\\\";\\n\\nabstract contract TimingStorage is ITimingInfo {\\n /// @dev Length of period in seconds\\n uint256 internal constant _periodLength = 1 days;\\n\\n /// @dev The number of blocks in a epoch\\n uint256 internal _numberOfBlocksInEpoch;\\n /// @dev The last updated block\\n uint256 internal _lastUpdatedBlock;\\n /// @dev The last updated period\\n uint256 internal _lastUpdatedPeriod;\\n /// @dev The starting block of the last updated period\\n uint256 internal _currentPeriodStartAtBlock;\\n\\n /// @dev Mapping from epoch index => period index\\n mapping(uint256 => uint256) internal _periodOf;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] private ______gap;\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function getLastUpdatedBlock() external view override returns (uint256) {\\n return _lastUpdatedBlock;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function epochOf(uint256 _block) public view virtual override returns (uint256) {\\n return _block / _numberOfBlocksInEpoch + 1;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber) {\\n return (_epoch <= epochOf(block.number) || _periodOf[_epoch] > 0, _periodOf[_epoch]);\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function isPeriodEnding() external view override returns (bool) {\\n return _isPeriodEnding(_computePeriod(block.timestamp));\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function epochEndingAt(uint256 _block) public view virtual override returns (bool) {\\n return _block % _numberOfBlocksInEpoch == _numberOfBlocksInEpoch - 1;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function currentPeriod() public view virtual override returns (uint256) {\\n return _lastUpdatedPeriod;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function currentPeriodStartAtBlock() public view override returns (uint256) {\\n return _currentPeriodStartAtBlock;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function numberOfBlocksInEpoch() public view virtual override returns (uint256 _numberOfBlocks) {\\n return _numberOfBlocksInEpoch;\\n }\\n\\n /**\\n * @dev See `ITimingInfo-isPeriodEnding`\\n */\\n function _isPeriodEnding(uint256 _newPeriod) internal view virtual returns (bool) {\\n return _newPeriod > _lastUpdatedPeriod;\\n }\\n\\n /**\\n * @dev Returns the calculated period.\\n */\\n function _computePeriod(uint256 _timestamp) internal pure returns (uint256) {\\n return _timestamp / _periodLength;\\n }\\n}\\n\",\"keccak256\":\"0x57d3ff59127de2366ea3877c300962a30b70c163edc057cecf8d7be6e1ba7578\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/ValidatorInfoStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\nimport \\\"../../../extensions/collections/HasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../../interfaces/validator/info-fragments/IValidatorInfo.sol\\\";\\n\\nabstract contract ValidatorInfoStorage is IValidatorInfo, HasRoninTrustedOrganizationContract {\\n using EnumFlags for EnumFlags.ValidatorFlag;\\n\\n /// @dev The maximum number of validator.\\n uint256 internal _maxValidatorNumber;\\n\\n /// @dev The total of validators\\n uint256 public validatorCount;\\n /// @dev Mapping from validator index => validator address\\n mapping(uint256 => address) internal _validators;\\n /// @dev Mapping from address => flag indicating the validator ability: producing block, operating bridge\\n mapping(address => EnumFlags.ValidatorFlag) internal _validatorMap;\\n /// @dev The number of slot that is reserved for prioritized validators\\n uint256 internal _maxPrioritizedValidatorNumber;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getValidators() public view override returns (address[] memory _validatorList) {\\n _validatorList = new address[](validatorCount);\\n for (uint _i = 0; _i < _validatorList.length; _i++) {\\n _validatorList[_i] = _validators[_i];\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isValidator(address _addr) public view override returns (bool) {\\n return !_validatorMap[_addr].isNone();\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getBlockProducers() public view override returns (address[] memory _result) {\\n _result = new address[](validatorCount);\\n uint256 _count = 0;\\n for (uint _i = 0; _i < _result.length; _i++) {\\n if (isBlockProducer(_validators[_i])) {\\n _result[_count++] = _validators[_i];\\n }\\n }\\n\\n assembly {\\n mstore(_result, _count)\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isBlockProducer(address _addr) public view override returns (bool) {\\n return _validatorMap[_addr].hasFlag(EnumFlags.ValidatorFlag.BlockProducer);\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function totalBlockProducers() external view returns (uint256 _total) {\\n for (uint _i = 0; _i < validatorCount; _i++) {\\n if (isBlockProducer(_validators[_i])) {\\n _total++;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getBridgeOperators() public view override returns (address[] memory _result) {\\n _result = new address[](validatorCount);\\n uint256 _count = 0;\\n for (uint _i = 0; _i < _result.length; _i++) {\\n if (isOperatingBridge(_validators[_i])) {\\n _result[_count++] = _bridgeOperatorOf(_validators[_i]);\\n }\\n }\\n\\n assembly {\\n mstore(_result, _count)\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs)\\n public\\n view\\n override\\n returns (address[] memory _result)\\n {\\n _result = new address[](_validatorAddrs.length);\\n for (uint _i = 0; _i < _result.length; _i++) {\\n _result[_i] = _bridgeOperatorOf(_validatorAddrs[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isBridgeOperator(address _bridgeOperatorAddr) external view override returns (bool _result) {\\n for (uint _i = 0; _i < validatorCount; _i++) {\\n if (_bridgeOperatorOf(_validators[_i]) == _bridgeOperatorAddr && isOperatingBridge(_validators[_i])) {\\n _result = true;\\n break;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isOperatingBridge(address _consensusAddr) public view override returns (bool) {\\n return _validatorMap[_consensusAddr].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator);\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {\\n return _maxValidatorNumber;\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function maxPrioritizedValidatorNumber() external view override returns (uint256 _maximumPrioritizedValidatorNumber) {\\n return _maxPrioritizedValidatorNumber;\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function totalBridgeOperators() public view returns (uint256 _total) {\\n for (uint _i = 0; _i < validatorCount; _i++) {\\n if (isOperatingBridge(_validators[_i])) {\\n _total++;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function setMaxValidatorNumber(uint256 _max) external override onlyAdmin {\\n _setMaxValidatorNumber(_max);\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _number) external override onlyAdmin {\\n _setMaxPrioritizedValidatorNumber(_number);\\n }\\n\\n /**\\n * @dev Returns the bridge operator of a consensus address.\\n */\\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address);\\n\\n /**\\n * @dev See `IValidatorInfo-setMaxValidatorNumber`\\n */\\n function _setMaxValidatorNumber(uint256 _number) internal {\\n _maxValidatorNumber = _number;\\n emit MaxValidatorNumberUpdated(_number);\\n }\\n\\n /**\\n * @dev See `IValidatorInfo-setMaxPrioritizedValidatorNumber`\\n */\\n function _setMaxPrioritizedValidatorNumber(uint256 _number) internal {\\n if (_number > _maxValidatorNumber) revert ErrInvalidMaxPrioritizedValidatorNumber();\\n _maxPrioritizedValidatorNumber = _number;\\n emit MaxPrioritizedValidatorNumberUpdated(_number);\\n }\\n}\\n\",\"keccak256\":\"0x7182a866705a783a82df9aef8cc04bcf9ae1be09a42422859fd61143ace10272\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b615f6b80620000f46000396000f3fe6080604052600436106103345760003560e01c8063605239a1116101ae578063605239a1146107bb57806365244ece146107d05780636611f843146107f0578063690b7536146108105780636aa1c2ef1461082557806372e468101461083a5780637593ff7114610842578063823a7b9c1461086257806387c891bd146108825780638d559c381461089757806396585fc2146108ab5780639b19dbfd146108cb5780639c8d98da146108e05780639dd373b9146109005780639e94b9ec14610920578063a0c3f2d214610935578063a3d545f514610955578063a66c0f7714610975578063a7c2f1191461098a578063ad295783146109aa578063b405aaf2146109ca578063b5e337de146109ea578063b7ab4db514610a0a578063ba77b06c14610a1f578063c3c8b5d614610a34578063c94aaa0214610a54578063cba44de914610a74578063d09f1ab414610a89578063d2cb215e14610a9e578063dd716ad314610abc578063e5125a1d14610adc578063edb194bb14610afc578063ee99205c14610b5e578063eeb629a814610b73578063f2811bcc14610b88578063facd743b14610ba857610343565b806303bbfb301461034b57806304d971ab1461038057806306040618146103a05780630f43a677146103c35780631104e528146103d957806311662dc2146103f95780631196ab661461043657806315b5ebde146104565780631b6e0a99146104765780631f628801146104a3578063217f35c2146104c357806323c65eb0146104d857806328bde1e1146104f85780632924de7114610525578063297a8fca146105455780632bcf3d151461055a5780632d784a981461057a5780632f78204c146105a75780633529214b146105c7578063367ec12b146105e95780633b3159b6146106095780634244d4c91461061d5780634493421e1461064a578063468c96ae1461066857806346fe93111461069f57806349096d26146106bf5780634d8df063146106d45780634de2b735146106f45780634ee4d72b146107145780634f2a693f1461072957806352091f17146107495780635248184a146107515780635511cde114610773578063562d5304146107915780635a08482d146107a657610343565b3661034357610341610bc8565b005b610341610bc8565b34801561035757600080fd5b5061036b6103663660046153d5565b610c2d565b60405190151581526020015b60405180910390f35b34801561038c57600080fd5b5061036b61039b3660046153f2565b610c4b565b3480156103ac57600080fd5b506103b5610c72565b604051908152602001610377565b3480156103cf57600080fd5b506103b560aa5481565b3480156103e557600080fd5b506103416103f436600461542b565b610c82565b34801561040557600080fd5b5061041961041436600461548f565b610f0d565b604080519315158452602084019290925290820152606001610377565b34801561044257600080fd5b506103416104513660046154bb565b610f90565b34801561046257600080fd5b5061034161047136600461548f565b610fd4565b34801561048257600080fd5b5061049661049136600461551f565b6110f0565b604051610377919061556a565b3480156104af57600080fd5b5061036b6104be3660046153d5565b6111ad565b3480156104cf57600080fd5b5061036b6111e7565b3480156104e457600080fd5b5061036b6104f336600461548f565b6111fc565b34801561050457600080fd5b506105186105133660046153d5565b611208565b6040516103779190615604565b34801561053157600080fd5b5061036b6105403660046153d5565b6112ab565b34801561055157600080fd5b506004546103b5565b34801561056657600080fd5b506103416105753660046153d5565b6112b7565b34801561058657600080fd5b5061059a6105953660046153d5565b611323565b6040516103779190615612565b3480156105b357600080fd5b506103416105c2366004615637565b6113b3565b3480156105d357600080fd5b506105dc6115cf565b6040516103779190615681565b3480156105f557600080fd5b506103416106043660046156a6565b6115de565b34801561061557600080fd5b5060686105dc565b34801561062957600080fd5b5061063d6106383660046157d5565b611769565b60405161037791906158b7565b34801561065657600080fd5b50606e546001600160a01b03166105dc565b34801561067457600080fd5b506106886106833660046154bb565b611820565b604080519215158352602083019190915201610377565b3480156106ab57600080fd5b506103416106ba3660046153d5565b61185e565b3480156106cb57600080fd5b5061063d6118ca565b3480156106e057600080fd5b506103416106ef3660046154bb565b6119b3565b34801561070057600080fd5b5061049661070f3660046158ca565b6119f4565b34801561072057600080fd5b5060e4546103b5565b34801561073557600080fd5b506103416107443660046154bb565b611aaf565b610341611af0565b34801561075d57600080fd5b50610766611eef565b604051610377919061590b565b34801561077f57600080fd5b5060a8546001600160a01b03166105dc565b34801561079d57600080fd5b506103b561201f565b3480156107b257600080fd5b506105dc612073565b3480156107c757600080fd5b506072546103b5565b3480156107dc57600080fd5b5061036b6107eb3660046153d5565b612082565b3480156107fc57600080fd5b5061034161080b3660046154bb565b6120b6565b34801561081c57600080fd5b5060e5546103b5565b34801561083157600080fd5b506001546103b5565b6103416120f7565b34801561084e57600080fd5b5061036b61085d3660046154bb565b612355565b34801561086e57600080fd5b5061034161087d3660046154bb565b612379565b34801561088e57600080fd5b506002546103b5565b3480156108a357600080fd5b5060666105dc565b3480156108b757600080fd5b506104196108c63660046153d5565b6123ba565b3480156108d757600080fd5b5061063d6123d6565b3480156108ec57600080fd5b506103416108fb3660046153d5565b6124c2565b34801561090c57600080fd5b5061034161091b3660046153d5565b61252e565b34801561092c57600080fd5b506103b561259a565b34801561094157600080fd5b5061036b6109503660046153d5565b6125ee565b34801561096157600080fd5b506103b56109703660046154bb565b61260b565b34801561098157600080fd5b5060e6546103b5565b34801561099657600080fd5b506103416109a536600461548f565b612616565b3480156109b657600080fd5b506103416109c53660046153d5565b612884565b3480156109d657600080fd5b5061036b6109e53660046153d5565b6128f0565b3480156109f657600080fd5b50610341610a053660046153d5565b612975565b348015610a1657600080fd5b5061063d6129e1565b348015610a2b57600080fd5b5061063d612a8e565b348015610a4057600080fd5b50610341610a4f3660046153f2565b612af0565b348015610a6057600080fd5b50610341610a6f3660046154bb565b612d73565b348015610a8057600080fd5b506076546103b5565b348015610a9557600080fd5b5060a9546103b5565b348015610aaa57600080fd5b50606f546001600160a01b03166105dc565b348015610ac857600080fd5b50610341610ad736600461548f565b612db4565b348015610ae857600080fd5b50610341610af736600461594d565b612e5e565b348015610b0857600080fd5b5061059a610b173660046153d5565b6040805180820190915260008082526020820152506001600160a01b0316600090815260776020908152604091829020825180840190935280548352600101549082015290565b348015610b6a57600080fd5b506105dc612f93565b348015610b7f57600080fd5b5060ad546103b5565b348015610b9457600080fd5b50610496610ba33660046158ca565b612fa2565b348015610bb457600080fd5b5061036b610bc33660046153d5565b61306b565b610bd06115cf565b6001600160a01b0316336001600160a01b031614158015610c0a5750610bf4612f93565b6001600160a01b0316336001600160a01b031614155b15610c2b5760405160016234baed60e01b0319815260040160405180910390fd5b565b600080610c38610c72565b9050610c4483826130a8565b9392505050565b6001600160a01b038281166000908152607560205260409020548116908216145b92915050565b6000610c7d60035490565b905090565b33610c8b612f93565b6001600160a01b031614610cb257604051638aaf4a0760e01b815260040160405180910390fd5b6073546072548110610cd757604051638616841b60e01b815260040160405180910390fd5b610ce0856125ee565b15610cfe57604051638ad9cdf960e01b815260040160405180910390fd5b612710821115610d2157604051631b8454a360e21b815260040160405180910390fd5b60005b607354811015610e1c5760006075600060738481548110610d4757610d47615982565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190208054909250811690891603610da3578760405163fc3d8c7560e01b8152600401610d9a9190615681565b60405180910390fd5b60028101546001600160a01b0390811690871603610dd65785604051632d33a7e760e11b8152600401610d9a9190615681565b60038101546001600160a01b0390811690861603610e0957846040516350e1263b60e01b8152600401610d9a9190615681565b5080610e14816159ae565b915050610d24565b506001600160a01b038581166000818152607460209081526040808320861990556073805460018082019092557ff79bde9ddd17963ebce6f7d021d60de7c2bd0db944d23c900c0c0e775f5300520180546001600160a01b03199081168717909155607590935292819020805483168c87169081178255938101805484168617905560028101805484168b8816908117909155600382018054909416968a1696909617909255600482018790555190939192907fd690f592ed983cfbc05717fbcf06c4e10ae328432c309fe49246cf4a4be69fcd90610efc908990615681565b60405180910390a450505050505050565b6001600160a01b0382166000908152603a60205260408120548190819084811015610f4357600080600093509350935050610f89565b60019350610f5185826159c7565b610f5c9060016159da565b9250610f678561260b565b610f708261260b565b610f7a91906159c7565b610f859060016159da565b9150505b9250925092565b610f986130d3565b6001600160a01b0316336001600160a01b031614610fc85760405162461bcd60e51b8152600401610d9a906159ed565b610fd181613101565b50565b33610fdd612073565b6001600160a01b031614611004576040516328b9c24b60e21b815260040160405180910390fd5b6001600160a01b0382166000908152603c6020526040902054431161103e57816040516353e0424d60e01b8152600401610d9a9190615681565b6001600160a01b038216600081815260386020908152604080832085845282528083208054600160ff19918216811790925594845260378352818420868552909252909120805490921690915561109590436159c7565b6001600160a01b0383166000818152603a6020526040908190209290925590517f6bb2436cb6b6eb65d5a52fac2ae0373a77ade6661e523ef3004ee2d5524e6c6e906110e49084815260200190565b60405180910390a25050565b6060826001600160401b0381111561110a5761110a61576c565b604051908082528060200260200182016040528015611133578160200160208202803683370190505b50905060005b838110156111a55761117185858381811061115657611156615982565b905060200201602081019061116b91906153d5565b8461315f565b82828151811061118357611183615982565b911515602092830291909101909101528061119d816159ae565b915050611139565b509392505050565b6001600160a01b038116600090815260ac6020526040812054610c6c9060029060ff1660038111156111e1576111e1615a2f565b9061318a565b6000610c7d6111f5426131bd565b6003541090565b6000610c4483836131cc565b611210615384565b611219826125ee565b6112365760405163a64b34ad60e01b815260040160405180910390fd5b506001600160a01b03908116600090815260756020908152604091829020825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015290565b6000610c6c82436111fc565b6112bf6130d3565b6001600160a01b0316336001600160a01b0316146112ef5760405162461bcd60e51b8152600401610d9a906159ed565b806001600160a01b03163b60000361131a57604051637bcd509160e01b815260040160405180910390fd5b610fd1816131ec565b604080518082018252600080825260209182018190526001600160a01b038416815260e88252829020825180840190935280548352600101549082018190526113ae5760405162461bcd60e51b815260206004820181905260248201527f436f6d6d6f6e53746f726167653a206e6f6e2d6578697374656e7420696e666f6044820152606401610d9a565b919050565b336113bc612073565b6001600160a01b0316146113e3576040516328b9c24b60e21b815260040160405180910390fd5b60006113ed610c72565b6001600160a01b03861660008181526037602090815260408083208584528252808320805460ff1916600117905592825260e181528282205460e09091529190205491925061143b916159da565b60e4600082825461144c91906159da565b90915550506001600160a01b038516600090815260e06020908152604080832083905560e18252808320839055603a90915290205461148c908590613237565b6001600160a01b0386166000908152603a6020526040902055821561153c5760715460405163138ac02f60e11b81526000916001600160a01b031690632715805e906114de9089908890600401615a45565b6020604051808303816000875af11580156114fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115219190615a5e565b90508060e4600082825461153591906159da565b9091555050505b8115611580576001600160a01b0385166000908152603c6020526040902054611566908590613237565b6001600160a01b0386166000908152603c60205260409020555b6001600160a01b0385166000818152603a6020526040808220549051849392600080516020615f16833981519152926115c0929091899160019190615a77565b60405180910390a35050505050565b606d546001600160a01b031690565b600054610100900460ff16158080156115fe5750600054600160ff909116105b806116185750303b158015611618575060005460ff166001145b61167b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610d9a565b6000805460ff19166001179055801561169e576000805461ff0019166101001790555b6116a78d6131ec565b6116b08c61324e565b6116b98b613299565b6116c28a6132e4565b6116cb8861332f565b6116d48961337a565b6116dd876133c5565b6116e6866133fa565b6116ef8561342f565b6116f884613101565b6117028235613487565b61170f60208301356134bc565b6001839055801561175a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b606081516001600160401b038111156117845761178461576c565b6040519080825280602002602001820160405280156117ad578160200160208202803683370190505b50905060005b815181101561181a576117de8382815181106117d1576117d1615982565b60200260200101516134f1565b8282815181106117f0576117f0615982565b6001600160a01b039092166020928302919091019091015280611812816159ae565b9150506117b3565b50919050565b60008061182c4361260b565b83111580611847575060008381526005602052604090205415155b600093845260056020526040909320549293915050565b6118666130d3565b6001600160a01b0316336001600160a01b0316146118965760405162461bcd60e51b8152600401610d9a906159ed565b806001600160a01b03163b6000036118c157604051637bcd509160e01b815260040160405180910390fd5b610fd1816132e4565b606060aa546001600160401b038111156118e6576118e661576c565b60405190808252806020026020018201604052801561190f578160200160208202803683370190505b5090506000805b82518110156119ad57600081815260ab6020526040902054611940906001600160a01b0316612082565b1561199b57600081815260ab60205260409020546001600160a01b03168383611968816159ae565b94508151811061197a5761197a615982565b60200260200101906001600160a01b031690816001600160a01b0316815250505b806119a5816159ae565b915050611916565b50815290565b6119bb6130d3565b6001600160a01b0316336001600160a01b0316146119eb5760405162461bcd60e51b8152600401610d9a906159ed565b610fd1816134bc565b6060816001600160401b03811115611a0e57611a0e61576c565b604051908082528060200260200182016040528015611a37578160200160208202803683370190505b50905060005b82811015611aa857611a74848483818110611a5a57611a5a615982565b9050602002016020810190611a6f91906153d5565b6134fc565b828281518110611a8657611a86615982565b9115156020928302919091019091015280611aa0816159ae565b915050611a3d565b5092915050565b611ab76130d3565b6001600160a01b0316336001600160a01b031614611ae75760405162461bcd60e51b8152600401610d9a906159ed565b610fd1816133fa565b334114611b10576040516309f358fd60e01b815260040160405180910390fd5b34336000611b1d82612082565b8015611b2f5750611b2d826134fc565b155b8015611b495750611b4782611b42610c72565b61315f565b155b606d54604051630634f5b960e01b8152821515600482015260016024820181905292935060009182916001600160a01b0390911690630634f5b9906044016060604051808303816000875af1158015611ba6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bca9190615a96565b92509250508060e26000828254611be191906159da565b90915550849050611c3f578560e46000828254611bfe91906159da565b92505081905550846001600160a01b0316600080516020615ef6833981519152876001604051611c2f929190615acd565b60405180910390a2505050505050565b846001600160a01b03167f0ede5c3be8625943fa64003cd4b91230089411249f3059bac6500873543ca9b18784604051611c7a929190615aff565b60405180910390a26000611c8c610c72565b90506000611c9a84896159da565b6001600160a01b03881660009081526038602090815260408083208684529091528120549192509060ff1615611da5576070546040805163631c8fd160e11b815290516000926001600160a01b03169163c6391fa29160048083019260809291908290030181865afa158015611d14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d389190615b0d565b93505050506127108184611d4c9190615b43565b611d569190615b70565b91508160e46000828254611d6a91906159da565b92505081905550886001600160a01b0316600080516020615ef6833981519152836002604051611d9b929190615acd565b60405180910390a2505b611daf81836159c7565b91506000607160009054906101000a90046001600160a01b03166001600160a01b031663c673316c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2a9190615a5e565b6001600160a01b038a1660009081526075602052604081206004015491925090611e549083613508565b90506000612710611e658684615b43565b611e6f9190615b70565b6001600160a01b038c16600090815260e06020526040812080549293508392909190611e9c9084906159da565b9091555060009050611eae82876159c7565b6001600160a01b038d16600090815260e16020526040812080549293508392909190611edb9084906159da565b909155505050505050505050505050505050565b6073546060906001600160401b03811115611f0c57611f0c61576c565b604051908082528060200260200182016040528015611f4557816020015b611f32615384565b815260200190600190039081611f2a5790505b50905060005b815181101561201b576075600060738381548110611f6b57611f6b615982565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c08201528251839083908110611ffd57611ffd615982565b60200260200101819052508080612013906159ae565b915050611f4b565b5090565b6000805b60aa5481101561201b57600081815260ab602052604090205461204e906001600160a01b03166111ad565b15612061578161205d816159ae565b9250505b8061206b816159ae565b915050612023565b6070546001600160a01b031690565b6001600160a01b038116600090815260ac6020526040812054610c6c9060019060ff1660038111156111e1576111e1615a2f565b6120be6130d3565b6001600160a01b0316336001600160a01b0316146120ee5760405162461bcd60e51b8152600401610d9a906159ed565b610fd181613487565b334114612117576040516309f358fd60e01b815260040160405180910390fd5b61212043612355565b61213d57604051636c74eecf60e01b815260040160405180910390fd5b6121464361260b565b61215160025461260b565b1061216f57604051632458f64160e01b815260040160405180910390fd5b43600255600061217e426131bd565b9050600061218d826003541090565b905060006121996129e1565b9050606060006121a84361260b565b905060006121b78260016159da565b905060006121c3610c72565b905085156122ef576121d58186613517565b6000806121e28388613772565b915091506121f2838884846139a4565b6121fa613aad565b612202613c08565b607054604051631da0214360e21b81526001600160a01b0390911690637680850c90612234908a908790600401615b84565b600060405180830381600087803b15801561224e57600080fd5b505af1158015612262573d6000803e3d6000fd5b5050505061226f89613d37565b80519198509650156122de576070546040516303e1697b60e11b81526001600160a01b03909116906307c2d2f6906122ab9089906004016158b7565b600060405180830381600087803b1580156122c557600080fd5b505af11580156122d9573d6000803e3d6000fd5b505050505b6122e94360016159da565b60045550505b6122fa878387613ec2565b82817f0195462033384fec211477c56217da64a58bd405e0bed331ba4ded67e4ae4ce78860405161232f911515815260200190565b60405180910390a350600090815260056020526040902085905550505060039190915550565b60006001805461236591906159c7565b6001546123729084615ba6565b1492915050565b6123816130d3565b6001600160a01b0316336001600160a01b0316146123b15760405162461bcd60e51b8152600401610d9a906159ed565b610fd1816133c5565b60008060006123c98443610f0d565b9250925092509193909250565b606060aa546001600160401b038111156123f2576123f261576c565b60405190808252806020026020018201604052801561241b578160200160208202803683370190505b5090506000805b82518110156119ad57600081815260ab602052604090205461244c906001600160a01b03166111ad565b156124b057600081815260ab6020526040902054612472906001600160a01b03166134f1565b838361247d816159ae565b94508151811061248f5761248f615982565b60200260200101906001600160a01b031690816001600160a01b0316815250505b806124ba816159ae565b915050612422565b6124ca6130d3565b6001600160a01b0316336001600160a01b0316146124fa5760405162461bcd60e51b8152600401610d9a906159ed565b806001600160a01b03163b60000361252557604051637bcd509160e01b815260040160405180910390fd5b610fd18161332f565b6125366130d3565b6001600160a01b0316336001600160a01b0316146125665760405162461bcd60e51b8152600401610d9a906159ed565b806001600160a01b03163b60000361259157604051637bcd509160e01b815260040160405180910390fd5b610fd18161324e565b6000805b60aa5481101561201b57600081815260ab60205260409020546125c9906001600160a01b0316612082565b156125dc57816125d8816159ae565b9250505b806125e6816159ae565b91505061259e565b6001600160a01b0316600090815260746020526040902054151590565b6000610c6c82614287565b3361261f612f93565b6001600160a01b03161461264657604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b038216600090815260e8602052604090206001810154156126815760405163057aab3160e31b815260040160405180910390fd5b600061268d83426159da565b6001600160a01b03851660009081526075602052604090209091506126b290826142a2565b6001600160a01b038085166000908152603b602052604080822084905560715460e554915163138ac02f60e11b815292931691632715805e916126fa91899190600401615a45565b6020604051808303816000875af1158015612719573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273d9190615a5e565b9050801561283a57600060e6544261275591906159da565b60e78054600180820183556000929092527f6cb0db1d7354dfb4a1464318006df0643cafe2002a86a29ff8560f900fef28a10180546001600160a01b0319166001600160a01b038a16179055838655850181905590506127b36130d3565b6001600160a01b0387811660008181526075602052604090819020600201549051630a2fae5760e41b81526004810192909252821660248201524260448201526064810184905291169063a2fae57090608401600060405180830381600087803b15801561282057600080fd5b505af1158015612834573d6000803e3d6000fd5b50505050505b846001600160a01b03167f77a1a819870c0f4d04c3ca4cc2881a0393136abc28bd651af50aedade94a27c48260405161287591815260200190565b60405180910390a25050505050565b61288c6130d3565b6001600160a01b0316336001600160a01b0316146128bc5760405162461bcd60e51b8152600401610d9a906159ed565b806001600160a01b03163b6000036128e757604051637bcd509160e01b815260040160405180910390fd5b610fd181613299565b6000805b60aa5481101561181a57600081815260ab60205260409020546001600160a01b038085169161292391166134f1565b6001600160a01b03161480156129555750600081815260ab6020526040902054612955906001600160a01b03166111ad565b15612963576001915061181a565b8061296d816159ae565b9150506128f4565b61297d6130d3565b6001600160a01b0316336001600160a01b0316146129ad5760405162461bcd60e51b8152600401610d9a906159ed565b806001600160a01b03163b6000036129d857604051637bcd509160e01b815260040160405180910390fd5b610fd18161337a565b606060aa546001600160401b038111156129fd576129fd61576c565b604051908082528060200260200182016040528015612a26578160200160208202803683370190505b50905060005b815181101561201b57600081815260ab602052604090205482516001600160a01b0390911690839083908110612a6457612a64615982565b6001600160a01b039092166020928302919091019091015280612a86816159ae565b915050612a2c565b60606073805480602002602001604051908101604052809291908181526020018280548015612ae657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612ac8575b5050505050905090565b612af86130d3565b6001600160a01b0316336001600160a01b031614612b285760405162461bcd60e51b8152600401610d9a906159ed565b6001600160a01b038216600090815260e8602052604090206001015415612d6f5760e7548060005b82811015612ba957846001600160a01b031660e78281548110612b7557612b75615982565b6000918252602090912001546001600160a01b031603612b9757809150612ba9565b80612ba1816159ae565b915050612b50565b50818103612bb75750505050565b6001600160a01b038416600090815260e860205260409020548015612d6b576001600160a01b038516600090815260e860205260408120818155600190810191909155831115612c795760e7612c0e6001856159c7565b81548110612c1e57612c1e615982565b60009182526020909120015460e780546001600160a01b039092169184908110612c4a57612c4a615982565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480612c8a57612c8a615bba565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825260e9905260409020805460ff19166001179055612cdc8482610dac61431e565b15612d2657836001600160a01b0316856001600160a01b03167f7229136a18186c71a86246c012af3bb1df6460ef163934bbdccd6368abdd41e4836040516115c091815260200190565b836001600160a01b0316856001600160a01b03167f3747d14eb72ad3e35cba9c3e00dab3b8d15b40cac6bdbd08402356e4f69f30a183476040516115c0929190615aff565b5050505b5050565b612d7b6130d3565b6001600160a01b0316336001600160a01b031614612dab5760405162461bcd60e51b8152600401610d9a906159ed565b610fd18161342f565b33612dbd612f93565b6001600160a01b031614612de457604051638aaf4a0760e01b815260040160405180910390fd5b612ded8261437e565b15612e0b5760405163030081e760e01b815260040160405180910390fd5b6001600160a01b0382166000908152607560205260409020600581015415612e465760405163fab9167360e01b815260040160405180910390fd5b612e5981612e5484426159da565b6142a2565b505050565b33612e67612f93565b6001600160a01b031614612e8e57604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604090205415612ec557604051632f32dcdd60e11b815260040160405180910390fd5b612710811115612ee857604051631b8454a360e21b815260040160405180910390fd5b607654821015612f0b5760405163fa0ae69360e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604081209083612f326201518042615b70565b612f3c91906159da565b612f499062015180615b43565b808355600183018490556040519091506001600160a01b038616907f6ebafd1bb6316b2f63198a81b05cff2149c6eaae1784466a6d062b4391900f21906128759084908790615aff565b6071546001600160a01b031690565b6060816001600160401b03811115612fbc57612fbc61576c565b604051908082528060200260200182016040528015612fe5578160200160208202803683370190505b5090506000612ff2610c72565b905060005b838110156130635761302f85858381811061301457613014615982565b905060200201602081019061302991906153d5565b8361315f565b83828151811061304157613041615982565b911515602092830291909101909101528061305b816159ae565b915050612ff7565b505092915050565b6001600160a01b038116600090815260ac60205260408120546130a19060ff16600381111561309c5761309c615a2f565b6143fb565b1592915050565b6001600160a01b03919091166000908152603960209081526040808320938352929052205460ff1690565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b6001811015613123576040516317b8970f60e01b815260040160405180910390fd5b60768190556040518181527f266d432ffe659e3565750d26ec685b822a58041eee724b67a5afec3168a25267906020015b60405180910390a150565b6001600160a01b03919091166000908152603760209081526040808320938352929052205460ff1690565b600081600381111561319e5761319e615a2f565b8360038111156131b0576131b0615a2f565b1660ff1615159392505050565b6000610c6c6201518083615b70565b6001600160a01b03919091166000908152603a6020526040902054101590565b607080546001600160a01b0319166001600160a01b0383161790556040517faa5b07dd43aa44c69b70a6a2b9c3fcfed12b6e5f6323596ba7ac91035ab80a4f90613154908390615681565b6000818310156132475781610c44565b5090919050565b607180546001600160a01b0319166001600160a01b0383161790556040517f6397f5b135542bb3f477cb346cfab5abdec1251d08dc8f8d4efb4ffe122ea0bf90613154908390615681565b606d80546001600160a01b0319166001600160a01b0383161790556040517fc328090a37d855191ab58469296f98f87a851ca57d5cdfd1e9ac3c83e9e7096d90613154908390615681565b606f80546001600160a01b0319166001600160a01b0383161790556040517f31a33f126a5bae3c5bdf6cfc2cd6dcfffe2fe9634bdb09e21c44762993889e3b90613154908390615681565b606e80546001600160a01b0319166001600160a01b0383161790556040517f034c8da497df28467c79ddadbba1cc3cdd41f510ea73faae271e6f16a611162190613154908390615681565b60a880546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d790613154908390615681565b60a98190556040518181527fb5464c05fd0e0f000c535850116cda2742ee1f7b34384cb920ad7b8e802138b590602001613154565b60728190556040518181527f82d5dc32d1b741512ad09c32404d7e7921e8934c6222343d95f55f7a2b9b2ab490602001613154565b60a954811115613452576040516355408ce960e11b815260040160405180910390fd5b60ad8190556040518181527fa9588dc77416849bd922605ce4fc806712281ad8a8f32d4238d6c8cca548e15e90602001613154565b60e58190556040518181527f17a6c3eb965cdd7439982da25abf85be88f0f772ca33198f548e2f99fee0289a90602001613154565b60e68190556040518181527f0a50c66137118f386332efb949231ddd3946100dbf880003daca37ddd9e0662b90602001613154565b6000610c6c82614419565b6000610c6c82436131cc565b60008183106132475781610c44565b606e5460405163889998ef60e01b8152600481018490526001600160a01b0390911690600090829063889998ef90602401602060405180830381865afa158015613565573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135899190615a5e565b60405163033cdc2b60e31b8152600481018690529091506000906001600160a01b038416906319e6e15890602401602060405180830381865afa1580156135d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135f89190615a5e565b9050600061360585611769565b90506000846001600160a01b031663f67e815288846040518363ffffffff1660e01b8152600401613637929190615bd0565b600060405180830381865afa158015613654573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261367c9190810190615bf1565b9050600080600080607060009054906101000a90046001600160a01b03166001600160a01b0316631079402a6040518163ffffffff1660e01b8152600401608060405180830381865afa1580156136d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136fb9190615b0d565b935093509350935060005b8a51811015613764576137528c8c838151811061372557613725615982565b602002602001015188848151811061373f5761373f615982565b60200260200101518b8d8a8a8a8a61443e565b8061375c816159ae565b915050613706565b505050505050505050505050565b6000606060008084516001600160401b038111156137925761379261576c565b6040519080825280602002602001820160405280156137bb578160200160208202803683370190505b50925060005b8551811015613994578581815181106137dc576137dc615982565b6020908102919091018101516001600160a01b038082166000908152607590935260409092206002015490945016915061381683886130a8565b613849576001600160a01b03808416600090815260756020526040902060030154613844918591168461485e565b61387b565b6001600160a01b038316600090815260e3602052604081205460e48054919290916138759084906159da565b90915550505b613884836134fc565b1580156138985750613896838861315f565b155b1561390c576001600160a01b038316600090815260e160205260409020546138c090866159da565b6001600160a01b038416600090815260e160205260409020548551919650908590839081106138f1576138f1615982565b602002602001018181525050613907838361493b565b613952565b6001600160a01b038316600090815260e1602090815260408083205460e09092529091205461393b91906159da565b60e4600082825461394c91906159da565b90915550505b6001600160a01b038316600090815260e16020908152604080832083905560e0825280832083905560e39091528120558061398c816159ae565b9150506137c1565b5060e26000905550509250929050565b6071546001600160a01b03168215612d6b576139c08184614a03565b15613a685760405163566bce2360e11b81526001600160a01b0382169063acd79c46906139f590879086908a90600401615ca6565b600060405180830381600087803b158015613a0f57600080fd5b505af1158015613a23573d6000803e3d6000fd5b505050507f9e242ca1ef9dde96eb71ef8d19a3f0f6a619b63e4c0d3998771387103656d087838584604051613a5a93929190615cdc565b60405180910390a150613aa7565b7fe5668ec1bb2b6bb144a50f810e388da4b1d7d3fc05fcb9d588a1aac59d248f8983858447604051613a9d9493929190615d11565b60405180910390a1505b50505050565b60e754600080805b83831015613aa75760e78381548110613ad057613ad0615982565b60009182526020808320909101546001600160a01b031680835260e89091526040909120600181015491935091504210613bf657805460e48054600090613b189084906159da565b90915550506001600160a01b038216600090815260e860205260408120818155600101819055613b4785615d4e565b9450841115613bbe5760e78481548110613b6357613b63615982565b60009182526020909120015460e780546001600160a01b039092169185908110613b8f57613b8f615982565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480613bcf57613bcf615bba565b600082815260209020810160001990810180546001600160a01b0319169055019055613ab5565b82613c00816159ae565b935050613ab5565b60e4548015610fd1576000613c1b6115cf565b600060e481905560408051600481526024810182526020810180516001600160e01b03166359f778df60e01b179052905192935090916001600160a01b038416918591613c689190615d65565b60006040518083038185875af1925050503d8060008114613ca5576040519150601f19603f3d011682016040523d82523d6000602084013e613caa565b606091505b505090508015613cfc57816001600160a01b03167fc447c884574da5878be39c403db2245c22530c99b579ea7bcbb3720e1d110dc884604051613cef91815260200190565b60405180910390a2505050565b816001600160a01b03167fa0561a59abed308fcd0556834574739d778cc6229018039a24ddda0f86aa0b738447604051613cef929190615aff565b606080613d4383614a5f565b6071546040516391f8723f60e01b81529192506000916001600160a01b03909116906391f8723f90613d7a90607390600401615d94565b600060405180830381865afa158015613d97573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613dbf9190810190615bf1565b60a854604051632907e73160e11b81529192506000916001600160a01b039091169063520fce6290613df690607390600401615d94565b600060405180830381865afa158015613e13573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613e3b9190810190615bf1565b90506000613eaa6073805480602002602001604051908101604052809291908181526020018280548015613e9857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613e7a575b5050505050848460a95460ad54614f53565b9095509050613eba85828861501d565b505050915091565b606f546000906001600160a01b031663fdadda8183613ee24360016159da565b6040518363ffffffff1660e01b8152600401613eff929190615b84565b600060405180830381865afa158015613f1c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f449190810190615dd8565b905060005b8251811015614200576000838281518110613f6657613f66615982565b6020908102919091018101516001600160a01b0381166000908152603b909252604082205490925042111590613f9b83612082565b90506000613fa8846134fc565b80613fc95750858581518110613fc057613fc0615982565b60200260200101515b80613fd15750825b15905081158015613fdf5750805b1561405a576001600160a01b038416600090815260ac602052604090205461401e9060019060ff16600381111561401857614018615a2f565b9061517b565b6001600160a01b038516600090815260ac60205260409020805460ff1916600183600381111561405057614050615a2f565b02179055506140dc565b818015614065575080155b156140dc576001600160a01b038416600090815260ac60205260409020546140a49060019060ff16600381111561409e5761409e615a2f565b906151b6565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156140d6576140d6615a2f565b02179055505b60006140e7856111ad565b90508315811580156140f65750805b1561416b576001600160a01b038616600090815260ac602052604090205461412f9060029060ff16600381111561401857614018615a2f565b6001600160a01b038716600090815260ac60205260409020805460ff1916600183600381111561416157614161615a2f565b02179055506141e7565b818015614176575080155b156141e7576001600160a01b038616600090815260ac60205260409020546141af9060029060ff16600381111561409e5761409e615a2f565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156141e1576141e1615a2f565b02179055505b50505050505080806141f8906159ae565b915050613f49565b5082847f283b50d76057d5f828df85bc87724c6af604e9b55c363a07c9faa2a2cd688b8261422c6118ca565b60405161423991906158b7565b60405180910390a382847f773d1888df530d69716b183a92450d45f97fba49f2a4bb34fae3b23da0e2cc6f61426c6123d6565b60405161427991906158b7565b60405180910390a350505050565b6000600154826142979190615b70565b610c6c9060016159da565b60018201546142b9906001600160a01b03166125ee565b6142d65760405163a64b34ad60e01b815260040160405180910390fd5b6005820181905560018201546040518281526001600160a01b03909116907fb9a1e33376bfbda9092f2d1e37662c1b435aab0d3fa8da3acc8f37ee222f99e7906020016110e4565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d806000811461436e576040519150601f19603f3d011682016040523d82523d6000602084013e614373565b606091505b509095945050505050565b60a85460405163107fbb4760e21b815260009182916001600160a01b03909116906341feed1c906143b3908690600401615681565b602060405180830381865afa1580156143d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143f49190615a5e565b1192915050565b600081600381111561440f5761440f615a2f565b60ff161592915050565b6001600160a01b03808216600090815260756020526040812060030154909116610c6c565b841580801561444b575086155b156144845761445861201f565b60e2546144659190615b70565b6001600160a01b038a16600090815260e3602052604090205550614853565b80156144905750614853565b8187116144b057858860e2546144a69190615b43565b6144659190615b70565b6000876144bf6127108b615b43565b6144c99190615b70565b905060006144d9826127106159c7565b90508581106146f4576001603960008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008e815260200190815260200160002060006101000a81548160ff0219169083151502179055506001603760008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008e815260200190815260200160002060006101000a81548160ff0219169083151502179055506145ad854361458f91906159da565b6001600160a01b038d166000908152603a6020526040902054613237565b6001600160a01b038c166000908152603a60205260409020556145f16145d386436159da565b6001600160a01b038d166000908152603c6020526040902054613237565b603c60008d6001600160a01b03166001600160a01b0316815260200190815260200160002081905550607060009054906101000a90046001600160a01b03166001600160a01b031663c008ce398c60028f6040518463ffffffff1660e01b815260040161466093929190615e66565b600060405180830381600087803b15801561467a57600080fd5b505af115801561468e573d6000803e3d6000fd5b505050508b8b6001600160a01b0316600080516020615f16833981519152603a60008f6001600160a01b03166001600160a01b031681526020019081526020016000205460006001806040516146e79493929190615a77565b60405180910390a3613764565b868110614817576001603960008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008e815260200190815260200160002060006101000a81548160ff021916908315150217905550607060009054906101000a90046001600160a01b03166001600160a01b031663c008ce398c60018f6040518463ffffffff1660e01b815260040161479093929190615e66565b600060405180830381600087803b1580156147aa57600080fd5b505af11580156147be573d6000803e3d6000fd5b505050508b8b6001600160a01b0316600080516020615f16833981519152603a60008f6001600160a01b03166001600160a01b031681526020019081526020016000205460008060016040516146e79493929190615a77565b871561376457878a60e25461482c9190615b43565b6148369190615b70565b6001600160a01b038c16600090815260e360205260409020555050505b505050505050505050565b6001600160a01b038316600090815260e360205260409020548015613aa75761488a8282610dac61431e565b156148ec57816001600160a01b0316836001600160a01b0316856001600160a01b03167f72a57dc38837a1cba7881b7b1a5594d9e6b65cec6a985b54e2cee3e89369691c846040516148de91815260200190565b60405180910390a450505050565b816001600160a01b0316836001600160a01b0316856001600160a01b03167fd35d76d87d51ed89407fc7ceaaccf32cf72784b94530892ce33546540e141b7284476040516148de929190615aff565b6001600160a01b038216600090815260e060205260409020548015612e59576149678282610dac61431e565b156149be57816001600160a01b0316836001600160a01b03167f1ce7a1c4702402cd393500acb1de5bd927727a54e144a587d328f1b679abe4ec836040516149b191815260200190565b60405180910390a3505050565b816001600160a01b0316836001600160a01b03167f6c69e09ee5c5ac33c0cd57787261c5bade070a392ab34a4b5487c6868f723f6e83476040516149b1929190615aff565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114614a50576040519150601f19603f3d011682016040523d82523d6000602084013e614a55565b606091505b5090949350505050565b6071546040805163af24542960e01b815290516060926001600160a01b031691600091839163af2454299160048083019260209291908290030181865afa158015614aae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ad29190615a5e565b90506000826001600160a01b031663909791dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b389190615a5e565b90506000836001600160a01b03166342ef3c3460736040518263ffffffff1660e01b8152600401614b699190615d94565b600060405180830381865afa158015614b86573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052614bae9190810190615bf1565b6073549091506000816001600160401b03811115614bce57614bce61576c565b604051908082528060200260200182016040528015614bf7578160200160208202803683370190505b50965060008060005b84831015614ea35760738381548110614c1b57614c1b615982565b60009182526020808320909101546001600160a01b031680835260759091526040909120600681015488519294509092501515908890889086908110614c6357614c63615982565b60200260200101511015614cbf5780614cba576000614c828a426159da565b600684018190556040518181529091506001600160a01b03851690600080516020615ed68339815191529060200160405180910390a2505b614d00565b8015614d00578160060160009055826001600160a01b0316600080516020615ed68339815191526000604051614cf791815260200190565b60405180910390a25b60008260050154600014158015614d1b575042836005015411155b80614d3e57506001600160a01b038416600090815260e9602052604090205460ff165b905060008360060154600014158015614d5b575042846006015411155b90508180614d665750805b15614dfc5788614d7589615d4e565b98508881518110614d8857614d88615982565b6020026020010151898781518110614da257614da2615982565b6020908102919091010152848d88614db9816159ae565b995081518110614dcb57614dcb615982565b60200260200101906001600160a01b031690816001600160a01b031681525050614df4856151f2565b505050614c00565b6001600160a01b0385166000908152607760205260409020548015801590614e245750428111155b15614e8d576001600160a01b0386166000818152607760209081526040808320600181018054918590559390935560048901839055518281529192917f86d576c20e383fc2413ef692209cc48ddad5e52f25db5b32f8f7ec5076461ae9910160405180910390a2505b86614e97816159ae565b97505050505050614c00565b505081159050614f48578087527f4eaf233b9dc25a5552c1927feee1412eea69add17c2485c831c2e60e234f3c9187604051614edf91906158b7565b60405180910390a160405163e22d1c9d60e01b81526001600160a01b0387169063e22d1c9d90614f15908a908c90600401615b84565b600060405180830381600087803b158015614f2f57600080fd5b505af1158015614f43573d6000803e3d6000fd5b505050505b505050505050919050565b60606000806068905060008888888888604051602401614f77959493929190615e87565b60408051601f19818403018152919052602080820180516001600160e01b0316633bca0a8960e11b17905281518b519293506001929091600091614fba91615b43565b614fc59060406159da565b90506020840181888483895afa614fdb57600093505b503d614fe657600092505b6020870196508261500a57604051630fc2632160e01b815260040160405180910390fd5b8651955050505050509550959350505050565b815b60aa5481101561507b57600081815260ab6020818152604080842080546001600160a01b0316855260ac8352908420805460ff19169055928490525280546001600160a01b031916905580615073816159ae565b91505061501f565b5060005b828110156150c557600081815260ab60209081526040808320546001600160a01b0316835260ac9091529020805460ff19169055806150bd816159ae565b91505061507f565b5060005b828110156151435760008482815181106150e5576150e5615982565b6020908102919091018101516001600160a01b0316600081815260ac83526040808220805460ff1916600317905585825260ab9093529190912080546001600160a01b0319169091179055508061513b816159ae565b9150506150c9565b508160aa81905550807f3d0eea40644a206ec25781dd5bb3b60eb4fa1264b993c3bddf3c73b14f29ef5e84604051613cef91906158b7565b600081600381111561518f5761518f615a2f565b8360038111156151a1576151a1615a2f565b1760ff166003811115610c4457610c44615a2f565b60008160038111156151ca576151ca615a2f565b198360038111156151dd576151dd615a2f565b1660ff166003811115610c4457610c44615a2f565b6001600160a01b038116600090815260e960209081526040808320805460ff191690556074909152812054610fd19183919081900361522f575050565b6001600160a01b038216600090815260756020908152604080832080546001600160a01b0319908116825560018083018054831690556002830180548316905560038301805490921690915560048201859055600582018590556006909101849055607483528184208490556077909252822082815581018290556073805490916152b9916159c7565b815481106152c9576152c9615982565b6000918252602090912001546001600160a01b0390811691508316811461534c576001600160a01b038116600090815260746020526040902082905560738054829190841990811061531d5761531d615982565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b607380548061535d5761535d615bba565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6001600160a01b0381168114610fd157600080fd5b6000602082840312156153e757600080fd5b8135610c44816153c0565b6000806040838503121561540557600080fd5b8235615410816153c0565b91506020830135615420816153c0565b809150509250929050565b600080600080600060a0868803121561544357600080fd5b853561544e816153c0565b9450602086013561545e816153c0565b9350604086013561546e816153c0565b9250606086013561547e816153c0565b949793965091946080013592915050565b600080604083850312156154a257600080fd5b82356154ad816153c0565b946020939093013593505050565b6000602082840312156154cd57600080fd5b5035919050565b60008083601f8401126154e657600080fd5b5081356001600160401b038111156154fd57600080fd5b6020830191508360208260051b850101111561551857600080fd5b9250929050565b60008060006040848603121561553457600080fd5b83356001600160401b0381111561554a57600080fd5b615556868287016154d4565b909790965060209590950135949350505050565b6020808252825182820181905260009190848201906040850190845b818110156155a4578351151583529284019291840191600101615586565b50909695505050505050565b60018060a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b60e08101610c6c82846155b0565b815181526020808301519082015260408101610c6c565b8015158114610fd157600080fd5b6000806000806080858703121561564d57600080fd5b8435615658816153c0565b93506020850135925060408501359150606085013561567681615629565b939692955090935050565b6001600160a01b0391909116815260200190565b8060408101831015610c6c57600080fd5b6000806000806000806000806000806000806101a08d8f0312156156c957600080fd5b8c356156d4816153c0565b9b5060208d01356156e4816153c0565b9a5060408d01356156f4816153c0565b995060608d0135615704816153c0565b985060808d0135615714816153c0565b975060a08d0135615724816153c0565b965060c08d0135955060e08d013594506101008d013593506101208d013592506101408d0135915061575a8e6101608f01615695565b90509295989b509295989b509295989b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156157aa576157aa61576c565b604052919050565b60006001600160401b038211156157cb576157cb61576c565b5060051b60200190565b600060208083850312156157e857600080fd5b82356001600160401b038111156157fe57600080fd5b8301601f8101851361580f57600080fd5b803561582261581d826157b2565b615782565b81815260059190911b8201830190838101908783111561584157600080fd5b928401925b82841015615868578335615859816153c0565b82529284019290840190615846565b979650505050505050565b600081518084526020808501945080840160005b838110156158ac5781516001600160a01b031687529582019590820190600101615887565b509495945050505050565b602081526000610c446020830184615873565b600080602083850312156158dd57600080fd5b82356001600160401b038111156158f357600080fd5b6158ff858286016154d4565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156155a45761593a8385516155b0565b9284019260e09290920191600101615927565b60008060006060848603121561596257600080fd5b833561596d816153c0565b95602085013595506040909401359392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016159c0576159c0615998565b5060010190565b81810381811115610c6c57610c6c615998565b80820180821115610c6c57610c6c615998565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b6001600160a01b03929092168252602082015260400190565b600060208284031215615a7057600080fd5b5051919050565b9384526020840192909252151560408301521515606082015260800190565b600080600060608486031215615aab57600080fd5b8351615ab681615629565b602085015160409095015190969495509392505050565b8281526040810160038310615af257634e487b7160e01b600052602160045260246000fd5b8260208301529392505050565b918252602082015260400190565b60008060008060808587031215615b2357600080fd5b505082516020840151604085015160609095015191969095509092509050565b8082028115828204841417610c6c57610c6c615998565b634e487b7160e01b600052601260045260246000fd5b600082615b7f57615b7f615b5a565b500490565b604081526000615b976040830185615873565b90508260208301529392505050565b600082615bb557615bb5615b5a565b500690565b634e487b7160e01b600052603160045260246000fd5b828152604060208201526000615be96040830184615873565b949350505050565b60006020808385031215615c0457600080fd5b82516001600160401b03811115615c1a57600080fd5b8301601f81018513615c2b57600080fd5b8051615c3961581d826157b2565b81815260059190911b82018301908381019087831115615c5857600080fd5b928401925b8284101561586857835182529284019290840190615c5d565b600081518084526020808501945080840160005b838110156158ac57815187529582019590820190600101615c8a565b606081526000615cb96060830186615873565b8281036020840152615ccb8186615c76565b915050826040830152949350505050565b838152606060208201526000615cf56060830185615873565b8281036040840152615d078185615c76565b9695505050505050565b848152608060208201526000615d2a6080830186615873565b8281036040840152615d3c8186615c76565b91505082606083015295945050505050565b600081615d5d57615d5d615998565b506000190190565b6000825160005b81811015615d865760208186018101518583015201615d6c565b506000920191825250919050565b6020808252825482820181905260008481528281209092916040850190845b818110156155a45783546001600160a01b031683526001938401939285019201615db3565b60006020808385031215615deb57600080fd5b82516001600160401b03811115615e0157600080fd5b8301601f81018513615e1257600080fd5b8051615e2061581d826157b2565b81815260059190911b82018301908381019087831115615e3f57600080fd5b928401925b82841015615868578351615e5781615629565b82529284019290840190615e44565b6001600160a01b039390931683526020830191909152604082015260600190565b60a081526000615e9a60a0830188615873565b8281036020840152615eac8188615c76565b90508281036040840152615ec08187615c76565b6060840195909552505060800152939250505056fe88f854e137380c14d63f6ed99781bf13402167cf55bac49bcd44d4f2d6a342754042bb9a70998f80a86d9963f0d2132e9b11c8ad94d207c6141c8e34b05ce53e54ce99c5ce1fc9f61656d4a0fb2697974d0c973ac32eecaefe06fcf18b8ef68aa2646970667358221220c404751bdd0e38f9d7131910efc0fb8267dfc163279ad93e029aff6c6f812a0764736f6c63430008110033", - "deployedBytecode": "0x6080604052600436106103345760003560e01c8063605239a1116101ae578063605239a1146107bb57806365244ece146107d05780636611f843146107f0578063690b7536146108105780636aa1c2ef1461082557806372e468101461083a5780637593ff7114610842578063823a7b9c1461086257806387c891bd146108825780638d559c381461089757806396585fc2146108ab5780639b19dbfd146108cb5780639c8d98da146108e05780639dd373b9146109005780639e94b9ec14610920578063a0c3f2d214610935578063a3d545f514610955578063a66c0f7714610975578063a7c2f1191461098a578063ad295783146109aa578063b405aaf2146109ca578063b5e337de146109ea578063b7ab4db514610a0a578063ba77b06c14610a1f578063c3c8b5d614610a34578063c94aaa0214610a54578063cba44de914610a74578063d09f1ab414610a89578063d2cb215e14610a9e578063dd716ad314610abc578063e5125a1d14610adc578063edb194bb14610afc578063ee99205c14610b5e578063eeb629a814610b73578063f2811bcc14610b88578063facd743b14610ba857610343565b806303bbfb301461034b57806304d971ab1461038057806306040618146103a05780630f43a677146103c35780631104e528146103d957806311662dc2146103f95780631196ab661461043657806315b5ebde146104565780631b6e0a99146104765780631f628801146104a3578063217f35c2146104c357806323c65eb0146104d857806328bde1e1146104f85780632924de7114610525578063297a8fca146105455780632bcf3d151461055a5780632d784a981461057a5780632f78204c146105a75780633529214b146105c7578063367ec12b146105e95780633b3159b6146106095780634244d4c91461061d5780634493421e1461064a578063468c96ae1461066857806346fe93111461069f57806349096d26146106bf5780634d8df063146106d45780634de2b735146106f45780634ee4d72b146107145780634f2a693f1461072957806352091f17146107495780635248184a146107515780635511cde114610773578063562d5304146107915780635a08482d146107a657610343565b3661034357610341610bc8565b005b610341610bc8565b34801561035757600080fd5b5061036b6103663660046153d5565b610c2d565b60405190151581526020015b60405180910390f35b34801561038c57600080fd5b5061036b61039b3660046153f2565b610c4b565b3480156103ac57600080fd5b506103b5610c72565b604051908152602001610377565b3480156103cf57600080fd5b506103b560aa5481565b3480156103e557600080fd5b506103416103f436600461542b565b610c82565b34801561040557600080fd5b5061041961041436600461548f565b610f0d565b604080519315158452602084019290925290820152606001610377565b34801561044257600080fd5b506103416104513660046154bb565b610f90565b34801561046257600080fd5b5061034161047136600461548f565b610fd4565b34801561048257600080fd5b5061049661049136600461551f565b6110f0565b604051610377919061556a565b3480156104af57600080fd5b5061036b6104be3660046153d5565b6111ad565b3480156104cf57600080fd5b5061036b6111e7565b3480156104e457600080fd5b5061036b6104f336600461548f565b6111fc565b34801561050457600080fd5b506105186105133660046153d5565b611208565b6040516103779190615604565b34801561053157600080fd5b5061036b6105403660046153d5565b6112ab565b34801561055157600080fd5b506004546103b5565b34801561056657600080fd5b506103416105753660046153d5565b6112b7565b34801561058657600080fd5b5061059a6105953660046153d5565b611323565b6040516103779190615612565b3480156105b357600080fd5b506103416105c2366004615637565b6113b3565b3480156105d357600080fd5b506105dc6115cf565b6040516103779190615681565b3480156105f557600080fd5b506103416106043660046156a6565b6115de565b34801561061557600080fd5b5060686105dc565b34801561062957600080fd5b5061063d6106383660046157d5565b611769565b60405161037791906158b7565b34801561065657600080fd5b50606e546001600160a01b03166105dc565b34801561067457600080fd5b506106886106833660046154bb565b611820565b604080519215158352602083019190915201610377565b3480156106ab57600080fd5b506103416106ba3660046153d5565b61185e565b3480156106cb57600080fd5b5061063d6118ca565b3480156106e057600080fd5b506103416106ef3660046154bb565b6119b3565b34801561070057600080fd5b5061049661070f3660046158ca565b6119f4565b34801561072057600080fd5b5060e4546103b5565b34801561073557600080fd5b506103416107443660046154bb565b611aaf565b610341611af0565b34801561075d57600080fd5b50610766611eef565b604051610377919061590b565b34801561077f57600080fd5b5060a8546001600160a01b03166105dc565b34801561079d57600080fd5b506103b561201f565b3480156107b257600080fd5b506105dc612073565b3480156107c757600080fd5b506072546103b5565b3480156107dc57600080fd5b5061036b6107eb3660046153d5565b612082565b3480156107fc57600080fd5b5061034161080b3660046154bb565b6120b6565b34801561081c57600080fd5b5060e5546103b5565b34801561083157600080fd5b506001546103b5565b6103416120f7565b34801561084e57600080fd5b5061036b61085d3660046154bb565b612355565b34801561086e57600080fd5b5061034161087d3660046154bb565b612379565b34801561088e57600080fd5b506002546103b5565b3480156108a357600080fd5b5060666105dc565b3480156108b757600080fd5b506104196108c63660046153d5565b6123ba565b3480156108d757600080fd5b5061063d6123d6565b3480156108ec57600080fd5b506103416108fb3660046153d5565b6124c2565b34801561090c57600080fd5b5061034161091b3660046153d5565b61252e565b34801561092c57600080fd5b506103b561259a565b34801561094157600080fd5b5061036b6109503660046153d5565b6125ee565b34801561096157600080fd5b506103b56109703660046154bb565b61260b565b34801561098157600080fd5b5060e6546103b5565b34801561099657600080fd5b506103416109a536600461548f565b612616565b3480156109b657600080fd5b506103416109c53660046153d5565b612884565b3480156109d657600080fd5b5061036b6109e53660046153d5565b6128f0565b3480156109f657600080fd5b50610341610a053660046153d5565b612975565b348015610a1657600080fd5b5061063d6129e1565b348015610a2b57600080fd5b5061063d612a8e565b348015610a4057600080fd5b50610341610a4f3660046153f2565b612af0565b348015610a6057600080fd5b50610341610a6f3660046154bb565b612d73565b348015610a8057600080fd5b506076546103b5565b348015610a9557600080fd5b5060a9546103b5565b348015610aaa57600080fd5b50606f546001600160a01b03166105dc565b348015610ac857600080fd5b50610341610ad736600461548f565b612db4565b348015610ae857600080fd5b50610341610af736600461594d565b612e5e565b348015610b0857600080fd5b5061059a610b173660046153d5565b6040805180820190915260008082526020820152506001600160a01b0316600090815260776020908152604091829020825180840190935280548352600101549082015290565b348015610b6a57600080fd5b506105dc612f93565b348015610b7f57600080fd5b5060ad546103b5565b348015610b9457600080fd5b50610496610ba33660046158ca565b612fa2565b348015610bb457600080fd5b5061036b610bc33660046153d5565b61306b565b610bd06115cf565b6001600160a01b0316336001600160a01b031614158015610c0a5750610bf4612f93565b6001600160a01b0316336001600160a01b031614155b15610c2b5760405160016234baed60e01b0319815260040160405180910390fd5b565b600080610c38610c72565b9050610c4483826130a8565b9392505050565b6001600160a01b038281166000908152607560205260409020548116908216145b92915050565b6000610c7d60035490565b905090565b33610c8b612f93565b6001600160a01b031614610cb257604051638aaf4a0760e01b815260040160405180910390fd5b6073546072548110610cd757604051638616841b60e01b815260040160405180910390fd5b610ce0856125ee565b15610cfe57604051638ad9cdf960e01b815260040160405180910390fd5b612710821115610d2157604051631b8454a360e21b815260040160405180910390fd5b60005b607354811015610e1c5760006075600060738481548110610d4757610d47615982565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190208054909250811690891603610da3578760405163fc3d8c7560e01b8152600401610d9a9190615681565b60405180910390fd5b60028101546001600160a01b0390811690871603610dd65785604051632d33a7e760e11b8152600401610d9a9190615681565b60038101546001600160a01b0390811690861603610e0957846040516350e1263b60e01b8152600401610d9a9190615681565b5080610e14816159ae565b915050610d24565b506001600160a01b038581166000818152607460209081526040808320861990556073805460018082019092557ff79bde9ddd17963ebce6f7d021d60de7c2bd0db944d23c900c0c0e775f5300520180546001600160a01b03199081168717909155607590935292819020805483168c87169081178255938101805484168617905560028101805484168b8816908117909155600382018054909416968a1696909617909255600482018790555190939192907fd690f592ed983cfbc05717fbcf06c4e10ae328432c309fe49246cf4a4be69fcd90610efc908990615681565b60405180910390a450505050505050565b6001600160a01b0382166000908152603a60205260408120548190819084811015610f4357600080600093509350935050610f89565b60019350610f5185826159c7565b610f5c9060016159da565b9250610f678561260b565b610f708261260b565b610f7a91906159c7565b610f859060016159da565b9150505b9250925092565b610f986130d3565b6001600160a01b0316336001600160a01b031614610fc85760405162461bcd60e51b8152600401610d9a906159ed565b610fd181613101565b50565b33610fdd612073565b6001600160a01b031614611004576040516328b9c24b60e21b815260040160405180910390fd5b6001600160a01b0382166000908152603c6020526040902054431161103e57816040516353e0424d60e01b8152600401610d9a9190615681565b6001600160a01b038216600081815260386020908152604080832085845282528083208054600160ff19918216811790925594845260378352818420868552909252909120805490921690915561109590436159c7565b6001600160a01b0383166000818152603a6020526040908190209290925590517f6bb2436cb6b6eb65d5a52fac2ae0373a77ade6661e523ef3004ee2d5524e6c6e906110e49084815260200190565b60405180910390a25050565b6060826001600160401b0381111561110a5761110a61576c565b604051908082528060200260200182016040528015611133578160200160208202803683370190505b50905060005b838110156111a55761117185858381811061115657611156615982565b905060200201602081019061116b91906153d5565b8461315f565b82828151811061118357611183615982565b911515602092830291909101909101528061119d816159ae565b915050611139565b509392505050565b6001600160a01b038116600090815260ac6020526040812054610c6c9060029060ff1660038111156111e1576111e1615a2f565b9061318a565b6000610c7d6111f5426131bd565b6003541090565b6000610c4483836131cc565b611210615384565b611219826125ee565b6112365760405163a64b34ad60e01b815260040160405180910390fd5b506001600160a01b03908116600090815260756020908152604091829020825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015290565b6000610c6c82436111fc565b6112bf6130d3565b6001600160a01b0316336001600160a01b0316146112ef5760405162461bcd60e51b8152600401610d9a906159ed565b806001600160a01b03163b60000361131a57604051637bcd509160e01b815260040160405180910390fd5b610fd1816131ec565b604080518082018252600080825260209182018190526001600160a01b038416815260e88252829020825180840190935280548352600101549082018190526113ae5760405162461bcd60e51b815260206004820181905260248201527f436f6d6d6f6e53746f726167653a206e6f6e2d6578697374656e7420696e666f6044820152606401610d9a565b919050565b336113bc612073565b6001600160a01b0316146113e3576040516328b9c24b60e21b815260040160405180910390fd5b60006113ed610c72565b6001600160a01b03861660008181526037602090815260408083208584528252808320805460ff1916600117905592825260e181528282205460e09091529190205491925061143b916159da565b60e4600082825461144c91906159da565b90915550506001600160a01b038516600090815260e06020908152604080832083905560e18252808320839055603a90915290205461148c908590613237565b6001600160a01b0386166000908152603a6020526040902055821561153c5760715460405163138ac02f60e11b81526000916001600160a01b031690632715805e906114de9089908890600401615a45565b6020604051808303816000875af11580156114fd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115219190615a5e565b90508060e4600082825461153591906159da565b9091555050505b8115611580576001600160a01b0385166000908152603c6020526040902054611566908590613237565b6001600160a01b0386166000908152603c60205260409020555b6001600160a01b0385166000818152603a6020526040808220549051849392600080516020615f16833981519152926115c0929091899160019190615a77565b60405180910390a35050505050565b606d546001600160a01b031690565b600054610100900460ff16158080156115fe5750600054600160ff909116105b806116185750303b158015611618575060005460ff166001145b61167b5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610d9a565b6000805460ff19166001179055801561169e576000805461ff0019166101001790555b6116a78d6131ec565b6116b08c61324e565b6116b98b613299565b6116c28a6132e4565b6116cb8861332f565b6116d48961337a565b6116dd876133c5565b6116e6866133fa565b6116ef8561342f565b6116f884613101565b6117028235613487565b61170f60208301356134bc565b6001839055801561175a576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b606081516001600160401b038111156117845761178461576c565b6040519080825280602002602001820160405280156117ad578160200160208202803683370190505b50905060005b815181101561181a576117de8382815181106117d1576117d1615982565b60200260200101516134f1565b8282815181106117f0576117f0615982565b6001600160a01b039092166020928302919091019091015280611812816159ae565b9150506117b3565b50919050565b60008061182c4361260b565b83111580611847575060008381526005602052604090205415155b600093845260056020526040909320549293915050565b6118666130d3565b6001600160a01b0316336001600160a01b0316146118965760405162461bcd60e51b8152600401610d9a906159ed565b806001600160a01b03163b6000036118c157604051637bcd509160e01b815260040160405180910390fd5b610fd1816132e4565b606060aa546001600160401b038111156118e6576118e661576c565b60405190808252806020026020018201604052801561190f578160200160208202803683370190505b5090506000805b82518110156119ad57600081815260ab6020526040902054611940906001600160a01b0316612082565b1561199b57600081815260ab60205260409020546001600160a01b03168383611968816159ae565b94508151811061197a5761197a615982565b60200260200101906001600160a01b031690816001600160a01b0316815250505b806119a5816159ae565b915050611916565b50815290565b6119bb6130d3565b6001600160a01b0316336001600160a01b0316146119eb5760405162461bcd60e51b8152600401610d9a906159ed565b610fd1816134bc565b6060816001600160401b03811115611a0e57611a0e61576c565b604051908082528060200260200182016040528015611a37578160200160208202803683370190505b50905060005b82811015611aa857611a74848483818110611a5a57611a5a615982565b9050602002016020810190611a6f91906153d5565b6134fc565b828281518110611a8657611a86615982565b9115156020928302919091019091015280611aa0816159ae565b915050611a3d565b5092915050565b611ab76130d3565b6001600160a01b0316336001600160a01b031614611ae75760405162461bcd60e51b8152600401610d9a906159ed565b610fd1816133fa565b334114611b10576040516309f358fd60e01b815260040160405180910390fd5b34336000611b1d82612082565b8015611b2f5750611b2d826134fc565b155b8015611b495750611b4782611b42610c72565b61315f565b155b606d54604051630634f5b960e01b8152821515600482015260016024820181905292935060009182916001600160a01b0390911690630634f5b9906044016060604051808303816000875af1158015611ba6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bca9190615a96565b92509250508060e26000828254611be191906159da565b90915550849050611c3f578560e46000828254611bfe91906159da565b92505081905550846001600160a01b0316600080516020615ef6833981519152876001604051611c2f929190615acd565b60405180910390a2505050505050565b846001600160a01b03167f0ede5c3be8625943fa64003cd4b91230089411249f3059bac6500873543ca9b18784604051611c7a929190615aff565b60405180910390a26000611c8c610c72565b90506000611c9a84896159da565b6001600160a01b03881660009081526038602090815260408083208684529091528120549192509060ff1615611da5576070546040805163631c8fd160e11b815290516000926001600160a01b03169163c6391fa29160048083019260809291908290030181865afa158015611d14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d389190615b0d565b93505050506127108184611d4c9190615b43565b611d569190615b70565b91508160e46000828254611d6a91906159da565b92505081905550886001600160a01b0316600080516020615ef6833981519152836002604051611d9b929190615acd565b60405180910390a2505b611daf81836159c7565b91506000607160009054906101000a90046001600160a01b03166001600160a01b031663c673316c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611e06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e2a9190615a5e565b6001600160a01b038a1660009081526075602052604081206004015491925090611e549083613508565b90506000612710611e658684615b43565b611e6f9190615b70565b6001600160a01b038c16600090815260e06020526040812080549293508392909190611e9c9084906159da565b9091555060009050611eae82876159c7565b6001600160a01b038d16600090815260e16020526040812080549293508392909190611edb9084906159da565b909155505050505050505050505050505050565b6073546060906001600160401b03811115611f0c57611f0c61576c565b604051908082528060200260200182016040528015611f4557816020015b611f32615384565b815260200190600190039081611f2a5790505b50905060005b815181101561201b576075600060738381548110611f6b57611f6b615982565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c08201528251839083908110611ffd57611ffd615982565b60200260200101819052508080612013906159ae565b915050611f4b565b5090565b6000805b60aa5481101561201b57600081815260ab602052604090205461204e906001600160a01b03166111ad565b15612061578161205d816159ae565b9250505b8061206b816159ae565b915050612023565b6070546001600160a01b031690565b6001600160a01b038116600090815260ac6020526040812054610c6c9060019060ff1660038111156111e1576111e1615a2f565b6120be6130d3565b6001600160a01b0316336001600160a01b0316146120ee5760405162461bcd60e51b8152600401610d9a906159ed565b610fd181613487565b334114612117576040516309f358fd60e01b815260040160405180910390fd5b61212043612355565b61213d57604051636c74eecf60e01b815260040160405180910390fd5b6121464361260b565b61215160025461260b565b1061216f57604051632458f64160e01b815260040160405180910390fd5b43600255600061217e426131bd565b9050600061218d826003541090565b905060006121996129e1565b9050606060006121a84361260b565b905060006121b78260016159da565b905060006121c3610c72565b905085156122ef576121d58186613517565b6000806121e28388613772565b915091506121f2838884846139a4565b6121fa613aad565b612202613c08565b607054604051631da0214360e21b81526001600160a01b0390911690637680850c90612234908a908790600401615b84565b600060405180830381600087803b15801561224e57600080fd5b505af1158015612262573d6000803e3d6000fd5b5050505061226f89613d37565b80519198509650156122de576070546040516303e1697b60e11b81526001600160a01b03909116906307c2d2f6906122ab9089906004016158b7565b600060405180830381600087803b1580156122c557600080fd5b505af11580156122d9573d6000803e3d6000fd5b505050505b6122e94360016159da565b60045550505b6122fa878387613ec2565b82817f0195462033384fec211477c56217da64a58bd405e0bed331ba4ded67e4ae4ce78860405161232f911515815260200190565b60405180910390a350600090815260056020526040902085905550505060039190915550565b60006001805461236591906159c7565b6001546123729084615ba6565b1492915050565b6123816130d3565b6001600160a01b0316336001600160a01b0316146123b15760405162461bcd60e51b8152600401610d9a906159ed565b610fd1816133c5565b60008060006123c98443610f0d565b9250925092509193909250565b606060aa546001600160401b038111156123f2576123f261576c565b60405190808252806020026020018201604052801561241b578160200160208202803683370190505b5090506000805b82518110156119ad57600081815260ab602052604090205461244c906001600160a01b03166111ad565b156124b057600081815260ab6020526040902054612472906001600160a01b03166134f1565b838361247d816159ae565b94508151811061248f5761248f615982565b60200260200101906001600160a01b031690816001600160a01b0316815250505b806124ba816159ae565b915050612422565b6124ca6130d3565b6001600160a01b0316336001600160a01b0316146124fa5760405162461bcd60e51b8152600401610d9a906159ed565b806001600160a01b03163b60000361252557604051637bcd509160e01b815260040160405180910390fd5b610fd18161332f565b6125366130d3565b6001600160a01b0316336001600160a01b0316146125665760405162461bcd60e51b8152600401610d9a906159ed565b806001600160a01b03163b60000361259157604051637bcd509160e01b815260040160405180910390fd5b610fd18161324e565b6000805b60aa5481101561201b57600081815260ab60205260409020546125c9906001600160a01b0316612082565b156125dc57816125d8816159ae565b9250505b806125e6816159ae565b91505061259e565b6001600160a01b0316600090815260746020526040902054151590565b6000610c6c82614287565b3361261f612f93565b6001600160a01b03161461264657604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b038216600090815260e8602052604090206001810154156126815760405163057aab3160e31b815260040160405180910390fd5b600061268d83426159da565b6001600160a01b03851660009081526075602052604090209091506126b290826142a2565b6001600160a01b038085166000908152603b602052604080822084905560715460e554915163138ac02f60e11b815292931691632715805e916126fa91899190600401615a45565b6020604051808303816000875af1158015612719573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273d9190615a5e565b9050801561283a57600060e6544261275591906159da565b60e78054600180820183556000929092527f6cb0db1d7354dfb4a1464318006df0643cafe2002a86a29ff8560f900fef28a10180546001600160a01b0319166001600160a01b038a16179055838655850181905590506127b36130d3565b6001600160a01b0387811660008181526075602052604090819020600201549051630a2fae5760e41b81526004810192909252821660248201524260448201526064810184905291169063a2fae57090608401600060405180830381600087803b15801561282057600080fd5b505af1158015612834573d6000803e3d6000fd5b50505050505b846001600160a01b03167f77a1a819870c0f4d04c3ca4cc2881a0393136abc28bd651af50aedade94a27c48260405161287591815260200190565b60405180910390a25050505050565b61288c6130d3565b6001600160a01b0316336001600160a01b0316146128bc5760405162461bcd60e51b8152600401610d9a906159ed565b806001600160a01b03163b6000036128e757604051637bcd509160e01b815260040160405180910390fd5b610fd181613299565b6000805b60aa5481101561181a57600081815260ab60205260409020546001600160a01b038085169161292391166134f1565b6001600160a01b03161480156129555750600081815260ab6020526040902054612955906001600160a01b03166111ad565b15612963576001915061181a565b8061296d816159ae565b9150506128f4565b61297d6130d3565b6001600160a01b0316336001600160a01b0316146129ad5760405162461bcd60e51b8152600401610d9a906159ed565b806001600160a01b03163b6000036129d857604051637bcd509160e01b815260040160405180910390fd5b610fd18161337a565b606060aa546001600160401b038111156129fd576129fd61576c565b604051908082528060200260200182016040528015612a26578160200160208202803683370190505b50905060005b815181101561201b57600081815260ab602052604090205482516001600160a01b0390911690839083908110612a6457612a64615982565b6001600160a01b039092166020928302919091019091015280612a86816159ae565b915050612a2c565b60606073805480602002602001604051908101604052809291908181526020018280548015612ae657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612ac8575b5050505050905090565b612af86130d3565b6001600160a01b0316336001600160a01b031614612b285760405162461bcd60e51b8152600401610d9a906159ed565b6001600160a01b038216600090815260e8602052604090206001015415612d6f5760e7548060005b82811015612ba957846001600160a01b031660e78281548110612b7557612b75615982565b6000918252602090912001546001600160a01b031603612b9757809150612ba9565b80612ba1816159ae565b915050612b50565b50818103612bb75750505050565b6001600160a01b038416600090815260e860205260409020548015612d6b576001600160a01b038516600090815260e860205260408120818155600190810191909155831115612c795760e7612c0e6001856159c7565b81548110612c1e57612c1e615982565b60009182526020909120015460e780546001600160a01b039092169184908110612c4a57612c4a615982565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480612c8a57612c8a615bba565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825260e9905260409020805460ff19166001179055612cdc8482610dac61431e565b15612d2657836001600160a01b0316856001600160a01b03167f7229136a18186c71a86246c012af3bb1df6460ef163934bbdccd6368abdd41e4836040516115c091815260200190565b836001600160a01b0316856001600160a01b03167f3747d14eb72ad3e35cba9c3e00dab3b8d15b40cac6bdbd08402356e4f69f30a183476040516115c0929190615aff565b5050505b5050565b612d7b6130d3565b6001600160a01b0316336001600160a01b031614612dab5760405162461bcd60e51b8152600401610d9a906159ed565b610fd18161342f565b33612dbd612f93565b6001600160a01b031614612de457604051638aaf4a0760e01b815260040160405180910390fd5b612ded8261437e565b15612e0b5760405163030081e760e01b815260040160405180910390fd5b6001600160a01b0382166000908152607560205260409020600581015415612e465760405163fab9167360e01b815260040160405180910390fd5b612e5981612e5484426159da565b6142a2565b505050565b33612e67612f93565b6001600160a01b031614612e8e57604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604090205415612ec557604051632f32dcdd60e11b815260040160405180910390fd5b612710811115612ee857604051631b8454a360e21b815260040160405180910390fd5b607654821015612f0b5760405163fa0ae69360e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604081209083612f326201518042615b70565b612f3c91906159da565b612f499062015180615b43565b808355600183018490556040519091506001600160a01b038616907f6ebafd1bb6316b2f63198a81b05cff2149c6eaae1784466a6d062b4391900f21906128759084908790615aff565b6071546001600160a01b031690565b6060816001600160401b03811115612fbc57612fbc61576c565b604051908082528060200260200182016040528015612fe5578160200160208202803683370190505b5090506000612ff2610c72565b905060005b838110156130635761302f85858381811061301457613014615982565b905060200201602081019061302991906153d5565b8361315f565b83828151811061304157613041615982565b911515602092830291909101909101528061305b816159ae565b915050612ff7565b505092915050565b6001600160a01b038116600090815260ac60205260408120546130a19060ff16600381111561309c5761309c615a2f565b6143fb565b1592915050565b6001600160a01b03919091166000908152603960209081526040808320938352929052205460ff1690565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b6001811015613123576040516317b8970f60e01b815260040160405180910390fd5b60768190556040518181527f266d432ffe659e3565750d26ec685b822a58041eee724b67a5afec3168a25267906020015b60405180910390a150565b6001600160a01b03919091166000908152603760209081526040808320938352929052205460ff1690565b600081600381111561319e5761319e615a2f565b8360038111156131b0576131b0615a2f565b1660ff1615159392505050565b6000610c6c6201518083615b70565b6001600160a01b03919091166000908152603a6020526040902054101590565b607080546001600160a01b0319166001600160a01b0383161790556040517faa5b07dd43aa44c69b70a6a2b9c3fcfed12b6e5f6323596ba7ac91035ab80a4f90613154908390615681565b6000818310156132475781610c44565b5090919050565b607180546001600160a01b0319166001600160a01b0383161790556040517f6397f5b135542bb3f477cb346cfab5abdec1251d08dc8f8d4efb4ffe122ea0bf90613154908390615681565b606d80546001600160a01b0319166001600160a01b0383161790556040517fc328090a37d855191ab58469296f98f87a851ca57d5cdfd1e9ac3c83e9e7096d90613154908390615681565b606f80546001600160a01b0319166001600160a01b0383161790556040517f31a33f126a5bae3c5bdf6cfc2cd6dcfffe2fe9634bdb09e21c44762993889e3b90613154908390615681565b606e80546001600160a01b0319166001600160a01b0383161790556040517f034c8da497df28467c79ddadbba1cc3cdd41f510ea73faae271e6f16a611162190613154908390615681565b60a880546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d790613154908390615681565b60a98190556040518181527fb5464c05fd0e0f000c535850116cda2742ee1f7b34384cb920ad7b8e802138b590602001613154565b60728190556040518181527f82d5dc32d1b741512ad09c32404d7e7921e8934c6222343d95f55f7a2b9b2ab490602001613154565b60a954811115613452576040516355408ce960e11b815260040160405180910390fd5b60ad8190556040518181527fa9588dc77416849bd922605ce4fc806712281ad8a8f32d4238d6c8cca548e15e90602001613154565b60e58190556040518181527f17a6c3eb965cdd7439982da25abf85be88f0f772ca33198f548e2f99fee0289a90602001613154565b60e68190556040518181527f0a50c66137118f386332efb949231ddd3946100dbf880003daca37ddd9e0662b90602001613154565b6000610c6c82614419565b6000610c6c82436131cc565b60008183106132475781610c44565b606e5460405163889998ef60e01b8152600481018490526001600160a01b0390911690600090829063889998ef90602401602060405180830381865afa158015613565573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135899190615a5e565b60405163033cdc2b60e31b8152600481018690529091506000906001600160a01b038416906319e6e15890602401602060405180830381865afa1580156135d4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135f89190615a5e565b9050600061360585611769565b90506000846001600160a01b031663f67e815288846040518363ffffffff1660e01b8152600401613637929190615bd0565b600060405180830381865afa158015613654573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261367c9190810190615bf1565b9050600080600080607060009054906101000a90046001600160a01b03166001600160a01b0316631079402a6040518163ffffffff1660e01b8152600401608060405180830381865afa1580156136d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136fb9190615b0d565b935093509350935060005b8a51811015613764576137528c8c838151811061372557613725615982565b602002602001015188848151811061373f5761373f615982565b60200260200101518b8d8a8a8a8a61443e565b8061375c816159ae565b915050613706565b505050505050505050505050565b6000606060008084516001600160401b038111156137925761379261576c565b6040519080825280602002602001820160405280156137bb578160200160208202803683370190505b50925060005b8551811015613994578581815181106137dc576137dc615982565b6020908102919091018101516001600160a01b038082166000908152607590935260409092206002015490945016915061381683886130a8565b613849576001600160a01b03808416600090815260756020526040902060030154613844918591168461485e565b61387b565b6001600160a01b038316600090815260e3602052604081205460e48054919290916138759084906159da565b90915550505b613884836134fc565b1580156138985750613896838861315f565b155b1561390c576001600160a01b038316600090815260e160205260409020546138c090866159da565b6001600160a01b038416600090815260e160205260409020548551919650908590839081106138f1576138f1615982565b602002602001018181525050613907838361493b565b613952565b6001600160a01b038316600090815260e1602090815260408083205460e09092529091205461393b91906159da565b60e4600082825461394c91906159da565b90915550505b6001600160a01b038316600090815260e16020908152604080832083905560e0825280832083905560e39091528120558061398c816159ae565b9150506137c1565b5060e26000905550509250929050565b6071546001600160a01b03168215612d6b576139c08184614a03565b15613a685760405163566bce2360e11b81526001600160a01b0382169063acd79c46906139f590879086908a90600401615ca6565b600060405180830381600087803b158015613a0f57600080fd5b505af1158015613a23573d6000803e3d6000fd5b505050507f9e242ca1ef9dde96eb71ef8d19a3f0f6a619b63e4c0d3998771387103656d087838584604051613a5a93929190615cdc565b60405180910390a150613aa7565b7fe5668ec1bb2b6bb144a50f810e388da4b1d7d3fc05fcb9d588a1aac59d248f8983858447604051613a9d9493929190615d11565b60405180910390a1505b50505050565b60e754600080805b83831015613aa75760e78381548110613ad057613ad0615982565b60009182526020808320909101546001600160a01b031680835260e89091526040909120600181015491935091504210613bf657805460e48054600090613b189084906159da565b90915550506001600160a01b038216600090815260e860205260408120818155600101819055613b4785615d4e565b9450841115613bbe5760e78481548110613b6357613b63615982565b60009182526020909120015460e780546001600160a01b039092169185908110613b8f57613b8f615982565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480613bcf57613bcf615bba565b600082815260209020810160001990810180546001600160a01b0319169055019055613ab5565b82613c00816159ae565b935050613ab5565b60e4548015610fd1576000613c1b6115cf565b600060e481905560408051600481526024810182526020810180516001600160e01b03166359f778df60e01b179052905192935090916001600160a01b038416918591613c689190615d65565b60006040518083038185875af1925050503d8060008114613ca5576040519150601f19603f3d011682016040523d82523d6000602084013e613caa565b606091505b505090508015613cfc57816001600160a01b03167fc447c884574da5878be39c403db2245c22530c99b579ea7bcbb3720e1d110dc884604051613cef91815260200190565b60405180910390a2505050565b816001600160a01b03167fa0561a59abed308fcd0556834574739d778cc6229018039a24ddda0f86aa0b738447604051613cef929190615aff565b606080613d4383614a5f565b6071546040516391f8723f60e01b81529192506000916001600160a01b03909116906391f8723f90613d7a90607390600401615d94565b600060405180830381865afa158015613d97573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613dbf9190810190615bf1565b60a854604051632907e73160e11b81529192506000916001600160a01b039091169063520fce6290613df690607390600401615d94565b600060405180830381865afa158015613e13573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613e3b9190810190615bf1565b90506000613eaa6073805480602002602001604051908101604052809291908181526020018280548015613e9857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613e7a575b5050505050848460a95460ad54614f53565b9095509050613eba85828861501d565b505050915091565b606f546000906001600160a01b031663fdadda8183613ee24360016159da565b6040518363ffffffff1660e01b8152600401613eff929190615b84565b600060405180830381865afa158015613f1c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f449190810190615dd8565b905060005b8251811015614200576000838281518110613f6657613f66615982565b6020908102919091018101516001600160a01b0381166000908152603b909252604082205490925042111590613f9b83612082565b90506000613fa8846134fc565b80613fc95750858581518110613fc057613fc0615982565b60200260200101515b80613fd15750825b15905081158015613fdf5750805b1561405a576001600160a01b038416600090815260ac602052604090205461401e9060019060ff16600381111561401857614018615a2f565b9061517b565b6001600160a01b038516600090815260ac60205260409020805460ff1916600183600381111561405057614050615a2f565b02179055506140dc565b818015614065575080155b156140dc576001600160a01b038416600090815260ac60205260409020546140a49060019060ff16600381111561409e5761409e615a2f565b906151b6565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156140d6576140d6615a2f565b02179055505b60006140e7856111ad565b90508315811580156140f65750805b1561416b576001600160a01b038616600090815260ac602052604090205461412f9060029060ff16600381111561401857614018615a2f565b6001600160a01b038716600090815260ac60205260409020805460ff1916600183600381111561416157614161615a2f565b02179055506141e7565b818015614176575080155b156141e7576001600160a01b038616600090815260ac60205260409020546141af9060029060ff16600381111561409e5761409e615a2f565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156141e1576141e1615a2f565b02179055505b50505050505080806141f8906159ae565b915050613f49565b5082847f283b50d76057d5f828df85bc87724c6af604e9b55c363a07c9faa2a2cd688b8261422c6118ca565b60405161423991906158b7565b60405180910390a382847f773d1888df530d69716b183a92450d45f97fba49f2a4bb34fae3b23da0e2cc6f61426c6123d6565b60405161427991906158b7565b60405180910390a350505050565b6000600154826142979190615b70565b610c6c9060016159da565b60018201546142b9906001600160a01b03166125ee565b6142d65760405163a64b34ad60e01b815260040160405180910390fd5b6005820181905560018201546040518281526001600160a01b03909116907fb9a1e33376bfbda9092f2d1e37662c1b435aab0d3fa8da3acc8f37ee222f99e7906020016110e4565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d806000811461436e576040519150601f19603f3d011682016040523d82523d6000602084013e614373565b606091505b509095945050505050565b60a85460405163107fbb4760e21b815260009182916001600160a01b03909116906341feed1c906143b3908690600401615681565b602060405180830381865afa1580156143d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143f49190615a5e565b1192915050565b600081600381111561440f5761440f615a2f565b60ff161592915050565b6001600160a01b03808216600090815260756020526040812060030154909116610c6c565b841580801561444b575086155b156144845761445861201f565b60e2546144659190615b70565b6001600160a01b038a16600090815260e3602052604090205550614853565b80156144905750614853565b8187116144b057858860e2546144a69190615b43565b6144659190615b70565b6000876144bf6127108b615b43565b6144c99190615b70565b905060006144d9826127106159c7565b90508581106146f4576001603960008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008e815260200190815260200160002060006101000a81548160ff0219169083151502179055506001603760008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008e815260200190815260200160002060006101000a81548160ff0219169083151502179055506145ad854361458f91906159da565b6001600160a01b038d166000908152603a6020526040902054613237565b6001600160a01b038c166000908152603a60205260409020556145f16145d386436159da565b6001600160a01b038d166000908152603c6020526040902054613237565b603c60008d6001600160a01b03166001600160a01b0316815260200190815260200160002081905550607060009054906101000a90046001600160a01b03166001600160a01b031663c008ce398c60028f6040518463ffffffff1660e01b815260040161466093929190615e66565b600060405180830381600087803b15801561467a57600080fd5b505af115801561468e573d6000803e3d6000fd5b505050508b8b6001600160a01b0316600080516020615f16833981519152603a60008f6001600160a01b03166001600160a01b031681526020019081526020016000205460006001806040516146e79493929190615a77565b60405180910390a3613764565b868110614817576001603960008d6001600160a01b03166001600160a01b0316815260200190815260200160002060008e815260200190815260200160002060006101000a81548160ff021916908315150217905550607060009054906101000a90046001600160a01b03166001600160a01b031663c008ce398c60018f6040518463ffffffff1660e01b815260040161479093929190615e66565b600060405180830381600087803b1580156147aa57600080fd5b505af11580156147be573d6000803e3d6000fd5b505050508b8b6001600160a01b0316600080516020615f16833981519152603a60008f6001600160a01b03166001600160a01b031681526020019081526020016000205460008060016040516146e79493929190615a77565b871561376457878a60e25461482c9190615b43565b6148369190615b70565b6001600160a01b038c16600090815260e360205260409020555050505b505050505050505050565b6001600160a01b038316600090815260e360205260409020548015613aa75761488a8282610dac61431e565b156148ec57816001600160a01b0316836001600160a01b0316856001600160a01b03167f72a57dc38837a1cba7881b7b1a5594d9e6b65cec6a985b54e2cee3e89369691c846040516148de91815260200190565b60405180910390a450505050565b816001600160a01b0316836001600160a01b0316856001600160a01b03167fd35d76d87d51ed89407fc7ceaaccf32cf72784b94530892ce33546540e141b7284476040516148de929190615aff565b6001600160a01b038216600090815260e060205260409020548015612e59576149678282610dac61431e565b156149be57816001600160a01b0316836001600160a01b03167f1ce7a1c4702402cd393500acb1de5bd927727a54e144a587d328f1b679abe4ec836040516149b191815260200190565b60405180910390a3505050565b816001600160a01b0316836001600160a01b03167f6c69e09ee5c5ac33c0cd57787261c5bade070a392ab34a4b5487c6868f723f6e83476040516149b1929190615aff565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114614a50576040519150601f19603f3d011682016040523d82523d6000602084013e614a55565b606091505b5090949350505050565b6071546040805163af24542960e01b815290516060926001600160a01b031691600091839163af2454299160048083019260209291908290030181865afa158015614aae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614ad29190615a5e565b90506000826001600160a01b031663909791dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b14573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b389190615a5e565b90506000836001600160a01b03166342ef3c3460736040518263ffffffff1660e01b8152600401614b699190615d94565b600060405180830381865afa158015614b86573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052614bae9190810190615bf1565b6073549091506000816001600160401b03811115614bce57614bce61576c565b604051908082528060200260200182016040528015614bf7578160200160208202803683370190505b50965060008060005b84831015614ea35760738381548110614c1b57614c1b615982565b60009182526020808320909101546001600160a01b031680835260759091526040909120600681015488519294509092501515908890889086908110614c6357614c63615982565b60200260200101511015614cbf5780614cba576000614c828a426159da565b600684018190556040518181529091506001600160a01b03851690600080516020615ed68339815191529060200160405180910390a2505b614d00565b8015614d00578160060160009055826001600160a01b0316600080516020615ed68339815191526000604051614cf791815260200190565b60405180910390a25b60008260050154600014158015614d1b575042836005015411155b80614d3e57506001600160a01b038416600090815260e9602052604090205460ff165b905060008360060154600014158015614d5b575042846006015411155b90508180614d665750805b15614dfc5788614d7589615d4e565b98508881518110614d8857614d88615982565b6020026020010151898781518110614da257614da2615982565b6020908102919091010152848d88614db9816159ae565b995081518110614dcb57614dcb615982565b60200260200101906001600160a01b031690816001600160a01b031681525050614df4856151f2565b505050614c00565b6001600160a01b0385166000908152607760205260409020548015801590614e245750428111155b15614e8d576001600160a01b0386166000818152607760209081526040808320600181018054918590559390935560048901839055518281529192917f86d576c20e383fc2413ef692209cc48ddad5e52f25db5b32f8f7ec5076461ae9910160405180910390a2505b86614e97816159ae565b97505050505050614c00565b505081159050614f48578087527f4eaf233b9dc25a5552c1927feee1412eea69add17c2485c831c2e60e234f3c9187604051614edf91906158b7565b60405180910390a160405163e22d1c9d60e01b81526001600160a01b0387169063e22d1c9d90614f15908a908c90600401615b84565b600060405180830381600087803b158015614f2f57600080fd5b505af1158015614f43573d6000803e3d6000fd5b505050505b505050505050919050565b60606000806068905060008888888888604051602401614f77959493929190615e87565b60408051601f19818403018152919052602080820180516001600160e01b0316633bca0a8960e11b17905281518b519293506001929091600091614fba91615b43565b614fc59060406159da565b90506020840181888483895afa614fdb57600093505b503d614fe657600092505b6020870196508261500a57604051630fc2632160e01b815260040160405180910390fd5b8651955050505050509550959350505050565b815b60aa5481101561507b57600081815260ab6020818152604080842080546001600160a01b0316855260ac8352908420805460ff19169055928490525280546001600160a01b031916905580615073816159ae565b91505061501f565b5060005b828110156150c557600081815260ab60209081526040808320546001600160a01b0316835260ac9091529020805460ff19169055806150bd816159ae565b91505061507f565b5060005b828110156151435760008482815181106150e5576150e5615982565b6020908102919091018101516001600160a01b0316600081815260ac83526040808220805460ff1916600317905585825260ab9093529190912080546001600160a01b0319169091179055508061513b816159ae565b9150506150c9565b508160aa81905550807f3d0eea40644a206ec25781dd5bb3b60eb4fa1264b993c3bddf3c73b14f29ef5e84604051613cef91906158b7565b600081600381111561518f5761518f615a2f565b8360038111156151a1576151a1615a2f565b1760ff166003811115610c4457610c44615a2f565b60008160038111156151ca576151ca615a2f565b198360038111156151dd576151dd615a2f565b1660ff166003811115610c4457610c44615a2f565b6001600160a01b038116600090815260e960209081526040808320805460ff191690556074909152812054610fd19183919081900361522f575050565b6001600160a01b038216600090815260756020908152604080832080546001600160a01b0319908116825560018083018054831690556002830180548316905560038301805490921690915560048201859055600582018590556006909101849055607483528184208490556077909252822082815581018290556073805490916152b9916159c7565b815481106152c9576152c9615982565b6000918252602090912001546001600160a01b0390811691508316811461534c576001600160a01b038116600090815260746020526040902082905560738054829190841990811061531d5761531d615982565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b607380548061535d5761535d615bba565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6001600160a01b0381168114610fd157600080fd5b6000602082840312156153e757600080fd5b8135610c44816153c0565b6000806040838503121561540557600080fd5b8235615410816153c0565b91506020830135615420816153c0565b809150509250929050565b600080600080600060a0868803121561544357600080fd5b853561544e816153c0565b9450602086013561545e816153c0565b9350604086013561546e816153c0565b9250606086013561547e816153c0565b949793965091946080013592915050565b600080604083850312156154a257600080fd5b82356154ad816153c0565b946020939093013593505050565b6000602082840312156154cd57600080fd5b5035919050565b60008083601f8401126154e657600080fd5b5081356001600160401b038111156154fd57600080fd5b6020830191508360208260051b850101111561551857600080fd5b9250929050565b60008060006040848603121561553457600080fd5b83356001600160401b0381111561554a57600080fd5b615556868287016154d4565b909790965060209590950135949350505050565b6020808252825182820181905260009190848201906040850190845b818110156155a4578351151583529284019291840191600101615586565b50909695505050505050565b60018060a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b60e08101610c6c82846155b0565b815181526020808301519082015260408101610c6c565b8015158114610fd157600080fd5b6000806000806080858703121561564d57600080fd5b8435615658816153c0565b93506020850135925060408501359150606085013561567681615629565b939692955090935050565b6001600160a01b0391909116815260200190565b8060408101831015610c6c57600080fd5b6000806000806000806000806000806000806101a08d8f0312156156c957600080fd5b8c356156d4816153c0565b9b5060208d01356156e4816153c0565b9a5060408d01356156f4816153c0565b995060608d0135615704816153c0565b985060808d0135615714816153c0565b975060a08d0135615724816153c0565b965060c08d0135955060e08d013594506101008d013593506101208d013592506101408d0135915061575a8e6101608f01615695565b90509295989b509295989b509295989b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156157aa576157aa61576c565b604052919050565b60006001600160401b038211156157cb576157cb61576c565b5060051b60200190565b600060208083850312156157e857600080fd5b82356001600160401b038111156157fe57600080fd5b8301601f8101851361580f57600080fd5b803561582261581d826157b2565b615782565b81815260059190911b8201830190838101908783111561584157600080fd5b928401925b82841015615868578335615859816153c0565b82529284019290840190615846565b979650505050505050565b600081518084526020808501945080840160005b838110156158ac5781516001600160a01b031687529582019590820190600101615887565b509495945050505050565b602081526000610c446020830184615873565b600080602083850312156158dd57600080fd5b82356001600160401b038111156158f357600080fd5b6158ff858286016154d4565b90969095509350505050565b6020808252825182820181905260009190848201906040850190845b818110156155a45761593a8385516155b0565b9284019260e09290920191600101615927565b60008060006060848603121561596257600080fd5b833561596d816153c0565b95602085013595506040909401359392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016159c0576159c0615998565b5060010190565b81810381811115610c6c57610c6c615998565b80820180821115610c6c57610c6c615998565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b634e487b7160e01b600052602160045260246000fd5b6001600160a01b03929092168252602082015260400190565b600060208284031215615a7057600080fd5b5051919050565b9384526020840192909252151560408301521515606082015260800190565b600080600060608486031215615aab57600080fd5b8351615ab681615629565b602085015160409095015190969495509392505050565b8281526040810160038310615af257634e487b7160e01b600052602160045260246000fd5b8260208301529392505050565b918252602082015260400190565b60008060008060808587031215615b2357600080fd5b505082516020840151604085015160609095015191969095509092509050565b8082028115828204841417610c6c57610c6c615998565b634e487b7160e01b600052601260045260246000fd5b600082615b7f57615b7f615b5a565b500490565b604081526000615b976040830185615873565b90508260208301529392505050565b600082615bb557615bb5615b5a565b500690565b634e487b7160e01b600052603160045260246000fd5b828152604060208201526000615be96040830184615873565b949350505050565b60006020808385031215615c0457600080fd5b82516001600160401b03811115615c1a57600080fd5b8301601f81018513615c2b57600080fd5b8051615c3961581d826157b2565b81815260059190911b82018301908381019087831115615c5857600080fd5b928401925b8284101561586857835182529284019290840190615c5d565b600081518084526020808501945080840160005b838110156158ac57815187529582019590820190600101615c8a565b606081526000615cb96060830186615873565b8281036020840152615ccb8186615c76565b915050826040830152949350505050565b838152606060208201526000615cf56060830185615873565b8281036040840152615d078185615c76565b9695505050505050565b848152608060208201526000615d2a6080830186615873565b8281036040840152615d3c8186615c76565b91505082606083015295945050505050565b600081615d5d57615d5d615998565b506000190190565b6000825160005b81811015615d865760208186018101518583015201615d6c565b506000920191825250919050565b6020808252825482820181905260008481528281209092916040850190845b818110156155a45783546001600160a01b031683526001938401939285019201615db3565b60006020808385031215615deb57600080fd5b82516001600160401b03811115615e0157600080fd5b8301601f81018513615e1257600080fd5b8051615e2061581d826157b2565b81815260059190911b82018301908381019087831115615e3f57600080fd5b928401925b82841015615868578351615e5781615629565b82529284019290840190615e44565b6001600160a01b039390931683526020830191909152604082015260600190565b60a081526000615e9a60a0830188615873565b8281036020840152615eac8188615c76565b90508281036040840152615ec08187615c76565b6060840195909552505060800152939250505056fe88f854e137380c14d63f6ed99781bf13402167cf55bac49bcd44d4f2d6a342754042bb9a70998f80a86d9963f0d2132e9b11c8ad94d207c6141c8e34b05ce53e54ce99c5ce1fc9f61656d4a0fb2697974d0c973ac32eecaefe06fcf18b8ef68aa2646970667358221220c404751bdd0e38f9d7131910efc0fb8267dfc163279ad93e029aff6c6f812a0764736f6c63430008110033", + "numDeployments": 8, + "solcInputHash": "2a8db5de0d3bfe0cb40ba15ae8460f16", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedEmergencyExit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedRevokingCandidate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedUpdatingCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyWrappedEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAtEndOfEpochOnly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallPrecompiled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeBridgeTrackingContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeCoinbase\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeMaintenanceContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeRoninTrustedOrgContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeSlashIndicatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeStakingContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeStakingVestingContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"ErrCannotBailout\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExceedsMaxNumberOfCandidate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentBridgeOperator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExistentCandidate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdminAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentCandidateAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_treasuryAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidEffectiveDaysOnwards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMaxPrioritizedValidatorNumber\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMinEffectiveDaysOnwards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrNonExistentCandidate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrTrustedOrgCannotRenounce\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnauthorizedReceiveRON\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonExistentRecyclingInfo\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"BlockProducerSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coinbaseAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum ICoinbaseExecution.BlockRewardDeprecatedType\",\"name\":\"deprecatedType\",\"type\":\"uint8\"}],\"name\":\"BlockRewardDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coinbaseAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"submittedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bonusAmount\",\"type\":\"uint256\"}],\"name\":\"BlockRewardSubmitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"bridgeOperators\",\"type\":\"address[]\"}],\"name\":\"BridgeOperatorSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"BridgeTrackingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"BridgeTrackingIncorrectlyResponded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"}],\"name\":\"CandidateGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"}],\"name\":\"CandidateRevokingTimestampUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"name\":\"CandidateTopupDeadlineUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"CandidatesRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"effectiveTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateUpdateScheduled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"name\":\"DeprecatedRewardRecycleFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DeprecatedRewardRecycled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockedAmount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedFundReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedFundReleasingFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lockedAmount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExpiryDurationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"MaintenanceContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MaxPrioritizedValidatorNumberUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"MaxValidatorCandidateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MaxValidatorNumberUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"numOfDays\",\"type\":\"uint256\"}],\"name\":\"MinEffectiveDaysOnwardsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MiningRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"MiningRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"RoninTrustedOrganizationContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SlashIndicatorContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"StakingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"StakingRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"StakingVestingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailedUntil\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"deductedStakingAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"blockProducerRewardDeprecated\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"bridgeOperatorRewardDeprecated\",\"type\":\"bool\"}],\"name\":\"ValidatorPunished\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"ValidatorSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"ValidatorUnjailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"periodNumber\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochNumber\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"periodEnding\",\"type\":\"bool\"}],\"name\":\"WrappedUpEpoch\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADDITION_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERIOD_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bridgeTrackingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkBridgeRewardDeprecatedAtLatestPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"checkBridgeRewardDeprecatedAtPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"checkJailed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_blockNum\",\"type\":\"uint256\"}],\"name\":\"checkJailedAtBlock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"}],\"name\":\"checkManyJailed\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_result\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_blockProducer\",\"type\":\"address\"}],\"name\":\"checkMiningRewardDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_blockProducer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"checkMiningRewardDeprecatedAtPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentPeriodStartAtBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyExitLockedAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyExpiryDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"epochEndingAt\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"epochOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"execApplyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"execBailOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_secLeftToRevoke\",\"type\":\"uint256\"}],\"name\":\"execEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_recipient\",\"type\":\"address\"}],\"name\":\"execReleaseLockedFundForEmergencyExitRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_secsLeft\",\"type\":\"uint256\"}],\"name\":\"execRequestRenounceCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_effectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"execRequestUpdateCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_newJailedUntil\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"_cannotBailout\",\"type\":\"bool\"}],\"name\":\"execSlash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBlockProducers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBridgeOperators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validatorAddrs\",\"type\":\"address[]\"}],\"name\":\"getBridgeOperatorsOf\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCandidateInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.ValidatorCandidate\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCandidateInfos\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.ValidatorCandidate[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCommissionChangeSchedule\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"effectiveTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.CommissionSchedule\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getEmergencyExitInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"lockedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"recyclingAt\",\"type\":\"uint256\"}],\"internalType\":\"struct ICommonInfo.EmergencyExitInfo\",\"name\":\"_info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"getJailedTimeLeft\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isJailed_\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"blockLeft_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochLeft_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_blockNum\",\"type\":\"uint256\"}],\"name\":\"getJailedTimeLeftAtBlock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isJailed_\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"blockLeft_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochLeft_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastUpdatedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorCandidates\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_validatorList\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_bridgeOperators\",\"type\":\"address[]\"},{\"internalType\":\"enum EnumFlags.ValidatorFlag[]\",\"name\":\"_flags\",\"type\":\"uint8[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__slashIndicatorContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__stakingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__stakingVestingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__maintenanceContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninTrustedOrganizationContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__bridgeTrackingContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__maxValidatorNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxValidatorCandidate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxPrioritizedValidatorNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__minEffectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__numberOfBlocksInEpoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256[2]\",\"name\":\"__emergencyExitConfigs\",\"type\":\"uint256[2]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isBlockProducer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"}],\"name\":\"isBridgeOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isOperator\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"}],\"name\":\"isCandidateAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"isOperatingBridge\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isPeriodEnding\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isValidator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isValidatorCandidate\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maintenanceContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxPrioritizedValidatorNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maximumPrioritizedValidatorNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorCandidate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maximumValidatorNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minEffectiveDaysOnwards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfBlocksInEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfBlocks\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompilePickValidatorSetAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompileSortValidatorsAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninTrustedOrganizationContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setBridgeTrackingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_emergencyExitLockedAmount\",\"type\":\"uint256\"}],\"name\":\"setEmergencyExitLockedAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_emergencyExpiryDuration\",\"type\":\"uint256\"}],\"name\":\"setEmergencyExpiryDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setMaintenanceContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"name\":\"setMaxPrioritizedValidatorNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"name\":\"setMaxValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_max\",\"type\":\"uint256\"}],\"name\":\"setMaxValidatorNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numOfDays\",\"type\":\"uint256\"}],\"name\":\"setMinEffectiveDaysOnwards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setRoninTrustedOrganizationContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setSlashIndicatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setStakingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setStakingVestingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"slashIndicatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingVestingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"submitBlockReward\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBlockProducers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBridgeOperators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalDeprecatedReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"tryGetPeriodOfEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_filled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_periodNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wrapUpEpoch\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrAlreadyRequestedEmergencyExit()\":[{\"details\":\"Error of already requested emergency exit before.\"}],\"ErrAlreadyRequestedRevokingCandidate()\":[{\"details\":\"Error of already requested revoking candidate before.\"}],\"ErrAlreadyRequestedUpdatingCommissionRate()\":[{\"details\":\"Error of commission change schedule exists.\"}],\"ErrAlreadyWrappedEpoch()\":[{\"details\":\"Error of query for already wrapped up epoch\"}],\"ErrAtEndOfEpochOnly()\":[{\"details\":\"Error of only allowed at the end of epoch\"}],\"ErrCallPrecompiled()\":[{\"details\":\"Error of call to precompile fails.\"}],\"ErrCallerMustBeBridgeTrackingContract()\":[{\"details\":\"Error of method caller must be bridge tracking contract.\"}],\"ErrCallerMustBeCoinbase()\":[{\"details\":\"Error of method caller must be coinbase\"}],\"ErrCallerMustBeMaintenanceContract()\":[{\"details\":\"Error of method caller must be maintenance contract.\"}],\"ErrCallerMustBeRoninTrustedOrgContract()\":[{\"details\":\"Error of method caller must be Ronin trusted org contract.\"}],\"ErrCallerMustBeSlashIndicatorContract()\":[{\"details\":\"Error of method caller must be slash indicator contract.\"}],\"ErrCallerMustBeStakingContract()\":[{\"details\":\"Error of method caller must be staking contract.\"}],\"ErrCallerMustBeStakingVestingContract()\":[{\"details\":\"Error of method caller must be staking vesting contract.\"}],\"ErrCannotBailout(address)\":[{\"details\":\"Error of cannot bailout due to high tier slash.\"}],\"ErrExceedsMaxNumberOfCandidate()\":[{\"details\":\"Error of exceeding maximum number of candidates.\"}],\"ErrExistentBridgeOperator(address)\":[{\"details\":\"Error of bridge operator already exists.\"}],\"ErrExistentCandidate()\":[{\"details\":\"Error of querying for already existent candidate.\"}],\"ErrExistentCandidateAdmin(address)\":[{\"details\":\"Error of candidate admin already exists.\"}],\"ErrExistentTreasury(address)\":[{\"details\":\"Error of treasury already exists.\"}],\"ErrInsufficientBalance()\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrInvalidCommissionRate()\":[{\"details\":\"Error of invalid commission rate.\"}],\"ErrInvalidEffectiveDaysOnwards()\":[{\"details\":\"Error of invalid effective days onwards.\"}],\"ErrInvalidMaxPrioritizedValidatorNumber()\":[{\"details\":\"Error of number of prioritized greater than number of max validators.\"}],\"ErrInvalidMinEffectiveDaysOnwards()\":[{\"details\":\"Error of invalid min effective days onwards.\"}],\"ErrNonExistentCandidate()\":[{\"details\":\"Error of querying for non-existent candidate.\"}],\"ErrRecipientRevert()\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrTrustedOrgCannotRenounce()\":[{\"details\":\"Error of trusted org cannot renounce.\"}],\"ErrUnauthorizedReceiveRON()\":[{\"details\":\"Error thrown when receives RON from neither staking vesting contract nor staking contract\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}],\"NonExistentRecyclingInfo()\":[{\"details\":\"Error thrown when queries for a non existent info.\"}]},\"kind\":\"dev\",\"methods\":{\"bridgeTrackingContract()\":{\"details\":\"Returns the bridge tracking contract.\"},\"checkBridgeRewardDeprecatedAtLatestPeriod(address)\":{\"details\":\"Because the information of deprecating bridge reward of a period is only determined at the end of that period, this method will return the deprecating info of the latest period. A method for querying that info of current period is no need.\"},\"checkBridgeRewardDeprecatedAtPeriod(address,uint256)\":{\"details\":\"Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\"},\"checkJailed(address)\":{\"details\":\"Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\"},\"checkJailedAtBlock(address,uint256)\":{\"details\":\"Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\"},\"checkManyJailed(address[])\":{\"details\":\"Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\"},\"checkMiningRewardDeprecated(address)\":{\"details\":\"Returns whether the incoming reward of the block producer is deprecated during the current period.\"},\"checkMiningRewardDeprecatedAtPeriod(address,uint256)\":{\"details\":\"Returns whether the incoming reward of the block producer is deprecated during a specific period.\"},\"currentPeriod()\":{\"details\":\"Returns the period index from the current block.\"},\"currentPeriodStartAtBlock()\":{\"details\":\"Returns the block number that the current period starts at.\"},\"emergencyExitLockedAmount()\":{\"details\":\"Returns the amount of RON to lock from a consensus address.\"},\"emergencyExpiryDuration()\":{\"details\":\"Returns the duration that an emergency request is expired and the fund will be recycled.\"},\"epochEndingAt(uint256)\":{\"details\":\"Returns whether the epoch ending is at the block number `_block`.\"},\"epochOf(uint256)\":{\"details\":\"Returns the epoch index from the block number.\"},\"execApplyValidatorCandidate(address,address,address,address,uint256)\":{\"details\":\"Grants a validator candidate. Requirements: - The method caller is staking contract. Emits the event `CandidateGranted`.\"},\"execBailOut(address,uint256)\":{\"details\":\"Finalize the bailout request from slash indicator contract. Requirements: - The method caller is slash indicator contract. Emits the event `ValidatorUnjailed`.\"},\"execEmergencyExit(address,uint256)\":{\"details\":\"Fallback function of `IStaking-requestEmergencyExit`. Requirements: - The method caller is staking contract.\"},\"execReleaseLockedFundForEmergencyExitRequest(address,address)\":{\"details\":\"Unlocks fund for emergency exit request. Requirements: - The method caller is admin. Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked. Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\"},\"execRequestRenounceCandidate(address,uint256)\":{\"details\":\"Requests to revoke a validator candidate in next `_secsLeft` seconds. Requirements: - The method caller is staking contract. Emits the event `CandidateRevokingTimestampUpdated`.\"},\"execRequestUpdateCommissionRate(address,uint256,uint256)\":{\"details\":\"Fallback function of `CandidateStaking-requestUpdateCommissionRate`. Requirements: - The method caller is the staking contract. - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdateScheduled`.\"},\"execSlash(address,uint256,uint256,bool)\":{\"details\":\"Finalize the slash request from slash indicator contract. Requirements: - The method caller is slash indicator contract. Emits the event `ValidatorPunished`.\"},\"getBlockProducers()\":{\"details\":\"Returns the current block producer list.\"},\"getBridgeOperators()\":{\"details\":\"Returns the current bridge operator list.\"},\"getBridgeOperatorsOf(address[])\":{\"details\":\"Returns the bridge operator list corresponding to validator address list.\"},\"getCandidateInfo(address)\":{\"details\":\"Returns the info of a candidate.\"},\"getCandidateInfos()\":{\"details\":\"Returns all candidate info.\"},\"getCommissionChangeSchedule(address)\":{\"details\":\"Returns the schedule of changing commission rate of a candidate address.\"},\"getEmergencyExitInfo(address)\":{\"details\":\"Returns the emergency exit request.\"},\"getJailedTimeLeft(address)\":{\"details\":\"Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\"},\"getJailedTimeLeftAtBlock(address,uint256)\":{\"details\":\"Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\"},\"getLastUpdatedBlock()\":{\"details\":\"Returns the block that validator set was updated.\"},\"getValidatorCandidates()\":{\"details\":\"Returns the validator candidate.\"},\"getValidators()\":{\"details\":\"Returns the current validator list.\"},\"initialize(address,address,address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256[2])\":{\"details\":\"Initializes the contract storage.\"},\"isBlockProducer(address)\":{\"details\":\"Returns whether the address is block producer or not.\"},\"isBridgeOperator(address)\":{\"details\":\"Returns whether the address is bridge operator.\"},\"isCandidateAdmin(address,address)\":{\"details\":\"Returns whether the address is the candidate admin.\"},\"isOperatingBridge(address)\":{\"details\":\"Returns whether the consensus address is operating the bridge or not.\"},\"isPeriodEnding()\":{\"details\":\"Returns whether the period ending at the current block number.\"},\"isValidator(address)\":{\"details\":\"Returns whether the address is either a bridge operator or a block producer.\"},\"isValidatorCandidate(address)\":{\"details\":\"Returns whether the address is a validator (candidate).\"},\"maintenanceContract()\":{\"details\":\"Returns the maintenance contract.\"},\"maxPrioritizedValidatorNumber()\":{\"details\":\"Returns the number of reserved slots for prioritized validators.\"},\"maxValidatorCandidate()\":{\"details\":\"Returns the maximum number of validator candidate.\"},\"maxValidatorNumber()\":{\"details\":\"Returns the maximum number of validators in the epoch.\"},\"minEffectiveDaysOnwards()\":{\"details\":\"Returns the minimum number of days to the effective date of commission rate change.\"},\"numberOfBlocksInEpoch()\":{\"details\":\"Returns the number of blocks in a epoch.\"},\"precompilePickValidatorSetAddress()\":{\"details\":\"Gets the address of the precompile of picking validator set\"},\"precompileSortValidatorsAddress()\":{\"details\":\"Gets the address of the precompile of sorting validators\"},\"roninTrustedOrganizationContract()\":{\"details\":\"Returns the ronin trusted organization contract.\"},\"setBridgeTrackingContract(address)\":{\"details\":\"Sets the bridge tracking contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `BridgeTrackingContractUpdated`.\"},\"setEmergencyExitLockedAmount(uint256)\":{\"details\":\"Sets the amount of RON to lock from a consensus address. Requirements: - The method caller is admin. Emits the event `EmergencyExitLockedAmountUpdated`.\"},\"setEmergencyExpiryDuration(uint256)\":{\"details\":\"Sets the duration that an emergency request is expired and the fund will be recycled. Requirements: - The method caller is admin. Emits the event `EmergencyExpiryDurationUpdated`.\"},\"setMaintenanceContract(address)\":{\"details\":\"Sets the maintenance contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `MaintenanceContractUpdated`.\"},\"setMaxPrioritizedValidatorNumber(uint256)\":{\"details\":\"Updates the number of reserved slots for prioritized validators Requirements: - The method caller is admin Emits the event `MaxPrioritizedValidatorNumberUpdated`\"},\"setMaxValidatorCandidate(uint256)\":{\"details\":\"Sets the maximum number of validator candidate. Requirements: - The method caller is admin. Emits the `MaxValidatorCandidateUpdated` event.\"},\"setMaxValidatorNumber(uint256)\":{\"details\":\"Updates the max validator number Requirements: - The method caller is admin Emits the event `MaxValidatorNumberUpdated`\"},\"setMinEffectiveDaysOnwards(uint256)\":{\"details\":\"Sets the minimum number of days to the effective date of commision rate change. Requirements: - The method caller is admin. Emits the `MinEffectiveDaysOnwardsUpdated` event.\"},\"setRoninTrustedOrganizationContract(address)\":{\"details\":\"Sets the ronin trusted organization contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `RoninTrustedOrganizationContractUpdated`.\"},\"setSlashIndicatorContract(address)\":{\"details\":\"Sets the slash indicator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `SlashIndicatorContractUpdated`.\"},\"setStakingContract(address)\":{\"details\":\"Sets the staking contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `StakingContractUpdated`.\"},\"setStakingVestingContract(address)\":{\"details\":\"Sets the staking vesting contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `StakingVestingContractUpdated`.\"},\"slashIndicatorContract()\":{\"details\":\"Returns the slash indicator contract.\"},\"stakingContract()\":{\"details\":\"Returns the staking contract.\"},\"stakingVestingContract()\":{\"details\":\"Returns the staking vesting contract.\"},\"submitBlockReward()\":{\"details\":\"Submits reward of the current block. Requirements: - The method caller is coinbase. Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer. Emits the event `BlockRewardSubmitted` for the valid call.\"},\"totalBlockProducers()\":{\"details\":\"Returns total numbers of the block producers.\"},\"totalBridgeOperators()\":{\"details\":\"Returns total numbers of the bridge operators.\"},\"totalDeprecatedReward()\":{\"details\":\"Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\"},\"tryGetPeriodOfEpoch(uint256)\":{\"details\":\"Tries to get the period index from the epoch number.\"},\"wrapUpEpoch()\":{\"details\":\"Wraps up the current epoch. Requirements: - The method must be called when the current epoch is ending. - The epoch is not wrapped yet. - The method caller is coinbase. Emits the event `MiningRewardDistributed` when some validator has reward distributed. Emits the event `StakingRewardDistributed` when some staking pool has reward distributed. Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up. Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending. Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated. Emits the event `WrappedUpEpoch`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/validator/RoninValidatorSet.sol\":\"RoninValidatorSet\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":0},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xdb7f5c28fc61cda0bd8ab60ce288e206b791643bcd3ba464a70cbec18895a2f5\",\"license\":\"MIT\"},\"contracts/extensions/RONTransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract RONTransferHelper {\\n /// @dev Error of recipient not accepting RON when transfer RON.\\n error ErrRecipientRevert();\\n /// @dev Error of sender has insufficient balance.\\n error ErrInsufficientBalance();\\n\\n /**\\n * @dev See `_sendRON`.\\n * Reverts if the recipient does not receive RON.\\n */\\n function _transferRON(address payable _recipient, uint256 _amount) internal {\\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\\n }\\n\\n /**\\n * @dev Send `_amount` RON to the address `_recipient`.\\n * Returns whether the recipient receives RON or not.\\n * Reverts once the contract balance is insufficient.\\n *\\n * Note: consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\\n return _unsafeSendRON(_recipient, _amount);\\n }\\n\\n /**\\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\\n * the call does not revert.\\n *\\n * Note:\\n * - Does not assert whether the balance of sender is sufficient.\\n * - Does not assert whether the recipient accepts RON.\\n * - Consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount }(\\\"\\\");\\n }\\n\\n /**\\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\\n */\\n function _unsafeSendRON(\\n address payable _recipient,\\n uint256 _amount,\\n uint256 _gas\\n ) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbf47d40b2431cf190fa737b803e4cb6fb55aee3f8804470da57a9e340f7914f8\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasBridgeTrackingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasBridgeTrackingContract.sol\\\";\\nimport \\\"../../interfaces/IBridgeTracking.sol\\\";\\n\\ncontract HasBridgeTrackingContract is IHasBridgeTrackingContract, HasProxyAdmin {\\n IBridgeTracking internal _bridgeTrackingContract;\\n\\n modifier onlyBridgeTrackingContract() {\\n if (bridgeTrackingContract() != msg.sender) revert ErrCallerMustBeBridgeTrackingContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeTrackingContract\\n */\\n function bridgeTrackingContract() public view override returns (address) {\\n return address(_bridgeTrackingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeTrackingContract\\n */\\n function setBridgeTrackingContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setBridgeTrackingContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the bridge tracking contract.\\n *\\n * Emits the event `BridgeTrackingContractUpdated`.\\n *\\n */\\n function _setBridgeTrackingContract(address _addr) internal {\\n _bridgeTrackingContract = IBridgeTracking(_addr);\\n emit BridgeTrackingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x195b0d3fc2305aa4620f5091ba161f3e983b4cef2272d80f5f5b180a8ab98a34\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasMaintenanceContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasMaintenanceContract.sol\\\";\\nimport \\\"../../interfaces/IMaintenance.sol\\\";\\n\\ncontract HasMaintenanceContract is IHasMaintenanceContract, HasProxyAdmin {\\n IMaintenance internal _maintenanceContract;\\n\\n modifier onlyMaintenanceContract() {\\n if (maintenanceContract() != msg.sender) revert ErrCallerMustBeMaintenanceContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasMaintenanceContract\\n */\\n function maintenanceContract() public view override returns (address) {\\n return address(_maintenanceContract);\\n }\\n\\n /**\\n * @inheritdoc IHasMaintenanceContract\\n */\\n function setMaintenanceContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setMaintenanceContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the scheduled maintenance contract.\\n *\\n * Emits the event `MaintenanceContractUpdated`.\\n *\\n */\\n function _setMaintenanceContract(address _addr) internal {\\n _maintenanceContract = IMaintenance(_addr);\\n emit MaintenanceContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x117a29d878d44a20350df8ab539d34335713ba0f3b2c768a58124f61efb74357\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\n\\ncontract HasRoninTrustedOrganizationContract is IHasRoninTrustedOrganizationContract, HasProxyAdmin {\\n IRoninTrustedOrganization internal _roninTrustedOrganizationContract;\\n\\n modifier onlyRoninTrustedOrganizationContract() {\\n if (roninTrustedOrganizationContract() != msg.sender) revert ErrCallerMustBeRoninTrustedOrgContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function roninTrustedOrganizationContract() public view override returns (address) {\\n return address(_roninTrustedOrganizationContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function setRoninTrustedOrganizationContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setRoninTrustedOrganizationContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function _setRoninTrustedOrganizationContract(address _addr) internal {\\n _roninTrustedOrganizationContract = IRoninTrustedOrganization(_addr);\\n emit RoninTrustedOrganizationContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x951fd730f4853d8c932da5484ea093f3094c8186735b603d31fb53035c395751\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasSlashIndicatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasSlashIndicatorContract.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashIndicator.sol\\\";\\n\\ncontract HasSlashIndicatorContract is IHasSlashIndicatorContract, HasProxyAdmin {\\n ISlashIndicator internal _slashIndicatorContract;\\n\\n modifier onlySlashIndicatorContract() {\\n if (slashIndicatorContract() != msg.sender) revert ErrCallerMustBeSlashIndicatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasSlashIndicatorContract\\n */\\n function slashIndicatorContract() public view override returns (address) {\\n return address(_slashIndicatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasSlashIndicatorContract\\n */\\n function setSlashIndicatorContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setSlashIndicatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the slash indicator contract.\\n *\\n * Emits the event `SlashIndicatorContractUpdated`.\\n *\\n */\\n function _setSlashIndicatorContract(address _addr) internal {\\n _slashIndicatorContract = ISlashIndicator(_addr);\\n emit SlashIndicatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x280c56e53c53bf1438cf7d3e71026baf383d24332359bce59282074c94abe5bb\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasStakingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasStakingContract.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\n\\ncontract HasStakingContract is IHasStakingContract, HasProxyAdmin {\\n IStaking internal _stakingContract;\\n\\n modifier onlyStakingContract() {\\n if (stakingContract() != msg.sender) revert ErrCallerMustBeStakingContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasStakingContract\\n */\\n function stakingContract() public view override returns (address) {\\n return address(_stakingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasStakingContract\\n */\\n function setStakingContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setStakingContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the staking contract.\\n *\\n * Emits the event `StakingContractUpdated`.\\n *\\n */\\n function _setStakingContract(address _addr) internal {\\n _stakingContract = IStaking(_addr);\\n emit StakingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x54d2a4608e0a8819ebd7fdb4ae784d3c709285e93f002034f9e2e787a6607923\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasStakingVestingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasStakingVestingContract.sol\\\";\\nimport \\\"../../interfaces/IStakingVesting.sol\\\";\\n\\ncontract HasStakingVestingContract is IHasStakingVestingContract, HasProxyAdmin {\\n IStakingVesting internal _stakingVestingContract;\\n\\n modifier onlyStakingVestingContract() {\\n if (stakingVestingContract() != msg.sender) revert ErrCallerMustBeStakingVestingContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasStakingVestingContract\\n */\\n function stakingVestingContract() public view override returns (address) {\\n return address(_stakingVestingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasStakingVestingContract\\n */\\n function setStakingVestingContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setStakingVestingContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the staking vesting contract.\\n *\\n * Emits the event `StakingVestingContractUpdated`.\\n *\\n */\\n function _setStakingVestingContract(address _addr) internal {\\n _stakingVestingContract = IStakingVesting(_addr);\\n emit StakingVestingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x1893fae5d612b0d78f6d66695194aa6b03817a3b92be602887918781fba29e37\",\"license\":\"MIT\"},\"contracts/extensions/consumers/GlobalConfigConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract GlobalConfigConsumer {\\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\\n /// @dev The length of a period in second.\\n uint256 public constant PERIOD_DURATION = 1 days;\\n}\\n\",\"keccak256\":\"0x96d6b1ea4c8e126a8c2468683e7513d195f8e05456d85dd8f259ab049347b527\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/IBridgeTracking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBridgeTracking {\\n struct Request {\\n VoteKind kind;\\n uint256 id;\\n }\\n\\n enum VoteKind {\\n Deposit,\\n Withdrawal,\\n MainchainWithdrawal\\n }\\n\\n /**\\n * @dev Returns the total number of votes at the specific period `_period`.\\n */\\n function totalVotes(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots at the specific period `_period`.\\n */\\n function totalBallots(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\\n */\\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\\n */\\n function totalBallotsOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\\n\\n /**\\n * @dev Handles the request once it is approved.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\\n\\n /**\\n * @dev Records vote for a receipt and a operator.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function recordVote(\\n VoteKind _kind,\\n uint256 _requestId,\\n address _operator\\n ) external;\\n}\\n\",\"keccak256\":\"0x6066ff36c2ad0494a676dfeb4289c3cbe48d0d70266e8ec0930014a41f2a39a3\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IMaintenance {\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\\n */\\n function checkScheduled(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr`\\n */\\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\\n */\\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedules() external view returns (uint256 _count);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedules() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4f06c8f3ad7ec8b863882c655ddf443675d557272445e51d8a1e1f3454089d09\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x10f3b360430e6d03773c9959f54cbed6fb0346069645c05b05ef50cfb19f3753\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninGovernanceAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../libraries/BridgeOperatorsBallot.sol\\\";\\n\\ninterface IRoninGovernanceAdmin {\\n /// @dev Emitted when the bridge operators are approved.\\n event BridgeOperatorsApproved(uint256 _period, uint256 _epoch, address[] _operators);\\n /// @dev Emitted when an emergency exit poll is created.\\n event EmergencyExitPollCreated(\\n bytes32 _voteHash,\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n );\\n /// @dev Emitted when an emergency exit poll is approved.\\n event EmergencyExitPollApproved(bytes32 _voteHash);\\n /// @dev Emitted when an emergency exit poll is expired.\\n event EmergencyExitPollExpired(bytes32 _voteHash);\\n\\n /**\\n * @dev Returns the last voted block of the bridge voter.\\n */\\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256);\\n\\n /**\\n * @dev Returns the synced bridge operator set info.\\n */\\n function lastSyncedBridgeOperatorSetInfo()\\n external\\n view\\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory _bridgeOperatorSetInfo);\\n\\n /**\\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n */\\n function createEmergencyExitPoll(\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) external;\\n}\\n\",\"keccak256\":\"0x1aa218f9a8cad8fa9f865c179b257aa8f2614e034100dedebdd352da9a7d96d9\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeights() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganizations() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x1edb7a3f5d340e7efc141cb8d94c5499954dec869f026d3998ad92cbc714d604\",\"license\":\"MIT\"},\"contracts/interfaces/IStakingVesting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IStakingVesting {\\n /// @dev Emitted when the block bonus for block producer is transferred.\\n event BonusTransferred(\\n uint256 indexed blockNumber,\\n address indexed recipient,\\n uint256 blockProducerAmount,\\n uint256 bridgeOperatorAmount\\n );\\n /// @dev Emitted when the transfer of block bonus for block producer is failed.\\n event BonusTransferFailed(\\n uint256 indexed blockNumber,\\n address indexed recipient,\\n uint256 blockProducerAmount,\\n uint256 bridgeOperatorAmount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the block bonus for block producer is updated\\n event BlockProducerBonusPerBlockUpdated(uint256);\\n /// @dev Emitted when the block bonus for bridge operator is updated\\n event BridgeOperatorBonusPerBlockUpdated(uint256);\\n\\n /**\\n * @dev Returns the bonus amount for the block producer at `_block`.\\n */\\n function blockProducerBlockBonus(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns the bonus amount for the bridge validator at `_block`.\\n */\\n function bridgeOperatorBlockBonus(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Receives RON from any address.\\n */\\n function receiveRON() external payable;\\n\\n /**\\n * @dev Returns the last block number that the staking vesting is sent.\\n */\\n function lastBlockSendingBonus() external view returns (uint256);\\n\\n /**\\n * @dev Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n * - The method must be called only once per block.\\n *\\n * Emits the event `BonusTransferred` or `BonusTransferFailed`.\\n *\\n * Notes:\\n * - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method\\n * will not be reverted, and the underlying nodes does not hang.\\n *\\n * @param _forBlockProducer Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\\n * @param _forBridgeOperator Indicates whether requesting the bonus for the bridge operator.\\n *\\n * @return _success Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\\n * @return _blockProducerBonus The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\\n * @return _bridgeOperatorBonus The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\\n *\\n */\\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\\n external\\n returns (\\n bool _success,\\n uint256 _blockProducerBonus,\\n uint256 _bridgeOperatorBonus\\n );\\n\\n /**\\n * @dev Sets the bonus amount per block for block producer.\\n *\\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n */\\n function setBlockProducerBonusPerBlock(uint256 _amount) external;\\n\\n /**\\n * @dev Sets the bonus amount per block for bridge operator.\\n *\\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n */\\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0x6705fdccf03c4acd34ceb1034c2ab556c901781d6d5597e63f257eafe75cf1ae\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasBridgeTrackingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasBridgeTrackingContract is IHasContract {\\n /// @dev Emitted when the bridge tracking contract is updated.\\n event BridgeTrackingContractUpdated(address);\\n\\n /// @dev Error of method caller must be bridge tracking contract.\\n error ErrCallerMustBeBridgeTrackingContract();\\n\\n /**\\n * @dev Returns the bridge tracking contract.\\n */\\n function bridgeTrackingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the bridge tracking contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `BridgeTrackingContractUpdated`.\\n *\\n */\\n function setBridgeTrackingContract(address) external;\\n}\\n\",\"keccak256\":\"0x2d1b7e356826bfe1c2a3348137d828f46ca931f7c2f48197379ad987e713714b\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasMaintenanceContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasMaintenanceContract is IHasContract {\\n /// @dev Emitted when the maintenance contract is updated.\\n event MaintenanceContractUpdated(address);\\n\\n /// @dev Error of method caller must be maintenance contract.\\n error ErrCallerMustBeMaintenanceContract();\\n\\n /**\\n * @dev Returns the maintenance contract.\\n */\\n function maintenanceContract() external view returns (address);\\n\\n /**\\n * @dev Sets the maintenance contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `MaintenanceContractUpdated`.\\n *\\n */\\n function setMaintenanceContract(address) external;\\n}\\n\",\"keccak256\":\"0x0a0ef6ba14e2929c7c8dda0642a7a831c9997d1b0d049eb83f64dfc21ff0e72e\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\\n /// @dev Emitted when the ronin trusted organization contract is updated.\\n event RoninTrustedOrganizationContractUpdated(address);\\n\\n /// @dev Error of method caller must be Ronin trusted org contract.\\n error ErrCallerMustBeRoninTrustedOrgContract();\\n\\n /**\\n * @dev Returns the ronin trusted organization contract.\\n */\\n function roninTrustedOrganizationContract() external view returns (address);\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function setRoninTrustedOrganizationContract(address) external;\\n}\\n\",\"keccak256\":\"0x7d0a0b1d658e9cf4d69f4934748e0a5c1d22183024d26927f5d621fc61aff0b2\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasSlashIndicatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasSlashIndicatorContract is IHasContract {\\n /// @dev Emitted when the slash indicator contract is updated.\\n event SlashIndicatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be slash indicator contract.\\n error ErrCallerMustBeSlashIndicatorContract();\\n\\n /**\\n * @dev Returns the slash indicator contract.\\n */\\n function slashIndicatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `SlashIndicatorContractUpdated`.\\n *\\n */\\n function setSlashIndicatorContract(address) external;\\n}\\n\",\"keccak256\":\"0xfaaeec87f74039a55fe451c07c341b88794e62a8a331c878a8d9e91f55f1ff45\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasStakingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasStakingContract is IHasContract {\\n /// @dev Emitted when the staking contract is updated.\\n event StakingContractUpdated(address);\\n\\n /// @dev Error of method caller must be staking contract.\\n error ErrCallerMustBeStakingContract();\\n\\n /**\\n * @dev Returns the staking contract.\\n */\\n function stakingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the staking contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `StakingContractUpdated`.\\n *\\n */\\n function setStakingContract(address) external;\\n}\\n\",\"keccak256\":\"0xd5e9b017f7ba0157fa41152a8bb166edbc6ef54a97fa3bb71a2a9b333d846c0b\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasStakingVestingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasStakingVestingContract is IHasContract {\\n /// @dev Emitted when the staking vesting contract is updated.\\n event StakingVestingContractUpdated(address);\\n\\n /// @dev Error of method caller must be staking vesting contract.\\n error ErrCallerMustBeStakingVestingContract();\\n\\n /**\\n * @dev Returns the staking vesting contract.\\n */\\n function stakingVestingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the staking vesting contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `StakingVestingContractUpdated`.\\n *\\n */\\n function setStakingVestingContract(address) external;\\n}\\n\",\"keccak256\":\"0xfc5f14854b15f81d5b535e4baaeca7cedca69b26813bfc6ade75fdabc4eaffcf\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface PeriodWrapperConsumer {\\n struct PeriodWrapper {\\n // Inner value.\\n uint256 inner;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n}\\n\",\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/IBaseSlash.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseSlash {\\n enum SlashType {\\n UNKNOWN,\\n UNAVAILABILITY_TIER_1,\\n UNAVAILABILITY_TIER_2,\\n DOUBLE_SIGNING,\\n BRIDGE_VOTING,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\\n UNAVAILABILITY_TIER_3\\n }\\n\\n /// @dev Emitted when the validator is slashed.\\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\\n}\\n\",\"keccak256\":\"0x04d449f2852840566dfff4e3673929f6e9b8d9b5fc5b29744bf4f344dc7f9bc0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ICreditScore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICreditScore {\\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\\n event CreditScoreConfigsUpdated(\\n uint256 gainCreditScore,\\n uint256 maxCreditScore,\\n uint256 bailOutCostMultiplier,\\n uint256 cutOffPercentageAfterBailout\\n );\\n /// @dev Emitted the credit score of validators is updated.\\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\\n /// @dev Emitted when a validator bailed out of jail.\\n event BailedOut(address indexed validator, uint256 period, uint256 usedCreditScore);\\n\\n /**\\n * @dev Updates the credit score for the validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function updateCreditScores(address[] calldata _validators, uint256 _period) external;\\n\\n /**\\n * @dev Resets the credit score for the revoked validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function execResetCreditScores(address[] calldata _validators) external;\\n\\n /**\\n * @dev A slashed validator use this method to get out of jail.\\n *\\n * Requirements:\\n * - The `_consensusAddr` must be a validator.\\n * - Only validator's admin can call this method.\\n *\\n * Emits the event `BailedOut`.\\n *\\n */\\n function bailOut(address _consensusAddr) external;\\n\\n /**\\n * @dev Sets the configs to credit score.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CreditScoreConfigsUpdated`.\\n *\\n * @param _gainScore The score to gain per period.\\n * @param _maxScore The max number of credit score that a validator can hold.\\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to credit score.\\n *\\n * @return _gainCreditScore The score to gain per period.\\n * @return _maxCreditScore The max number of credit score that a validator can hold.\\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function getCreditScoreConfigs()\\n external\\n view\\n returns (\\n uint256 _gainCreditScore,\\n uint256 _maxCreditScore,\\n uint256 _bailOutCostMultiplier,\\n uint256 _cutOffPercentageAfterBailout\\n );\\n\\n /**\\n * @dev Returns the current credit score of the validator.\\n */\\n function getCreditScore(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the current credit score of a list of validators.\\n */\\n function getManyCreditScores(address[] calldata _validators) external view returns (uint256[] memory _resultList);\\n\\n /**\\n * @dev Returns the whether the `_validator` has been bailed out at the `_period`.\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5364db88efb971f73aac569e27e5604758a123f28567af757b9933fdddd14f8\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeOperator is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method\\n * `getBridgeOperatorSlashingConfigs` for param details.\\n */\\n event BridgeOperatorSlashingConfigsUpdated(\\n uint256 missingVotesRatioTier1,\\n uint256 missingVotesRatioTier2,\\n uint256 jailDurationForMissingVotesRatioTier2,\\n uint256 skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\\n * @param _tier The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1`\\n * and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2`\\n *\\n * Requirements:\\n * - Only validator contract can invoke this method.\\n * - Should be called only at the end of period.\\n * - Should be called only when there is slash of bridge operator.\\n *\\n * Emits the event `Slashed`.\\n */\\n function execSlashBridgeOperator(\\n address _consensusAddr,\\n uint256 _tier,\\n uint256 _period\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to bridge operator slashing.\\n *\\n * @return _missingVotesRatioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio.\\n * @return _missingVotesRatioTier2 The bridge reward and mining reward will be deprecated and the corresponding\\n * block producer will be put in jail if (s)he misses more than this ratio.\\n * @return _jailDurationForMissingVotesRatioTier2 The number of blocks to jail the corresponding block producer when\\n * its bridge operator is slashed tier-2.\\n * @return _skipBridgeOperatorSlashingThreshold The threshold to skip slashing the bridge operator in case the total\\n * number of votes in the bridge is too small.\\n *\\n */\\n function getBridgeOperatorSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _missingVotesRatioTier1,\\n uint256 _missingVotesRatioTier2,\\n uint256 _jailDurationForMissingVotesRatioTier2,\\n uint256 _skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash bridge operators.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _ratioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map\\n * to 0%-100%.\\n * @param _ratioTier2 The bridge reward and mining reward will be deprecated and the corresponding block producer will\\n * be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\\n * @param _jailDurationTier2 The number of blocks to jail the corresponding block producer when its bridge operator is\\n * slashed tier-2.\\n * @param _skipSlashingThreshold The threshold to skip slashing the bridge operator in case the total number of votes\\n * in the bridge is too small.\\n *\\n */\\n function setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x5c09ac11ead005bfa25ae58e970c441144849b14d58fd5f53fadc3b9be16e5d6\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeVoting is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge voting is updated. See the method `getBridgeVotingSlashingConfigs` for param\\n * details.\\n */\\n event BridgeVotingSlashingConfigsUpdated(uint256 bridgeVotingThreshold, uint256 bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Slashes for bridge voter governance.\\n *\\n * Emits the event `Slashed`.\\n */\\n function slashBridgeVoting(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the configs related to bridge voting slashing.\\n *\\n * @return _bridgeVotingThreshold The threshold to slash when a trusted organization does not vote for bridge\\n * operators.\\n * @return _bridgeVotingSlashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function getBridgeVotingSlashingConfigs()\\n external\\n view\\n returns (uint256 _bridgeVotingThreshold, uint256 _bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Sets the configs to slash bridge voting.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeVotingSlashingConfigsUpdated`.\\n *\\n * @param _threshold The threshold to slash when a trusted organization does not vote for bridge operators.\\n * @param _slashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external;\\n}\\n\",\"keccak256\":\"0x72c3bcfe3c49f946651caa3066bd5296d007871c9a56fa113e2d3c0f3db7eb99\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashDoubleSign is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\\n * for param details.\\n */\\n event DoubleSignSlashingConfigsUpdated(\\n uint256 slashDoubleSignAmount,\\n uint256 doubleSigningJailUntilBlock,\\n uint256 doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Slashes for double signing.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\\n */\\n function slashDoubleSign(\\n address _validatorAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\\n * double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function getDoubleSignSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _slashDoubleSignAmount,\\n uint256 _doubleSigningJailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\\n *\\n * @param _slashAmount The amount of RON to slash double sign.\\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n ) external;\\n}\\n\",\"keccak256\":\"0xe72708c42d468b0c40ffa0c72b3386899f11273e4149425aab490a78d5312222\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashIndicator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashDoubleSign.sol\\\";\\nimport \\\"./ISlashBridgeVoting.sol\\\";\\nimport \\\"./ISlashBridgeOperator.sol\\\";\\nimport \\\"./ISlashUnavailability.sol\\\";\\nimport \\\"./ICreditScore.sol\\\";\\n\\ninterface ISlashIndicator is\\n ISlashDoubleSign,\\n ISlashBridgeVoting,\\n ISlashBridgeOperator,\\n ISlashUnavailability,\\n ICreditScore\\n{}\\n\",\"keccak256\":\"0xe8b8fde3af614735cb304bc1eb82b05d65ede4df804b5d555787e5d5ecb95ec0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashUnavailability.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashUnavailability is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\\n * for param details.\\n */\\n event UnavailabilitySlashingConfigsUpdated(\\n uint256 unavailabilityTier1Threshold,\\n uint256 unavailabilityTier2Threshold,\\n uint256 slashAmountForUnavailabilityTier2Threshold,\\n uint256 jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Returns the last block that a block producer is slashed for unavailability.\\n */\\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Slashes for unavailability by increasing the counter of block producer `_consensusAddr`.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` when the threshold is reached.\\n *\\n */\\n function slashUnavailability(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the current unavailability indicator of a block producer.\\n */\\n function currentUnavailabilityIndicator(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the unavailability indicator in the period `_period` of a block producer.\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\\n * @return _unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\\n * @return _slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\\n * producer when (s)he is slashed with tier-2 or tier-3.\\n * @return _jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\\n * slashed with tier-2 or tier-3.\\n *\\n */\\n function getUnavailabilitySlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _unavailabilityTier1Threshold,\\n uint256 _unavailabilityTier2Threshold,\\n uint256 _slashAmountForUnavailabilityTier2Threshold,\\n uint256 _jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\\n * @param _tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\\n * self-staking if (s)he misses more than this threshold.\\n * @param _slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\\n * is slashed tier-2.\\n * @param _jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\\n *\\n */\\n function setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x92f7d8e9c6f80d4fedab80515c68db0a46cf4f8da143f8d766bf5f7582aa0a21\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseStaking {\\n struct PoolDetail {\\n // Address of the pool i.e. consensus address of the validator\\n address addr;\\n // Pool admin address\\n address admin;\\n // Self-staking amount\\n uint256 stakingAmount;\\n // Total number of RON staking for the pool\\n uint256 stakingTotal;\\n // Mapping from delegator => delegating amount\\n mapping(address => uint256) delegatingAmount;\\n // Mapping from delegator => the last timestamp that delegator staked\\n mapping(address => uint256) lastDelegatingTimestamp;\\n }\\n\\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\\n event WaitingSecsToRevokeUpdated(uint256 secs);\\n\\n /// @dev Error of cannot transfer RON.\\n error ErrCannotTransferRON();\\n /// @dev Error of receiving zero message value.\\n error ErrZeroValue();\\n /// @dev Error of pool admin is not allowed to call.\\n error ErrPoolAdminForbidden();\\n /// @dev Error of no one is allowed to call but the pool's admin.\\n error ErrOnlyPoolAdminAllowed();\\n /// @dev Error of admin of any active pool cannot delegate.\\n error ErrAdminOfAnyActivePoolForbidden(address admin);\\n /// @dev Error of querying inactive pool.\\n error ErrInactivePool(address poolAddr);\\n /// @dev Error of length of input arrays are not of the same.\\n error ErrInvalidArrays();\\n\\n /**\\n * @dev Returns whether the `_poolAdminAddr` is currently active.\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the consensus address corresponding to the pool admin.\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\\n\\n /**\\n * @dev Returns the staking pool detail.\\n */\\n function getPoolDetail(address)\\n external\\n view\\n returns (\\n address _admin,\\n uint256 _stakingAmount,\\n uint256 _stakingTotal\\n );\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\\n */\\n function waitingSecsToRevoke() external view returns (uint256);\\n\\n /**\\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external;\\n}\\n\",\"keccak256\":\"0x008b3d42a3104820de7b7edb5ea4b21c75d4417767fc0791f89f00ac9a2cce8d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface ICandidateStaking is IRewardPool {\\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\\n event MinValidatorStakingAmountUpdated(uint256 threshold);\\n /// @dev Emitted when the commission rate range is updated.\\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\\n\\n /// @dev Emitted when the pool admin staked for themself.\\n event Staked(address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\\n event Unstaked(address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Emitted when the validator pool is approved.\\n event PoolApproved(address indexed validator, address indexed admin);\\n /// @dev Emitted when the validator pool is deprecated.\\n event PoolsDeprecated(address[] validator);\\n /// @dev Emitted when the staking amount transfer failed.\\n event StakingAmountTransferFailed(\\n address indexed validator,\\n address indexed admin,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\\n event StakingAmountDeductFailed(\\n address indexed validator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Error of cannot transfer RON to specified target.\\n error ErrCannotInitTransferRON(address addr, string extraInfo);\\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\\n error ErrThreeInteractionAddrsNotEqual();\\n /// @dev Error of three operation addresses must be distinct in applying for validator candidate.\\n error ErrThreeOperationAddrsNotDistinct();\\n /// @dev Error of unstaking zero amount.\\n error ErrUnstakeZeroAmount();\\n /// @dev Error of invalid staking amount left after deducted.\\n error ErrStakingAmountLeft();\\n /// @dev Error of insufficient staking amount for unstaking.\\n error ErrInsufficientStakingAmount();\\n /// @dev Error of unstaking too early.\\n error ErrUnstakeTooEarly();\\n /// @dev Error of setting commission rate exceeds max allowed.\\n error ErrInvalidCommissionRate();\\n\\n /**\\n * @dev Returns the minimum threshold for being a validator candidate.\\n */\\n function minValidatorStakingAmount() external view returns (uint256);\\n\\n /**\\n * @dev Returns the commission rate range that the candidate can set.\\n */\\n function getCommissionRateRange() external view returns (uint256 _minRange, uint256 _maxRange);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function setMinValidatorStakingAmount(uint256) external;\\n\\n /**\\n * @dev Sets the commission rate range that a candidate can set.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `CommissionRateRangeUpdated` event.\\n *\\n */\\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external;\\n\\n /**\\n * @dev Proposes a candidate to become a validator.\\n *\\n * Requirements:\\n * - The method caller is able to receive RON.\\n * - The treasury is able to receive RON.\\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\\n *\\n * Emits the event `PoolApproved`.\\n *\\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\\n * to its candidate, e.g. scheduling maintenance.\\n *\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external payable;\\n\\n /**\\n * @dev Deprecates the pool.\\n * - Deduct self-staking amount of the pool admin to zero.\\n * - Transfer the deducted amount to the pool admin.\\n * - Deactivate the pool admin address in the mapping of active pool admins\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\\n *\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\\n\\n /**\\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `msg.value` is larger than 0.\\n *\\n * Emits the event `Staked`.\\n *\\n */\\n function stake(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function unstake(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdated`.\\n *\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestRenounce(address _consensusAddr) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestEmergencyExit(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x5681cd641c0014aa2cc0ae336e110ebd9a5b28419ae387acd720683ba54ca89f\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface IDelegatorStaking is IRewardPool {\\n /// @dev Emitted when the delegator staked for a validator candidate.\\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the delegator unstaked from a validator candidate.\\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Error of undelegating zero amount.\\n error ErrUndelegateZeroAmount();\\n /// @dev Error of undelegating insufficient amount.\\n error ErrInsufficientDelegatingAmount();\\n /// @dev Error of undelegating too early.\\n error ErrUndelegateTooEarly();\\n\\n /**\\n * @dev Stakes for a validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n */\\n function delegate(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Undelegated` event.\\n *\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Bulk unstakes from a list of candidates.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the events `Undelegated`.\\n *\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\\n\\n /**\\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `Undelegated` event and the `Delegated` event.\\n *\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external;\\n\\n /**\\n * @dev Returns the claimable reward of the user `_user`.\\n */\\n function getRewards(address _user, address[] calldata _poolAddrList)\\n external\\n view\\n returns (uint256[] memory _rewards);\\n\\n /**\\n * @dev Claims the reward of method caller.\\n *\\n * Emits the `RewardClaimed` event.\\n *\\n */\\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `RewardClaimed` event and the `Delegated` event.\\n *\\n */\\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\\n external\\n returns (uint256 _amount);\\n}\\n\",\"keccak256\":\"0x5ce840a920ed06139f9e33d306c8ee50b2a81e4bd2ac6ed24b47297c348576b8\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IRewardPool.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/consumers/PeriodWrapperConsumer.sol\\\";\\n\\ninterface IRewardPool is PeriodWrapperConsumer {\\n struct UserRewardFields {\\n // Recorded reward amount.\\n uint256 debited;\\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\\n uint256 aRps;\\n // Lowest staking amount in the period.\\n uint256 lowestAmount;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n\\n struct PoolFields {\\n // Accumulated of the amount rewards per share (one unit staking).\\n uint256 aRps;\\n // The staking total to share reward of the current period.\\n PeriodWrapper shares;\\n }\\n\\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\\n /// @dev Emitted when the user claimed their reward\\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\\n\\n /// @dev Emitted when the pool shares are updated\\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\\n /// @dev Emitted when the pools are updated\\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\\n /// @dev Emitted when the contract fails when updating the pools\\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\\n /// @dev Emitted when the contract fails when updating the pools that already set\\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\\n\\n /// @dev Error of invalid pool share.\\n error ErrInvalidPoolShare();\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amount of an user.\\n */\\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amounts of the users.\\n */\\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total staking amount of all users for a pool.\\n */\\n function getStakingTotal(address _poolAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\\n */\\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\\n}\\n\",\"keccak256\":\"0x92315ca9d6d93f55a7752adf2567adb86745f708198bfcd74b9a626b6570208f\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseStaking.sol\\\";\\nimport \\\"./ICandidateStaking.sol\\\";\\nimport \\\"./IDelegatorStaking.sol\\\";\\n\\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable;\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\\n external\\n returns (uint256 _actualDeductingAmount);\\n}\\n\",\"keccak256\":\"0xb7942c5032c16ea567ac0bfc07ecacd84840d6de134735ea538aa22fc6da05a5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/BridgeOperatorsBallot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nlibrary BridgeOperatorsBallot {\\n struct BridgeOperatorSet {\\n uint256 period;\\n uint256 epoch;\\n address[] operators;\\n }\\n\\n // keccak256(\\\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\\\");\\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\\n\\n /**\\n * @dev Verifies whether the ballot is valid or not.\\n *\\n * Requirements:\\n * - The ballot is not for an empty operator set.\\n * - The operator address list is in order.\\n *\\n */\\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\\n require(_ballot.operators.length > 0, \\\"BridgeOperatorsBallot: invalid array length\\\");\\n address _addr = _ballot.operators[0];\\n for (uint _i = 1; _i < _ballot.operators.length; _i++) {\\n require(_addr < _ballot.operators[_i], \\\"BridgeOperatorsBallot: invalid order of bridge operators\\\");\\n _addr = _ballot.operators[_i];\\n }\\n }\\n\\n /**\\n * @dev Returns hash of the ballot.\\n */\\n function hash(BridgeOperatorSet calldata _ballot) internal pure returns (bytes32) {\\n bytes32 _operatorsHash;\\n address[] memory _operators = _ballot.operators;\\n\\n assembly {\\n _operatorsHash := keccak256(add(_operators, 32), mul(mload(_operators), 32))\\n }\\n\\n return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\\n }\\n}\\n\",\"keccak256\":\"0x986425ebae2dcfcfa266c9ca825232ff300ec8ce796e8975da6714d87e921793\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xf719e74bc39be7aceb4e5cc455260f81b2b21e83aa693e0b50c390c9909e08c4\",\"license\":\"UNLICENSED\"},\"contracts/precompile-usages/PCUPickValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUPickValidatorSet is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of picking validator set\\n function precompilePickValidatorSetAddress() public view virtual returns (address) {\\n return address(0x68);\\n }\\n\\n /**\\n * @dev Sorts and arranges to return a new validator set.\\n *\\n * Note: The recover process is done by pre-compiled contract. This function is marked as\\n * virtual for implementing mocking contract for testing purpose.\\n */\\n function _pcPickValidatorSet(\\n address[] memory _candidates,\\n uint256[] memory _weights,\\n uint256[] memory _trustedWeights,\\n uint256 _maxValidatorNumber,\\n uint256 _maxPrioritizedValidatorNumber\\n ) internal view virtual returns (address[] memory _result, uint256 _newValidatorCount) {\\n address _smc = precompilePickValidatorSetAddress();\\n bytes memory _payload = abi.encodeWithSignature(\\n \\\"pickValidatorSet(address[],uint256[],uint256[],uint256,uint256)\\\",\\n _candidates,\\n _weights,\\n _trustedWeights,\\n _maxValidatorNumber,\\n _maxPrioritizedValidatorNumber\\n );\\n bool _success = true;\\n\\n uint256 _payloadLength = _payload.length;\\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\\n\\n assembly {\\n let _payloadStart := add(_payload, 0x20)\\n\\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\\n _success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n _success := 0\\n }\\n\\n _result := add(_result, 0x20)\\n }\\n\\n if (!_success) revert ErrCallPrecompiled();\\n\\n _newValidatorCount = _result.length;\\n }\\n}\\n\",\"keccak256\":\"0xcb57a021897a773d11be9d98a195e0653f2124b7e95e84c4832b57d9d36d67e1\",\"license\":\"MIT\"},\"contracts/precompile-usages/PCUSortValidators.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUSortValidators is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of sorting validators\\n function precompileSortValidatorsAddress() public view virtual returns (address) {\\n return address(0x66);\\n }\\n\\n /**\\n * @dev Sorts candidates descending by their weights by calling precompile contract.\\n *\\n * Note: This function is marked as virtual for being wrapping in mock contract for testing purpose.\\n */\\n function _pcSortCandidates(address[] memory _candidates, uint256[] memory _weights)\\n internal\\n view\\n virtual\\n returns (address[] memory _result)\\n {\\n address _smc = precompileSortValidatorsAddress();\\n bool _success = true;\\n\\n bytes memory _payload = abi.encodeWithSignature(\\\"sortValidators(address[],uint256[])\\\", _candidates, _weights);\\n uint256 _payloadLength = _payload.length;\\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\\n\\n assembly {\\n let _payloadStart := add(_payload, 0x20)\\n\\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\\n _success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n _success := 0\\n }\\n\\n _result := add(_result, 0x20)\\n }\\n\\n if (!_success) revert ErrCallPrecompiled();\\n }\\n}\\n\",\"keccak256\":\"0xc779a5a5e29fb4416450b2eb6608a09e2cf63f6d9af5b2c1eec130dd16b0d22a\",\"license\":\"MIT\"},\"contracts/precompile-usages/PrecompiledUsage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PrecompiledUsage {\\n /// @dev Error of call to precompile fails.\\n error ErrCallPrecompiled();\\n}\\n\",\"keccak256\":\"0x76facc3f3a8dd573c826bbbfedaa5cd8ef30963fbabd8c163c0c72b6efea5551\",\"license\":\"MIT\"},\"contracts/ronin/validator/CandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasStakingContract.sol\\\";\\nimport \\\"../../extensions/consumers/GlobalConfigConsumer.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../interfaces/validator/ICandidateManager.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\n\\nabstract contract CandidateManager is ICandidateManager, PercentageConsumer, GlobalConfigConsumer, HasStakingContract {\\n /// @dev Maximum number of validator candidate\\n uint256 private _maxValidatorCandidate;\\n\\n /// @dev The validator candidate array\\n address[] internal _candidates;\\n /// @dev Mapping from candidate consensus address => bitwise negation of validator index in `_candidates`\\n mapping(address => uint256) internal _candidateIndex;\\n /// @dev Mapping from candidate consensus address => their info\\n mapping(address => ValidatorCandidate) internal _candidateInfo;\\n\\n /**\\n * @dev The minimum offset in day from current date to the effective date of a new commission schedule.\\n * Value of 1 means the change gets affected at the beginning of the following day.\\n **/\\n uint256 internal _minEffectiveDaysOnwards;\\n /// @dev Mapping from candidate consensus address => schedule commission change.\\n mapping(address => CommissionSchedule) internal _candidateCommissionChangeSchedule;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] private ______gap;\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function maxValidatorCandidate() public view override returns (uint256) {\\n return _maxValidatorCandidate;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function minEffectiveDaysOnwards() external view override returns (uint256) {\\n return _minEffectiveDaysOnwards;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function setMaxValidatorCandidate(uint256 _number) external override onlyAdmin {\\n _setMaxValidatorCandidate(_number);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external override onlyAdmin {\\n _setMinEffectiveDaysOnwards(_numOfDays);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function execApplyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external override onlyStakingContract {\\n uint256 _length = _candidates.length;\\n if (_length >= maxValidatorCandidate()) revert ErrExceedsMaxNumberOfCandidate();\\n if (isValidatorCandidate(_consensusAddr)) revert ErrExistentCandidate();\\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\\n\\n for (uint _i; _i < _candidates.length; _i++) {\\n ValidatorCandidate storage existentInfo = _candidateInfo[_candidates[_i]];\\n if (_candidateAdmin == existentInfo.admin) revert ErrExistentCandidateAdmin(_candidateAdmin);\\n if (_treasuryAddr == existentInfo.treasuryAddr) revert ErrExistentTreasury(_treasuryAddr);\\n if (_bridgeOperatorAddr == existentInfo.bridgeOperatorAddr) revert ErrExistentBridgeOperator(_bridgeOperatorAddr);\\n }\\n\\n _candidateIndex[_consensusAddr] = ~_length;\\n _candidates.push(_consensusAddr);\\n\\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\\n _info.admin = _candidateAdmin;\\n _info.consensusAddr = _consensusAddr;\\n _info.treasuryAddr = _treasuryAddr;\\n _info.bridgeOperatorAddr = _bridgeOperatorAddr;\\n _info.commissionRate = _commissionRate;\\n emit CandidateGranted(_consensusAddr, _treasuryAddr, _candidateAdmin, _bridgeOperatorAddr);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function execRequestRenounceCandidate(address _consensusAddr, uint256 _secsLeft)\\n external\\n override\\n onlyStakingContract\\n {\\n if (_isTrustedOrg(_consensusAddr)) revert ErrTrustedOrgCannotRenounce();\\n\\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\\n if (_info.revokingTimestamp != 0) revert ErrAlreadyRequestedRevokingCandidate();\\n _setRevokingTimestamp(_info, block.timestamp + _secsLeft);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external override onlyStakingContract {\\n if (_candidateCommissionChangeSchedule[_consensusAddr].effectiveTimestamp != 0) {\\n revert ErrAlreadyRequestedUpdatingCommissionRate();\\n }\\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\\n if (_effectiveDaysOnwards < _minEffectiveDaysOnwards) revert ErrInvalidEffectiveDaysOnwards();\\n\\n CommissionSchedule storage _schedule = _candidateCommissionChangeSchedule[_consensusAddr];\\n uint256 _effectiveTimestamp = ((block.timestamp / PERIOD_DURATION) + _effectiveDaysOnwards) * PERIOD_DURATION;\\n _schedule.effectiveTimestamp = _effectiveTimestamp;\\n _schedule.commissionRate = _commissionRate;\\n\\n emit CommissionRateUpdateScheduled(_consensusAddr, _effectiveTimestamp, _commissionRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function isValidatorCandidate(address _addr) public view override returns (bool) {\\n return _candidateIndex[_addr] != 0;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getCandidateInfos() external view override returns (ValidatorCandidate[] memory _list) {\\n _list = new ValidatorCandidate[](_candidates.length);\\n for (uint _i; _i < _list.length; _i++) {\\n _list[_i] = _candidateInfo[_candidates[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getCandidateInfo(address _candidate) external view override returns (ValidatorCandidate memory) {\\n if (!isValidatorCandidate(_candidate)) revert ErrNonExistentCandidate();\\n return _candidateInfo[_candidate];\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getValidatorCandidates() public view override returns (address[] memory) {\\n return _candidates;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getCommissionChangeSchedule(address _candidate) external view override returns (CommissionSchedule memory) {\\n return _candidateCommissionChangeSchedule[_candidate];\\n }\\n\\n /**\\n * @dev Removes unsastisfied candidates, the ones who have insufficient minimum candidate staking amount,\\n * or the ones who requested to renounce their candidate role.\\n *\\n * Emits the event `CandidatesRevoked` when a candidate is revoked.\\n *\\n */\\n function _syncCandidateSet(uint256 _nextPeriod) internal returns (address[] memory _unsatisfiedCandidates) {\\n IStaking _staking = _stakingContract;\\n uint256 _waitingSecsToRevoke = _staking.waitingSecsToRevoke();\\n uint256 _minStakingAmount = _staking.minValidatorStakingAmount();\\n uint256[] memory _selfStakings = _staking.getManySelfStakings(_candidates);\\n\\n uint256 _length = _candidates.length;\\n uint256 _unsatisfiedCount;\\n _unsatisfiedCandidates = new address[](_length);\\n\\n {\\n uint256 _i;\\n address _addr;\\n ValidatorCandidate storage _info;\\n while (_i < _length) {\\n _addr = _candidates[_i];\\n _info = _candidateInfo[_addr];\\n\\n // Checks for under-balance status of candidates\\n bool _hasTopupDeadline = _info.topupDeadline != 0;\\n if (_selfStakings[_i] < _minStakingAmount) {\\n // Updates deadline on the first time unsatisfied the staking amount condition\\n if (!_hasTopupDeadline) {\\n uint256 _topupDeadline = block.timestamp + _waitingSecsToRevoke;\\n _info.topupDeadline = _topupDeadline;\\n emit CandidateTopupDeadlineUpdated(_addr, _topupDeadline);\\n }\\n } else if (_hasTopupDeadline) {\\n // Removes the deadline if the staking amount condition is satisfied\\n delete _info.topupDeadline;\\n emit CandidateTopupDeadlineUpdated(_addr, 0);\\n }\\n\\n // Removes unsastisfied candidates\\n bool _revokingActivated = (_info.revokingTimestamp != 0 && _info.revokingTimestamp <= block.timestamp) ||\\n _emergencyExitLockedFundReleased(_addr);\\n bool _topupDeadlineMissed = _info.topupDeadline != 0 && _info.topupDeadline <= block.timestamp;\\n if (_revokingActivated || _topupDeadlineMissed) {\\n _selfStakings[_i] = _selfStakings[--_length];\\n _unsatisfiedCandidates[_unsatisfiedCount++] = _addr;\\n _removeCandidate(_addr);\\n continue;\\n }\\n\\n // Checks for schedule of commission change and updates commission rate\\n uint256 _scheduleTimestamp = _candidateCommissionChangeSchedule[_addr].effectiveTimestamp;\\n if (_scheduleTimestamp != 0 && _scheduleTimestamp <= block.timestamp) {\\n uint256 _commisionRate = _candidateCommissionChangeSchedule[_addr].commissionRate;\\n delete _candidateCommissionChangeSchedule[_addr];\\n _info.commissionRate = _commisionRate;\\n emit CommissionRateUpdated(_addr, _commisionRate);\\n }\\n\\n _i++;\\n }\\n }\\n\\n assembly {\\n mstore(_unsatisfiedCandidates, _unsatisfiedCount)\\n }\\n\\n if (_unsatisfiedCount > 0) {\\n emit CandidatesRevoked(_unsatisfiedCandidates);\\n _staking.execDeprecatePools(_unsatisfiedCandidates, _nextPeriod);\\n }\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view override returns (bool) {\\n return _candidateInfo[_candidate].admin == _admin;\\n }\\n\\n /**\\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\\n */\\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address) {\\n return _candidateInfo[_consensusAddr].bridgeOperatorAddr;\\n }\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function _setMaxValidatorCandidate(uint256 _threshold) internal {\\n _maxValidatorCandidate = _threshold;\\n emit MaxValidatorCandidateUpdated(_threshold);\\n }\\n\\n /**\\n * @dev Sets the minimum number of days onwards to the effective date of commission rate change.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function _setMinEffectiveDaysOnwards(uint256 _numOfDays) internal {\\n if (_numOfDays < 1) revert ErrInvalidMinEffectiveDaysOnwards();\\n _minEffectiveDaysOnwards = _numOfDays;\\n emit MinEffectiveDaysOnwardsUpdated(_numOfDays);\\n }\\n\\n /**\\n * @dev Removes the candidate.\\n */\\n function _removeCandidate(address _addr) internal virtual {\\n uint256 _idx = _candidateIndex[_addr];\\n if (_idx == 0) {\\n return;\\n }\\n\\n delete _candidateInfo[_addr];\\n delete _candidateIndex[_addr];\\n delete _candidateCommissionChangeSchedule[_addr];\\n\\n address _lastCandidate = _candidates[_candidates.length - 1];\\n if (_lastCandidate != _addr) {\\n _candidateIndex[_lastCandidate] = _idx;\\n _candidates[~_idx] = _lastCandidate;\\n }\\n\\n _candidates.pop();\\n }\\n\\n /**\\n * @dev Sets timestamp to revoke a candidate.\\n */\\n function _setRevokingTimestamp(ValidatorCandidate storage _candidate, uint256 _timestamp) internal {\\n if (!isValidatorCandidate(_candidate.consensusAddr)) revert ErrNonExistentCandidate();\\n _candidate.revokingTimestamp = _timestamp;\\n emit CandidateRevokingTimestampUpdated(_candidate.consensusAddr, _timestamp);\\n }\\n\\n /**\\n * @dev Returns a flag indicating whether the fund is unlocked.\\n */\\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual returns (bool);\\n\\n /**\\n * @dev Returns whether the consensus address is a trusted org or not.\\n */\\n function _isTrustedOrg(address _consensusAddr) internal virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x118e406abfbaba67fdb5a282740674f4e2442f55fe182fee6d0bd82ea8d7a8e7\",\"license\":\"MIT\"},\"contracts/ronin/validator/CoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasBridgeTrackingContract.sol\\\";\\nimport \\\"../../extensions/collections/HasMaintenanceContract.sol\\\";\\nimport \\\"../../extensions/collections/HasSlashIndicatorContract.sol\\\";\\nimport \\\"../../extensions/collections/HasStakingVestingContract.sol\\\";\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../interfaces/validator/ICoinbaseExecution.sol\\\";\\nimport \\\"../../libraries/EnumFlags.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"../../precompile-usages/PCUSortValidators.sol\\\";\\nimport \\\"../../precompile-usages/PCUPickValidatorSet.sol\\\";\\nimport \\\"./storage-fragments/CommonStorage.sol\\\";\\nimport \\\"./CandidateManager.sol\\\";\\nimport \\\"./EmergencyExit.sol\\\";\\n\\nabstract contract CoinbaseExecution is\\n ICoinbaseExecution,\\n RONTransferHelper,\\n PCUSortValidators,\\n PCUPickValidatorSet,\\n HasStakingVestingContract,\\n HasBridgeTrackingContract,\\n HasMaintenanceContract,\\n HasSlashIndicatorContract,\\n EmergencyExit\\n{\\n using EnumFlags for EnumFlags.ValidatorFlag;\\n\\n modifier onlyCoinbase() {\\n if (msg.sender != block.coinbase) revert ErrCallerMustBeCoinbase();\\n _;\\n }\\n\\n modifier whenEpochEnding() {\\n if (!epochEndingAt(block.number)) revert ErrAtEndOfEpochOnly();\\n _;\\n }\\n\\n modifier oncePerEpoch() {\\n if (epochOf(_lastUpdatedBlock) >= epochOf(block.number)) revert ErrAlreadyWrappedEpoch();\\n _lastUpdatedBlock = block.number;\\n _;\\n }\\n\\n /**\\n * @inheritdoc ICoinbaseExecution\\n */\\n function submitBlockReward() external payable override onlyCoinbase {\\n bool _requestForBlockProducer = isBlockProducer(msg.sender) &&\\n !_jailed(msg.sender) &&\\n !_miningRewardDeprecated(msg.sender, currentPeriod());\\n\\n (, uint256 _blockProducerBonus, uint256 _bridgeOperatorBonus) = _stakingVestingContract.requestBonus(\\n _requestForBlockProducer,\\n true // _requestForBridgeOperator\\n );\\n\\n _totalBridgeReward += _bridgeOperatorBonus;\\n\\n // Deprecates reward for non-validator or slashed validator\\n if (!_requestForBlockProducer) {\\n _totalDeprecatedReward += msg.value;\\n emit BlockRewardDeprecated(msg.sender, msg.value, BlockRewardDeprecatedType.UNAVAILABILITY);\\n return;\\n }\\n\\n emit BlockRewardSubmitted(msg.sender, msg.value, _blockProducerBonus);\\n\\n uint256 _period = currentPeriod();\\n uint256 _reward = msg.value + _blockProducerBonus;\\n uint256 _cutOffReward;\\n if (_miningRewardBailoutCutOffAtPeriod[msg.sender][_period]) {\\n (, , , uint256 _cutOffPercentage) = _slashIndicatorContract.getCreditScoreConfigs();\\n _cutOffReward = (_reward * _cutOffPercentage) / _MAX_PERCENTAGE;\\n _totalDeprecatedReward += _cutOffReward;\\n emit BlockRewardDeprecated(msg.sender, _cutOffReward, BlockRewardDeprecatedType.AFTER_BAILOUT);\\n }\\n\\n _reward -= _cutOffReward;\\n (uint256 _minRate, uint256 _maxRate) = _stakingContract.getCommissionRateRange();\\n uint256 _rate = Math.max(Math.min(_candidateInfo[msg.sender].commissionRate, _maxRate), _minRate);\\n uint256 _miningAmount = (_rate * _reward) / _MAX_PERCENTAGE;\\n _miningReward[msg.sender] += _miningAmount;\\n\\n uint256 _delegatingAmount = _reward - _miningAmount;\\n _delegatingReward[msg.sender] += _delegatingAmount;\\n }\\n\\n /**\\n * @inheritdoc ICoinbaseExecution\\n */\\n function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {\\n uint256 _newPeriod = _computePeriod(block.timestamp);\\n bool _periodEnding = _isPeriodEnding(_newPeriod);\\n\\n (address[] memory _currentValidators, , ) = getValidators();\\n address[] memory _revokedCandidates;\\n uint256 _epoch = epochOf(block.number);\\n uint256 _nextEpoch = _epoch + 1;\\n uint256 _lastPeriod = currentPeriod();\\n\\n if (_periodEnding) {\\n _syncBridgeOperatingReward(_lastPeriod, _currentValidators);\\n (\\n uint256 _totalDelegatingReward,\\n uint256[] memory _delegatingRewards\\n ) = _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(_lastPeriod, _currentValidators);\\n _settleAndTransferDelegatingRewards(_lastPeriod, _currentValidators, _totalDelegatingReward, _delegatingRewards);\\n _tryRecycleLockedFundsFromEmergencyExits();\\n _recycleDeprecatedRewards();\\n _slashIndicatorContract.updateCreditScores(_currentValidators, _lastPeriod);\\n (_currentValidators, _revokedCandidates) = _syncValidatorSet(_newPeriod);\\n if (_revokedCandidates.length > 0) {\\n _slashIndicatorContract.execResetCreditScores(_revokedCandidates);\\n }\\n _currentPeriodStartAtBlock = block.number + 1;\\n }\\n _revampRoles(_newPeriod, _nextEpoch, _currentValidators);\\n emit WrappedUpEpoch(_lastPeriod, _epoch, _periodEnding);\\n _periodOf[_nextEpoch] = _newPeriod;\\n _lastUpdatedPeriod = _newPeriod;\\n }\\n\\n /**\\n * @dev This loop over the all current validators to sync the bridge operating reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _syncBridgeOperatingReward(uint256 _lastPeriod, address[] memory _currentValidators) internal {\\n uint256 _totalBridgeBallots = _bridgeTrackingContract.totalBallots(_lastPeriod);\\n uint256 _totalBridgeVotes = _bridgeTrackingContract.totalVotes(_lastPeriod);\\n uint256[] memory _bridgeBallots = _bridgeTrackingContract.getManyTotalBallots(\\n _lastPeriod,\\n getBridgeOperatorsOf(_currentValidators)\\n );\\n\\n if (\\n !_validateBridgeTrackingResponse(_totalBridgeBallots, _totalBridgeVotes, _bridgeBallots) || _totalBridgeVotes == 0\\n ) {\\n // Shares equally in case the bridge has nothing to vote or bridge tracking response is incorrect\\n for (uint256 _i; _i < _currentValidators.length; _i++) {\\n _bridgeOperatingReward[_currentValidators[_i]] = _totalBridgeReward / _currentValidators.length;\\n }\\n return;\\n }\\n\\n (\\n uint256 _missingVotesRatioTier1,\\n uint256 _missingVotesRatioTier2,\\n uint256 _jailDurationForMissingVotesRatioTier2,\\n uint256 _skipBridgeOperatorSlashingThreshold\\n ) = _slashIndicatorContract.getBridgeOperatorSlashingConfigs();\\n\\n // Slashes the bridge reward if the total of votes exceeds the slashing threshold.\\n bool _shouldSlash = _totalBridgeVotes > _skipBridgeOperatorSlashingThreshold;\\n for (uint256 _i; _i < _currentValidators.length; _i++) {\\n // Shares the bridge operators reward proportionally.\\n _bridgeOperatingReward[_currentValidators[_i]] = (_totalBridgeReward * _bridgeBallots[_i]) / _totalBridgeBallots;\\n if (_shouldSlash) {\\n _slashBridgeOperatorBasedOnPerformance(\\n _lastPeriod,\\n _currentValidators[_i],\\n _MAX_PERCENTAGE - (_bridgeBallots[_i] * _MAX_PERCENTAGE) / _totalBridgeVotes,\\n _jailDurationForMissingVotesRatioTier2,\\n _missingVotesRatioTier1,\\n _missingVotesRatioTier2\\n );\\n }\\n }\\n }\\n\\n /**\\n * @dev Returns whether the responses from bridge tracking are correct.\\n */\\n function _validateBridgeTrackingResponse(\\n uint256 _totalBridgeBallots,\\n uint256 _totalBridgeVotes,\\n uint256[] memory _bridgeBallots\\n ) private returns (bool _valid) {\\n _valid = true;\\n uint256 _sumBallots;\\n for (uint _i; _i < _bridgeBallots.length; _i++) {\\n if (_bridgeBallots[_i] > _totalBridgeVotes) {\\n _valid = false;\\n break;\\n }\\n _sumBallots += _bridgeBallots[_i];\\n }\\n _valid = _valid && (_sumBallots <= _totalBridgeBallots);\\n if (!_valid) {\\n emit BridgeTrackingIncorrectlyResponded();\\n }\\n }\\n\\n /**\\n * @dev Slashes the validator on the corresponding bridge operator performance. Updates the status of the deprecated reward. Not update the reward amount.\\n *\\n * Consider validating the bridge tracking response by using the method `_validateBridgeTrackingResponse` before calling this function.\\n */\\n function _slashBridgeOperatorBasedOnPerformance(\\n uint256 _period,\\n address _validator,\\n uint256 _missedRatio,\\n uint256 _jailDurationTier2,\\n uint256 _ratioTier1,\\n uint256 _ratioTier2\\n ) internal {\\n if (_missedRatio >= _ratioTier2) {\\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\\n _miningRewardDeprecatedAtPeriod[_validator][_period] = true;\\n\\n uint256 _newJailUntilBlock = Math.addIfNonZero(block.number, _jailDurationTier2);\\n _blockProducerJailedBlock[_validator] = Math.max(_newJailUntilBlock, _blockProducerJailedBlock[_validator]);\\n _cannotBailoutUntilBlock[_validator] = Math.max(_newJailUntilBlock, _cannotBailoutUntilBlock[_validator]);\\n\\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 2, _period);\\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, true, true);\\n } else if (_missedRatio >= _ratioTier1) {\\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 1, _period);\\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, false, true);\\n }\\n }\\n\\n /**\\n * @dev This loops over all current validators to:\\n * - Update delegating reward for and calculate total delegating rewards to be sent to the staking contract,\\n * - Distribute the reward of block producers and bridge operators to their treasury addresses,\\n * - Update the total deprecated reward if the two previous conditions do not sastify.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(\\n uint256 _lastPeriod,\\n address[] memory _currentValidators\\n ) private returns (uint256 _totalDelegatingReward, uint256[] memory _delegatingRewards) {\\n address _consensusAddr;\\n address payable _treasury;\\n _delegatingRewards = new uint256[](_currentValidators.length);\\n for (uint _i; _i < _currentValidators.length; _i++) {\\n _consensusAddr = _currentValidators[_i];\\n _treasury = _candidateInfo[_consensusAddr].treasuryAddr;\\n\\n if (!_bridgeRewardDeprecated(_consensusAddr, _lastPeriod)) {\\n _distributeBridgeOperatingReward(_consensusAddr, _candidateInfo[_consensusAddr].bridgeOperatorAddr, _treasury);\\n } else {\\n _totalDeprecatedReward += _bridgeOperatingReward[_consensusAddr];\\n }\\n\\n if (!_jailed(_consensusAddr) && !_miningRewardDeprecated(_consensusAddr, _lastPeriod)) {\\n _totalDelegatingReward += _delegatingReward[_consensusAddr];\\n _delegatingRewards[_i] = _delegatingReward[_consensusAddr];\\n _distributeMiningReward(_consensusAddr, _treasury);\\n } else {\\n _totalDeprecatedReward += _miningReward[_consensusAddr] + _delegatingReward[_consensusAddr];\\n }\\n\\n delete _delegatingReward[_consensusAddr];\\n delete _miningReward[_consensusAddr];\\n delete _bridgeOperatingReward[_consensusAddr];\\n }\\n delete _totalBridgeReward;\\n }\\n\\n /**\\n * @dev Distributes bonus of staking vesting and mining fee for the block producer.\\n *\\n * Emits the `MiningRewardDistributed` once the reward is distributed successfully.\\n * Emits the `MiningRewardDistributionFailed` once the contract fails to distribute reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _distributeMiningReward(address _consensusAddr, address payable _treasury) private {\\n uint256 _amount = _miningReward[_consensusAddr];\\n if (_amount > 0) {\\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\\n emit MiningRewardDistributed(_consensusAddr, _treasury, _amount);\\n return;\\n }\\n\\n emit MiningRewardDistributionFailed(_consensusAddr, _treasury, _amount, address(this).balance);\\n }\\n }\\n\\n /**\\n * @dev Distribute bonus of staking vesting for the bridge operator.\\n *\\n * Emits the `BridgeOperatorRewardDistributed` once the reward is distributed successfully.\\n * Emits the `BridgeOperatorRewardDistributionFailed` once the contract fails to distribute reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _distributeBridgeOperatingReward(\\n address _consensusAddr,\\n address _bridgeOperator,\\n address payable _treasury\\n ) private {\\n uint256 _amount = _bridgeOperatingReward[_consensusAddr];\\n if (_amount > 0) {\\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\\n emit BridgeOperatorRewardDistributed(_consensusAddr, _bridgeOperator, _treasury, _amount);\\n return;\\n }\\n\\n emit BridgeOperatorRewardDistributionFailed(\\n _consensusAddr,\\n _bridgeOperator,\\n _treasury,\\n _amount,\\n address(this).balance\\n );\\n }\\n }\\n\\n /**\\n * @dev Helper function to settle rewards for delegators of `_currentValidators` at the end of each period,\\n * then transfer the rewards from this contract to the staking contract, in order to finalize a period.\\n *\\n * Emits the `StakingRewardDistributed` once the reward is distributed successfully.\\n * Emits the `StakingRewardDistributionFailed` once the contract fails to distribute reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _settleAndTransferDelegatingRewards(\\n uint256 _period,\\n address[] memory _currentValidators,\\n uint256 _totalDelegatingReward,\\n uint256[] memory _delegatingRewards\\n ) private {\\n IStaking _staking = _stakingContract;\\n if (_totalDelegatingReward > 0) {\\n if (_unsafeSendRON(payable(address(_staking)), _totalDelegatingReward)) {\\n _staking.execRecordRewards(_currentValidators, _delegatingRewards, _period);\\n emit StakingRewardDistributed(_totalDelegatingReward, _currentValidators, _delegatingRewards);\\n return;\\n }\\n\\n emit StakingRewardDistributionFailed(\\n _totalDelegatingReward,\\n _currentValidators,\\n _delegatingRewards,\\n address(this).balance\\n );\\n }\\n }\\n\\n /**\\n * @dev Transfer the deprecated rewards e.g. the rewards that get deprecated when validator is slashed/maintained,\\n * to the staking vesting contract\\n *\\n * Note: This method should be called once in the end of each period.\\n */\\n function _recycleDeprecatedRewards() private {\\n uint256 _withdrawAmount = _totalDeprecatedReward;\\n\\n if (_withdrawAmount != 0) {\\n address _withdrawTarget = stakingVestingContract();\\n\\n delete _totalDeprecatedReward;\\n\\n (bool _success, ) = _withdrawTarget.call{ value: _withdrawAmount }(\\n abi.encodeWithSelector(IStakingVesting.receiveRON.selector)\\n );\\n\\n if (_success) {\\n emit DeprecatedRewardRecycled(_withdrawTarget, _withdrawAmount);\\n } else {\\n emit DeprecatedRewardRecycleFailed(_withdrawTarget, _withdrawAmount, address(this).balance);\\n }\\n }\\n }\\n\\n /**\\n * @dev Updates the validator set based on the validator candidates from the Staking contract.\\n *\\n * Emits the `ValidatorSetUpdated` event.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _syncValidatorSet(uint256 _newPeriod)\\n private\\n returns (address[] memory _newValidators, address[] memory _unsastifiedCandidates)\\n {\\n _unsastifiedCandidates = _syncCandidateSet(_newPeriod);\\n uint256[] memory _weights = _stakingContract.getManyStakingTotals(_candidates);\\n uint256[] memory _trustedWeights = _roninTrustedOrganizationContract.getConsensusWeights(_candidates);\\n uint256 _newValidatorCount;\\n (_newValidators, _newValidatorCount) = _pcPickValidatorSet(\\n _candidates,\\n _weights,\\n _trustedWeights,\\n _maxValidatorNumber,\\n _maxPrioritizedValidatorNumber\\n );\\n _setNewValidatorSet(_newValidators, _newValidatorCount, _newPeriod);\\n }\\n\\n /**\\n * @dev Private helper function helps writing the new validator set into the contract storage.\\n *\\n * Emits the `ValidatorSetUpdated` event.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _setNewValidatorSet(\\n address[] memory _newValidators,\\n uint256 _newValidatorCount,\\n uint256 _newPeriod\\n ) private {\\n // Remove exceeding validators in the current set\\n for (uint256 _i = _newValidatorCount; _i < validatorCount; _i++) {\\n delete _validatorMap[_validators[_i]];\\n delete _validators[_i];\\n }\\n\\n // Remove flag for all validator in the current set\\n for (uint _i; _i < _newValidatorCount; _i++) {\\n delete _validatorMap[_validators[_i]];\\n }\\n\\n // Update new validator set and set flag correspondingly.\\n for (uint256 _i; _i < _newValidatorCount; _i++) {\\n address _newValidator = _newValidators[_i];\\n _validatorMap[_newValidator] = EnumFlags.ValidatorFlag.Both;\\n _validators[_i] = _newValidator;\\n }\\n\\n validatorCount = _newValidatorCount;\\n emit ValidatorSetUpdated(_newPeriod, _newValidators);\\n }\\n\\n /**\\n * @dev Activate/Deactivate the validators from producing blocks, based on their in jail status and maintenance status.\\n *\\n * Requirements:\\n * - This method is called at the end of each epoch\\n *\\n * Emits the `BlockProducerSetUpdated` event.\\n * Emits the `BridgeOperatorSetUpdated` event.\\n *\\n */\\n function _revampRoles(\\n uint256 _newPeriod,\\n uint256 _nextEpoch,\\n address[] memory _currentValidators\\n ) private {\\n bool[] memory _maintainedList = _maintenanceContract.checkManyMaintained(_currentValidators, block.number + 1);\\n\\n for (uint _i; _i < _currentValidators.length; _i++) {\\n address _validator = _currentValidators[_i];\\n bool _emergencyExitRequested = block.timestamp <= _emergencyExitJailedTimestamp[_validator];\\n bool _isProducerBefore = isBlockProducer(_validator);\\n bool _isProducerAfter = !(_jailedAtBlock(_validator, block.number + 1) ||\\n _maintainedList[_i] ||\\n _emergencyExitRequested);\\n\\n if (!_isProducerBefore && _isProducerAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BlockProducer);\\n } else if (_isProducerBefore && !_isProducerAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BlockProducer);\\n }\\n\\n bool _isBridgeOperatorBefore = isOperatingBridge(_validator);\\n bool _isBridgeOperatorAfter = !_emergencyExitRequested;\\n if (!_isBridgeOperatorBefore && _isBridgeOperatorAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BridgeOperator);\\n } else if (_isBridgeOperatorBefore && !_isBridgeOperatorAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BridgeOperator);\\n }\\n }\\n\\n emit BlockProducerSetUpdated(_newPeriod, _nextEpoch, getBlockProducers());\\n emit BridgeOperatorSetUpdated(_newPeriod, _nextEpoch, getBridgeOperators());\\n }\\n\\n /**\\n * @dev Override `CandidateManager-_isTrustedOrg`.\\n */\\n function _isTrustedOrg(address _consensusAddr) internal view override returns (bool) {\\n return _roninTrustedOrganizationContract.getConsensusWeight(_consensusAddr) > 0;\\n }\\n}\\n\",\"keccak256\":\"0x9d66bb0bb44607da8b24cbd5f65c65c148c8363d2615486651d2d328bef0e23a\",\"license\":\"MIT\"},\"contracts/ronin/validator/EmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../interfaces/IRoninGovernanceAdmin.sol\\\";\\nimport \\\"../../interfaces/validator/IEmergencyExit.sol\\\";\\nimport \\\"./storage-fragments/CommonStorage.sol\\\";\\nimport \\\"./CandidateManager.sol\\\";\\n\\nabstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateManager, CommonStorage {\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function emergencyExitLockedAmount() external view returns (uint256) {\\n return _emergencyExitLockedAmount;\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function emergencyExpiryDuration() external view returns (uint256) {\\n return _emergencyExpiryDuration;\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external onlyStakingContract {\\n EmergencyExitInfo storage _info = _exitInfo[_consensusAddr];\\n if (_info.recyclingAt != 0) revert ErrAlreadyRequestedEmergencyExit();\\n\\n uint256 _revokingTimestamp = block.timestamp + _secLeftToRevoke;\\n _setRevokingTimestamp(_candidateInfo[_consensusAddr], _revokingTimestamp);\\n _emergencyExitJailedTimestamp[_consensusAddr] = _revokingTimestamp;\\n _bridgeRewardDeprecatedAtPeriod[_consensusAddr][currentPeriod()] = true;\\n\\n uint256 _deductedAmount = _stakingContract.execDeductStakingAmount(_consensusAddr, _emergencyExitLockedAmount);\\n if (_deductedAmount > 0) {\\n uint256 _recyclingAt = block.timestamp + _emergencyExpiryDuration;\\n _lockedConsensusList.push(_consensusAddr);\\n _info.lockedAmount = _deductedAmount;\\n _info.recyclingAt = _recyclingAt;\\n IRoninGovernanceAdmin(_getAdmin()).createEmergencyExitPoll(\\n _consensusAddr,\\n _candidateInfo[_consensusAddr].treasuryAddr,\\n block.timestamp,\\n _recyclingAt\\n );\\n }\\n emit EmergencyExitRequested(_consensusAddr, _deductedAmount);\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external onlyAdmin {\\n _setEmergencyExitLockedAmount(_emergencyExitLockedAmount);\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external onlyAdmin {\\n _setEmergencyExpiryDuration(_emergencyExpiryDuration);\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient)\\n external\\n onlyAdmin\\n {\\n if (_exitInfo[_consensusAddr].recyclingAt == 0) {\\n return;\\n }\\n\\n uint256 _length = _lockedConsensusList.length;\\n uint256 _index = _length;\\n\\n for (uint _i; _i < _length; _i++) {\\n if (_lockedConsensusList[_i] == _consensusAddr) {\\n _index = _i;\\n break;\\n }\\n }\\n\\n // The locked amount might be recycled\\n if (_index == _length) {\\n return;\\n }\\n\\n uint256 _amount = _exitInfo[_consensusAddr].lockedAmount;\\n if (_amount > 0) {\\n delete _exitInfo[_consensusAddr];\\n if (_length > 1) {\\n _lockedConsensusList[_index] = _lockedConsensusList[_length - 1];\\n }\\n _lockedConsensusList.pop();\\n\\n _lockedFundReleased[_consensusAddr] = true;\\n if (_unsafeSendRON(_recipient, _amount, DEFAULT_ADDITION_GAS)) {\\n emit EmergencyExitLockedFundReleased(_consensusAddr, _recipient, _amount);\\n return;\\n }\\n\\n emit EmergencyExitLockedFundReleasingFailed(_consensusAddr, _recipient, _amount, address(this).balance);\\n }\\n }\\n\\n /**\\n * @dev Tries to recycle the locked funds from emergency exit requests.\\n */\\n function _tryRecycleLockedFundsFromEmergencyExits() internal {\\n uint256 _length = _lockedConsensusList.length;\\n\\n uint256 _i;\\n address _addr;\\n EmergencyExitInfo storage _info;\\n\\n while (_i < _length) {\\n _addr = _lockedConsensusList[_i];\\n _info = _exitInfo[_addr];\\n\\n if (_info.recyclingAt <= block.timestamp) {\\n _totalDeprecatedReward += _info.lockedAmount;\\n\\n delete _exitInfo[_addr];\\n if (--_length > 0) {\\n _lockedConsensusList[_i] = _lockedConsensusList[_length];\\n }\\n _lockedConsensusList.pop();\\n continue;\\n }\\n\\n _i++;\\n }\\n }\\n\\n /**\\n * @dev Override `CandidateManager-_emergencyExitLockedFundReleased`.\\n */\\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {\\n return _lockedFundReleased[_consensusAddr];\\n }\\n\\n /**\\n * @dev Override `CandidateManager-_removeCandidate`.\\n */\\n function _removeCandidate(address _consensusAddr) internal override {\\n delete _lockedFundReleased[_consensusAddr];\\n super._removeCandidate(_consensusAddr);\\n }\\n\\n /**\\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\\n */\\n function _bridgeOperatorOf(address _consensusAddr)\\n internal\\n view\\n virtual\\n override(CandidateManager, ValidatorInfoStorage)\\n returns (address)\\n {\\n return CandidateManager._bridgeOperatorOf(_consensusAddr);\\n }\\n\\n /**\\n * @dev See `setEmergencyExitLockedAmount.\\n */\\n function _setEmergencyExitLockedAmount(uint256 _amount) internal {\\n _emergencyExitLockedAmount = _amount;\\n emit EmergencyExitLockedAmountUpdated(_amount);\\n }\\n\\n /**\\n * @dev See `setEmergencyExpiryDuration`.\\n */\\n function _setEmergencyExpiryDuration(uint256 _duration) internal {\\n _emergencyExpiryDuration = _duration;\\n emit EmergencyExpiryDurationUpdated(_duration);\\n }\\n}\\n\",\"keccak256\":\"0x829dd3adae7a2171205dacc768d47f398be52669de1bb32ed3f8b91db6fc8885\",\"license\":\"MIT\"},\"contracts/ronin/validator/RoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"./CoinbaseExecution.sol\\\";\\nimport \\\"./SlashingExecution.sol\\\";\\n\\ncontract RoninValidatorSet is Initializable, CoinbaseExecution, SlashingExecution {\\n constructor() {\\n _disableInitializers();\\n }\\n\\n fallback() external payable {\\n _fallback();\\n }\\n\\n receive() external payable {\\n _fallback();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __slashIndicatorContract,\\n address __stakingContract,\\n address __stakingVestingContract,\\n address __maintenanceContract,\\n address __roninTrustedOrganizationContract,\\n address __bridgeTrackingContract,\\n uint256 __maxValidatorNumber,\\n uint256 __maxValidatorCandidate,\\n uint256 __maxPrioritizedValidatorNumber,\\n uint256 __minEffectiveDaysOnwards,\\n uint256 __numberOfBlocksInEpoch,\\n // __emergencyExitConfigs[0]: emergencyExitLockedAmount\\n // __emergencyExitConfigs[1]: emergencyExpiryDuration\\n uint256[2] calldata __emergencyExitConfigs\\n ) external initializer {\\n _setSlashIndicatorContract(__slashIndicatorContract);\\n _setStakingContract(__stakingContract);\\n _setStakingVestingContract(__stakingVestingContract);\\n _setMaintenanceContract(__maintenanceContract);\\n _setBridgeTrackingContract(__bridgeTrackingContract);\\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\\n _setMaxValidatorNumber(__maxValidatorNumber);\\n _setMaxValidatorCandidate(__maxValidatorCandidate);\\n _setMaxPrioritizedValidatorNumber(__maxPrioritizedValidatorNumber);\\n _setMinEffectiveDaysOnwards(__minEffectiveDaysOnwards);\\n _setEmergencyExitLockedAmount(__emergencyExitConfigs[0]);\\n _setEmergencyExpiryDuration(__emergencyExitConfigs[1]);\\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\\n }\\n\\n /**\\n * @dev Only receives RON from staking vesting contract (for topping up bonus), and from staking contract (for transferring\\n * deducting amount on slashing).\\n */\\n function _fallback() internal view {\\n if (msg.sender != stakingVestingContract() && msg.sender != stakingContract()) revert ErrUnauthorizedReceiveRON();\\n }\\n\\n /**\\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\\n */\\n function _bridgeOperatorOf(address _consensusAddr)\\n internal\\n view\\n override(EmergencyExit, ValidatorInfoStorage)\\n returns (address)\\n {\\n return super._bridgeOperatorOf(_consensusAddr);\\n }\\n}\\n\",\"keccak256\":\"0xd7a2ac4d3a2c8edbd1bbfb1ef3549ef0a019b4c9b4f1c12f1fd07b116b1adab3\",\"license\":\"MIT\"},\"contracts/ronin/validator/SlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasSlashIndicatorContract.sol\\\";\\nimport \\\"../../extensions/collections/HasStakingContract.sol\\\";\\nimport \\\"../../interfaces/validator/ISlashingExecution.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"./storage-fragments/CommonStorage.sol\\\";\\n\\nabstract contract SlashingExecution is\\n ISlashingExecution,\\n HasSlashIndicatorContract,\\n HasStakingContract,\\n CommonStorage\\n{\\n /**\\n * @inheritdoc ISlashingExecution\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external override onlySlashIndicatorContract {\\n uint256 _period = currentPeriod();\\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = true;\\n\\n _totalDeprecatedReward += _miningReward[_validatorAddr] + _delegatingReward[_validatorAddr];\\n\\n delete _miningReward[_validatorAddr];\\n delete _delegatingReward[_validatorAddr];\\n\\n _blockProducerJailedBlock[_validatorAddr] = Math.max(_newJailedUntil, _blockProducerJailedBlock[_validatorAddr]);\\n\\n if (_slashAmount > 0) {\\n uint256 _actualAmount = _stakingContract.execDeductStakingAmount(_validatorAddr, _slashAmount);\\n _totalDeprecatedReward += _actualAmount;\\n }\\n\\n if (_cannotBailout) {\\n _cannotBailoutUntilBlock[_validatorAddr] = Math.max(_newJailedUntil, _cannotBailoutUntilBlock[_validatorAddr]);\\n }\\n\\n emit ValidatorPunished(\\n _validatorAddr,\\n _period,\\n _blockProducerJailedBlock[_validatorAddr],\\n _slashAmount,\\n true,\\n false\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashingExecution\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external override onlySlashIndicatorContract {\\n if (block.number <= _cannotBailoutUntilBlock[_validatorAddr]) revert ErrCannotBailout(_validatorAddr);\\n\\n // Note: Removing rewards of validator in `bailOut` function is not needed, since the rewards have been\\n // removed previously in the `slash` function.\\n _miningRewardBailoutCutOffAtPeriod[_validatorAddr][_period] = true;\\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = false;\\n _blockProducerJailedBlock[_validatorAddr] = block.number - 1;\\n\\n emit ValidatorUnjailed(_validatorAddr, _period);\\n }\\n}\\n\",\"keccak256\":\"0xf10b8566c1397e3dc86c6c16dcd20bf91011726b01dbff7da3a9d9a59bdee9b0\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/CommonStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../interfaces/validator/info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./JailingStorage.sol\\\";\\nimport \\\"./TimingStorage.sol\\\";\\nimport \\\"./ValidatorInfoStorage.sol\\\";\\n\\nabstract contract CommonStorage is ICommonInfo, TimingStorage, JailingStorage, ValidatorInfoStorage {\\n /// @dev Mapping from consensus address => pending reward from producing block\\n mapping(address => uint256) internal _miningReward;\\n /// @dev Mapping from consensus address => pending reward from delegating\\n mapping(address => uint256) internal _delegatingReward;\\n\\n /// @dev The total reward for bridge operators\\n uint256 internal _totalBridgeReward;\\n /// @dev Mapping from consensus address => pending reward for being bridge operator\\n mapping(address => uint256) internal _bridgeOperatingReward;\\n\\n /// @dev The deprecated reward that has not been withdrawn by admin\\n uint256 internal _totalDeprecatedReward;\\n\\n /// @dev The amount of RON to lock from a consensus address.\\n uint256 internal _emergencyExitLockedAmount;\\n /// @dev The duration that an emergency request is expired and the fund will be recycled.\\n uint256 internal _emergencyExpiryDuration;\\n /// @dev The address list of consensus addresses that being locked fund.\\n address[] internal _lockedConsensusList;\\n /// @dev Mapping from consensus => request exist info\\n mapping(address => EmergencyExitInfo) internal _exitInfo;\\n /// @dev Mapping from consensus => flag indicating whether the locked fund is released\\n mapping(address => bool) internal _lockedFundReleased;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[44] private ______gap;\\n\\n /**\\n * @inheritdoc ICommonInfo\\n */\\n function getEmergencyExitInfo(address _consensusAddr)\\n external\\n view\\n override\\n returns (EmergencyExitInfo memory _info)\\n {\\n _info = _exitInfo[_consensusAddr];\\n if (_info.recyclingAt == 0) revert NonExistentRecyclingInfo();\\n }\\n\\n /**\\n * @inheritdoc ICommonInfo\\n */\\n function totalDeprecatedReward() external view override returns (uint256) {\\n return _totalDeprecatedReward;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function epochOf(uint256 _block)\\n public\\n view\\n virtual\\n override(ITimingInfo, JailingStorage, TimingStorage)\\n returns (uint256)\\n {\\n return TimingStorage.epochOf(_block);\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function currentPeriod() public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) {\\n return TimingStorage.currentPeriod();\\n }\\n}\\n\",\"keccak256\":\"0x7372a3febdddcd1fa0fdfd06eba11c58d1c3113ea1b408c0ab13b99eeeeb7b22\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/JailingStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../interfaces/validator/info-fragments/IJailingInfo.sol\\\";\\nimport \\\"./TimingStorage.sol\\\";\\n\\nabstract contract JailingStorage is IJailingInfo {\\n /// @dev Mapping from consensus address => period number => block producer has no pending reward.\\n mapping(address => mapping(uint256 => bool)) internal _miningRewardDeprecatedAtPeriod;\\n /// @dev Mapping from consensus address => period number => whether the block producer get cut off reward, due to bailout.\\n mapping(address => mapping(uint256 => bool)) internal _miningRewardBailoutCutOffAtPeriod;\\n /// @dev Mapping from consensus address => period number => block operator has no pending reward.\\n mapping(address => mapping(uint256 => bool)) internal _bridgeRewardDeprecatedAtPeriod;\\n\\n /// @dev Mapping from consensus address => the last block that the block producer is jailed.\\n mapping(address => uint256) internal _blockProducerJailedBlock;\\n /// @dev Mapping from consensus address => the last timestamp that the bridge operator is jailed.\\n mapping(address => uint256) internal _emergencyExitJailedTimestamp;\\n /// @dev Mapping from consensus address => the last block that the block producer cannot bailout.\\n mapping(address => uint256) internal _cannotBailoutUntilBlock;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] private ______gap;\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkJailed(address _addr) external view override returns (bool) {\\n return checkJailedAtBlock(_addr, block.number);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n override\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n )\\n {\\n return getJailedTimeLeftAtBlock(_addr, block.number);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) public view override returns (bool) {\\n return _jailedAtBlock(_addr, _blockNum);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n public\\n view\\n override\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n )\\n {\\n uint256 _jailedBlock = _blockProducerJailedBlock[_addr];\\n if (_jailedBlock < _blockNum) {\\n return (false, 0, 0);\\n }\\n\\n isJailed_ = true;\\n blockLeft_ = _jailedBlock - _blockNum + 1;\\n epochLeft_ = epochOf(_jailedBlock) - epochOf(_blockNum) + 1;\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkManyJailed(address[] calldata _addrList) external view override returns (bool[] memory _result) {\\n _result = new bool[](_addrList.length);\\n for (uint256 _i; _i < _addrList.length; _i++) {\\n _result[_i] = _jailed(_addrList[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view override returns (bool _result) {\\n uint256 _period = currentPeriod();\\n return _miningRewardDeprecated(_blockProducer, _period);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period)\\n external\\n view\\n override\\n returns (bool _result)\\n {\\n return _miningRewardDeprecated(_blockProducer, _period);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n *\\n * @dev Because the information of deprecating bridge reward of a period is only determined at the end of that period, this\\n * method will return the deprecating info of the latest period. A method for querying that info of current period is no need.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr)\\n external\\n view\\n override\\n returns (bool _result)\\n {\\n uint256 _period = currentPeriod() - 1;\\n return _bridgeRewardDeprecated(_consensusAddr, _period);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n override\\n returns (bool _result)\\n {\\n return _bridgeRewardDeprecated(_consensusAddr, _period);\\n }\\n\\n /**\\n * @dev See `ITimingInfo-epochOf`\\n */\\n function epochOf(uint256 _block) public view virtual returns (uint256);\\n\\n /**\\n * @dev See `ITimingInfo-currentPeriod`\\n */\\n function currentPeriod() public view virtual returns (uint256);\\n\\n /**\\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) during the current period.\\n */\\n function _jailed(address _validatorAddr) internal view returns (bool) {\\n return _jailedAtBlock(_validatorAddr, block.number);\\n }\\n\\n /**\\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) at a specific block.\\n */\\n function _jailedAtBlock(address _validatorAddr, uint256 _blockNum) internal view returns (bool) {\\n return _blockNum <= _blockProducerJailedBlock[_validatorAddr];\\n }\\n\\n /**\\n * @dev Returns whether the block producer has no pending reward in that period.\\n */\\n function _miningRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\\n return _miningRewardDeprecatedAtPeriod[_validatorAddr][_period];\\n }\\n\\n /**\\n * @dev Returns whether the bridge operator has no pending reward in the period.\\n */\\n function _bridgeRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\\n return _bridgeRewardDeprecatedAtPeriod[_validatorAddr][_period];\\n }\\n}\\n\",\"keccak256\":\"0x14ae5cc1f190f1b3e4517677b013638afc39a35d538303b8f0280fe1a52042c6\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/TimingStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../extensions/consumers/GlobalConfigConsumer.sol\\\";\\nimport \\\"../../../interfaces/validator/info-fragments/ITimingInfo.sol\\\";\\n\\nabstract contract TimingStorage is ITimingInfo, GlobalConfigConsumer {\\n /// @dev The number of blocks in a epoch\\n uint256 internal _numberOfBlocksInEpoch;\\n /// @dev The last updated block\\n uint256 internal _lastUpdatedBlock;\\n /// @dev The last updated period\\n uint256 internal _lastUpdatedPeriod;\\n /// @dev The starting block of the last updated period\\n uint256 internal _currentPeriodStartAtBlock;\\n\\n /// @dev Mapping from epoch index => period index\\n mapping(uint256 => uint256) internal _periodOf;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] private ______gap;\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function getLastUpdatedBlock() external view override returns (uint256) {\\n return _lastUpdatedBlock;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function epochOf(uint256 _block) public view virtual override returns (uint256) {\\n return _block / _numberOfBlocksInEpoch + 1;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber) {\\n return (_epoch <= epochOf(block.number) || _periodOf[_epoch] > 0, _periodOf[_epoch]);\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function isPeriodEnding() external view override returns (bool) {\\n return _isPeriodEnding(_computePeriod(block.timestamp));\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function epochEndingAt(uint256 _block) public view virtual override returns (bool) {\\n return _block % _numberOfBlocksInEpoch == _numberOfBlocksInEpoch - 1;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function currentPeriod() public view virtual override returns (uint256) {\\n return _lastUpdatedPeriod;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function currentPeriodStartAtBlock() public view override returns (uint256) {\\n return _currentPeriodStartAtBlock;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function numberOfBlocksInEpoch() public view virtual override returns (uint256 _numberOfBlocks) {\\n return _numberOfBlocksInEpoch;\\n }\\n\\n /**\\n * @dev See `ITimingInfo-isPeriodEnding`\\n */\\n function _isPeriodEnding(uint256 _newPeriod) internal view virtual returns (bool) {\\n return _newPeriod > _lastUpdatedPeriod;\\n }\\n\\n /**\\n * @dev Returns the calculated period.\\n */\\n function _computePeriod(uint256 _timestamp) internal pure returns (uint256) {\\n return _timestamp / PERIOD_DURATION;\\n }\\n}\\n\",\"keccak256\":\"0xc545f119b8b8978d793b62f2495dc2d49c3f416791459b9833bdc65f4dae8e7f\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/ValidatorInfoStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\nimport \\\"../../../extensions/collections/HasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../../interfaces/validator/info-fragments/IValidatorInfo.sol\\\";\\n\\nabstract contract ValidatorInfoStorage is IValidatorInfo, HasRoninTrustedOrganizationContract {\\n using EnumFlags for EnumFlags.ValidatorFlag;\\n\\n /// @dev The maximum number of validator.\\n uint256 internal _maxValidatorNumber;\\n\\n /// @dev The total of validators\\n uint256 public validatorCount;\\n /// @dev Mapping from validator index => validator address\\n mapping(uint256 => address) internal _validators;\\n /// @dev Mapping from address => flag indicating the validator ability: producing block, operating bridge\\n mapping(address => EnumFlags.ValidatorFlag) internal _validatorMap;\\n /// @dev The number of slot that is reserved for prioritized validators\\n uint256 internal _maxPrioritizedValidatorNumber;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getValidators()\\n public\\n view\\n override\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n )\\n {\\n _validatorList = new address[](validatorCount);\\n _bridgeOperators = new address[](validatorCount);\\n _flags = new EnumFlags.ValidatorFlag[](validatorCount);\\n for (uint _i; _i < _validatorList.length; _i++) {\\n address _validator = _validators[_i];\\n _validatorList[_i] = _validator;\\n _bridgeOperators[_i] = _bridgeOperatorOf(_validator);\\n _flags[_i] = _validatorMap[_validator];\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isValidator(address _addr) public view override returns (bool) {\\n return !_validatorMap[_addr].isNone();\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getBlockProducers() public view override returns (address[] memory _result) {\\n _result = new address[](validatorCount);\\n uint256 _count = 0;\\n for (uint _i; _i < _result.length; _i++) {\\n if (isBlockProducer(_validators[_i])) {\\n _result[_count++] = _validators[_i];\\n }\\n }\\n\\n assembly {\\n mstore(_result, _count)\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isBlockProducer(address _addr) public view override returns (bool) {\\n return _validatorMap[_addr].hasFlag(EnumFlags.ValidatorFlag.BlockProducer);\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function totalBlockProducers() external view returns (uint256 _total) {\\n for (uint _i; _i < validatorCount; _i++) {\\n if (isBlockProducer(_validators[_i])) {\\n _total++;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getBridgeOperators() public view override returns (address[] memory _result) {\\n _result = new address[](validatorCount);\\n uint256 _count = 0;\\n for (uint _i; _i < _result.length; _i++) {\\n if (isOperatingBridge(_validators[_i])) {\\n _result[_count++] = _bridgeOperatorOf(_validators[_i]);\\n }\\n }\\n\\n assembly {\\n mstore(_result, _count)\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs)\\n public\\n view\\n override\\n returns (address[] memory _result)\\n {\\n _result = new address[](_validatorAddrs.length);\\n for (uint _i; _i < _result.length; _i++) {\\n _result[_i] = _bridgeOperatorOf(_validatorAddrs[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isBridgeOperator(address _bridgeOperatorAddr) external view override returns (bool _isOperator) {\\n for (uint _i; _i < validatorCount; _i++) {\\n if (_bridgeOperatorOf(_validators[_i]) == _bridgeOperatorAddr && isOperatingBridge(_validators[_i])) {\\n _isOperator = true;\\n break;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isOperatingBridge(address _consensusAddr) public view override returns (bool) {\\n return _validatorMap[_consensusAddr].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator);\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {\\n return _maxValidatorNumber;\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function maxPrioritizedValidatorNumber() external view override returns (uint256 _maximumPrioritizedValidatorNumber) {\\n return _maxPrioritizedValidatorNumber;\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function totalBridgeOperators() public view returns (uint256 _total) {\\n for (uint _i; _i < validatorCount; _i++) {\\n if (isOperatingBridge(_validators[_i])) {\\n _total++;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function setMaxValidatorNumber(uint256 _max) external override onlyAdmin {\\n _setMaxValidatorNumber(_max);\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _number) external override onlyAdmin {\\n _setMaxPrioritizedValidatorNumber(_number);\\n }\\n\\n /**\\n * @dev Returns the bridge operator of a consensus address.\\n */\\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address);\\n\\n /**\\n * @dev See `IValidatorInfo-setMaxValidatorNumber`\\n */\\n function _setMaxValidatorNumber(uint256 _number) internal {\\n _maxValidatorNumber = _number;\\n emit MaxValidatorNumberUpdated(_number);\\n }\\n\\n /**\\n * @dev See `IValidatorInfo-setMaxPrioritizedValidatorNumber`\\n */\\n function _setMaxPrioritizedValidatorNumber(uint256 _number) internal {\\n if (_number > _maxValidatorNumber) revert ErrInvalidMaxPrioritizedValidatorNumber();\\n _maxPrioritizedValidatorNumber = _number;\\n emit MaxPrioritizedValidatorNumberUpdated(_number);\\n }\\n}\\n\",\"keccak256\":\"0x19dca6ad64bd68923a8eaa9983ccfe0adb8cd7ad5d94b4ba708c35483adc430e\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b615ffb80620000f46000396000f3fe6080604052600436106103455760003560e01c8063038278841461035c57806304d971ab1461038557806306040618146103b55780630f43a677146103ca5780631104e528146103e057806311662dc2146104005780631196ab661461043d57806315b5ebde1461045d5780631ab4a34c1461047d5780631f6288011461049d578063217f35c2146104bd57806323c65eb0146104d257806328bde1e1146104f25780632924de711461051f578063297a8fca1461053f5780632bcf3d15146105545780632d784a98146105745780632f78204c146105a157806331a8aef5146105c15780633529214b146105e1578063367ec12b146106035780633b3159b6146106235780634244d4c9146106375780634493421e14610664578063468c96ae1461068257806346fe9311146106b957806349096d26146106d95780634d8df063146106ee5780634de2b7351461070e5780634ee4d72b1461073b5780634f2a693f1461075057806352091f17146107705780635248184a146107785780635511cde11461079a578063562d5304146107b85780635a08482d146107cd578063605239a1146107e257806365244ece146107f75780636558954f146108175780636611f8431461082e578063690b75361461084e5780636aa1c2ef1461086357806372e46810146108785780637593ff7114610880578063823a7b9c146108a0578063873a5a70146108c057806387c891bd146108e05780638d559c38146108f557806396585fc2146109095780639b19dbfd146109295780639c8d98da1461093e5780639dd373b91461095e5780639e94b9ec1461097e578063a0c3f2d214610993578063a3d545f5146109b3578063a66c0f77146109d3578063a7c2f119146109e8578063ad29578314610a08578063b405aaf214610a28578063b5e337de14610a48578063b7ab4db514610a68578063ba77b06c14610a8c578063c3c8b5d614610aa1578063c94aaa0214610ac1578063cba44de914610ae1578063d09f1ab414610af6578063d2cb215e14610b0b578063d5a0744f14610b29578063dd716ad314610b49578063e5125a1d14610b69578063edb194bb14610b89578063ee99205c14610beb578063eeb629a814610c00578063facd743b14610c1557610354565b3661035457610352610c35565b005b610352610c35565b34801561036857600080fd5b506103726104b081565b6040519081526020015b60405180910390f35b34801561039157600080fd5b506103a56103a0366004615439565b610c9a565b604051901515815260200161037c565b3480156103c157600080fd5b50610372610cc1565b3480156103d657600080fd5b5061037260aa5481565b3480156103ec57600080fd5b506103526103fb366004615472565b610cd1565b34801561040c57600080fd5b5061042061041b3660046154d6565b610f5c565b60408051931515845260208401929092529082015260600161037c565b34801561044957600080fd5b50610352610458366004615502565b610fdf565b34801561046957600080fd5b506103526104783660046154d6565b611023565b34801561048957600080fd5b506103a561049836600461551b565b61113f565b3480156104a957600080fd5b506103a56104b836600461551b565b611169565b3480156104c957600080fd5b506103a56111a3565b3480156104de57600080fd5b506103a56104ed3660046154d6565b6111b8565b3480156104fe57600080fd5b5061051261050d36600461551b565b6111c4565b60405161037c919061558c565b34801561052b57600080fd5b506103a561053a36600461551b565b611267565b34801561054b57600080fd5b50600454610372565b34801561056057600080fd5b5061035261056f36600461551b565b611273565b34801561058057600080fd5b5061059461058f36600461551b565b6112df565b60405161037c919061559a565b3480156105ad57600080fd5b506103526105bc3660046155bf565b611341565b3480156105cd57600080fd5b506103a56105dc3660046154d6565b61155d565b3480156105ed57600080fd5b506105f6611569565b60405161037c9190615609565b34801561060f57600080fd5b5061035261061e36600461562e565b611578565b34801561062f57600080fd5b5060686105f6565b34801561064357600080fd5b5061065761065236600461575d565b611703565b60405161037c919061583f565b34801561067057600080fd5b50606e546001600160a01b03166105f6565b34801561068e57600080fd5b506106a261069d366004615502565b6117ba565b60408051921515835260208301919091520161037c565b3480156106c557600080fd5b506103526106d436600461551b565b6117f8565b3480156106e557600080fd5b50610657611864565b3480156106fa57600080fd5b50610352610709366004615502565b61194d565b34801561071a57600080fd5b5061072e610729366004615852565b61198e565b60405161037c91906158c6565b34801561074757600080fd5b5060e454610372565b34801561075c57600080fd5b5061035261076b366004615502565b611a49565b610352611a8a565b34801561078457600080fd5b5061078d611e49565b60405161037c919061590c565b3480156107a657600080fd5b5060a8546001600160a01b03166105f6565b3480156107c457600080fd5b50610372611f79565b3480156107d957600080fd5b506105f6611fcd565b3480156107ee57600080fd5b50607254610372565b34801561080357600080fd5b506103a561081236600461551b565b611fdc565b34801561082357600080fd5b506103726201518081565b34801561083a57600080fd5b50610352610849366004615502565b612010565b34801561085a57600080fd5b5060e554610372565b34801561086f57600080fd5b50600154610372565b610352612051565b34801561088c57600080fd5b506103a561089b366004615502565b6122b1565b3480156108ac57600080fd5b506103526108bb366004615502565b6122d5565b3480156108cc57600080fd5b506103a56108db36600461551b565b612316565b3480156108ec57600080fd5b50600254610372565b34801561090157600080fd5b5060666105f6565b34801561091557600080fd5b5061042061092436600461551b565b61232d565b34801561093557600080fd5b50610657612349565b34801561094a57600080fd5b5061035261095936600461551b565b612435565b34801561096a57600080fd5b5061035261097936600461551b565b6124a1565b34801561098a57600080fd5b5061037261250d565b34801561099f57600080fd5b506103a56109ae36600461551b565b612561565b3480156109bf57600080fd5b506103726109ce366004615502565b61257e565b3480156109df57600080fd5b5060e654610372565b3480156109f457600080fd5b50610352610a033660046154d6565b612589565b348015610a1457600080fd5b50610352610a2336600461551b565b612835565b348015610a3457600080fd5b506103a5610a4336600461551b565b6128a1565b348015610a5457600080fd5b50610352610a6336600461551b565b612926565b348015610a7457600080fd5b50610a7d612992565b60405161037c93929190615964565b348015610a9857600080fd5b50610657612b70565b348015610aad57600080fd5b50610352610abc366004615439565b612bd2565b348015610acd57600080fd5b50610352610adc366004615502565b612e55565b348015610aed57600080fd5b50607654610372565b348015610b0257600080fd5b5060a954610372565b348015610b1757600080fd5b50606f546001600160a01b03166105f6565b348015610b3557600080fd5b506103a5610b443660046154d6565b612e96565b348015610b5557600080fd5b50610352610b643660046154d6565b612ea2565b348015610b7557600080fd5b50610352610b843660046159dd565b612f4c565b348015610b9557600080fd5b50610594610ba436600461551b565b6040805180820190915260008082526020820152506001600160a01b0316600090815260776020908152604091829020825180840190935280548352600101549082015290565b348015610bf757600080fd5b506105f661307f565b348015610c0c57600080fd5b5060ad54610372565b348015610c2157600080fd5b506103a5610c3036600461551b565b61308e565b610c3d611569565b6001600160a01b0316336001600160a01b031614158015610c775750610c6161307f565b6001600160a01b0316336001600160a01b031614155b15610c985760405160016234baed60e01b0319815260040160405180910390fd5b565b6001600160a01b038281166000908152607560205260409020548116908216145b92915050565b6000610ccc60035490565b905090565b33610cda61307f565b6001600160a01b031614610d0157604051638aaf4a0760e01b815260040160405180910390fd5b6073546072548110610d2657604051638616841b60e01b815260040160405180910390fd5b610d2f85612561565b15610d4d57604051638ad9cdf960e01b815260040160405180910390fd5b612710821115610d7057604051631b8454a360e21b815260040160405180910390fd5b60005b607354811015610e6b5760006075600060738481548110610d9657610d96615a12565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190208054909250811690891603610df2578760405163fc3d8c7560e01b8152600401610de99190615609565b60405180910390fd5b60028101546001600160a01b0390811690871603610e255785604051632d33a7e760e11b8152600401610de99190615609565b60038101546001600160a01b0390811690861603610e5857846040516350e1263b60e01b8152600401610de99190615609565b5080610e6381615a3e565b915050610d73565b506001600160a01b038581166000818152607460209081526040808320861990556073805460018082019092557ff79bde9ddd17963ebce6f7d021d60de7c2bd0db944d23c900c0c0e775f5300520180546001600160a01b03199081168717909155607590935292819020805483168c87169081178255938101805484168617905560028101805484168b8816908117909155600382018054909416968a1696909617909255600482018790555190939192907fd690f592ed983cfbc05717fbcf06c4e10ae328432c309fe49246cf4a4be69fcd90610f4b908990615609565b60405180910390a450505050505050565b6001600160a01b0382166000908152603a60205260408120548190819084811015610f9257600080600093509350935050610fd8565b60019350610fa08582615a57565b610fab906001615a6a565b9250610fb68561257e565b610fbf8261257e565b610fc99190615a57565b610fd4906001615a6a565b9150505b9250925092565b610fe76130cb565b6001600160a01b0316336001600160a01b0316146110175760405162461bcd60e51b8152600401610de990615a7d565b611020816130f9565b50565b3361102c611fcd565b6001600160a01b031614611053576040516328b9c24b60e21b815260040160405180910390fd5b6001600160a01b0382166000908152603c6020526040902054431161108d57816040516353e0424d60e01b8152600401610de99190615609565b6001600160a01b038216600081815260386020908152604080832085845282528083208054600160ff1991821681179092559484526037835281842086855290925290912080549092169091556110e49043615a57565b6001600160a01b0383166000818152603a6020526040908190209290925590517f6bb2436cb6b6eb65d5a52fac2ae0373a77ade6661e523ef3004ee2d5524e6c6e906111339084815260200190565b60405180910390a25050565b600080600161114c610cc1565b6111569190615a57565b90506111628382613157565b9392505050565b6001600160a01b038116600090815260ac6020526040812054610cbb9060029060ff16600381111561119d5761119d61594e565b90613182565b6000610ccc6111b1426131b5565b6003541090565b600061116283836131c4565b6111cc6153e8565b6111d582612561565b6111f25760405163a64b34ad60e01b815260040160405180910390fd5b506001600160a01b03908116600090815260756020908152604091829020825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015290565b6000610cbb82436111b8565b61127b6130cb565b6001600160a01b0316336001600160a01b0316146112ab5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b6000036112d657604051637bcd509160e01b815260040160405180910390fd5b611020816131e4565b604080518082018252600080825260209182018190526001600160a01b038416815260e88252828120835180850190945280548452600101549183018290520361133c576040516370fdd4f160e11b815260040160405180910390fd5b919050565b3361134a611fcd565b6001600160a01b031614611371576040516328b9c24b60e21b815260040160405180910390fd5b600061137b610cc1565b6001600160a01b03861660008181526037602090815260408083208584528252808320805460ff1916600117905592825260e181528282205460e0909152919020549192506113c991615a6a565b60e460008282546113da9190615a6a565b90915550506001600160a01b038516600090815260e06020908152604080832083905560e18252808320839055603a90915290205461141a90859061322f565b6001600160a01b0386166000908152603a602052604090205582156114ca5760715460405163138ac02f60e11b81526000916001600160a01b031690632715805e9061146c9089908890600401615abf565b6020604051808303816000875af115801561148b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114af9190615ad8565b90508060e460008282546114c39190615a6a565b9091555050505b811561150e576001600160a01b0385166000908152603c60205260409020546114f490859061322f565b6001600160a01b0386166000908152603c60205260409020555b6001600160a01b0385166000818152603a6020526040808220549051849392600080516020615fa68339815191529261154e929091899160019190615af1565b60405180910390a35050505050565b60006111628383613246565b606d546001600160a01b031690565b600054610100900460ff16158080156115985750600054600160ff909116105b806115b25750303b1580156115b2575060005460ff166001145b6116155760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610de9565b6000805460ff191660011790558015611638576000805461ff0019166101001790555b6116418d6131e4565b61164a8c613271565b6116538b6132bc565b61165c8a613307565b61166588613352565b61166e8961339d565b611677876133e8565b6116808661341d565b61168985613452565b611692846130f9565b61169c82356134aa565b6116a960208301356134df565b600183905580156116f4576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b606081516001600160401b0381111561171e5761171e6156f4565b604051908082528060200260200182016040528015611747578160200160208202803683370190505b50905060005b81518110156117b45761177883828151811061176b5761176b615a12565b6020026020010151613514565b82828151811061178a5761178a615a12565b6001600160a01b0390921660209283029190910190910152806117ac81615a3e565b91505061174d565b50919050565b6000806117c64361257e565b831115806117e1575060008381526005602052604090205415155b600093845260056020526040909320549293915050565b6118006130cb565b6001600160a01b0316336001600160a01b0316146118305760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361185b57604051637bcd509160e01b815260040160405180910390fd5b61102081613307565b606060aa546001600160401b03811115611880576118806156f4565b6040519080825280602002602001820160405280156118a9578160200160208202803683370190505b5090506000805b825181101561194757600081815260ab60205260409020546118da906001600160a01b0316611fdc565b1561193557600081815260ab60205260409020546001600160a01b0316838361190281615a3e565b94508151811061191457611914615a12565b60200260200101906001600160a01b031690816001600160a01b0316815250505b8061193f81615a3e565b9150506118b0565b50815290565b6119556130cb565b6001600160a01b0316336001600160a01b0316146119855760405162461bcd60e51b8152600401610de990615a7d565b611020816134df565b6060816001600160401b038111156119a8576119a86156f4565b6040519080825280602002602001820160405280156119d1578160200160208202803683370190505b50905060005b82811015611a4257611a0e8484838181106119f4576119f4615a12565b9050602002016020810190611a09919061551b565b61351f565b828281518110611a2057611a20615a12565b9115156020928302919091019091015280611a3a81615a3e565b9150506119d7565b5092915050565b611a516130cb565b6001600160a01b0316336001600160a01b031614611a815760405162461bcd60e51b8152600401610de990615a7d565b6110208161341d565b334114611aaa576040516309f358fd60e01b815260040160405180910390fd5b6000611ab533611fdc565b8015611ac75750611ac53361351f565b155b8015611ae15750611adf33611ada610cc1565b613246565b155b606d54604051630634f5b960e01b815282151560048201526001602482015291925060009182916001600160a01b031690630634f5b9906044016060604051808303816000875af1158015611b3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5e9190615b10565b92509250508060e26000828254611b759190615a6a565b90915550839050611bc7573460e46000828254611b929190615a6a565b90915550506040513390600080516020615f8683398151915290611bba903490600190615b47565b60405180910390a2505050565b336001600160a01b03167f0ede5c3be8625943fa64003cd4b91230089411249f3059bac6500873543ca9b13484604051611c02929190615b6b565b60405180910390a26000611c14610cc1565b90506000611c228434615a6a565b3360009081526038602090815260408083208684529091528120549192509060ff1615611d1b576070546040805163631c8fd160e11b815290516000926001600160a01b03169163c6391fa29160048083019260809291908290030181865afa158015611c93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb79190615b79565b93505050506127108184611ccb9190615baf565b611cd59190615bdc565b91508160e46000828254611ce99190615a6a565b90915550506040513390600080516020615f8683398151915290611d11908590600290615b47565b60405180910390a2505b611d258183615a57565b60715460408051632298690160e11b8152815193955060009384936001600160a01b031692634530d20292600480820193918290030181865afa158015611d70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d949190615bf0565b3360009081526075602052604081206004015492945090925090611dc290611dbc908461352b565b8461322f565b90506000612710611dd38784615baf565b611ddd9190615bdc565b33600090815260e06020526040812080549293508392909190611e01908490615a6a565b9091555060009050611e138288615a57565b33600090815260e16020526040812080549293508392909190611e37908490615a6a565b90915550505050505050505050505050565b6073546060906001600160401b03811115611e6657611e666156f4565b604051908082528060200260200182016040528015611e9f57816020015b611e8c6153e8565b815260200190600190039081611e845790505b50905060005b8151811015611f75576075600060738381548110611ec557611ec5615a12565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c08201528251839083908110611f5757611f57615a12565b60200260200101819052508080611f6d90615a3e565b915050611ea5565b5090565b6000805b60aa54811015611f7557600081815260ab6020526040902054611fa8906001600160a01b0316611169565b15611fbb5781611fb781615a3e565b9250505b80611fc581615a3e565b915050611f7d565b6070546001600160a01b031690565b6001600160a01b038116600090815260ac6020526040812054610cbb9060019060ff16600381111561119d5761119d61594e565b6120186130cb565b6001600160a01b0316336001600160a01b0316146120485760405162461bcd60e51b8152600401610de990615a7d565b611020816134aa565b334114612071576040516309f358fd60e01b815260040160405180910390fd5b61207a436122b1565b61209757604051636c74eecf60e01b815260040160405180910390fd5b6120a04361257e565b6120ab60025461257e565b106120c957604051632458f64160e01b815260040160405180910390fd5b4360025560006120d8426131b5565b905060006120e7826003541090565b905060006120f3612992565b50509050606060006121044361257e565b90506000612113826001615a6a565b9050600061211f610cc1565b9050851561224b57612131818661353a565b60008061213e83886138c5565b9150915061214e83888484613af7565b612156613c00565b61215e613d5b565b607054604051631da0214360e21b81526001600160a01b0390911690637680850c90612190908a908790600401615c14565b600060405180830381600087803b1580156121aa57600080fd5b505af11580156121be573d6000803e3d6000fd5b505050506121cb89613e7d565b805191985096501561223a576070546040516303e1697b60e11b81526001600160a01b03909116906307c2d2f69061220790899060040161583f565b600060405180830381600087803b15801561222157600080fd5b505af1158015612235573d6000803e3d6000fd5b505050505b612245436001615a6a565b60045550505b612256878387614008565b82817f0195462033384fec211477c56217da64a58bd405e0bed331ba4ded67e4ae4ce78860405161228b911515815260200190565b60405180910390a350600090815260056020526040902085905550505060039190915550565b6000600180546122c19190615a57565b6001546122ce9084615c36565b1492915050565b6122dd6130cb565b6001600160a01b0316336001600160a01b03161461230d5760405162461bcd60e51b8152600401610de990615a7d565b611020816133e8565b600080612321610cc1565b90506111628382613246565b600080600061233c8443610f5c565b9250925092509193909250565b606060aa546001600160401b03811115612365576123656156f4565b60405190808252806020026020018201604052801561238e578160200160208202803683370190505b5090506000805b825181101561194757600081815260ab60205260409020546123bf906001600160a01b0316611169565b1561242357600081815260ab60205260409020546123e5906001600160a01b0316613514565b83836123f081615a3e565b94508151811061240257612402615a12565b60200260200101906001600160a01b031690816001600160a01b0316815250505b8061242d81615a3e565b915050612395565b61243d6130cb565b6001600160a01b0316336001600160a01b03161461246d5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361249857604051637bcd509160e01b815260040160405180910390fd5b61102081613352565b6124a96130cb565b6001600160a01b0316336001600160a01b0316146124d95760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361250457604051637bcd509160e01b815260040160405180910390fd5b61102081613271565b6000805b60aa54811015611f7557600081815260ab602052604090205461253c906001600160a01b0316611fdc565b1561254f578161254b81615a3e565b9250505b8061255981615a3e565b915050612511565b6001600160a01b0316600090815260746020526040902054151590565b6000610cbb826143d8565b3361259261307f565b6001600160a01b0316146125b957604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b038216600090815260e8602052604090206001810154156125f45760405163057aab3160e31b815260040160405180910390fd5b60006126008342615a6a565b6001600160a01b038516600090815260756020526040902090915061262590826143f3565b6001600160a01b0384166000908152603b6020908152604080832084905560399091528120600191612655610cc1565b8152602081019190915260409081016000908120805460ff19169315159390931790925560715460e554915163138ac02f60e11b81526001600160a01b0390911691632715805e916126ab918991600401615abf565b6020604051808303816000875af11580156126ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126ee9190615ad8565b905080156127eb57600060e654426127069190615a6a565b60e78054600180820183556000929092527f6cb0db1d7354dfb4a1464318006df0643cafe2002a86a29ff8560f900fef28a10180546001600160a01b0319166001600160a01b038a16179055838655850181905590506127646130cb565b6001600160a01b0387811660008181526075602052604090819020600201549051630a2fae5760e41b81526004810192909252821660248201524260448201526064810184905291169063a2fae57090608401600060405180830381600087803b1580156127d157600080fd5b505af11580156127e5573d6000803e3d6000fd5b50505050505b846001600160a01b03167f77a1a819870c0f4d04c3ca4cc2881a0393136abc28bd651af50aedade94a27c48260405161282691815260200190565b60405180910390a25050505050565b61283d6130cb565b6001600160a01b0316336001600160a01b03161461286d5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361289857604051637bcd509160e01b815260040160405180910390fd5b611020816132bc565b6000805b60aa548110156117b457600081815260ab60205260409020546001600160a01b03808516916128d49116613514565b6001600160a01b03161480156129065750600081815260ab6020526040902054612906906001600160a01b0316611169565b1561291457600191506117b4565b8061291e81615a3e565b9150506128a5565b61292e6130cb565b6001600160a01b0316336001600160a01b03161461295e5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361298957604051637bcd509160e01b815260040160405180910390fd5b6110208161339d565b606080606060aa546001600160401b038111156129b1576129b16156f4565b6040519080825280602002602001820160405280156129da578160200160208202803683370190505b50925060aa546001600160401b038111156129f7576129f76156f4565b604051908082528060200260200182016040528015612a20578160200160208202803683370190505b50915060aa546001600160401b03811115612a3d57612a3d6156f4565b604051908082528060200260200182016040528015612a66578160200160208202803683370190505b50905060005b8351811015612b6a57600081815260ab602052604090205484516001600160a01b03909116908190869084908110612aa657612aa6615a12565b60200260200101906001600160a01b031690816001600160a01b031681525050612acf81613514565b848381518110612ae157612ae1615a12565b6001600160a01b03928316602091820292909201810191909152908216600090815260ac9091526040902054835160ff90911690849084908110612b2757612b27615a12565b60200260200101906003811115612b4057612b4061594e565b90816003811115612b5357612b5361594e565b905250819050612b6281615a3e565b915050612a6c565b50909192565b60606073805480602002602001604051908101604052809291908181526020018280548015612bc857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612baa575b5050505050905090565b612bda6130cb565b6001600160a01b0316336001600160a01b031614612c0a5760405162461bcd60e51b8152600401610de990615a7d565b6001600160a01b038216600090815260e8602052604090206001015415612e515760e7548060005b82811015612c8b57846001600160a01b031660e78281548110612c5757612c57615a12565b6000918252602090912001546001600160a01b031603612c7957809150612c8b565b80612c8381615a3e565b915050612c32565b50818103612c995750505050565b6001600160a01b038416600090815260e860205260409020548015612e4d576001600160a01b038516600090815260e860205260408120818155600190810191909155831115612d5b5760e7612cf0600185615a57565b81548110612d0057612d00615a12565b60009182526020909120015460e780546001600160a01b039092169184908110612d2c57612d2c615a12565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480612d6c57612d6c615c4a565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825260e9905260409020805460ff19166001179055612dbe84826104b061446f565b15612e0857836001600160a01b0316856001600160a01b03167f7229136a18186c71a86246c012af3bb1df6460ef163934bbdccd6368abdd41e48360405161154e91815260200190565b836001600160a01b0316856001600160a01b03167f3747d14eb72ad3e35cba9c3e00dab3b8d15b40cac6bdbd08402356e4f69f30a1834760405161154e929190615b6b565b5050505b5050565b612e5d6130cb565b6001600160a01b0316336001600160a01b031614612e8d5760405162461bcd60e51b8152600401610de990615a7d565b61102081613452565b60006111628383613157565b33612eab61307f565b6001600160a01b031614612ed257604051638aaf4a0760e01b815260040160405180910390fd5b612edb826144cf565b15612ef95760405163030081e760e01b815260040160405180910390fd5b6001600160a01b0382166000908152607560205260409020600581015415612f345760405163fab9167360e01b815260040160405180910390fd5b612f4781612f428442615a6a565b6143f3565b505050565b33612f5561307f565b6001600160a01b031614612f7c57604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604090205415612fb357604051632f32dcdd60e11b815260040160405180910390fd5b612710811115612fd657604051631b8454a360e21b815260040160405180910390fd5b607654821015612ff95760405163fa0ae69360e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604081209062015180846130218242615bdc565b61302b9190615a6a565b6130359190615baf565b808355600183018490556040519091506001600160a01b038616907f6ebafd1bb6316b2f63198a81b05cff2149c6eaae1784466a6d062b4391900f21906128269084908790615b6b565b6071546001600160a01b031690565b6001600160a01b038116600090815260ac60205260408120546130c49060ff1660038111156130bf576130bf61594e565b61454c565b1592915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b600181101561311b576040516317b8970f60e01b815260040160405180910390fd5b60768190556040518181527f266d432ffe659e3565750d26ec685b822a58041eee724b67a5afec3168a25267906020015b60405180910390a150565b6001600160a01b03919091166000908152603960209081526040808320938352929052205460ff1690565b60008160038111156131965761319661594e565b8360038111156131a8576131a861594e565b1660ff1615159392505050565b6000610cbb6201518083615bdc565b6001600160a01b03919091166000908152603a6020526040902054101590565b607080546001600160a01b0319166001600160a01b0383161790556040517faa5b07dd43aa44c69b70a6a2b9c3fcfed12b6e5f6323596ba7ac91035ab80a4f9061314c908390615609565b60008183101561323f5781611162565b5090919050565b6001600160a01b03919091166000908152603760209081526040808320938352929052205460ff1690565b607180546001600160a01b0319166001600160a01b0383161790556040517f6397f5b135542bb3f477cb346cfab5abdec1251d08dc8f8d4efb4ffe122ea0bf9061314c908390615609565b606d80546001600160a01b0319166001600160a01b0383161790556040517fc328090a37d855191ab58469296f98f87a851ca57d5cdfd1e9ac3c83e9e7096d9061314c908390615609565b606f80546001600160a01b0319166001600160a01b0383161790556040517f31a33f126a5bae3c5bdf6cfc2cd6dcfffe2fe9634bdb09e21c44762993889e3b9061314c908390615609565b606e80546001600160a01b0319166001600160a01b0383161790556040517f034c8da497df28467c79ddadbba1cc3cdd41f510ea73faae271e6f16a61116219061314c908390615609565b60a880546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d79061314c908390615609565b60a98190556040518181527fb5464c05fd0e0f000c535850116cda2742ee1f7b34384cb920ad7b8e802138b59060200161314c565b60728190556040518181527f82d5dc32d1b741512ad09c32404d7e7921e8934c6222343d95f55f7a2b9b2ab49060200161314c565b60a954811115613475576040516355408ce960e11b815260040160405180910390fd5b60ad8190556040518181527fa9588dc77416849bd922605ce4fc806712281ad8a8f32d4238d6c8cca548e15e9060200161314c565b60e58190556040518181527f17a6c3eb965cdd7439982da25abf85be88f0f772ca33198f548e2f99fee0289a9060200161314c565b60e68190556040518181527f0a50c66137118f386332efb949231ddd3946100dbf880003daca37ddd9e0662b9060200161314c565b6000610cbb8261456a565b6000610cbb82436131c4565b600081831061323f5781611162565b606e5460405163889998ef60e01b8152600481018490526000916001600160a01b03169063889998ef90602401602060405180830381865afa158015613584573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135a89190615ad8565b606e5460405163033cdc2b60e31b8152600481018690529192506000916001600160a01b03909116906319e6e15890602401602060405180830381865afa1580156135f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061361b9190615ad8565b606e549091506000906001600160a01b031663f67e81528661363c87611703565b6040518363ffffffff1660e01b8152600401613659929190615c60565b600060405180830381865afa158015613676573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261369e9190810190615c81565b90506136ab83838361458f565b15806136b5575081155b156137325760005b845181101561372a57845160e2546136d59190615bdc565b60e360008784815181106136eb576136eb615a12565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550808061372290615a3e565b9150506136bd565b505050505050565b600080600080607060009054906101000a90046001600160a01b03166001600160a01b0316631079402a6040518163ffffffff1660e01b8152600401608060405180830381865afa15801561378b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137af9190615b79565b9296509094509250905080861160005b89518110156138b857888782815181106137db576137db615a12565b602002602001015160e2546137f09190615baf565b6137fa9190615bdc565b60e360008c848151811061381057613810615a12565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208190555081156138a6576138a68b8b838151811061385857613858615a12565b60200260200101518a6127108b868151811061387657613876615a12565b60200260200101516138889190615baf565b6138929190615bdc565b61389e90612710615a57565b878a8a614648565b806138b081615a3e565b9150506137bf565b5050505050505050505050565b6000606060008084516001600160401b038111156138e5576138e56156f4565b60405190808252806020026020018201604052801561390e578160200160208202803683370190505b50925060005b8551811015613ae75785818151811061392f5761392f615a12565b6020908102919091018101516001600160a01b03808216600090815260759093526040909220600201549094501691506139698388613157565b61399c576001600160a01b0380841660009081526075602052604090206003015461399791859116846148a8565b6139ce565b6001600160a01b038316600090815260e3602052604081205460e48054919290916139c8908490615a6a565b90915550505b6139d78361351f565b1580156139eb57506139e98388613246565b155b15613a5f576001600160a01b038316600090815260e16020526040902054613a139086615a6a565b6001600160a01b038416600090815260e16020526040902054855191965090859083908110613a4457613a44615a12565b602002602001018181525050613a5a8383614985565b613aa5565b6001600160a01b038316600090815260e1602090815260408083205460e090925290912054613a8e9190615a6a565b60e46000828254613a9f9190615a6a565b90915550505b6001600160a01b038316600090815260e16020908152604080832083905560e0825280832083905560e390915281205580613adf81615a3e565b915050613914565b5060e26000905550509250929050565b6071546001600160a01b03168215612e4d57613b138184614a4d565b15613bbb5760405163566bce2360e11b81526001600160a01b0382169063acd79c4690613b4890879086908a90600401615d36565b600060405180830381600087803b158015613b6257600080fd5b505af1158015613b76573d6000803e3d6000fd5b505050507f9e242ca1ef9dde96eb71ef8d19a3f0f6a619b63e4c0d3998771387103656d087838584604051613bad93929190615d6c565b60405180910390a150613bfa565b7fe5668ec1bb2b6bb144a50f810e388da4b1d7d3fc05fcb9d588a1aac59d248f8983858447604051613bf09493929190615da1565b60405180910390a1505b50505050565b60e754600080805b83831015613bfa5760e78381548110613c2357613c23615a12565b60009182526020808320909101546001600160a01b031680835260e89091526040909120600181015491935091504210613d4957805460e48054600090613c6b908490615a6a565b90915550506001600160a01b038216600090815260e860205260408120818155600101819055613c9a85615dde565b9450841115613d115760e78481548110613cb657613cb6615a12565b60009182526020909120015460e780546001600160a01b039092169185908110613ce257613ce2615a12565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480613d2257613d22615c4a565b600082815260209020810160001990810180546001600160a01b0319169055019055613c08565b82613d5381615a3e565b935050613c08565b60e4548015611020576000613d6e611569565b600060e481905560408051600481526024810182526020810180516001600160e01b03166359f778df60e01b179052905192935090916001600160a01b038416918591613dbb9190615df5565b60006040518083038185875af1925050503d8060008114613df8576040519150601f19603f3d011682016040523d82523d6000602084013e613dfd565b606091505b505090508015613e4257816001600160a01b03167fc447c884574da5878be39c403db2245c22530c99b579ea7bcbb3720e1d110dc884604051611bba91815260200190565b816001600160a01b03167fa0561a59abed308fcd0556834574739d778cc6229018039a24ddda0f86aa0b738447604051611bba929190615b6b565b606080613e8983614aa9565b6071546040516391f8723f60e01b81529192506000916001600160a01b03909116906391f8723f90613ec090607390600401615e24565b600060405180830381865afa158015613edd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f059190810190615c81565b60a854604051632907e73160e11b81529192506000916001600160a01b039091169063520fce6290613f3c90607390600401615e24565b600060405180830381865afa158015613f59573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f819190810190615c81565b90506000613ff06073805480602002602001604051908101604052809291908181526020018280548015613fde57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613fc0575b5050505050848460a95460ad54614f9c565b9095509050614000858288615066565b505050915091565b606f546000906001600160a01b031663fdadda8183614028436001615a6a565b6040518363ffffffff1660e01b8152600401614045929190615c14565b600060405180830381865afa158015614062573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261408a9190810190615e68565b905060005b82518110156143515760008382815181106140ac576140ac615a12565b6020908102919091018101516001600160a01b0381166000908152603b9092526040822054909250421115906140e183611fdc565b905060006140f9846140f4436001615a6a565b6131c4565b8061411a575085858151811061411157614111615a12565b60200260200101515b806141225750825b159050811580156141305750805b156141ab576001600160a01b038416600090815260ac602052604090205461416f9060019060ff1660038111156141695761416961594e565b906151c4565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156141a1576141a161594e565b021790555061422d565b8180156141b6575080155b1561422d576001600160a01b038416600090815260ac60205260409020546141f59060019060ff1660038111156141ef576141ef61594e565b906151ff565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156142275761422761594e565b02179055505b600061423885611169565b90508315811580156142475750805b156142bc576001600160a01b038616600090815260ac60205260409020546142809060029060ff1660038111156141695761416961594e565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156142b2576142b261594e565b0217905550614338565b8180156142c7575080155b15614338576001600160a01b038616600090815260ac60205260409020546143009060029060ff1660038111156141ef576141ef61594e565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156143325761433261594e565b02179055505b505050505050808061434990615a3e565b91505061408f565b5082847f283b50d76057d5f828df85bc87724c6af604e9b55c363a07c9faa2a2cd688b8261437d611864565b60405161438a919061583f565b60405180910390a382847f773d1888df530d69716b183a92450d45f97fba49f2a4bb34fae3b23da0e2cc6f6143bd612349565b6040516143ca919061583f565b60405180910390a350505050565b6000600154826143e89190615bdc565b610cbb906001615a6a565b600182015461440a906001600160a01b0316612561565b6144275760405163a64b34ad60e01b815260040160405180910390fd5b6005820181905560018201546040518281526001600160a01b03909116907fb9a1e33376bfbda9092f2d1e37662c1b435aab0d3fa8da3acc8f37ee222f99e790602001611133565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d80600081146144bf576040519150601f19603f3d011682016040523d82523d6000602084013e6144c4565b606091505b509095945050505050565b60a85460405163107fbb4760e21b815260009182916001600160a01b03909116906341feed1c90614504908690600401615609565b602060405180830381865afa158015614521573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145459190615ad8565b1192915050565b60008160038111156145605761456061594e565b60ff161592915050565b6001600160a01b03808216600090815260756020526040812060030154909116610cbb565b60016000805b835181101561460157848482815181106145b1576145b1615a12565b602002602001015111156145c85760009250614601565b8381815181106145da576145da615a12565b6020026020010151826145ed9190615a6a565b9150806145f981615a3e565b915050614595565b5081801561460f5750848111155b915081614640576040517f64ba7143ea5a17abea37667aa9ae137e3afba5033c5f504770c02829c128189c90600090a15b509392505050565b8084106147c4576001600160a01b03851660008181526039602090815260408083208a845282528083208054600160ff199182168117909255948452603783528184208b855290925282208054909316179091556146a6438561523b565b6001600160a01b0387166000908152603a60205260409020549091506146cd90829061322f565b6001600160a01b0387166000908152603a6020908152604080832093909355603c905220546146fd90829061322f565b6001600160a01b038088166000908152603c60205260409081902092909255607054915163c008ce3960e01b815291169063c008ce39906147479089906002908c90600401615ef6565b600060405180830381600087803b15801561476157600080fd5b505af1158015614775573d6000803e3d6000fd5b5050506001600160a01b0387166000818152603a60205260408082205490518b9450600080516020615fa6833981519152926147b692916001908190615af1565b60405180910390a35061372a565b81841061372a576001600160a01b0380861660009081526039602090815260408083208a845290915290819020805460ff19166001908117909155607054915163c008ce3960e01b8152919092169163c008ce39916148299189918b90600401615ef6565b600060405180830381600087803b15801561484357600080fd5b505af1158015614857573d6000803e3d6000fd5b5050506001600160a01b0386166000818152603a60205260408082205490518a9450600080516020615fa68339815191529261489892918190600190615af1565b60405180910390a3505050505050565b6001600160a01b038316600090815260e360205260409020548015613bfa576148d482826104b061446f565b1561493657816001600160a01b0316836001600160a01b0316856001600160a01b03167f72a57dc38837a1cba7881b7b1a5594d9e6b65cec6a985b54e2cee3e89369691c8460405161492891815260200190565b60405180910390a450505050565b816001600160a01b0316836001600160a01b0316856001600160a01b03167fd35d76d87d51ed89407fc7ceaaccf32cf72784b94530892ce33546540e141b728447604051614928929190615b6b565b6001600160a01b038216600090815260e060205260409020548015612f47576149b182826104b061446f565b15614a0857816001600160a01b0316836001600160a01b03167f1ce7a1c4702402cd393500acb1de5bd927727a54e144a587d328f1b679abe4ec836040516149fb91815260200190565b60405180910390a3505050565b816001600160a01b0316836001600160a01b03167f6c69e09ee5c5ac33c0cd57787261c5bade070a392ab34a4b5487c6868f723f6e83476040516149fb929190615b6b565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114614a9a576040519150601f19603f3d011682016040523d82523d6000602084013e614a9f565b606091505b5090949350505050565b6071546040805163af24542960e01b815290516060926001600160a01b031691600091839163af2454299160048083019260209291908290030181865afa158015614af8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b1c9190615ad8565b90506000826001600160a01b031663909791dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b829190615ad8565b90506000836001600160a01b03166342ef3c3460736040518263ffffffff1660e01b8152600401614bb39190615e24565b600060405180830381865afa158015614bd0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052614bf89190810190615c81565b6073549091506000816001600160401b03811115614c1857614c186156f4565b604051908082528060200260200182016040528015614c41578160200160208202803683370190505b50965060008060005b84831015614eed5760738381548110614c6557614c65615a12565b60009182526020808320909101546001600160a01b031680835260759091526040909120600681015488519294509092501515908890889086908110614cad57614cad615a12565b60200260200101511015614d095780614d04576000614ccc8a42615a6a565b600684018190556040518181529091506001600160a01b03851690600080516020615f668339815191529060200160405180910390a2505b614d4a565b8015614d4a578160060160009055826001600160a01b0316600080516020615f668339815191526000604051614d4191815260200190565b60405180910390a25b60008260050154600014158015614d65575042836005015411155b80614d8857506001600160a01b038416600090815260e9602052604090205460ff165b905060008360060154600014158015614da5575042846006015411155b90508180614db05750805b15614e465788614dbf89615dde565b98508881518110614dd257614dd2615a12565b6020026020010151898781518110614dec57614dec615a12565b6020908102919091010152848d88614e0381615a3e565b995081518110614e1557614e15615a12565b60200260200101906001600160a01b031690816001600160a01b031681525050614e3e85615256565b505050614c4a565b6001600160a01b0385166000908152607760205260409020548015801590614e6e5750428111155b15614ed7576001600160a01b0386166000818152607760209081526040808320600181018054918590559390935560048901839055518281529192917f86d576c20e383fc2413ef692209cc48ddad5e52f25db5b32f8f7ec5076461ae9910160405180910390a2505b86614ee181615a3e565b97505050505050614c4a565b5050508087528015614f91577f4eaf233b9dc25a5552c1927feee1412eea69add17c2485c831c2e60e234f3c9187604051614f28919061583f565b60405180910390a160405163e22d1c9d60e01b81526001600160a01b0387169063e22d1c9d90614f5e908a908c90600401615c14565b600060405180830381600087803b158015614f7857600080fd5b505af1158015614f8c573d6000803e3d6000fd5b505050505b505050505050919050565b60606000806068905060008888888888604051602401614fc0959493929190615f17565b60408051601f19818403018152919052602080820180516001600160e01b0316633bca0a8960e11b17905281518b51929350600192909160009161500391615baf565b61500e906040615a6a565b90506020840181888483895afa61502457600093505b503d61502f57600092505b6020870196508261505357604051630fc2632160e01b815260040160405180910390fd5b8651955050505050509550959350505050565b815b60aa548110156150c457600081815260ab6020818152604080842080546001600160a01b0316855260ac8352908420805460ff19169055928490525280546001600160a01b0319169055806150bc81615a3e565b915050615068565b5060005b8281101561510e57600081815260ab60209081526040808320546001600160a01b0316835260ac9091529020805460ff191690558061510681615a3e565b9150506150c8565b5060005b8281101561518c57600084828151811061512e5761512e615a12565b6020908102919091018101516001600160a01b0316600081815260ac83526040808220805460ff1916600317905585825260ab9093529190912080546001600160a01b0319169091179055508061518481615a3e565b915050615112565b508160aa81905550807f3d0eea40644a206ec25781dd5bb3b60eb4fa1264b993c3bddf3c73b14f29ef5e84604051611bba919061583f565b60008160038111156151d8576151d861594e565b8360038111156151ea576151ea61594e565b1760ff1660038111156111625761116261594e565b60008160038111156152135761521361594e565b198360038111156152265761522661594e565b1660ff1660038111156111625761116261594e565b60008160000361524c576000611162565b6111628284615a6a565b6001600160a01b038116600090815260e960209081526040808320805460ff19169055607490915281205461102091839190819003615293575050565b6001600160a01b038216600090815260756020908152604080832080546001600160a01b03199081168255600180830180548316905560028301805483169055600383018054909216909155600482018590556005820185905560069091018490556074835281842084905560779092528220828155810182905560738054909161531d91615a57565b8154811061532d5761532d615a12565b6000918252602090912001546001600160a01b039081169150831681146153b0576001600160a01b038116600090815260746020526040902082905560738054829190841990811061538157615381615a12565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60738054806153c1576153c1615c4a565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6001600160a01b038116811461102057600080fd5b6000806040838503121561544c57600080fd5b823561545781615424565b9150602083013561546781615424565b809150509250929050565b600080600080600060a0868803121561548a57600080fd5b853561549581615424565b945060208601356154a581615424565b935060408601356154b581615424565b925060608601356154c581615424565b949793965091946080013592915050565b600080604083850312156154e957600080fd5b82356154f481615424565b946020939093013593505050565b60006020828403121561551457600080fd5b5035919050565b60006020828403121561552d57600080fd5b813561116281615424565b60018060a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b60e08101610cbb8284615538565b815181526020808301519082015260408101610cbb565b801515811461102057600080fd5b600080600080608085870312156155d557600080fd5b84356155e081615424565b9350602085013592506040850135915060608501356155fe816155b1565b939692955090935050565b6001600160a01b0391909116815260200190565b8060408101831015610cbb57600080fd5b6000806000806000806000806000806000806101a08d8f03121561565157600080fd5b8c3561565c81615424565b9b5060208d013561566c81615424565b9a5060408d013561567c81615424565b995060608d013561568c81615424565b985060808d013561569c81615424565b975060a08d01356156ac81615424565b965060c08d0135955060e08d013594506101008d013593506101208d013592506101408d013591506156e28e6101608f0161561d565b90509295989b509295989b509295989b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715615732576157326156f4565b604052919050565b60006001600160401b03821115615753576157536156f4565b5060051b60200190565b6000602080838503121561577057600080fd5b82356001600160401b0381111561578657600080fd5b8301601f8101851361579757600080fd5b80356157aa6157a58261573a565b61570a565b81815260059190911b820183019083810190878311156157c957600080fd5b928401925b828410156157f05783356157e181615424565b825292840192908401906157ce565b979650505050505050565b600081518084526020808501945080840160005b838110156158345781516001600160a01b03168752958201959082019060010161580f565b509495945050505050565b60208152600061116260208301846157fb565b6000806020838503121561586557600080fd5b82356001600160401b038082111561587c57600080fd5b818501915085601f83011261589057600080fd5b81358181111561589f57600080fd5b8660208260051b85010111156158b457600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b818110156159005783511515835292840192918401916001016158e2565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156159005761593b838551615538565b9284019260e09290920191600101615928565b634e487b7160e01b600052602160045260246000fd5b60608152600061597760608301866157fb565b60208382038185015261598a82876157fb565b8481036040860152855180825282870193509082019060005b818110156159cf578451600481106159bd576159bd61594e565b835293830193918301916001016159a3565b509098975050505050505050565b6000806000606084860312156159f257600080fd5b83356159fd81615424565b95602085013595506040909401359392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201615a5057615a50615a28565b5060010190565b81810381811115610cbb57610cbb615a28565b80820180821115610cbb57610cbb615a28565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b6001600160a01b03929092168252602082015260400190565b600060208284031215615aea57600080fd5b5051919050565b9384526020840192909252151560408301521515606082015260800190565b600080600060608486031215615b2557600080fd5b8351615b30816155b1565b602085015160409095015190969495509392505050565b8281526040810160038310615b5e57615b5e61594e565b8260208301529392505050565b918252602082015260400190565b60008060008060808587031215615b8f57600080fd5b505082516020840151604085015160609095015191969095509092509050565b8082028115828204841417610cbb57610cbb615a28565b634e487b7160e01b600052601260045260246000fd5b600082615beb57615beb615bc6565b500490565b60008060408385031215615c0357600080fd5b505080516020909101519092909150565b604081526000615c2760408301856157fb565b90508260208301529392505050565b600082615c4557615c45615bc6565b500690565b634e487b7160e01b600052603160045260246000fd5b828152604060208201526000615c7960408301846157fb565b949350505050565b60006020808385031215615c9457600080fd5b82516001600160401b03811115615caa57600080fd5b8301601f81018513615cbb57600080fd5b8051615cc96157a58261573a565b81815260059190911b82018301908381019087831115615ce857600080fd5b928401925b828410156157f057835182529284019290840190615ced565b600081518084526020808501945080840160005b8381101561583457815187529582019590820190600101615d1a565b606081526000615d4960608301866157fb565b8281036020840152615d5b8186615d06565b915050826040830152949350505050565b838152606060208201526000615d8560608301856157fb565b8281036040840152615d978185615d06565b9695505050505050565b848152608060208201526000615dba60808301866157fb565b8281036040840152615dcc8186615d06565b91505082606083015295945050505050565b600081615ded57615ded615a28565b506000190190565b6000825160005b81811015615e165760208186018101518583015201615dfc565b506000920191825250919050565b6020808252825482820181905260008481528281209092916040850190845b818110156159005783546001600160a01b031683526001938401939285019201615e43565b60006020808385031215615e7b57600080fd5b82516001600160401b03811115615e9157600080fd5b8301601f81018513615ea257600080fd5b8051615eb06157a58261573a565b81815260059190911b82018301908381019087831115615ecf57600080fd5b928401925b828410156157f0578351615ee7816155b1565b82529284019290840190615ed4565b6001600160a01b039390931683526020830191909152604082015260600190565b60a081526000615f2a60a08301886157fb565b8281036020840152615f3c8188615d06565b90508281036040840152615f508187615d06565b6060840195909552505060800152939250505056fe88f854e137380c14d63f6ed99781bf13402167cf55bac49bcd44d4f2d6a342754042bb9a70998f80a86d9963f0d2132e9b11c8ad94d207c6141c8e34b05ce53e54ce99c5ce1fc9f61656d4a0fb2697974d0c973ac32eecaefe06fcf18b8ef68aa2646970667358221220a1eb2c9a0a4cbc889fd4810519c15ef9865e041ad7aa23ef79fce6ce5a27a4c564736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106103455760003560e01c8063038278841461035c57806304d971ab1461038557806306040618146103b55780630f43a677146103ca5780631104e528146103e057806311662dc2146104005780631196ab661461043d57806315b5ebde1461045d5780631ab4a34c1461047d5780631f6288011461049d578063217f35c2146104bd57806323c65eb0146104d257806328bde1e1146104f25780632924de711461051f578063297a8fca1461053f5780632bcf3d15146105545780632d784a98146105745780632f78204c146105a157806331a8aef5146105c15780633529214b146105e1578063367ec12b146106035780633b3159b6146106235780634244d4c9146106375780634493421e14610664578063468c96ae1461068257806346fe9311146106b957806349096d26146106d95780634d8df063146106ee5780634de2b7351461070e5780634ee4d72b1461073b5780634f2a693f1461075057806352091f17146107705780635248184a146107785780635511cde11461079a578063562d5304146107b85780635a08482d146107cd578063605239a1146107e257806365244ece146107f75780636558954f146108175780636611f8431461082e578063690b75361461084e5780636aa1c2ef1461086357806372e46810146108785780637593ff7114610880578063823a7b9c146108a0578063873a5a70146108c057806387c891bd146108e05780638d559c38146108f557806396585fc2146109095780639b19dbfd146109295780639c8d98da1461093e5780639dd373b91461095e5780639e94b9ec1461097e578063a0c3f2d214610993578063a3d545f5146109b3578063a66c0f77146109d3578063a7c2f119146109e8578063ad29578314610a08578063b405aaf214610a28578063b5e337de14610a48578063b7ab4db514610a68578063ba77b06c14610a8c578063c3c8b5d614610aa1578063c94aaa0214610ac1578063cba44de914610ae1578063d09f1ab414610af6578063d2cb215e14610b0b578063d5a0744f14610b29578063dd716ad314610b49578063e5125a1d14610b69578063edb194bb14610b89578063ee99205c14610beb578063eeb629a814610c00578063facd743b14610c1557610354565b3661035457610352610c35565b005b610352610c35565b34801561036857600080fd5b506103726104b081565b6040519081526020015b60405180910390f35b34801561039157600080fd5b506103a56103a0366004615439565b610c9a565b604051901515815260200161037c565b3480156103c157600080fd5b50610372610cc1565b3480156103d657600080fd5b5061037260aa5481565b3480156103ec57600080fd5b506103526103fb366004615472565b610cd1565b34801561040c57600080fd5b5061042061041b3660046154d6565b610f5c565b60408051931515845260208401929092529082015260600161037c565b34801561044957600080fd5b50610352610458366004615502565b610fdf565b34801561046957600080fd5b506103526104783660046154d6565b611023565b34801561048957600080fd5b506103a561049836600461551b565b61113f565b3480156104a957600080fd5b506103a56104b836600461551b565b611169565b3480156104c957600080fd5b506103a56111a3565b3480156104de57600080fd5b506103a56104ed3660046154d6565b6111b8565b3480156104fe57600080fd5b5061051261050d36600461551b565b6111c4565b60405161037c919061558c565b34801561052b57600080fd5b506103a561053a36600461551b565b611267565b34801561054b57600080fd5b50600454610372565b34801561056057600080fd5b5061035261056f36600461551b565b611273565b34801561058057600080fd5b5061059461058f36600461551b565b6112df565b60405161037c919061559a565b3480156105ad57600080fd5b506103526105bc3660046155bf565b611341565b3480156105cd57600080fd5b506103a56105dc3660046154d6565b61155d565b3480156105ed57600080fd5b506105f6611569565b60405161037c9190615609565b34801561060f57600080fd5b5061035261061e36600461562e565b611578565b34801561062f57600080fd5b5060686105f6565b34801561064357600080fd5b5061065761065236600461575d565b611703565b60405161037c919061583f565b34801561067057600080fd5b50606e546001600160a01b03166105f6565b34801561068e57600080fd5b506106a261069d366004615502565b6117ba565b60408051921515835260208301919091520161037c565b3480156106c557600080fd5b506103526106d436600461551b565b6117f8565b3480156106e557600080fd5b50610657611864565b3480156106fa57600080fd5b50610352610709366004615502565b61194d565b34801561071a57600080fd5b5061072e610729366004615852565b61198e565b60405161037c91906158c6565b34801561074757600080fd5b5060e454610372565b34801561075c57600080fd5b5061035261076b366004615502565b611a49565b610352611a8a565b34801561078457600080fd5b5061078d611e49565b60405161037c919061590c565b3480156107a657600080fd5b5060a8546001600160a01b03166105f6565b3480156107c457600080fd5b50610372611f79565b3480156107d957600080fd5b506105f6611fcd565b3480156107ee57600080fd5b50607254610372565b34801561080357600080fd5b506103a561081236600461551b565b611fdc565b34801561082357600080fd5b506103726201518081565b34801561083a57600080fd5b50610352610849366004615502565b612010565b34801561085a57600080fd5b5060e554610372565b34801561086f57600080fd5b50600154610372565b610352612051565b34801561088c57600080fd5b506103a561089b366004615502565b6122b1565b3480156108ac57600080fd5b506103526108bb366004615502565b6122d5565b3480156108cc57600080fd5b506103a56108db36600461551b565b612316565b3480156108ec57600080fd5b50600254610372565b34801561090157600080fd5b5060666105f6565b34801561091557600080fd5b5061042061092436600461551b565b61232d565b34801561093557600080fd5b50610657612349565b34801561094a57600080fd5b5061035261095936600461551b565b612435565b34801561096a57600080fd5b5061035261097936600461551b565b6124a1565b34801561098a57600080fd5b5061037261250d565b34801561099f57600080fd5b506103a56109ae36600461551b565b612561565b3480156109bf57600080fd5b506103726109ce366004615502565b61257e565b3480156109df57600080fd5b5060e654610372565b3480156109f457600080fd5b50610352610a033660046154d6565b612589565b348015610a1457600080fd5b50610352610a2336600461551b565b612835565b348015610a3457600080fd5b506103a5610a4336600461551b565b6128a1565b348015610a5457600080fd5b50610352610a6336600461551b565b612926565b348015610a7457600080fd5b50610a7d612992565b60405161037c93929190615964565b348015610a9857600080fd5b50610657612b70565b348015610aad57600080fd5b50610352610abc366004615439565b612bd2565b348015610acd57600080fd5b50610352610adc366004615502565b612e55565b348015610aed57600080fd5b50607654610372565b348015610b0257600080fd5b5060a954610372565b348015610b1757600080fd5b50606f546001600160a01b03166105f6565b348015610b3557600080fd5b506103a5610b443660046154d6565b612e96565b348015610b5557600080fd5b50610352610b643660046154d6565b612ea2565b348015610b7557600080fd5b50610352610b843660046159dd565b612f4c565b348015610b9557600080fd5b50610594610ba436600461551b565b6040805180820190915260008082526020820152506001600160a01b0316600090815260776020908152604091829020825180840190935280548352600101549082015290565b348015610bf757600080fd5b506105f661307f565b348015610c0c57600080fd5b5060ad54610372565b348015610c2157600080fd5b506103a5610c3036600461551b565b61308e565b610c3d611569565b6001600160a01b0316336001600160a01b031614158015610c775750610c6161307f565b6001600160a01b0316336001600160a01b031614155b15610c985760405160016234baed60e01b0319815260040160405180910390fd5b565b6001600160a01b038281166000908152607560205260409020548116908216145b92915050565b6000610ccc60035490565b905090565b33610cda61307f565b6001600160a01b031614610d0157604051638aaf4a0760e01b815260040160405180910390fd5b6073546072548110610d2657604051638616841b60e01b815260040160405180910390fd5b610d2f85612561565b15610d4d57604051638ad9cdf960e01b815260040160405180910390fd5b612710821115610d7057604051631b8454a360e21b815260040160405180910390fd5b60005b607354811015610e6b5760006075600060738481548110610d9657610d96615a12565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190208054909250811690891603610df2578760405163fc3d8c7560e01b8152600401610de99190615609565b60405180910390fd5b60028101546001600160a01b0390811690871603610e255785604051632d33a7e760e11b8152600401610de99190615609565b60038101546001600160a01b0390811690861603610e5857846040516350e1263b60e01b8152600401610de99190615609565b5080610e6381615a3e565b915050610d73565b506001600160a01b038581166000818152607460209081526040808320861990556073805460018082019092557ff79bde9ddd17963ebce6f7d021d60de7c2bd0db944d23c900c0c0e775f5300520180546001600160a01b03199081168717909155607590935292819020805483168c87169081178255938101805484168617905560028101805484168b8816908117909155600382018054909416968a1696909617909255600482018790555190939192907fd690f592ed983cfbc05717fbcf06c4e10ae328432c309fe49246cf4a4be69fcd90610f4b908990615609565b60405180910390a450505050505050565b6001600160a01b0382166000908152603a60205260408120548190819084811015610f9257600080600093509350935050610fd8565b60019350610fa08582615a57565b610fab906001615a6a565b9250610fb68561257e565b610fbf8261257e565b610fc99190615a57565b610fd4906001615a6a565b9150505b9250925092565b610fe76130cb565b6001600160a01b0316336001600160a01b0316146110175760405162461bcd60e51b8152600401610de990615a7d565b611020816130f9565b50565b3361102c611fcd565b6001600160a01b031614611053576040516328b9c24b60e21b815260040160405180910390fd5b6001600160a01b0382166000908152603c6020526040902054431161108d57816040516353e0424d60e01b8152600401610de99190615609565b6001600160a01b038216600081815260386020908152604080832085845282528083208054600160ff1991821681179092559484526037835281842086855290925290912080549092169091556110e49043615a57565b6001600160a01b0383166000818152603a6020526040908190209290925590517f6bb2436cb6b6eb65d5a52fac2ae0373a77ade6661e523ef3004ee2d5524e6c6e906111339084815260200190565b60405180910390a25050565b600080600161114c610cc1565b6111569190615a57565b90506111628382613157565b9392505050565b6001600160a01b038116600090815260ac6020526040812054610cbb9060029060ff16600381111561119d5761119d61594e565b90613182565b6000610ccc6111b1426131b5565b6003541090565b600061116283836131c4565b6111cc6153e8565b6111d582612561565b6111f25760405163a64b34ad60e01b815260040160405180910390fd5b506001600160a01b03908116600090815260756020908152604091829020825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015290565b6000610cbb82436111b8565b61127b6130cb565b6001600160a01b0316336001600160a01b0316146112ab5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b6000036112d657604051637bcd509160e01b815260040160405180910390fd5b611020816131e4565b604080518082018252600080825260209182018190526001600160a01b038416815260e88252828120835180850190945280548452600101549183018290520361133c576040516370fdd4f160e11b815260040160405180910390fd5b919050565b3361134a611fcd565b6001600160a01b031614611371576040516328b9c24b60e21b815260040160405180910390fd5b600061137b610cc1565b6001600160a01b03861660008181526037602090815260408083208584528252808320805460ff1916600117905592825260e181528282205460e0909152919020549192506113c991615a6a565b60e460008282546113da9190615a6a565b90915550506001600160a01b038516600090815260e06020908152604080832083905560e18252808320839055603a90915290205461141a90859061322f565b6001600160a01b0386166000908152603a602052604090205582156114ca5760715460405163138ac02f60e11b81526000916001600160a01b031690632715805e9061146c9089908890600401615abf565b6020604051808303816000875af115801561148b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114af9190615ad8565b90508060e460008282546114c39190615a6a565b9091555050505b811561150e576001600160a01b0385166000908152603c60205260409020546114f490859061322f565b6001600160a01b0386166000908152603c60205260409020555b6001600160a01b0385166000818152603a6020526040808220549051849392600080516020615fa68339815191529261154e929091899160019190615af1565b60405180910390a35050505050565b60006111628383613246565b606d546001600160a01b031690565b600054610100900460ff16158080156115985750600054600160ff909116105b806115b25750303b1580156115b2575060005460ff166001145b6116155760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610de9565b6000805460ff191660011790558015611638576000805461ff0019166101001790555b6116418d6131e4565b61164a8c613271565b6116538b6132bc565b61165c8a613307565b61166588613352565b61166e8961339d565b611677876133e8565b6116808661341d565b61168985613452565b611692846130f9565b61169c82356134aa565b6116a960208301356134df565b600183905580156116f4576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b606081516001600160401b0381111561171e5761171e6156f4565b604051908082528060200260200182016040528015611747578160200160208202803683370190505b50905060005b81518110156117b45761177883828151811061176b5761176b615a12565b6020026020010151613514565b82828151811061178a5761178a615a12565b6001600160a01b0390921660209283029190910190910152806117ac81615a3e565b91505061174d565b50919050565b6000806117c64361257e565b831115806117e1575060008381526005602052604090205415155b600093845260056020526040909320549293915050565b6118006130cb565b6001600160a01b0316336001600160a01b0316146118305760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361185b57604051637bcd509160e01b815260040160405180910390fd5b61102081613307565b606060aa546001600160401b03811115611880576118806156f4565b6040519080825280602002602001820160405280156118a9578160200160208202803683370190505b5090506000805b825181101561194757600081815260ab60205260409020546118da906001600160a01b0316611fdc565b1561193557600081815260ab60205260409020546001600160a01b0316838361190281615a3e565b94508151811061191457611914615a12565b60200260200101906001600160a01b031690816001600160a01b0316815250505b8061193f81615a3e565b9150506118b0565b50815290565b6119556130cb565b6001600160a01b0316336001600160a01b0316146119855760405162461bcd60e51b8152600401610de990615a7d565b611020816134df565b6060816001600160401b038111156119a8576119a86156f4565b6040519080825280602002602001820160405280156119d1578160200160208202803683370190505b50905060005b82811015611a4257611a0e8484838181106119f4576119f4615a12565b9050602002016020810190611a09919061551b565b61351f565b828281518110611a2057611a20615a12565b9115156020928302919091019091015280611a3a81615a3e565b9150506119d7565b5092915050565b611a516130cb565b6001600160a01b0316336001600160a01b031614611a815760405162461bcd60e51b8152600401610de990615a7d565b6110208161341d565b334114611aaa576040516309f358fd60e01b815260040160405180910390fd5b6000611ab533611fdc565b8015611ac75750611ac53361351f565b155b8015611ae15750611adf33611ada610cc1565b613246565b155b606d54604051630634f5b960e01b815282151560048201526001602482015291925060009182916001600160a01b031690630634f5b9906044016060604051808303816000875af1158015611b3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5e9190615b10565b92509250508060e26000828254611b759190615a6a565b90915550839050611bc7573460e46000828254611b929190615a6a565b90915550506040513390600080516020615f8683398151915290611bba903490600190615b47565b60405180910390a2505050565b336001600160a01b03167f0ede5c3be8625943fa64003cd4b91230089411249f3059bac6500873543ca9b13484604051611c02929190615b6b565b60405180910390a26000611c14610cc1565b90506000611c228434615a6a565b3360009081526038602090815260408083208684529091528120549192509060ff1615611d1b576070546040805163631c8fd160e11b815290516000926001600160a01b03169163c6391fa29160048083019260809291908290030181865afa158015611c93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb79190615b79565b93505050506127108184611ccb9190615baf565b611cd59190615bdc565b91508160e46000828254611ce99190615a6a565b90915550506040513390600080516020615f8683398151915290611d11908590600290615b47565b60405180910390a2505b611d258183615a57565b60715460408051632298690160e11b8152815193955060009384936001600160a01b031692634530d20292600480820193918290030181865afa158015611d70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d949190615bf0565b3360009081526075602052604081206004015492945090925090611dc290611dbc908461352b565b8461322f565b90506000612710611dd38784615baf565b611ddd9190615bdc565b33600090815260e06020526040812080549293508392909190611e01908490615a6a565b9091555060009050611e138288615a57565b33600090815260e16020526040812080549293508392909190611e37908490615a6a565b90915550505050505050505050505050565b6073546060906001600160401b03811115611e6657611e666156f4565b604051908082528060200260200182016040528015611e9f57816020015b611e8c6153e8565b815260200190600190039081611e845790505b50905060005b8151811015611f75576075600060738381548110611ec557611ec5615a12565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c08201528251839083908110611f5757611f57615a12565b60200260200101819052508080611f6d90615a3e565b915050611ea5565b5090565b6000805b60aa54811015611f7557600081815260ab6020526040902054611fa8906001600160a01b0316611169565b15611fbb5781611fb781615a3e565b9250505b80611fc581615a3e565b915050611f7d565b6070546001600160a01b031690565b6001600160a01b038116600090815260ac6020526040812054610cbb9060019060ff16600381111561119d5761119d61594e565b6120186130cb565b6001600160a01b0316336001600160a01b0316146120485760405162461bcd60e51b8152600401610de990615a7d565b611020816134aa565b334114612071576040516309f358fd60e01b815260040160405180910390fd5b61207a436122b1565b61209757604051636c74eecf60e01b815260040160405180910390fd5b6120a04361257e565b6120ab60025461257e565b106120c957604051632458f64160e01b815260040160405180910390fd5b4360025560006120d8426131b5565b905060006120e7826003541090565b905060006120f3612992565b50509050606060006121044361257e565b90506000612113826001615a6a565b9050600061211f610cc1565b9050851561224b57612131818661353a565b60008061213e83886138c5565b9150915061214e83888484613af7565b612156613c00565b61215e613d5b565b607054604051631da0214360e21b81526001600160a01b0390911690637680850c90612190908a908790600401615c14565b600060405180830381600087803b1580156121aa57600080fd5b505af11580156121be573d6000803e3d6000fd5b505050506121cb89613e7d565b805191985096501561223a576070546040516303e1697b60e11b81526001600160a01b03909116906307c2d2f69061220790899060040161583f565b600060405180830381600087803b15801561222157600080fd5b505af1158015612235573d6000803e3d6000fd5b505050505b612245436001615a6a565b60045550505b612256878387614008565b82817f0195462033384fec211477c56217da64a58bd405e0bed331ba4ded67e4ae4ce78860405161228b911515815260200190565b60405180910390a350600090815260056020526040902085905550505060039190915550565b6000600180546122c19190615a57565b6001546122ce9084615c36565b1492915050565b6122dd6130cb565b6001600160a01b0316336001600160a01b03161461230d5760405162461bcd60e51b8152600401610de990615a7d565b611020816133e8565b600080612321610cc1565b90506111628382613246565b600080600061233c8443610f5c565b9250925092509193909250565b606060aa546001600160401b03811115612365576123656156f4565b60405190808252806020026020018201604052801561238e578160200160208202803683370190505b5090506000805b825181101561194757600081815260ab60205260409020546123bf906001600160a01b0316611169565b1561242357600081815260ab60205260409020546123e5906001600160a01b0316613514565b83836123f081615a3e565b94508151811061240257612402615a12565b60200260200101906001600160a01b031690816001600160a01b0316815250505b8061242d81615a3e565b915050612395565b61243d6130cb565b6001600160a01b0316336001600160a01b03161461246d5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361249857604051637bcd509160e01b815260040160405180910390fd5b61102081613352565b6124a96130cb565b6001600160a01b0316336001600160a01b0316146124d95760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361250457604051637bcd509160e01b815260040160405180910390fd5b61102081613271565b6000805b60aa54811015611f7557600081815260ab602052604090205461253c906001600160a01b0316611fdc565b1561254f578161254b81615a3e565b9250505b8061255981615a3e565b915050612511565b6001600160a01b0316600090815260746020526040902054151590565b6000610cbb826143d8565b3361259261307f565b6001600160a01b0316146125b957604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b038216600090815260e8602052604090206001810154156125f45760405163057aab3160e31b815260040160405180910390fd5b60006126008342615a6a565b6001600160a01b038516600090815260756020526040902090915061262590826143f3565b6001600160a01b0384166000908152603b6020908152604080832084905560399091528120600191612655610cc1565b8152602081019190915260409081016000908120805460ff19169315159390931790925560715460e554915163138ac02f60e11b81526001600160a01b0390911691632715805e916126ab918991600401615abf565b6020604051808303816000875af11580156126ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126ee9190615ad8565b905080156127eb57600060e654426127069190615a6a565b60e78054600180820183556000929092527f6cb0db1d7354dfb4a1464318006df0643cafe2002a86a29ff8560f900fef28a10180546001600160a01b0319166001600160a01b038a16179055838655850181905590506127646130cb565b6001600160a01b0387811660008181526075602052604090819020600201549051630a2fae5760e41b81526004810192909252821660248201524260448201526064810184905291169063a2fae57090608401600060405180830381600087803b1580156127d157600080fd5b505af11580156127e5573d6000803e3d6000fd5b50505050505b846001600160a01b03167f77a1a819870c0f4d04c3ca4cc2881a0393136abc28bd651af50aedade94a27c48260405161282691815260200190565b60405180910390a25050505050565b61283d6130cb565b6001600160a01b0316336001600160a01b03161461286d5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361289857604051637bcd509160e01b815260040160405180910390fd5b611020816132bc565b6000805b60aa548110156117b457600081815260ab60205260409020546001600160a01b03808516916128d49116613514565b6001600160a01b03161480156129065750600081815260ab6020526040902054612906906001600160a01b0316611169565b1561291457600191506117b4565b8061291e81615a3e565b9150506128a5565b61292e6130cb565b6001600160a01b0316336001600160a01b03161461295e5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361298957604051637bcd509160e01b815260040160405180910390fd5b6110208161339d565b606080606060aa546001600160401b038111156129b1576129b16156f4565b6040519080825280602002602001820160405280156129da578160200160208202803683370190505b50925060aa546001600160401b038111156129f7576129f76156f4565b604051908082528060200260200182016040528015612a20578160200160208202803683370190505b50915060aa546001600160401b03811115612a3d57612a3d6156f4565b604051908082528060200260200182016040528015612a66578160200160208202803683370190505b50905060005b8351811015612b6a57600081815260ab602052604090205484516001600160a01b03909116908190869084908110612aa657612aa6615a12565b60200260200101906001600160a01b031690816001600160a01b031681525050612acf81613514565b848381518110612ae157612ae1615a12565b6001600160a01b03928316602091820292909201810191909152908216600090815260ac9091526040902054835160ff90911690849084908110612b2757612b27615a12565b60200260200101906003811115612b4057612b4061594e565b90816003811115612b5357612b5361594e565b905250819050612b6281615a3e565b915050612a6c565b50909192565b60606073805480602002602001604051908101604052809291908181526020018280548015612bc857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612baa575b5050505050905090565b612bda6130cb565b6001600160a01b0316336001600160a01b031614612c0a5760405162461bcd60e51b8152600401610de990615a7d565b6001600160a01b038216600090815260e8602052604090206001015415612e515760e7548060005b82811015612c8b57846001600160a01b031660e78281548110612c5757612c57615a12565b6000918252602090912001546001600160a01b031603612c7957809150612c8b565b80612c8381615a3e565b915050612c32565b50818103612c995750505050565b6001600160a01b038416600090815260e860205260409020548015612e4d576001600160a01b038516600090815260e860205260408120818155600190810191909155831115612d5b5760e7612cf0600185615a57565b81548110612d0057612d00615a12565b60009182526020909120015460e780546001600160a01b039092169184908110612d2c57612d2c615a12565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480612d6c57612d6c615c4a565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825260e9905260409020805460ff19166001179055612dbe84826104b061446f565b15612e0857836001600160a01b0316856001600160a01b03167f7229136a18186c71a86246c012af3bb1df6460ef163934bbdccd6368abdd41e48360405161154e91815260200190565b836001600160a01b0316856001600160a01b03167f3747d14eb72ad3e35cba9c3e00dab3b8d15b40cac6bdbd08402356e4f69f30a1834760405161154e929190615b6b565b5050505b5050565b612e5d6130cb565b6001600160a01b0316336001600160a01b031614612e8d5760405162461bcd60e51b8152600401610de990615a7d565b61102081613452565b60006111628383613157565b33612eab61307f565b6001600160a01b031614612ed257604051638aaf4a0760e01b815260040160405180910390fd5b612edb826144cf565b15612ef95760405163030081e760e01b815260040160405180910390fd5b6001600160a01b0382166000908152607560205260409020600581015415612f345760405163fab9167360e01b815260040160405180910390fd5b612f4781612f428442615a6a565b6143f3565b505050565b33612f5561307f565b6001600160a01b031614612f7c57604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604090205415612fb357604051632f32dcdd60e11b815260040160405180910390fd5b612710811115612fd657604051631b8454a360e21b815260040160405180910390fd5b607654821015612ff95760405163fa0ae69360e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604081209062015180846130218242615bdc565b61302b9190615a6a565b6130359190615baf565b808355600183018490556040519091506001600160a01b038616907f6ebafd1bb6316b2f63198a81b05cff2149c6eaae1784466a6d062b4391900f21906128269084908790615b6b565b6071546001600160a01b031690565b6001600160a01b038116600090815260ac60205260408120546130c49060ff1660038111156130bf576130bf61594e565b61454c565b1592915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b600181101561311b576040516317b8970f60e01b815260040160405180910390fd5b60768190556040518181527f266d432ffe659e3565750d26ec685b822a58041eee724b67a5afec3168a25267906020015b60405180910390a150565b6001600160a01b03919091166000908152603960209081526040808320938352929052205460ff1690565b60008160038111156131965761319661594e565b8360038111156131a8576131a861594e565b1660ff1615159392505050565b6000610cbb6201518083615bdc565b6001600160a01b03919091166000908152603a6020526040902054101590565b607080546001600160a01b0319166001600160a01b0383161790556040517faa5b07dd43aa44c69b70a6a2b9c3fcfed12b6e5f6323596ba7ac91035ab80a4f9061314c908390615609565b60008183101561323f5781611162565b5090919050565b6001600160a01b03919091166000908152603760209081526040808320938352929052205460ff1690565b607180546001600160a01b0319166001600160a01b0383161790556040517f6397f5b135542bb3f477cb346cfab5abdec1251d08dc8f8d4efb4ffe122ea0bf9061314c908390615609565b606d80546001600160a01b0319166001600160a01b0383161790556040517fc328090a37d855191ab58469296f98f87a851ca57d5cdfd1e9ac3c83e9e7096d9061314c908390615609565b606f80546001600160a01b0319166001600160a01b0383161790556040517f31a33f126a5bae3c5bdf6cfc2cd6dcfffe2fe9634bdb09e21c44762993889e3b9061314c908390615609565b606e80546001600160a01b0319166001600160a01b0383161790556040517f034c8da497df28467c79ddadbba1cc3cdd41f510ea73faae271e6f16a61116219061314c908390615609565b60a880546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d79061314c908390615609565b60a98190556040518181527fb5464c05fd0e0f000c535850116cda2742ee1f7b34384cb920ad7b8e802138b59060200161314c565b60728190556040518181527f82d5dc32d1b741512ad09c32404d7e7921e8934c6222343d95f55f7a2b9b2ab49060200161314c565b60a954811115613475576040516355408ce960e11b815260040160405180910390fd5b60ad8190556040518181527fa9588dc77416849bd922605ce4fc806712281ad8a8f32d4238d6c8cca548e15e9060200161314c565b60e58190556040518181527f17a6c3eb965cdd7439982da25abf85be88f0f772ca33198f548e2f99fee0289a9060200161314c565b60e68190556040518181527f0a50c66137118f386332efb949231ddd3946100dbf880003daca37ddd9e0662b9060200161314c565b6000610cbb8261456a565b6000610cbb82436131c4565b600081831061323f5781611162565b606e5460405163889998ef60e01b8152600481018490526000916001600160a01b03169063889998ef90602401602060405180830381865afa158015613584573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135a89190615ad8565b606e5460405163033cdc2b60e31b8152600481018690529192506000916001600160a01b03909116906319e6e15890602401602060405180830381865afa1580156135f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061361b9190615ad8565b606e549091506000906001600160a01b031663f67e81528661363c87611703565b6040518363ffffffff1660e01b8152600401613659929190615c60565b600060405180830381865afa158015613676573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261369e9190810190615c81565b90506136ab83838361458f565b15806136b5575081155b156137325760005b845181101561372a57845160e2546136d59190615bdc565b60e360008784815181106136eb576136eb615a12565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550808061372290615a3e565b9150506136bd565b505050505050565b600080600080607060009054906101000a90046001600160a01b03166001600160a01b0316631079402a6040518163ffffffff1660e01b8152600401608060405180830381865afa15801561378b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137af9190615b79565b9296509094509250905080861160005b89518110156138b857888782815181106137db576137db615a12565b602002602001015160e2546137f09190615baf565b6137fa9190615bdc565b60e360008c848151811061381057613810615a12565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208190555081156138a6576138a68b8b838151811061385857613858615a12565b60200260200101518a6127108b868151811061387657613876615a12565b60200260200101516138889190615baf565b6138929190615bdc565b61389e90612710615a57565b878a8a614648565b806138b081615a3e565b9150506137bf565b5050505050505050505050565b6000606060008084516001600160401b038111156138e5576138e56156f4565b60405190808252806020026020018201604052801561390e578160200160208202803683370190505b50925060005b8551811015613ae75785818151811061392f5761392f615a12565b6020908102919091018101516001600160a01b03808216600090815260759093526040909220600201549094501691506139698388613157565b61399c576001600160a01b0380841660009081526075602052604090206003015461399791859116846148a8565b6139ce565b6001600160a01b038316600090815260e3602052604081205460e48054919290916139c8908490615a6a565b90915550505b6139d78361351f565b1580156139eb57506139e98388613246565b155b15613a5f576001600160a01b038316600090815260e16020526040902054613a139086615a6a565b6001600160a01b038416600090815260e16020526040902054855191965090859083908110613a4457613a44615a12565b602002602001018181525050613a5a8383614985565b613aa5565b6001600160a01b038316600090815260e1602090815260408083205460e090925290912054613a8e9190615a6a565b60e46000828254613a9f9190615a6a565b90915550505b6001600160a01b038316600090815260e16020908152604080832083905560e0825280832083905560e390915281205580613adf81615a3e565b915050613914565b5060e26000905550509250929050565b6071546001600160a01b03168215612e4d57613b138184614a4d565b15613bbb5760405163566bce2360e11b81526001600160a01b0382169063acd79c4690613b4890879086908a90600401615d36565b600060405180830381600087803b158015613b6257600080fd5b505af1158015613b76573d6000803e3d6000fd5b505050507f9e242ca1ef9dde96eb71ef8d19a3f0f6a619b63e4c0d3998771387103656d087838584604051613bad93929190615d6c565b60405180910390a150613bfa565b7fe5668ec1bb2b6bb144a50f810e388da4b1d7d3fc05fcb9d588a1aac59d248f8983858447604051613bf09493929190615da1565b60405180910390a1505b50505050565b60e754600080805b83831015613bfa5760e78381548110613c2357613c23615a12565b60009182526020808320909101546001600160a01b031680835260e89091526040909120600181015491935091504210613d4957805460e48054600090613c6b908490615a6a565b90915550506001600160a01b038216600090815260e860205260408120818155600101819055613c9a85615dde565b9450841115613d115760e78481548110613cb657613cb6615a12565b60009182526020909120015460e780546001600160a01b039092169185908110613ce257613ce2615a12565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480613d2257613d22615c4a565b600082815260209020810160001990810180546001600160a01b0319169055019055613c08565b82613d5381615a3e565b935050613c08565b60e4548015611020576000613d6e611569565b600060e481905560408051600481526024810182526020810180516001600160e01b03166359f778df60e01b179052905192935090916001600160a01b038416918591613dbb9190615df5565b60006040518083038185875af1925050503d8060008114613df8576040519150601f19603f3d011682016040523d82523d6000602084013e613dfd565b606091505b505090508015613e4257816001600160a01b03167fc447c884574da5878be39c403db2245c22530c99b579ea7bcbb3720e1d110dc884604051611bba91815260200190565b816001600160a01b03167fa0561a59abed308fcd0556834574739d778cc6229018039a24ddda0f86aa0b738447604051611bba929190615b6b565b606080613e8983614aa9565b6071546040516391f8723f60e01b81529192506000916001600160a01b03909116906391f8723f90613ec090607390600401615e24565b600060405180830381865afa158015613edd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f059190810190615c81565b60a854604051632907e73160e11b81529192506000916001600160a01b039091169063520fce6290613f3c90607390600401615e24565b600060405180830381865afa158015613f59573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f819190810190615c81565b90506000613ff06073805480602002602001604051908101604052809291908181526020018280548015613fde57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613fc0575b5050505050848460a95460ad54614f9c565b9095509050614000858288615066565b505050915091565b606f546000906001600160a01b031663fdadda8183614028436001615a6a565b6040518363ffffffff1660e01b8152600401614045929190615c14565b600060405180830381865afa158015614062573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261408a9190810190615e68565b905060005b82518110156143515760008382815181106140ac576140ac615a12565b6020908102919091018101516001600160a01b0381166000908152603b9092526040822054909250421115906140e183611fdc565b905060006140f9846140f4436001615a6a565b6131c4565b8061411a575085858151811061411157614111615a12565b60200260200101515b806141225750825b159050811580156141305750805b156141ab576001600160a01b038416600090815260ac602052604090205461416f9060019060ff1660038111156141695761416961594e565b906151c4565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156141a1576141a161594e565b021790555061422d565b8180156141b6575080155b1561422d576001600160a01b038416600090815260ac60205260409020546141f59060019060ff1660038111156141ef576141ef61594e565b906151ff565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156142275761422761594e565b02179055505b600061423885611169565b90508315811580156142475750805b156142bc576001600160a01b038616600090815260ac60205260409020546142809060029060ff1660038111156141695761416961594e565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156142b2576142b261594e565b0217905550614338565b8180156142c7575080155b15614338576001600160a01b038616600090815260ac60205260409020546143009060029060ff1660038111156141ef576141ef61594e565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156143325761433261594e565b02179055505b505050505050808061434990615a3e565b91505061408f565b5082847f283b50d76057d5f828df85bc87724c6af604e9b55c363a07c9faa2a2cd688b8261437d611864565b60405161438a919061583f565b60405180910390a382847f773d1888df530d69716b183a92450d45f97fba49f2a4bb34fae3b23da0e2cc6f6143bd612349565b6040516143ca919061583f565b60405180910390a350505050565b6000600154826143e89190615bdc565b610cbb906001615a6a565b600182015461440a906001600160a01b0316612561565b6144275760405163a64b34ad60e01b815260040160405180910390fd5b6005820181905560018201546040518281526001600160a01b03909116907fb9a1e33376bfbda9092f2d1e37662c1b435aab0d3fa8da3acc8f37ee222f99e790602001611133565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d80600081146144bf576040519150601f19603f3d011682016040523d82523d6000602084013e6144c4565b606091505b509095945050505050565b60a85460405163107fbb4760e21b815260009182916001600160a01b03909116906341feed1c90614504908690600401615609565b602060405180830381865afa158015614521573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145459190615ad8565b1192915050565b60008160038111156145605761456061594e565b60ff161592915050565b6001600160a01b03808216600090815260756020526040812060030154909116610cbb565b60016000805b835181101561460157848482815181106145b1576145b1615a12565b602002602001015111156145c85760009250614601565b8381815181106145da576145da615a12565b6020026020010151826145ed9190615a6a565b9150806145f981615a3e565b915050614595565b5081801561460f5750848111155b915081614640576040517f64ba7143ea5a17abea37667aa9ae137e3afba5033c5f504770c02829c128189c90600090a15b509392505050565b8084106147c4576001600160a01b03851660008181526039602090815260408083208a845282528083208054600160ff199182168117909255948452603783528184208b855290925282208054909316179091556146a6438561523b565b6001600160a01b0387166000908152603a60205260409020549091506146cd90829061322f565b6001600160a01b0387166000908152603a6020908152604080832093909355603c905220546146fd90829061322f565b6001600160a01b038088166000908152603c60205260409081902092909255607054915163c008ce3960e01b815291169063c008ce39906147479089906002908c90600401615ef6565b600060405180830381600087803b15801561476157600080fd5b505af1158015614775573d6000803e3d6000fd5b5050506001600160a01b0387166000818152603a60205260408082205490518b9450600080516020615fa6833981519152926147b692916001908190615af1565b60405180910390a35061372a565b81841061372a576001600160a01b0380861660009081526039602090815260408083208a845290915290819020805460ff19166001908117909155607054915163c008ce3960e01b8152919092169163c008ce39916148299189918b90600401615ef6565b600060405180830381600087803b15801561484357600080fd5b505af1158015614857573d6000803e3d6000fd5b5050506001600160a01b0386166000818152603a60205260408082205490518a9450600080516020615fa68339815191529261489892918190600190615af1565b60405180910390a3505050505050565b6001600160a01b038316600090815260e360205260409020548015613bfa576148d482826104b061446f565b1561493657816001600160a01b0316836001600160a01b0316856001600160a01b03167f72a57dc38837a1cba7881b7b1a5594d9e6b65cec6a985b54e2cee3e89369691c8460405161492891815260200190565b60405180910390a450505050565b816001600160a01b0316836001600160a01b0316856001600160a01b03167fd35d76d87d51ed89407fc7ceaaccf32cf72784b94530892ce33546540e141b728447604051614928929190615b6b565b6001600160a01b038216600090815260e060205260409020548015612f47576149b182826104b061446f565b15614a0857816001600160a01b0316836001600160a01b03167f1ce7a1c4702402cd393500acb1de5bd927727a54e144a587d328f1b679abe4ec836040516149fb91815260200190565b60405180910390a3505050565b816001600160a01b0316836001600160a01b03167f6c69e09ee5c5ac33c0cd57787261c5bade070a392ab34a4b5487c6868f723f6e83476040516149fb929190615b6b565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114614a9a576040519150601f19603f3d011682016040523d82523d6000602084013e614a9f565b606091505b5090949350505050565b6071546040805163af24542960e01b815290516060926001600160a01b031691600091839163af2454299160048083019260209291908290030181865afa158015614af8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b1c9190615ad8565b90506000826001600160a01b031663909791dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b829190615ad8565b90506000836001600160a01b03166342ef3c3460736040518263ffffffff1660e01b8152600401614bb39190615e24565b600060405180830381865afa158015614bd0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052614bf89190810190615c81565b6073549091506000816001600160401b03811115614c1857614c186156f4565b604051908082528060200260200182016040528015614c41578160200160208202803683370190505b50965060008060005b84831015614eed5760738381548110614c6557614c65615a12565b60009182526020808320909101546001600160a01b031680835260759091526040909120600681015488519294509092501515908890889086908110614cad57614cad615a12565b60200260200101511015614d095780614d04576000614ccc8a42615a6a565b600684018190556040518181529091506001600160a01b03851690600080516020615f668339815191529060200160405180910390a2505b614d4a565b8015614d4a578160060160009055826001600160a01b0316600080516020615f668339815191526000604051614d4191815260200190565b60405180910390a25b60008260050154600014158015614d65575042836005015411155b80614d8857506001600160a01b038416600090815260e9602052604090205460ff165b905060008360060154600014158015614da5575042846006015411155b90508180614db05750805b15614e465788614dbf89615dde565b98508881518110614dd257614dd2615a12565b6020026020010151898781518110614dec57614dec615a12565b6020908102919091010152848d88614e0381615a3e565b995081518110614e1557614e15615a12565b60200260200101906001600160a01b031690816001600160a01b031681525050614e3e85615256565b505050614c4a565b6001600160a01b0385166000908152607760205260409020548015801590614e6e5750428111155b15614ed7576001600160a01b0386166000818152607760209081526040808320600181018054918590559390935560048901839055518281529192917f86d576c20e383fc2413ef692209cc48ddad5e52f25db5b32f8f7ec5076461ae9910160405180910390a2505b86614ee181615a3e565b97505050505050614c4a565b5050508087528015614f91577f4eaf233b9dc25a5552c1927feee1412eea69add17c2485c831c2e60e234f3c9187604051614f28919061583f565b60405180910390a160405163e22d1c9d60e01b81526001600160a01b0387169063e22d1c9d90614f5e908a908c90600401615c14565b600060405180830381600087803b158015614f7857600080fd5b505af1158015614f8c573d6000803e3d6000fd5b505050505b505050505050919050565b60606000806068905060008888888888604051602401614fc0959493929190615f17565b60408051601f19818403018152919052602080820180516001600160e01b0316633bca0a8960e11b17905281518b51929350600192909160009161500391615baf565b61500e906040615a6a565b90506020840181888483895afa61502457600093505b503d61502f57600092505b6020870196508261505357604051630fc2632160e01b815260040160405180910390fd5b8651955050505050509550959350505050565b815b60aa548110156150c457600081815260ab6020818152604080842080546001600160a01b0316855260ac8352908420805460ff19169055928490525280546001600160a01b0319169055806150bc81615a3e565b915050615068565b5060005b8281101561510e57600081815260ab60209081526040808320546001600160a01b0316835260ac9091529020805460ff191690558061510681615a3e565b9150506150c8565b5060005b8281101561518c57600084828151811061512e5761512e615a12565b6020908102919091018101516001600160a01b0316600081815260ac83526040808220805460ff1916600317905585825260ab9093529190912080546001600160a01b0319169091179055508061518481615a3e565b915050615112565b508160aa81905550807f3d0eea40644a206ec25781dd5bb3b60eb4fa1264b993c3bddf3c73b14f29ef5e84604051611bba919061583f565b60008160038111156151d8576151d861594e565b8360038111156151ea576151ea61594e565b1760ff1660038111156111625761116261594e565b60008160038111156152135761521361594e565b198360038111156152265761522661594e565b1660ff1660038111156111625761116261594e565b60008160000361524c576000611162565b6111628284615a6a565b6001600160a01b038116600090815260e960209081526040808320805460ff19169055607490915281205461102091839190819003615293575050565b6001600160a01b038216600090815260756020908152604080832080546001600160a01b03199081168255600180830180548316905560028301805483169055600383018054909216909155600482018590556005820185905560069091018490556074835281842084905560779092528220828155810182905560738054909161531d91615a57565b8154811061532d5761532d615a12565b6000918252602090912001546001600160a01b039081169150831681146153b0576001600160a01b038116600090815260746020526040902082905560738054829190841990811061538157615381615a12565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60738054806153c1576153c1615c4a565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6001600160a01b038116811461102057600080fd5b6000806040838503121561544c57600080fd5b823561545781615424565b9150602083013561546781615424565b809150509250929050565b600080600080600060a0868803121561548a57600080fd5b853561549581615424565b945060208601356154a581615424565b935060408601356154b581615424565b925060608601356154c581615424565b949793965091946080013592915050565b600080604083850312156154e957600080fd5b82356154f481615424565b946020939093013593505050565b60006020828403121561551457600080fd5b5035919050565b60006020828403121561552d57600080fd5b813561116281615424565b60018060a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b60e08101610cbb8284615538565b815181526020808301519082015260408101610cbb565b801515811461102057600080fd5b600080600080608085870312156155d557600080fd5b84356155e081615424565b9350602085013592506040850135915060608501356155fe816155b1565b939692955090935050565b6001600160a01b0391909116815260200190565b8060408101831015610cbb57600080fd5b6000806000806000806000806000806000806101a08d8f03121561565157600080fd5b8c3561565c81615424565b9b5060208d013561566c81615424565b9a5060408d013561567c81615424565b995060608d013561568c81615424565b985060808d013561569c81615424565b975060a08d01356156ac81615424565b965060c08d0135955060e08d013594506101008d013593506101208d013592506101408d013591506156e28e6101608f0161561d565b90509295989b509295989b509295989b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715615732576157326156f4565b604052919050565b60006001600160401b03821115615753576157536156f4565b5060051b60200190565b6000602080838503121561577057600080fd5b82356001600160401b0381111561578657600080fd5b8301601f8101851361579757600080fd5b80356157aa6157a58261573a565b61570a565b81815260059190911b820183019083810190878311156157c957600080fd5b928401925b828410156157f05783356157e181615424565b825292840192908401906157ce565b979650505050505050565b600081518084526020808501945080840160005b838110156158345781516001600160a01b03168752958201959082019060010161580f565b509495945050505050565b60208152600061116260208301846157fb565b6000806020838503121561586557600080fd5b82356001600160401b038082111561587c57600080fd5b818501915085601f83011261589057600080fd5b81358181111561589f57600080fd5b8660208260051b85010111156158b457600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b818110156159005783511515835292840192918401916001016158e2565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156159005761593b838551615538565b9284019260e09290920191600101615928565b634e487b7160e01b600052602160045260246000fd5b60608152600061597760608301866157fb565b60208382038185015261598a82876157fb565b8481036040860152855180825282870193509082019060005b818110156159cf578451600481106159bd576159bd61594e565b835293830193918301916001016159a3565b509098975050505050505050565b6000806000606084860312156159f257600080fd5b83356159fd81615424565b95602085013595506040909401359392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201615a5057615a50615a28565b5060010190565b81810381811115610cbb57610cbb615a28565b80820180821115610cbb57610cbb615a28565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b6001600160a01b03929092168252602082015260400190565b600060208284031215615aea57600080fd5b5051919050565b9384526020840192909252151560408301521515606082015260800190565b600080600060608486031215615b2557600080fd5b8351615b30816155b1565b602085015160409095015190969495509392505050565b8281526040810160038310615b5e57615b5e61594e565b8260208301529392505050565b918252602082015260400190565b60008060008060808587031215615b8f57600080fd5b505082516020840151604085015160609095015191969095509092509050565b8082028115828204841417610cbb57610cbb615a28565b634e487b7160e01b600052601260045260246000fd5b600082615beb57615beb615bc6565b500490565b60008060408385031215615c0357600080fd5b505080516020909101519092909150565b604081526000615c2760408301856157fb565b90508260208301529392505050565b600082615c4557615c45615bc6565b500690565b634e487b7160e01b600052603160045260246000fd5b828152604060208201526000615c7960408301846157fb565b949350505050565b60006020808385031215615c9457600080fd5b82516001600160401b03811115615caa57600080fd5b8301601f81018513615cbb57600080fd5b8051615cc96157a58261573a565b81815260059190911b82018301908381019087831115615ce857600080fd5b928401925b828410156157f057835182529284019290840190615ced565b600081518084526020808501945080840160005b8381101561583457815187529582019590820190600101615d1a565b606081526000615d4960608301866157fb565b8281036020840152615d5b8186615d06565b915050826040830152949350505050565b838152606060208201526000615d8560608301856157fb565b8281036040840152615d978185615d06565b9695505050505050565b848152608060208201526000615dba60808301866157fb565b8281036040840152615dcc8186615d06565b91505082606083015295945050505050565b600081615ded57615ded615a28565b506000190190565b6000825160005b81811015615e165760208186018101518583015201615dfc565b506000920191825250919050565b6020808252825482820181905260008481528281209092916040850190845b818110156159005783546001600160a01b031683526001938401939285019201615e43565b60006020808385031215615e7b57600080fd5b82516001600160401b03811115615e9157600080fd5b8301601f81018513615ea257600080fd5b8051615eb06157a58261573a565b81815260059190911b82018301908381019087831115615ecf57600080fd5b928401925b828410156157f0578351615ee7816155b1565b82529284019290840190615ed4565b6001600160a01b039390931683526020830191909152604082015260600190565b60a081526000615f2a60a08301886157fb565b8281036020840152615f3c8188615d06565b90508281036040840152615f508187615d06565b6060840195909552505060800152939250505056fe88f854e137380c14d63f6ed99781bf13402167cf55bac49bcd44d4f2d6a342754042bb9a70998f80a86d9963f0d2132e9b11c8ad94d207c6141c8e34b05ce53e54ce99c5ce1fc9f61656d4a0fb2697974d0c973ac32eecaefe06fcf18b8ef68aa2646970667358221220a1eb2c9a0a4cbc889fd4810519c15ef9865e041ad7aa23ef79fce6ce5a27a4c564736f6c63430008110033", "devdoc": { "errors": { "ErrAlreadyRequestedEmergencyExit()": [ @@ -2456,10 +2527,20 @@ "details": "Error of trusted org cannot renounce." } ], + "ErrUnauthorizedReceiveRON()": [ + { + "details": "Error thrown when receives RON from neither staking vesting contract nor staking contract" + } + ], "ErrZeroCodeContract()": [ { "details": "Error of set to non-contract." } + ], + "NonExistentRecyclingInfo()": [ + { + "details": "Error thrown when queries for a non existent info." + } ] }, "kind": "dev", @@ -2467,8 +2548,11 @@ "bridgeTrackingContract()": { "details": "Returns the bridge tracking contract." }, - "checkBridgeRewardDeprecated(address)": { - "details": "Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the current period." + "checkBridgeRewardDeprecatedAtLatestPeriod(address)": { + "details": "Because the information of deprecating bridge reward of a period is only determined at the end of that period, this method will return the deprecating info of the latest period. A method for querying that info of current period is no need." + }, + "checkBridgeRewardDeprecatedAtPeriod(address,uint256)": { + "details": "Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`." }, "checkJailed(address)": { "details": "Returns whether the validator are put in jail (cannot join the set of validators) during the current period." @@ -2479,11 +2563,11 @@ "checkManyJailed(address[])": { "details": "Returns whether the validators are put in jail (cannot join the set of validators) during the current period." }, - "checkMiningRewardDeprecated(address[])": { - "details": "Returns whether the incoming reward of the block producers are deprecated during the current period." + "checkMiningRewardDeprecated(address)": { + "details": "Returns whether the incoming reward of the block producer is deprecated during the current period." }, - "checkMiningRewardDeprecatedAtPeriod(address[],uint256)": { - "details": "Returns whether the incoming reward of the block producers are deprecated during a specific period." + "checkMiningRewardDeprecatedAtPeriod(address,uint256)": { + "details": "Returns whether the incoming reward of the block producer is deprecated during a specific period." }, "currentPeriod()": { "details": "Returns the period index from the current block." @@ -2567,7 +2651,7 @@ "details": "Returns whether the address is block producer or not." }, "isBridgeOperator(address)": { - "details": "Returns whether the address is bridge operator or not." + "details": "Returns whether the address is bridge operator." }, "isCandidateAdmin(address,address)": { "details": "Returns whether the address is the candidate admin." @@ -2701,7 +2785,7 @@ "type": "t_bool" }, { - "astId": 32331, + "astId": 33718, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_numberOfBlocksInEpoch", "offset": 0, @@ -2709,7 +2793,7 @@ "type": "t_uint256" }, { - "astId": 32334, + "astId": 33721, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_lastUpdatedBlock", "offset": 0, @@ -2717,7 +2801,7 @@ "type": "t_uint256" }, { - "astId": 32337, + "astId": 33724, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_lastUpdatedPeriod", "offset": 0, @@ -2725,7 +2809,7 @@ "type": "t_uint256" }, { - "astId": 32340, + "astId": 33727, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_currentPeriodStartAtBlock", "offset": 0, @@ -2733,7 +2817,7 @@ "type": "t_uint256" }, { - "astId": 32345, + "astId": 33732, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_periodOf", "offset": 0, @@ -2741,7 +2825,7 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 32350, + "astId": 33737, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "______gap", "offset": 0, @@ -2749,7 +2833,7 @@ "type": "t_array(t_uint256)49_storage" }, { - "astId": 31937, + "astId": 33364, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_miningRewardDeprecatedAtPeriod", "offset": 0, @@ -2757,7 +2841,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 31944, + "astId": 33371, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_miningRewardBailoutCutOffAtPeriod", "offset": 0, @@ -2765,7 +2849,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 31951, + "astId": 33378, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_bridgeRewardDeprecatedAtPeriod", "offset": 0, @@ -2773,7 +2857,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 31956, + "astId": 33383, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_blockProducerJailedBlock", "offset": 0, @@ -2781,7 +2865,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 31961, + "astId": 33388, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_emergencyExitJailedTimestamp", "offset": 0, @@ -2789,7 +2873,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 31966, + "astId": 33393, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_cannotBailoutUntilBlock", "offset": 0, @@ -2797,7 +2881,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 31971, + "astId": 33398, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "______gap", "offset": 0, @@ -2805,47 +2889,47 @@ "type": "t_array(t_uint256)48_storage" }, { - "astId": 6383, + "astId": 6972, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_stakingVestingContract", "offset": 0, "slot": "109", - "type": "t_contract(IStakingVesting)10285" + "type": "t_contract(IStakingVesting)10271" }, { - "astId": 5876, + "astId": 6465, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_bridgeTrackingContract", "offset": 0, "slot": "110", - "type": "t_contract(IBridgeTracking)9335" + "type": "t_contract(IBridgeTracking)9283" }, { - "astId": 5955, + "astId": 6544, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_maintenanceContract", "offset": 0, "slot": "111", - "type": "t_contract(IMaintenance)9709" + "type": "t_contract(IMaintenance)9657" }, { - "astId": 6225, + "astId": 6814, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_slashIndicatorContract", "offset": 0, "slot": "112", - "type": "t_contract(ISlashIndicator)10863" + "type": "t_contract(ISlashIndicator)10849" }, { - "astId": 6304, + "astId": 6893, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_stakingContract", "offset": 0, "slot": "113", - "type": "t_contract(IStaking)11497" + "type": "t_contract(IStaking)11489" }, { - "astId": 28739, + "astId": 30114, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_maxValidatorCandidate", "offset": 0, @@ -2853,7 +2937,7 @@ "type": "t_uint256" }, { - "astId": 28743, + "astId": 30118, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_candidates", "offset": 0, @@ -2861,7 +2945,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 28748, + "astId": 30123, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_candidateIndex", "offset": 0, @@ -2869,15 +2953,15 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 28754, + "astId": 30129, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_candidateInfo", "offset": 0, "slot": "117", - "type": "t_mapping(t_address,t_struct(ValidatorCandidate)11514_storage)" + "type": "t_mapping(t_address,t_struct(ValidatorCandidate)11506_storage)" }, { - "astId": 28757, + "astId": 30132, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_minEffectiveDaysOnwards", "offset": 0, @@ -2885,15 +2969,15 @@ "type": "t_uint256" }, { - "astId": 28763, + "astId": 30138, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_candidateCommissionChangeSchedule", "offset": 0, "slot": "119", - "type": "t_mapping(t_address,t_struct(CommissionSchedule)11519_storage)" + "type": "t_mapping(t_address,t_struct(CommissionSchedule)11511_storage)" }, { - "astId": 28768, + "astId": 30143, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "______gap", "offset": 0, @@ -2901,15 +2985,15 @@ "type": "t_array(t_uint256)48_storage" }, { - "astId": 6146, + "astId": 6735, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_roninTrustedOrganizationContract", "offset": 0, "slot": "168", - "type": "t_contract(IRoninTrustedOrganization)10196" + "type": "t_contract(IRoninTrustedOrganization)10182" }, { - "astId": 32510, + "astId": 33897, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_maxValidatorNumber", "offset": 0, @@ -2917,7 +3001,7 @@ "type": "t_uint256" }, { - "astId": 32513, + "astId": 33900, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "validatorCount", "offset": 0, @@ -2925,7 +3009,7 @@ "type": "t_uint256" }, { - "astId": 32518, + "astId": 33905, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_validators", "offset": 0, @@ -2933,15 +3017,15 @@ "type": "t_mapping(t_uint256,t_address)" }, { - "astId": 32524, + "astId": 33911, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_validatorMap", "offset": 0, "slot": "172", - "type": "t_mapping(t_address,t_enum(ValidatorFlag)12605)" + "type": "t_mapping(t_address,t_enum(ValidatorFlag)12618)" }, { - "astId": 32527, + "astId": 33914, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_maxPrioritizedValidatorNumber", "offset": 0, @@ -2949,7 +3033,7 @@ "type": "t_uint256" }, { - "astId": 32532, + "astId": 33919, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "______gap", "offset": 0, @@ -2957,7 +3041,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 31813, + "astId": 33240, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_miningReward", "offset": 0, @@ -2965,7 +3049,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 31818, + "astId": 33245, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_delegatingReward", "offset": 0, @@ -2973,7 +3057,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 31821, + "astId": 33248, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_totalBridgeReward", "offset": 0, @@ -2981,7 +3065,7 @@ "type": "t_uint256" }, { - "astId": 31826, + "astId": 33253, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_bridgeOperatingReward", "offset": 0, @@ -2989,7 +3073,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 31829, + "astId": 33256, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_totalDeprecatedReward", "offset": 0, @@ -2997,7 +3081,7 @@ "type": "t_uint256" }, { - "astId": 31832, + "astId": 33259, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_emergencyExitLockedAmount", "offset": 0, @@ -3005,7 +3089,7 @@ "type": "t_uint256" }, { - "astId": 31835, + "astId": 33262, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_emergencyExpiryDuration", "offset": 0, @@ -3013,7 +3097,7 @@ "type": "t_uint256" }, { - "astId": 31839, + "astId": 33266, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_lockedConsensusList", "offset": 0, @@ -3021,15 +3105,15 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 31845, + "astId": 33272, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_exitInfo", "offset": 0, "slot": "232", - "type": "t_mapping(t_address,t_struct(EmergencyExitInfo)12044_storage)" + "type": "t_mapping(t_address,t_struct(EmergencyExitInfo)12039_storage)" }, { - "astId": 31850, + "astId": 33277, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_lockedFundReleased", "offset": 0, @@ -3037,7 +3121,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 31855, + "astId": 33282, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "______gap", "offset": 0, @@ -3091,37 +3175,37 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(IBridgeTracking)9335": { + "t_contract(IBridgeTracking)9283": { "encoding": "inplace", "label": "contract IBridgeTracking", "numberOfBytes": "20" }, - "t_contract(IMaintenance)9709": { + "t_contract(IMaintenance)9657": { "encoding": "inplace", "label": "contract IMaintenance", "numberOfBytes": "20" }, - "t_contract(IRoninTrustedOrganization)10196": { + "t_contract(IRoninTrustedOrganization)10182": { "encoding": "inplace", "label": "contract IRoninTrustedOrganization", "numberOfBytes": "20" }, - "t_contract(ISlashIndicator)10863": { + "t_contract(ISlashIndicator)10849": { "encoding": "inplace", "label": "contract ISlashIndicator", "numberOfBytes": "20" }, - "t_contract(IStaking)11497": { + "t_contract(IStaking)11489": { "encoding": "inplace", "label": "contract IStaking", "numberOfBytes": "20" }, - "t_contract(IStakingVesting)10285": { + "t_contract(IStakingVesting)10271": { "encoding": "inplace", "label": "contract IStakingVesting", "numberOfBytes": "20" }, - "t_enum(ValidatorFlag)12605": { + "t_enum(ValidatorFlag)12618": { "encoding": "inplace", "label": "enum EnumFlags.ValidatorFlag", "numberOfBytes": "1" @@ -3133,12 +3217,12 @@ "numberOfBytes": "32", "value": "t_bool" }, - "t_mapping(t_address,t_enum(ValidatorFlag)12605)": { + "t_mapping(t_address,t_enum(ValidatorFlag)12618)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => enum EnumFlags.ValidatorFlag)", "numberOfBytes": "32", - "value": "t_enum(ValidatorFlag)12605" + "value": "t_enum(ValidatorFlag)12618" }, "t_mapping(t_address,t_mapping(t_uint256,t_bool))": { "encoding": "mapping", @@ -3147,26 +3231,26 @@ "numberOfBytes": "32", "value": "t_mapping(t_uint256,t_bool)" }, - "t_mapping(t_address,t_struct(CommissionSchedule)11519_storage)": { + "t_mapping(t_address,t_struct(CommissionSchedule)11511_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct ICandidateManager.CommissionSchedule)", "numberOfBytes": "32", - "value": "t_struct(CommissionSchedule)11519_storage" + "value": "t_struct(CommissionSchedule)11511_storage" }, - "t_mapping(t_address,t_struct(EmergencyExitInfo)12044_storage)": { + "t_mapping(t_address,t_struct(EmergencyExitInfo)12039_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct ICommonInfo.EmergencyExitInfo)", "numberOfBytes": "32", - "value": "t_struct(EmergencyExitInfo)12044_storage" + "value": "t_struct(EmergencyExitInfo)12039_storage" }, - "t_mapping(t_address,t_struct(ValidatorCandidate)11514_storage)": { + "t_mapping(t_address,t_struct(ValidatorCandidate)11506_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct ICandidateManager.ValidatorCandidate)", "numberOfBytes": "32", - "value": "t_struct(ValidatorCandidate)11514_storage" + "value": "t_struct(ValidatorCandidate)11506_storage" }, "t_mapping(t_address,t_uint256)": { "encoding": "mapping", @@ -3196,12 +3280,12 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(CommissionSchedule)11519_storage": { + "t_struct(CommissionSchedule)11511_storage": { "encoding": "inplace", "label": "struct ICandidateManager.CommissionSchedule", "members": [ { - "astId": 11516, + "astId": 11508, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "effectiveTimestamp", "offset": 0, @@ -3209,7 +3293,7 @@ "type": "t_uint256" }, { - "astId": 11518, + "astId": 11510, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "commissionRate", "offset": 0, @@ -3219,12 +3303,12 @@ ], "numberOfBytes": "64" }, - "t_struct(EmergencyExitInfo)12044_storage": { + "t_struct(EmergencyExitInfo)12039_storage": { "encoding": "inplace", "label": "struct ICommonInfo.EmergencyExitInfo", "members": [ { - "astId": 12041, + "astId": 12036, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "lockedAmount", "offset": 0, @@ -3232,7 +3316,7 @@ "type": "t_uint256" }, { - "astId": 12043, + "astId": 12038, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "recyclingAt", "offset": 0, @@ -3242,12 +3326,12 @@ ], "numberOfBytes": "64" }, - "t_struct(ValidatorCandidate)11514_storage": { + "t_struct(ValidatorCandidate)11506_storage": { "encoding": "inplace", "label": "struct ICandidateManager.ValidatorCandidate", "members": [ { - "astId": 11501, + "astId": 11493, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "admin", "offset": 0, @@ -3255,7 +3339,7 @@ "type": "t_address" }, { - "astId": 11503, + "astId": 11495, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "consensusAddr", "offset": 0, @@ -3263,7 +3347,7 @@ "type": "t_address" }, { - "astId": 11505, + "astId": 11497, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "treasuryAddr", "offset": 0, @@ -3271,7 +3355,7 @@ "type": "t_address_payable" }, { - "astId": 11507, + "astId": 11499, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "bridgeOperatorAddr", "offset": 0, @@ -3279,7 +3363,7 @@ "type": "t_address" }, { - "astId": 11509, + "astId": 11501, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "commissionRate", "offset": 0, @@ -3287,7 +3371,7 @@ "type": "t_uint256" }, { - "astId": 11511, + "astId": 11503, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "revokingTimestamp", "offset": 0, @@ -3295,7 +3379,7 @@ "type": "t_uint256" }, { - "astId": 11513, + "astId": 11505, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "topupDeadline", "offset": 0, diff --git a/deployments/ronin-testnet/SlashIndicatorLogic.json b/deployments/ronin-testnet/SlashIndicatorLogic.json index 200b0e5c6..ab20bc5b1 100644 --- a/deployments/ronin-testnet/SlashIndicatorLogic.json +++ b/deployments/ronin-testnet/SlashIndicatorLogic.json @@ -1,5 +1,5 @@ { - "address": "0x5ed68c257c83bBAbB55586C26F3b5c39c3B92729", + "address": "0x8e4F01c695804263D02f8d9854d6a7Cd40A9E539", "abi": [ { "inputs": [], @@ -962,41 +962,41 @@ "type": "function" } ], - "transactionHash": "0xce53ae77397dc6b42182315659624fc31c96dcaf5d8eb8d6ccf1dbf75d8a4a92", + "transactionHash": "0x79154bdd7b165e43219dd2f5a081bd0c58901c7e3bd9e583a6578f0aad834f46", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0x5ed68c257c83bBAbB55586C26F3b5c39c3B92729", + "contractAddress": "0x8e4F01c695804263D02f8d9854d6a7Cd40A9E539", "transactionIndex": 0, - "gasUsed": "2627998", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000200000000000000000000000000000000000000400000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0x04fb922d599c51a19e5b4570b184f07ce8b5efc4be21553bc65a5e3295273b9b", - "transactionHash": "0xce53ae77397dc6b42182315659624fc31c96dcaf5d8eb8d6ccf1dbf75d8a4a92", + "gasUsed": "2626414", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000001000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000800000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x187f1b7683827e055137ccee04941b756247ddadf55739e89228b7e70939e912", + "transactionHash": "0x79154bdd7b165e43219dd2f5a081bd0c58901c7e3bd9e583a6578f0aad834f46", "logs": [ { "transactionIndex": 0, - "blockNumber": 14747623, - "transactionHash": "0xce53ae77397dc6b42182315659624fc31c96dcaf5d8eb8d6ccf1dbf75d8a4a92", - "address": "0x5ed68c257c83bBAbB55586C26F3b5c39c3B92729", + "blockNumber": 16816865, + "transactionHash": "0x79154bdd7b165e43219dd2f5a081bd0c58901c7e3bd9e583a6578f0aad834f46", + "address": "0x8e4F01c695804263D02f8d9854d6a7Cd40A9E539", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", "logIndex": 0, - "blockHash": "0x04fb922d599c51a19e5b4570b184f07ce8b5efc4be21553bc65a5e3295273b9b" + "blockHash": "0x187f1b7683827e055137ccee04941b756247ddadf55739e89228b7e70939e912" } ], - "blockNumber": 14747623, - "cumulativeGasUsed": "2627998", + "blockNumber": 16816865, + "cumulativeGasUsed": "2626414", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 5, - "solcInputHash": "3c352db0d062e062f7c0c18610e9070b", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallPrecompiled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeGovernanceAdminContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeMaintenanceContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeRoninTrustedOrgContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"usedCreditScore\",\"type\":\"uint256\"}],\"name\":\"BailedOut\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"missingVotesRatioTier1\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"missingVotesRatioTier2\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailDurationForMissingVotesRatioTier2\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"skipBridgeOperatorSlashingThreshold\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorSlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bridgeVotingThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bridgeVotingSlashAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeVotingSlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gainCreditScore\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxCreditScore\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bailOutCostMultiplier\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cutOffPercentageAfterBailout\",\"type\":\"uint256\"}],\"name\":\"CreditScoreConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"creditScores\",\"type\":\"uint256[]\"}],\"name\":\"CreditScoresUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashDoubleSignAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"doubleSigningJailUntilBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"doubleSigningOffsetLimitBlock\",\"type\":\"uint256\"}],\"name\":\"DoubleSignSlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"MaintenanceContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"RoninGovernanceAdminContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"RoninTrustedOrganizationContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"enum IBaseSlash.SlashType\",\"name\":\"slashType\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"Slashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unavailabilityTier1Threshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unavailabilityTier2Threshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashAmountForUnavailabilityTier2Threshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailDurationForUnavailabilityTier2Threshold\",\"type\":\"uint256\"}],\"name\":\"UnavailabilitySlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"bailOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"checkBailedOutAtPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"}],\"name\":\"currentUnavailabilityIndicator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validators\",\"type\":\"address[]\"}],\"name\":\"execResetCreditScores\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_tier\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"execSlashBridgeOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBridgeOperatorSlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"missingVotesRatioTier1_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"missingVotesRatioTier2_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jailDurationForMissingVotesRatioTier2_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"skipBridgeOperatorSlashingThreshold_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBridgeVotingSlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"bridgeVotingThreshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"bridgeVotingSlashAmount_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"}],\"name\":\"getCreditScore\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCreditScoreConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gainCreditScore_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxCreditScore_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"bailOutCostMultiplier_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cutOffPercentageAfterBailout_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDoubleSignSlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"slashDoubleSignAmount_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"doubleSigningJailUntilBlock_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"doubleSigningOffsetLimitBlock_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validators\",\"type\":\"address[]\"}],\"name\":\"getManyCreditScores\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_resultList\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"getUnavailabilityIndicator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getUnavailabilitySlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"unavailabilityTier1Threshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unavailabilityTier2Threshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashAmountForUnavailabilityTier2Threshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jailDurationForUnavailabilityTier2Threshold_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__maintenanceContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninTrustedOrganizationContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninGovernanceAdminContract\",\"type\":\"address\"},{\"internalType\":\"uint256[4]\",\"name\":\"_bridgeOperatorSlashingConfigs\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[2]\",\"name\":\"_bridgeVotingSlashingConfigs\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[3]\",\"name\":\"_doubleSignSlashingConfigs\",\"type\":\"uint256[3]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_unavailabilitySlashingConfigs\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_creditScoreConfigs\",\"type\":\"uint256[4]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastUnavailabilitySlashedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maintenanceContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompileValidateDoubleSignAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninGovernanceAdminContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninTrustedOrganizationContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_ratioTier1\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ratioTier2\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jailDurationTier2\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_skipSlashingThreshold\",\"type\":\"uint256\"}],\"name\":\"setBridgeOperatorSlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_slashAmount\",\"type\":\"uint256\"}],\"name\":\"setBridgeVotingSlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gainScore\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxScore\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_bailOutMultiplier\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cutOffPercentage\",\"type\":\"uint256\"}],\"name\":\"setCreditScoreConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jailUntilBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_offsetLimitBlock\",\"type\":\"uint256\"}],\"name\":\"setDoubleSignSlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setMaintenanceContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setRoninGovernanceAdminContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setRoninTrustedOrganizationContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_tier1Threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_tier2Threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_slashAmountForTier2Threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jailDurationForTier2Threshold\",\"type\":\"uint256\"}],\"name\":\"setUnavailabilitySlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"slashBridgeVoting\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_header1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"_header2\",\"type\":\"bytes\"}],\"name\":\"slashDoubleSign\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorAddr\",\"type\":\"address\"}],\"name\":\"slashUnavailability\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validators\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"updateCreditScores\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallPrecompiled()\":[{\"details\":\"Error of call to precompile fails.\"}],\"ErrCallerMustBeGovernanceAdminContract()\":[{\"details\":\"Error of method caller must be goverance admin contract.\"}],\"ErrCallerMustBeMaintenanceContract()\":[{\"details\":\"Error of method caller must be maintenance contract.\"}],\"ErrCallerMustBeRoninTrustedOrgContract()\":[{\"details\":\"Error of method caller must be Ronin trusted org contract.\"}],\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"bailOut(address)\":{\"details\":\"A slashed validator use this method to get out of jail. Requirements: - The `_consensusAddr` must be a validator. - Only validator's admin can call this method. Emits the event `BailedOut`.\"},\"checkBailedOutAtPeriod(address,uint256)\":{\"details\":\"Returns the whether the `_validator` has been bailed out at the `_period`.\"},\"currentUnavailabilityIndicator(address)\":{\"details\":\"Returns the current unavailability indicator of a block producer.\"},\"execResetCreditScores(address[])\":{\"details\":\"Resets the credit score for the revoked validators. Requirements: - Only validator contract can call this method. - This method is only called at the end of each period. Emits the event `CreditScoresUpdated`.\"},\"execSlashBridgeOperator(address,uint256,uint256)\":{\"details\":\"Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\",\"params\":{\"_tier\":\"The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1` and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2` Requirements: - Only validator contract can invoke this method. - Should be called only at the end of period. - Should be called only when there is slash of bridge operator. Emits the event `Slashed`.\"}},\"getBridgeOperatorSlashingConfigs()\":{\"details\":\"Returns the configs related to bridge operator slashing.\",\"returns\":{\"jailDurationForMissingVotesRatioTier2_\":\"The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\",\"missingVotesRatioTier1_\":\"The bridge reward will be deprecated if (s)he missed more than this ratio.\",\"missingVotesRatioTier2_\":\"The bridge reward and mining reward will be deprecated and the corresponding block producer will be put in jail if (s)he misses more than this ratio.\",\"skipBridgeOperatorSlashingThreshold_\":\"The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\"}},\"getBridgeVotingSlashingConfigs()\":{\"details\":\"Returns the configs related to bridge voting slashing.\",\"returns\":{\"bridgeVotingSlashAmount_\":\"The amount of RON to slash bridge voting.\",\"bridgeVotingThreshold_\":\"The threshold to slash when a trusted organization does not vote for bridge operators.\"}},\"getCreditScore(address)\":{\"details\":\"Returns the current credit score of the validator.\"},\"getCreditScoreConfigs()\":{\"details\":\"Returns the configs related to credit score.\",\"returns\":{\"bailOutCostMultiplier_\":\"The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\",\"cutOffPercentageAfterBailout_\":\"The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\",\"gainCreditScore_\":\"The score to gain per period.\",\"maxCreditScore_\":\"The max number of credit score that a validator can hold.\"}},\"getDoubleSignSlashingConfigs()\":{\"details\":\"Returns the configs related to block producer slashing.\",\"params\":{\"_doubleSigningOffsetLimitBlock\":\"The number of block that the current block is at most far from the double signing block.\"},\"returns\":{\"doubleSigningJailUntilBlock_\":\"The block number that the punished validator will be jailed until, due to double signing.\",\"slashDoubleSignAmount_\":\"The amount of RON to slash double sign.\"}},\"getManyCreditScores(address[])\":{\"details\":\"Returns the current credit score of a list of validators.\"},\"getUnavailabilityIndicator(address,uint256)\":{\"details\":\"Helper for CreditScore contract to query indicator of the validator.\"},\"getUnavailabilitySlashingConfigs()\":{\"details\":\"Returns the configs related to block producer slashing.\",\"returns\":{\"jailDurationForUnavailabilityTier2Threshold_\":\"The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\",\"slashAmountForUnavailabilityTier2Threshold_\":\"The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with tier-2 or tier-3.\",\"unavailabilityTier1Threshold_\":\"The mining reward will be deprecated, if (s)he missed more than this threshold. This threshold is applied for tier-1 and tier-3 slash.\",\"unavailabilityTier2Threshold_\":\" The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\"}},\"initialize(address,address,address,address,uint256[4],uint256[2],uint256[3],uint256[4],uint256[4])\":{\"details\":\"Initializes the contract storage.\"},\"maintenanceContract()\":{\"details\":\"Returns the maintenance contract.\"},\"precompileValidateDoubleSignAddress()\":{\"details\":\"Gets the address of the precompile of validating double sign evidence\"},\"roninGovernanceAdminContract()\":{\"details\":\"Returns the ronin governance admin contract.\"},\"roninTrustedOrganizationContract()\":{\"details\":\"Returns the ronin trusted organization contract.\"},\"setBridgeOperatorSlashingConfigs(uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the configs to slash bridge operators. Requirements: - The method caller is admin. Emits the event `BridgeOperatorSlashingConfigsUpdated`.\",\"params\":{\"_jailDurationTier2\":\"The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\",\"_ratioTier1\":\"The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map to 0%-100%.\",\"_ratioTier2\":\"The bridge reward and mining reward will be deprecated and the corresponding block producer will be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\",\"_skipSlashingThreshold\":\"The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\"}},\"setBridgeVotingSlashingConfigs(uint256,uint256)\":{\"details\":\"Sets the configs to slash bridge voting. Requirements: - The method caller is admin. Emits the event `BridgeVotingSlashingConfigsUpdated`.\",\"params\":{\"_slashAmount\":\"The amount of RON to slash bridge voting.\",\"_threshold\":\"The threshold to slash when a trusted organization does not vote for bridge operators.\"}},\"setCreditScoreConfigs(uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the configs to credit score. Requirements: - The method caller is admin. Emits the event `CreditScoreConfigsUpdated`.\",\"params\":{\"_bailOutMultiplier\":\"The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\",\"_cutOffPercentage\":\"The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\",\"_gainScore\":\"The score to gain per period.\",\"_maxScore\":\"The max number of credit score that a validator can hold.\"}},\"setDoubleSignSlashingConfigs(uint256,uint256,uint256)\":{\"details\":\"Sets the configs to slash block producers. Requirements: - The method caller is admin. Emits the event `DoubleSignSlashingConfigsUpdated`.\",\"params\":{\"_doubleSigningOffsetLimitBlock\":\"The number of block that the current block is at most far from the double signing block.\",\"_jailUntilBlock\":\"The block number that the punished validator will be jailed until, due to double signing.\",\"_slashAmount\":\"The amount of RON to slash double sign.\"}},\"setMaintenanceContract(address)\":{\"details\":\"Sets the maintenance contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `MaintenanceContractUpdated`.\"},\"setRoninGovernanceAdminContract(address)\":{\"details\":\"Sets the ronin governance admin contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `RoninGovernanceAdminContractUpdated`.\"},\"setRoninTrustedOrganizationContract(address)\":{\"details\":\"Sets the ronin trusted organization contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `RoninTrustedOrganizationContractUpdated`.\"},\"setUnavailabilitySlashingConfigs(uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the configs to slash block producers. Requirements: - The method caller is admin. Emits the event `BridgeOperatorSlashingConfigsUpdated`.\",\"params\":{\"_jailDurationForTier2Threshold\":\"The number of blocks to jail a block producer when (s)he is slashed tier-2.\",\"_slashAmountForTier2Threshold\":\"The amount of RON to deduct from self-staking of a block producer when (s)he is slashed tier-2.\",\"_tier1Threshold\":\"The mining reward will be deprecated, if (s)he missed more than this threshold.\",\"_tier2Threshold\":\"The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted self-staking if (s)he misses more than this threshold.\"}},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"slashBridgeVoting(address)\":{\"details\":\"Slashes for bridge voter governance. Emits the event `Slashed`.\"},\"slashDoubleSign(address,bytes,bytes)\":{\"details\":\"Slashes for double signing. Requirements: - The method caller is coinbase. Emits the event `Slashed` if the double signing evidence of the two headers valid.\"},\"slashUnavailability(address)\":{\"details\":\"Slashes for unavailability by increasing the counter of block producer `_consensusAddr`. Requirements: - The method caller is coinbase. Emits the event `Slashed` when the threshold is reached.\"},\"updateCreditScores(address[],uint256)\":{\"details\":\"Updates the credit score for the validators. Requirements: - Only validator contract can call this method. - This method is only called at the end of each period. Emits the event `CreditScoresUpdated`.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/slash-indicator/SlashIndicator.sol\":\"SlashIndicator\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xdb7f5c28fc61cda0bd8ab60ce288e206b791643bcd3ba464a70cbec18895a2f5\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasMaintenanceContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasMaintenanceContract.sol\\\";\\nimport \\\"../../interfaces/IMaintenance.sol\\\";\\n\\ncontract HasMaintenanceContract is IHasMaintenanceContract, HasProxyAdmin {\\n IMaintenance internal _maintenanceContract;\\n\\n modifier onlyMaintenanceContract() {\\n if (maintenanceContract() != msg.sender) revert ErrCallerMustBeMaintenanceContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasMaintenanceContract\\n */\\n function maintenanceContract() public view override returns (address) {\\n return address(_maintenanceContract);\\n }\\n\\n /**\\n * @inheritdoc IHasMaintenanceContract\\n */\\n function setMaintenanceContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setMaintenanceContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the scheduled maintenance contract.\\n *\\n * Emits the event `MaintenanceContractUpdated`.\\n *\\n */\\n function _setMaintenanceContract(address _addr) internal {\\n _maintenanceContract = IMaintenance(_addr);\\n emit MaintenanceContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x117a29d878d44a20350df8ab539d34335713ba0f3b2c768a58124f61efb74357\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasRoninGovernanceAdminContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasRoninGovernanceAdminContract.sol\\\";\\nimport \\\"../../interfaces/IRoninGovernanceAdmin.sol\\\";\\n\\ncontract HasRoninGovernanceAdminContract is IHasRoninGovernanceAdminContract, HasProxyAdmin {\\n IRoninGovernanceAdmin internal _roninGovernanceAdminContract;\\n\\n modifier onlyRoninGovernanceAdminContract() {\\n if (roninGovernanceAdminContract() != msg.sender) revert ErrCallerMustBeGovernanceAdminContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasRoninGovernanceAdminContract\\n */\\n function roninGovernanceAdminContract() public view override returns (address) {\\n return address(_roninGovernanceAdminContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninGovernanceAdminContract\\n */\\n function setRoninGovernanceAdminContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setRoninGovernanceAdminContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the ronin governance admin contract.\\n *\\n * Emits the event `RoninGovernanceAdminContractUpdated`.\\n *\\n */\\n function _setRoninGovernanceAdminContract(address _addr) internal {\\n _roninGovernanceAdminContract = IRoninGovernanceAdmin(_addr);\\n emit RoninGovernanceAdminContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xbbb077c4c406c6b13d8602dd1bcac1031cd144e9c1965ec59311ded2b9fe8e3c\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\n\\ncontract HasRoninTrustedOrganizationContract is IHasRoninTrustedOrganizationContract, HasProxyAdmin {\\n IRoninTrustedOrganization internal _roninTrustedOrganizationContract;\\n\\n modifier onlyRoninTrustedOrganizationContract() {\\n if (roninTrustedOrganizationContract() != msg.sender) revert ErrCallerMustBeRoninTrustedOrgContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function roninTrustedOrganizationContract() public view override returns (address) {\\n return address(_roninTrustedOrganizationContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function setRoninTrustedOrganizationContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setRoninTrustedOrganizationContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function _setRoninTrustedOrganizationContract(address _addr) internal {\\n _roninTrustedOrganizationContract = IRoninTrustedOrganization(_addr);\\n emit RoninTrustedOrganizationContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x951fd730f4853d8c932da5484ea093f3094c8186735b603d31fb53035c395751\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IMaintenance {\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\\n */\\n function checkScheduled(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr`\\n */\\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\\n */\\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedules() external view returns (uint256 _count);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedules() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4f06c8f3ad7ec8b863882c655ddf443675d557272445e51d8a1e1f3454089d09\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x10f3b360430e6d03773c9959f54cbed6fb0346069645c05b05ef50cfb19f3753\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninGovernanceAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../libraries/BridgeOperatorsBallot.sol\\\";\\n\\ninterface IRoninGovernanceAdmin {\\n /// @dev Emitted when the bridge operators are approved.\\n event BridgeOperatorsApproved(uint256 _period, uint256 _epoch, address[] _operators);\\n /// @dev Emitted when an emergency exit poll is created.\\n event EmergencyExitPollCreated(\\n bytes32 _voteHash,\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n );\\n /// @dev Emitted when an emergency exit poll is approved.\\n event EmergencyExitPollApproved(bytes32 _voteHash);\\n /// @dev Emitted when an emergency exit poll is expired.\\n event EmergencyExitPollExpired(bytes32 _voteHash);\\n\\n /**\\n * @dev Returns the last voted block of the bridge voter.\\n */\\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256);\\n\\n /**\\n * @dev Returns the synced bridge operator set info.\\n */\\n function lastSyncedBridgeOperatorSetInfo()\\n external\\n view\\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory _bridgeOperatorSetInfo);\\n\\n /**\\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n */\\n function createEmergencyExitPoll(\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) external;\\n}\\n\",\"keccak256\":\"0x1aa218f9a8cad8fa9f865c179b257aa8f2614e034100dedebdd352da9a7d96d9\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeights() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganizations() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x1edb7a3f5d340e7efc141cb8d94c5499954dec869f026d3998ad92cbc714d604\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasMaintenanceContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasMaintenanceContract is IHasContract {\\n /// @dev Emitted when the maintenance contract is updated.\\n event MaintenanceContractUpdated(address);\\n\\n /// @dev Error of method caller must be maintenance contract.\\n error ErrCallerMustBeMaintenanceContract();\\n\\n /**\\n * @dev Returns the maintenance contract.\\n */\\n function maintenanceContract() external view returns (address);\\n\\n /**\\n * @dev Sets the maintenance contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `MaintenanceContractUpdated`.\\n *\\n */\\n function setMaintenanceContract(address) external;\\n}\\n\",\"keccak256\":\"0x0a0ef6ba14e2929c7c8dda0642a7a831c9997d1b0d049eb83f64dfc21ff0e72e\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasRoninGovernanceAdminContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasRoninGovernanceAdminContract is IHasContract {\\n /// @dev Emitted when the ronin governance admin contract is updated.\\n event RoninGovernanceAdminContractUpdated(address);\\n\\n /// @dev Error of method caller must be goverance admin contract.\\n error ErrCallerMustBeGovernanceAdminContract();\\n\\n /**\\n * @dev Returns the ronin governance admin contract.\\n */\\n function roninGovernanceAdminContract() external view returns (address);\\n\\n /**\\n * @dev Sets the ronin governance admin contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `RoninGovernanceAdminContractUpdated`.\\n *\\n */\\n function setRoninGovernanceAdminContract(address) external;\\n}\\n\",\"keccak256\":\"0x7143a90b75a403f79f017c5350f816375d1ad5858ddbfa896c964ab9c8d4225a\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\\n /// @dev Emitted when the ronin trusted organization contract is updated.\\n event RoninTrustedOrganizationContractUpdated(address);\\n\\n /// @dev Error of method caller must be Ronin trusted org contract.\\n error ErrCallerMustBeRoninTrustedOrgContract();\\n\\n /**\\n * @dev Returns the ronin trusted organization contract.\\n */\\n function roninTrustedOrganizationContract() external view returns (address);\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function setRoninTrustedOrganizationContract(address) external;\\n}\\n\",\"keccak256\":\"0x7d0a0b1d658e9cf4d69f4934748e0a5c1d22183024d26927f5d621fc61aff0b2\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/IBaseSlash.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseSlash {\\n enum SlashType {\\n UNKNOWN,\\n UNAVAILABILITY_TIER_1,\\n UNAVAILABILITY_TIER_2,\\n DOUBLE_SIGNING,\\n BRIDGE_VOTING,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\\n UNAVAILABILITY_TIER_3\\n }\\n\\n /// @dev Emitted when the validator is slashed.\\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\\n}\\n\",\"keccak256\":\"0x04d449f2852840566dfff4e3673929f6e9b8d9b5fc5b29744bf4f344dc7f9bc0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ICreditScore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICreditScore {\\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\\n event CreditScoreConfigsUpdated(\\n uint256 gainCreditScore,\\n uint256 maxCreditScore,\\n uint256 bailOutCostMultiplier,\\n uint256 cutOffPercentageAfterBailout\\n );\\n /// @dev Emitted the credit score of validators is updated.\\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\\n /// @dev Emitted when a validator bailed out of jail.\\n event BailedOut(address indexed validator, uint256 period, uint256 usedCreditScore);\\n\\n /**\\n * @dev Updates the credit score for the validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function updateCreditScores(address[] calldata _validators, uint256 _period) external;\\n\\n /**\\n * @dev Resets the credit score for the revoked validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function execResetCreditScores(address[] calldata _validators) external;\\n\\n /**\\n * @dev A slashed validator use this method to get out of jail.\\n *\\n * Requirements:\\n * - The `_consensusAddr` must be a validator.\\n * - Only validator's admin can call this method.\\n *\\n * Emits the event `BailedOut`.\\n *\\n */\\n function bailOut(address _consensusAddr) external;\\n\\n /**\\n * @dev Sets the configs to credit score.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CreditScoreConfigsUpdated`.\\n *\\n * @param _gainScore The score to gain per period.\\n * @param _maxScore The max number of credit score that a validator can hold.\\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to credit score.\\n *\\n * @return _gainCreditScore The score to gain per period.\\n * @return _maxCreditScore The max number of credit score that a validator can hold.\\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function getCreditScoreConfigs()\\n external\\n view\\n returns (\\n uint256 _gainCreditScore,\\n uint256 _maxCreditScore,\\n uint256 _bailOutCostMultiplier,\\n uint256 _cutOffPercentageAfterBailout\\n );\\n\\n /**\\n * @dev Returns the current credit score of the validator.\\n */\\n function getCreditScore(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the current credit score of a list of validators.\\n */\\n function getManyCreditScores(address[] calldata _validators) external view returns (uint256[] memory _resultList);\\n\\n /**\\n * @dev Returns the whether the `_validator` has been bailed out at the `_period`.\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5364db88efb971f73aac569e27e5604758a123f28567af757b9933fdddd14f8\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeOperator is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method\\n * `getBridgeOperatorSlashingConfigs` for param details.\\n */\\n event BridgeOperatorSlashingConfigsUpdated(\\n uint256 missingVotesRatioTier1,\\n uint256 missingVotesRatioTier2,\\n uint256 jailDurationForMissingVotesRatioTier2,\\n uint256 skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\\n * @param _tier The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1`\\n * and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2`\\n *\\n * Requirements:\\n * - Only validator contract can invoke this method.\\n * - Should be called only at the end of period.\\n * - Should be called only when there is slash of bridge operator.\\n *\\n * Emits the event `Slashed`.\\n */\\n function execSlashBridgeOperator(\\n address _consensusAddr,\\n uint256 _tier,\\n uint256 _period\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to bridge operator slashing.\\n *\\n * @return _missingVotesRatioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio.\\n * @return _missingVotesRatioTier2 The bridge reward and mining reward will be deprecated and the corresponding\\n * block producer will be put in jail if (s)he misses more than this ratio.\\n * @return _jailDurationForMissingVotesRatioTier2 The number of blocks to jail the corresponding block producer when\\n * its bridge operator is slashed tier-2.\\n * @return _skipBridgeOperatorSlashingThreshold The threshold to skip slashing the bridge operator in case the total\\n * number of votes in the bridge is too small.\\n *\\n */\\n function getBridgeOperatorSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _missingVotesRatioTier1,\\n uint256 _missingVotesRatioTier2,\\n uint256 _jailDurationForMissingVotesRatioTier2,\\n uint256 _skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash bridge operators.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _ratioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map\\n * to 0%-100%.\\n * @param _ratioTier2 The bridge reward and mining reward will be deprecated and the corresponding block producer will\\n * be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\\n * @param _jailDurationTier2 The number of blocks to jail the corresponding block producer when its bridge operator is\\n * slashed tier-2.\\n * @param _skipSlashingThreshold The threshold to skip slashing the bridge operator in case the total number of votes\\n * in the bridge is too small.\\n *\\n */\\n function setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x5c09ac11ead005bfa25ae58e970c441144849b14d58fd5f53fadc3b9be16e5d6\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeVoting is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge voting is updated. See the method `getBridgeVotingSlashingConfigs` for param\\n * details.\\n */\\n event BridgeVotingSlashingConfigsUpdated(uint256 bridgeVotingThreshold, uint256 bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Slashes for bridge voter governance.\\n *\\n * Emits the event `Slashed`.\\n */\\n function slashBridgeVoting(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the configs related to bridge voting slashing.\\n *\\n * @return _bridgeVotingThreshold The threshold to slash when a trusted organization does not vote for bridge\\n * operators.\\n * @return _bridgeVotingSlashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function getBridgeVotingSlashingConfigs()\\n external\\n view\\n returns (uint256 _bridgeVotingThreshold, uint256 _bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Sets the configs to slash bridge voting.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeVotingSlashingConfigsUpdated`.\\n *\\n * @param _threshold The threshold to slash when a trusted organization does not vote for bridge operators.\\n * @param _slashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external;\\n}\\n\",\"keccak256\":\"0x72c3bcfe3c49f946651caa3066bd5296d007871c9a56fa113e2d3c0f3db7eb99\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashDoubleSign is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\\n * for param details.\\n */\\n event DoubleSignSlashingConfigsUpdated(\\n uint256 slashDoubleSignAmount,\\n uint256 doubleSigningJailUntilBlock,\\n uint256 doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Slashes for double signing.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\\n */\\n function slashDoubleSign(\\n address _validatorAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\\n * double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function getDoubleSignSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _slashDoubleSignAmount,\\n uint256 _doubleSigningJailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\\n *\\n * @param _slashAmount The amount of RON to slash double sign.\\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n ) external;\\n}\\n\",\"keccak256\":\"0xe72708c42d468b0c40ffa0c72b3386899f11273e4149425aab490a78d5312222\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashIndicator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashDoubleSign.sol\\\";\\nimport \\\"./ISlashBridgeVoting.sol\\\";\\nimport \\\"./ISlashBridgeOperator.sol\\\";\\nimport \\\"./ISlashUnavailability.sol\\\";\\nimport \\\"./ICreditScore.sol\\\";\\n\\ninterface ISlashIndicator is\\n ISlashDoubleSign,\\n ISlashBridgeVoting,\\n ISlashBridgeOperator,\\n ISlashUnavailability,\\n ICreditScore\\n{}\\n\",\"keccak256\":\"0xe8b8fde3af614735cb304bc1eb82b05d65ede4df804b5d555787e5d5ecb95ec0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashUnavailability.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashUnavailability is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\\n * for param details.\\n */\\n event UnavailabilitySlashingConfigsUpdated(\\n uint256 unavailabilityTier1Threshold,\\n uint256 unavailabilityTier2Threshold,\\n uint256 slashAmountForUnavailabilityTier2Threshold,\\n uint256 jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Returns the last block that a block producer is slashed for unavailability.\\n */\\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Slashes for unavailability by increasing the counter of block producer `_consensusAddr`.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` when the threshold is reached.\\n *\\n */\\n function slashUnavailability(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the current unavailability indicator of a block producer.\\n */\\n function currentUnavailabilityIndicator(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the unavailability indicator in the period `_period` of a block producer.\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\\n * @return _unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\\n * @return _slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\\n * producer when (s)he is slashed with tier-2 or tier-3.\\n * @return _jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\\n * slashed with tier-2 or tier-3.\\n *\\n */\\n function getUnavailabilitySlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _unavailabilityTier1Threshold,\\n uint256 _unavailabilityTier2Threshold,\\n uint256 _slashAmountForUnavailabilityTier2Threshold,\\n uint256 _jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\\n * @param _tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\\n * self-staking if (s)he misses more than this threshold.\\n * @param _slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\\n * is slashed tier-2.\\n * @param _jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\\n *\\n */\\n function setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x92f7d8e9c6f80d4fedab80515c68db0a46cf4f8da143f8d766bf5f7582aa0a21\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0xe4060b7e3b04a0043bd334011fe4ba67c990b0484dad52d7f14b35040989b6ab\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n // Error thrown when receives RON from neither staking vesting contract nor staking contract\\\"\\n error ErrUnauthorizedReceiveRON();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0x4e81a61359a3f8bcc9d452615e3df7b0d0201823ce88f763530ddd4f00c2fc48\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address[] calldata _blockProducers) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address[] calldata _blockProducers, uint256 _period)\\n external\\n view\\n returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the current period.\\n */\\n\\n function checkBridgeRewardDeprecated(address _consensusAddr) external view returns (bool _result);\\n}\\n\",\"keccak256\":\"0x853e7d0ac33ad868721733fc2ab4b78f2e613973a579eb0ea485cbdaa750e057\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator or not.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0xbd10b0207a749e3a7a2aadcb6e93784cb17343a5266d056a3d0b79acb7c5c93d\",\"license\":\"MIT\"},\"contracts/libraries/BridgeOperatorsBallot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nlibrary BridgeOperatorsBallot {\\n struct BridgeOperatorSet {\\n uint256 period;\\n uint256 epoch;\\n address[] operators;\\n }\\n\\n // keccak256(\\\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\\\");\\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\\n\\n /**\\n * @dev Verifies whether the ballot is valid or not.\\n *\\n * Requirements:\\n * - The ballot is not for an empty operator set.\\n * - The operator address list is in order.\\n *\\n */\\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\\n require(_ballot.operators.length > 0, \\\"BridgeOperatorsBallot: invalid array length\\\");\\n address _addr = _ballot.operators[0];\\n for (uint _i = 1; _i < _ballot.operators.length; _i++) {\\n require(_addr < _ballot.operators[_i], \\\"BridgeOperatorsBallot: invalid order of bridge operators\\\");\\n _addr = _ballot.operators[_i];\\n }\\n }\\n\\n /**\\n * @dev Returns hash of the ballot.\\n */\\n function hash(BridgeOperatorSet calldata _ballot) internal pure returns (bytes32) {\\n bytes32 _operatorsHash;\\n address[] memory _operators = _ballot.operators;\\n\\n assembly {\\n _operatorsHash := keccak256(add(_operators, 32), mul(mload(_operators), 32))\\n }\\n\\n return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\\n }\\n}\\n\",\"keccak256\":\"0x986425ebae2dcfcfa266c9ca825232ff300ec8ce796e8975da6714d87e921793\",\"license\":\"MIT\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - min(a, b);\\n }\\n}\\n\",\"keccak256\":\"0xa9e2a3ad43d7999a3cdbfb040b0f2dec282eae91ff8fe6ad26fdd19087121ce7\",\"license\":\"UNLICENSED\"},\"contracts/precompile-usages/PCUValidateDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUValidateDoubleSign is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of validating double sign evidence\\n function precompileValidateDoubleSignAddress() public view virtual returns (address) {\\n return address(0x67);\\n }\\n\\n /**\\n * @dev Validates the two submitted block header if they are produced by the same address\\n *\\n * Note: The recover process is done by pre-compiled contract. This function is marked as\\n * virtual for implementing mocking contract for testing purpose.\\n */\\n function _pcValidateEvidence(\\n address _consensusAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) internal view virtual returns (bool _validEvidence) {\\n address _smc = precompileValidateDoubleSignAddress();\\n bool _success = true;\\n\\n bytes memory _payload = abi.encodeWithSignature(\\n \\\"validatingDoubleSignProof(address,bytes,bytes)\\\",\\n _consensusAddr,\\n _header1,\\n _header2\\n );\\n uint _payloadLength = _payload.length;\\n uint[1] memory _output;\\n\\n assembly {\\n let _payloadStart := add(_payload, 0x20)\\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _output, 0x20)) {\\n _success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n _success := 0\\n }\\n }\\n\\n if (!_success) revert ErrCallPrecompiled();\\n return (_output[0] != 0);\\n }\\n}\\n\",\"keccak256\":\"0x9df5b8272e1cd963d776b94e29a69ba1139f0df7404b67c213b3c5ebe19e527b\",\"license\":\"MIT\"},\"contracts/precompile-usages/PrecompiledUsage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PrecompiledUsage {\\n /// @dev Error of call to precompile fails.\\n error ErrCallPrecompiled();\\n}\\n\",\"keccak256\":\"0x76facc3f3a8dd573c826bbbfedaa5cd8ef30963fbabd8c163c0c72b6efea5551\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/CreditScore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/slash-indicator/ICreditScore.sol\\\";\\nimport \\\"../../extensions/collections/HasMaintenanceContract.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\n\\nabstract contract CreditScore is ICreditScore, HasValidatorContract, HasMaintenanceContract, PercentageConsumer {\\n /// @dev Mapping from validator address => period index => whether bailed out before\\n mapping(address => mapping(uint256 => bool)) internal _checkBailedOutAtPeriod;\\n /// @dev Mapping from validator address => credit score\\n mapping(address => uint256) internal _creditScore;\\n\\n /// @dev The max gained number of credit score per period.\\n uint256 internal _gainCreditScore;\\n /// @dev The max number of credit score that a validator can hold.\\n uint256 internal _maxCreditScore;\\n /// @dev The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n uint256 internal _bailOutCostMultiplier;\\n /// @dev The percentage of reward to be cut off from the validator in the rest of the period after bailed out.\\n uint256 internal _cutOffPercentageAfterBailout;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function updateCreditScores(address[] calldata _validators, uint256 _period) external override onlyValidatorContract {\\n uint256 _periodStartAtBlock = _validatorContract.currentPeriodStartAtBlock();\\n\\n bool[] memory _jaileds = _validatorContract.checkManyJailed(_validators);\\n bool[] memory _maintaineds = _maintenanceContract.checkManyMaintainedInBlockRange(\\n _validators,\\n _periodStartAtBlock,\\n block.number\\n );\\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\\n\\n for (uint _i = 0; _i < _validators.length; _i++) {\\n address _validator = _validators[_i];\\n\\n uint256 _indicator = getUnavailabilityIndicator(_validator, _period);\\n bool _isJailedInPeriod = _jaileds[_i];\\n bool _isMaintainingInPeriod = _maintaineds[_i];\\n\\n uint256 _actualGain = (_isJailedInPeriod || _isMaintainingInPeriod)\\n ? 0\\n : Math.subNonNegative(_gainCreditScore, _indicator);\\n\\n _creditScore[_validator] = Math.addWithUpperbound(_creditScore[_validator], _actualGain, _maxCreditScore);\\n _updatedCreditScores[_i] = _creditScore[_validator];\\n }\\n\\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\\n }\\n\\n function execResetCreditScores(address[] calldata _validators) external override onlyValidatorContract {\\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\\n for (uint _i = 0; _i < _validators.length; _i++) {\\n address _validator = _validators[_i];\\n delete _creditScore[_validator];\\n delete _updatedCreditScores[_i];\\n }\\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function bailOut(address _consensusAddr) external override {\\n require(\\n _validatorContract.isValidatorCandidate(_consensusAddr),\\n \\\"SlashIndicator: consensus address must be a validator candidate\\\"\\n );\\n require(\\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\\n \\\"SlashIndicator: method caller must be a candidate admin\\\"\\n );\\n\\n (bool _isJailed, , uint256 _jailedEpochLeft) = _validatorContract.getJailedTimeLeft(_consensusAddr);\\n require(_isJailed, \\\"SlashIndicator: caller must be jailed in the current period\\\");\\n\\n uint256 _period = _validatorContract.currentPeriod();\\n require(!_checkBailedOutAtPeriod[_consensusAddr][_period], \\\"SlashIndicator: validator has bailed out previously\\\");\\n\\n uint256 _score = _creditScore[_consensusAddr];\\n uint256 _cost = _jailedEpochLeft * _bailOutCostMultiplier;\\n require(_score >= _cost, \\\"SlashIndicator: insufficient credit score to bail out\\\");\\n\\n _validatorContract.execBailOut(_consensusAddr, _period);\\n\\n _creditScore[_consensusAddr] -= _cost;\\n _setUnavailabilityIndicator(_consensusAddr, _period, 0);\\n _checkBailedOutAtPeriod[_consensusAddr][_period] = true;\\n emit BailedOut(_consensusAddr, _period, _cost);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) external override onlyAdmin {\\n _setCreditScoreConfigs(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\\n }\\n\\n /**\\n * @dev See `ISlashUnavailability`\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period) public view virtual returns (uint256);\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function getCreditScoreConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 gainCreditScore_,\\n uint256 maxCreditScore_,\\n uint256 bailOutCostMultiplier_,\\n uint256 cutOffPercentageAfterBailout_\\n )\\n {\\n return (_gainCreditScore, _maxCreditScore, _bailOutCostMultiplier, _cutOffPercentageAfterBailout);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function getCreditScore(address _validator) external view override returns (uint256) {\\n return _creditScore[_validator];\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function getManyCreditScores(address[] calldata _validators)\\n public\\n view\\n override\\n returns (uint256[] memory _resultList)\\n {\\n _resultList = new uint256[](_validators.length);\\n\\n for (uint _i = 0; _i < _resultList.length; _i++) {\\n _resultList[_i] = _creditScore[_validators[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual override returns (bool) {\\n return _checkBailedOutAtPeriod[_validator][_period];\\n }\\n\\n /**\\n * @dev See `SlashUnavailability`.\\n */\\n function _setUnavailabilityIndicator(\\n address _validator,\\n uint256 _period,\\n uint256 _indicator\\n ) internal virtual;\\n\\n /**\\n * @dev See `ICreditScore-setCreditScoreConfigs`.\\n */\\n function _setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) internal {\\n require(_gainScore <= _maxScore, \\\"CreditScore: invalid credit score config\\\");\\n require(_cutOffPercentage <= _MAX_PERCENTAGE, \\\"CreditScore: invalid cut off percentage config\\\");\\n\\n _gainCreditScore = _gainScore;\\n _maxCreditScore = _maxScore;\\n _bailOutCostMultiplier = _bailOutMultiplier;\\n _cutOffPercentageAfterBailout = _cutOffPercentage;\\n emit CreditScoreConfigsUpdated(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\\n }\\n}\\n\",\"keccak256\":\"0xe2a4b46731a462e0f71eda5a47b7b56bb1a77ca7e618e02f56acccc7bc759bab\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashBridgeOperator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../extensions/collections/HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashBridgeOperator.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\n\\nabstract contract SlashBridgeOperator is ISlashBridgeOperator, HasProxyAdmin, HasValidatorContract, PercentageConsumer {\\n /**\\n * @dev The bridge operators will be deprecated reward if (s)he missed more than the ratio.\\n * Values 0-10,000 map to 0%-100%.\\n */\\n uint256 internal _missingVotesRatioTier1;\\n /**\\n * @dev The bridge operators will be deprecated all rewards including bridge reward and mining reward if (s)he missed\\n * more than the ratio. Values 0-10,000 map to 0%-100%.\\n */\\n uint256 internal _missingVotesRatioTier2;\\n /// @dev The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\\n uint256 internal _jailDurationForMissingVotesRatioTier2;\\n /// @dev The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\\n uint256 internal _skipBridgeOperatorSlashingThreshold;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc ISlashBridgeOperator\\n */\\n function getBridgeOperatorSlashingConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 missingVotesRatioTier1_,\\n uint256 missingVotesRatioTier2_,\\n uint256 jailDurationForMissingVotesRatioTier2_,\\n uint256 skipBridgeOperatorSlashingThreshold_\\n )\\n {\\n return (\\n _missingVotesRatioTier1,\\n _missingVotesRatioTier2,\\n _jailDurationForMissingVotesRatioTier2,\\n _skipBridgeOperatorSlashingThreshold\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashBridgeOperator\\n */\\n function setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) external override onlyAdmin {\\n _setBridgeOperatorSlashingConfigs(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\\n }\\n\\n /**\\n * @inheritdoc ISlashBridgeOperator\\n */\\n function execSlashBridgeOperator(\\n address _consensusAddr,\\n uint256 _tier,\\n uint256 _period\\n ) external onlyValidatorContract {\\n if (_tier == 1) {\\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1, _period);\\n } else if (_tier == 2) {\\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2, _period);\\n }\\n }\\n\\n /**\\n * @dev See `ISlashBridgeOperator-setBridgeOperatorSlashingConfigs`.\\n */\\n function _setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) internal {\\n require(\\n _ratioTier1 <= _ratioTier2 && _ratioTier1 <= _MAX_PERCENTAGE && _ratioTier2 <= _MAX_PERCENTAGE,\\n \\\"SlashIndicator: invalid ratios\\\"\\n );\\n _missingVotesRatioTier1 = _ratioTier1;\\n _missingVotesRatioTier2 = _ratioTier2;\\n _jailDurationForMissingVotesRatioTier2 = _jailDurationTier2;\\n _skipBridgeOperatorSlashingThreshold = _skipSlashingThreshold;\\n emit BridgeOperatorSlashingConfigsUpdated(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\\n }\\n}\\n\",\"keccak256\":\"0x80fc557349f05e584737a6ba80f87dff5940bcae770db6215d62fb435342957a\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashBridgeVoting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashBridgeVoting.sol\\\";\\nimport \\\"../../extensions/collections/HasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../extensions/collections/HasRoninGovernanceAdminContract.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\n\\nabstract contract SlashBridgeVoting is\\n ISlashBridgeVoting,\\n HasValidatorContract,\\n HasRoninTrustedOrganizationContract,\\n HasRoninGovernanceAdminContract\\n{\\n /// @dev Mapping from validator address => period index => bridge voting slashed\\n mapping(address => mapping(uint256 => bool)) internal _bridgeVotingSlashed;\\n /// @dev The threshold to slash when a trusted organization does not vote for bridge operators.\\n uint256 internal _bridgeVotingThreshold;\\n /// @dev The amount of RON to slash bridge voting.\\n uint256 internal _bridgeVotingSlashAmount;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc ISlashBridgeVoting\\n */\\n function slashBridgeVoting(address _consensusAddr) external {\\n IRoninTrustedOrganization.TrustedOrganization memory _org = _roninTrustedOrganizationContract\\n .getTrustedOrganization(_consensusAddr);\\n uint256 _lastVotedBlock = Math.max(_roninGovernanceAdminContract.lastVotedBlock(_org.bridgeVoter), _org.addedBlock);\\n uint256 _period = _validatorContract.currentPeriod();\\n if (block.number - _lastVotedBlock > _bridgeVotingThreshold && !_bridgeVotingSlashed[_consensusAddr][_period]) {\\n _bridgeVotingSlashed[_consensusAddr][_period] = true;\\n emit Slashed(_consensusAddr, SlashType.BRIDGE_VOTING, _period);\\n _validatorContract.execSlash(_consensusAddr, 0, _bridgeVotingSlashAmount, false);\\n }\\n }\\n\\n /**\\n * @inheritdoc ISlashBridgeVoting\\n */\\n function getBridgeVotingSlashingConfigs()\\n external\\n view\\n override\\n returns (uint256 bridgeVotingThreshold_, uint256 bridgeVotingSlashAmount_)\\n {\\n return (_bridgeVotingThreshold, _bridgeVotingSlashAmount);\\n }\\n\\n /**\\n * @inheritdoc ISlashBridgeVoting\\n */\\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external override onlyAdmin {\\n _setBridgeVotingSlashingConfigs(_threshold, _slashAmount);\\n }\\n\\n /**\\n * @dev See `ISlashBridgeVoting-setBridgeVotingSlashingConfigs`.\\n */\\n function _setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) internal {\\n _bridgeVotingThreshold = _threshold;\\n _bridgeVotingSlashAmount = _slashAmount;\\n emit BridgeVotingSlashingConfigsUpdated(_threshold, _slashAmount);\\n }\\n}\\n\",\"keccak256\":\"0x962dede434213dccaa358651c526ab45331f8c5c0ec7565cd3596ba4ca483413\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/slash-indicator/ISlashDoubleSign.sol\\\";\\nimport \\\"../../precompile-usages/PCUValidateDoubleSign.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\n\\nabstract contract SlashDoubleSign is ISlashDoubleSign, HasValidatorContract, PCUValidateDoubleSign {\\n /// @dev The amount of RON to slash double sign.\\n uint256 internal _slashDoubleSignAmount;\\n /// @dev The block number that the punished validator will be jailed until, due to double signing.\\n uint256 internal _doubleSigningJailUntilBlock;\\n /** @dev The offset from the submitted block to the current block, from which double signing will be invalidated.\\n * This parameter is exposed for system transaction.\\n **/\\n uint256 internal _doubleSigningOffsetLimitBlock;\\n /// @dev Recording of submitted proof to prevent relay attack.\\n mapping(bytes32 => bool) _submittedEvidence;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] private ______gap;\\n\\n /**\\n * @inheritdoc ISlashDoubleSign\\n */\\n function slashDoubleSign(\\n address _consensusAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) external override onlyAdmin {\\n bytes32 _header1Checksum = keccak256(_header1);\\n bytes32 _header2Checksum = keccak256(_header2);\\n\\n require(\\n !_submittedEvidence[_header1Checksum] && !_submittedEvidence[_header2Checksum],\\n \\\"SlashDoubleSign: evidence already submitted\\\"\\n );\\n\\n if (_pcValidateEvidence(_consensusAddr, _header1, _header2)) {\\n uint256 _period = _validatorContract.currentPeriod();\\n _submittedEvidence[_header1Checksum] = true;\\n _submittedEvidence[_header2Checksum] = true;\\n emit Slashed(_consensusAddr, SlashType.DOUBLE_SIGNING, _period);\\n _validatorContract.execSlash(_consensusAddr, _doubleSigningJailUntilBlock, _slashDoubleSignAmount, true);\\n }\\n }\\n\\n /**\\n * @inheritdoc ISlashDoubleSign\\n */\\n function getDoubleSignSlashingConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 slashDoubleSignAmount_,\\n uint256 doubleSigningJailUntilBlock_,\\n uint256 doubleSigningOffsetLimitBlock_\\n )\\n {\\n return (_slashDoubleSignAmount, _doubleSigningJailUntilBlock, _doubleSigningOffsetLimitBlock);\\n }\\n\\n /**\\n * @inheritdoc ISlashDoubleSign\\n */\\n function setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _offsetLimitBlock\\n ) external override onlyAdmin {\\n _setDoubleSignSlashingConfigs(_slashAmount, _jailUntilBlock, _offsetLimitBlock);\\n }\\n\\n /**\\n * @dev See `ISlashDoubleSign-setDoubleSignSlashingConfigs`.\\n */\\n function _setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _offsetLimitBlock\\n ) internal {\\n _slashDoubleSignAmount = _slashAmount;\\n _doubleSigningJailUntilBlock = _jailUntilBlock;\\n _doubleSigningOffsetLimitBlock = _offsetLimitBlock;\\n emit DoubleSignSlashingConfigsUpdated(_slashAmount, _jailUntilBlock, _doubleSigningOffsetLimitBlock);\\n }\\n\\n /**\\n * @dev Returns whether the account `_addr` should be slashed or not.\\n */\\n function _shouldSlash(address _addr) internal view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xc0a3f6c59aa50b857e81fbb1ea1cb52ea631ddd1a0efb34b3619b1f4fd3a567a\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashIndicator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashIndicator.sol\\\";\\nimport \\\"./SlashDoubleSign.sol\\\";\\nimport \\\"./SlashBridgeVoting.sol\\\";\\nimport \\\"./SlashBridgeOperator.sol\\\";\\nimport \\\"./SlashUnavailability.sol\\\";\\nimport \\\"./CreditScore.sol\\\";\\n\\ncontract SlashIndicator is\\n ISlashIndicator,\\n SlashDoubleSign,\\n SlashBridgeVoting,\\n SlashBridgeOperator,\\n SlashUnavailability,\\n CreditScore,\\n Initializable\\n{\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n address __maintenanceContract,\\n address __roninTrustedOrganizationContract,\\n address __roninGovernanceAdminContract,\\n // _bridgeOperatorSlashingConfigs[0]: _missingVotesRatioTier1\\n // _bridgeOperatorSlashingConfigs[1]: _missingVotesRatioTier2\\n // _bridgeOperatorSlashingConfigs[2]: _jailDurationForMissingVotesRatioTier2\\n // _bridgeOperatorSlashingConfigs[3]: _skipBridgeOperatorSlashingThreshold\\n uint256[4] calldata _bridgeOperatorSlashingConfigs,\\n // _bridgeVotingSlashingConfigs[0]: _bridgeVotingThreshold\\n // _bridgeVotingSlashingConfigs[1]: _bridgeVotingSlashAmount\\n uint256[2] calldata _bridgeVotingSlashingConfigs,\\n // _doubleSignSlashingConfigs[0]: _slashDoubleSignAmount\\n // _doubleSignSlashingConfigs[1]: _doubleSigningJailUntilBlock\\n // _doubleSignSlashingConfigs[2]: _doubleSigningOffsetLimitBlock\\n uint256[3] calldata _doubleSignSlashingConfigs,\\n // _unavailabilitySlashingConfigs[0]: _unavailabilityTier1Threshold\\n // _unavailabilitySlashingConfigs[1]: _unavailabilityTier2Threshold\\n // _unavailabilitySlashingConfigs[2]: _slashAmountForUnavailabilityTier2Threshold\\n // _unavailabilitySlashingConfigs[3]: _jailDurationForUnavailabilityTier2Threshold\\n uint256[4] calldata _unavailabilitySlashingConfigs,\\n // _creditScoreConfigs[0]: _gainCreditScore\\n // _creditScoreConfigs[1]: _maxCreditScore\\n // _creditScoreConfigs[2]: _bailOutCostMultiplier\\n // _creditScoreConfigs[3]: _cutOffPercentageAfterBailout\\n uint256[4] calldata _creditScoreConfigs\\n ) external initializer {\\n _setValidatorContract(__validatorContract);\\n _setMaintenanceContract(__maintenanceContract);\\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\\n _setRoninGovernanceAdminContract(__roninGovernanceAdminContract);\\n _setBridgeOperatorSlashingConfigs(\\n _bridgeOperatorSlashingConfigs[0],\\n _bridgeOperatorSlashingConfigs[1],\\n _bridgeOperatorSlashingConfigs[2],\\n _bridgeOperatorSlashingConfigs[3]\\n );\\n _setBridgeVotingSlashingConfigs(_bridgeVotingSlashingConfigs[0], _bridgeVotingSlashingConfigs[1]);\\n _setDoubleSignSlashingConfigs(\\n _doubleSignSlashingConfigs[0],\\n _doubleSignSlashingConfigs[1],\\n _doubleSignSlashingConfigs[2]\\n );\\n _setUnavailabilitySlashingConfigs(\\n _unavailabilitySlashingConfigs[0],\\n _unavailabilitySlashingConfigs[1],\\n _unavailabilitySlashingConfigs[2],\\n _unavailabilitySlashingConfigs[3]\\n );\\n _setCreditScoreConfigs(\\n _creditScoreConfigs[0],\\n _creditScoreConfigs[1],\\n _creditScoreConfigs[2],\\n _creditScoreConfigs[3]\\n );\\n }\\n\\n /**\\n * @dev Helper for CreditScore contract to reset the indicator of the validator after bailing out.\\n */\\n function _setUnavailabilityIndicator(\\n address _validator,\\n uint256 _period,\\n uint256 _indicator\\n ) internal override(CreditScore, SlashUnavailability) {\\n SlashUnavailability._setUnavailabilityIndicator(_validator, _period, _indicator);\\n }\\n\\n /**\\n * @dev Helper for CreditScore contract to query indicator of the validator.\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period)\\n public\\n view\\n override(CreditScore, ISlashUnavailability, SlashUnavailability)\\n returns (uint256)\\n {\\n return SlashUnavailability.getUnavailabilityIndicator(_validator, _period);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period)\\n public\\n view\\n override(CreditScore, ICreditScore, SlashUnavailability)\\n returns (bool)\\n {\\n return CreditScore.checkBailedOutAtPeriod(_validator, _period);\\n }\\n\\n /**\\n * @dev Sanity check the address to be slashed\\n */\\n function _shouldSlash(address _addr) internal view override(SlashDoubleSign, SlashUnavailability) returns (bool) {\\n return\\n (msg.sender != _addr) &&\\n _validatorContract.isBlockProducer(_addr) &&\\n !_maintenanceContract.checkMaintained(_addr, block.number);\\n }\\n}\\n\",\"keccak256\":\"0x4e8ed6197fb42f52420fae0ebe09f46d891c5e6c56f4ee0fb8b3c2ffc879b648\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashUnavailability.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./CreditScore.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashUnavailability.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\n\\nabstract contract SlashUnavailability is ISlashUnavailability, HasValidatorContract {\\n /// @dev The last block that a validator is slashed for unavailability.\\n uint256 public lastUnavailabilitySlashedBlock;\\n /// @dev Mapping from validator address => period index => unavailability indicator.\\n mapping(address => mapping(uint256 => uint256)) internal _unavailabilityIndicator;\\n\\n /**\\n * @dev The mining reward will be deprecated, if (s)he missed more than this threshold.\\n * This threshold is applied for tier-1 and tier-3 of unavailability slash.\\n */\\n uint256 internal _unavailabilityTier1Threshold;\\n /**\\n * @dev The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\\n * self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\\n */\\n uint256 internal _unavailabilityTier2Threshold;\\n /**\\n * @dev The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with\\n * tier-2 or tier-3.\\n **/\\n uint256 internal _slashAmountForUnavailabilityTier2Threshold;\\n /// @dev The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\\n uint256 internal _jailDurationForUnavailabilityTier2Threshold;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n modifier oncePerBlock() {\\n require(\\n block.number > lastUnavailabilitySlashedBlock,\\n \\\"SlashIndicator: cannot slash a validator twice or slash more than one validator in one block\\\"\\n );\\n lastUnavailabilitySlashedBlock = block.number;\\n _;\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function slashUnavailability(address _validatorAddr) external override oncePerBlock {\\n require(msg.sender == block.coinbase, \\\"SlashUnavailability: method caller must be coinbase\\\");\\n if (!_shouldSlash(_validatorAddr)) {\\n // Should return instead of throwing error since this is a part of system transaction.\\n return;\\n }\\n\\n uint256 _period = _validatorContract.currentPeriod();\\n uint256 _count = ++_unavailabilityIndicator[_validatorAddr][_period];\\n\\n if (_count == _unavailabilityTier2Threshold) {\\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_2, _period);\\n _validatorContract.execSlash(\\n _validatorAddr,\\n block.number + _jailDurationForUnavailabilityTier2Threshold,\\n _slashAmountForUnavailabilityTier2Threshold,\\n false\\n );\\n } else if (_count == _unavailabilityTier1Threshold) {\\n bool _tier1SecondTime = checkBailedOutAtPeriod(_validatorAddr, _period);\\n if (!_tier1SecondTime) {\\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_1, _period);\\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\\n } else {\\n /// Handles tier-3\\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_3, _period);\\n uint256 _jailedUntilBlock = block.number + _jailDurationForUnavailabilityTier2Threshold;\\n _validatorContract.execSlash(\\n _validatorAddr,\\n _jailedUntilBlock,\\n _slashAmountForUnavailabilityTier2Threshold,\\n true\\n );\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) external override onlyAdmin {\\n _setUnavailabilitySlashingConfigs(\\n _tier1Threshold,\\n _tier2Threshold,\\n _slashAmountForTier2Threshold,\\n _jailDurationForTier2Threshold\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function getUnavailabilitySlashingConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 unavailabilityTier1Threshold_,\\n uint256 unavailabilityTier2Threshold_,\\n uint256 slashAmountForUnavailabilityTier2Threshold_,\\n uint256 jailDurationForUnavailabilityTier2Threshold_\\n )\\n {\\n return (\\n _unavailabilityTier1Threshold,\\n _unavailabilityTier2Threshold,\\n _slashAmountForUnavailabilityTier2Threshold,\\n _jailDurationForUnavailabilityTier2Threshold\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function currentUnavailabilityIndicator(address _validator) external view override returns (uint256) {\\n return getUnavailabilityIndicator(_validator, _validatorContract.currentPeriod());\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period)\\n public\\n view\\n virtual\\n override\\n returns (uint256)\\n {\\n return _unavailabilityIndicator[_validator][_period];\\n }\\n\\n /**\\n * @dev Sets the unavailability indicator of the `_validator` at `_period`.\\n */\\n function _setUnavailabilityIndicator(\\n address _validator,\\n uint256 _period,\\n uint256 _indicator\\n ) internal virtual {\\n _unavailabilityIndicator[_validator][_period] = _indicator;\\n }\\n\\n /**\\n * @dev See `ISlashUnavailability-setUnavailabilitySlashingConfigs`.\\n */\\n function _setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) internal {\\n require(_unavailabilityTier1Threshold <= _unavailabilityTier2Threshold, \\\"SlashUnavailability: invalid threshold\\\");\\n _unavailabilityTier1Threshold = _tier1Threshold;\\n _unavailabilityTier2Threshold = _tier2Threshold;\\n _slashAmountForUnavailabilityTier2Threshold = _slashAmountForTier2Threshold;\\n _jailDurationForUnavailabilityTier2Threshold = _jailDurationForTier2Threshold;\\n emit UnavailabilitySlashingConfigsUpdated(\\n _tier1Threshold,\\n _tier2Threshold,\\n _slashAmountForTier2Threshold,\\n _jailDurationForTier2Threshold\\n );\\n }\\n\\n /**\\n * @dev Returns whether the account `_addr` should be slashed or not.\\n */\\n function _shouldSlash(address _addr) internal view virtual returns (bool);\\n\\n /**\\n * @dev See `ICreditScore-checkBailedOutAtPeriod`\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xc5ed1a1835d2cdf08db97a1613a29a2d86aaa7c5c480dad5aa9089c2faa59671\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e7565b61011354610100900460ff1615620000905760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b6101135460ff9081161015620000e557610113805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b612e1780620000f76000396000f3fe608060405234801561001057600080fd5b50600436106101fb5760003560e01c8063994390891161011a578063d1737e27116100ad578063d73e81b81161007c578063d73e81b81461046d578063df4b6ee014610480578063f1001e78146104a4578063f562b3c4146104c4578063fd422cd0146104cd57600080fd5b8063d1737e271461040d578063d1f992f714610420578063d2cb215e14610433578063d3dd2bdf1461044457600080fd5b8063c6391fa2116100e9578063c6391fa2146103c3578063ccbb72ed146103d4578063cdf64a76146103e7578063cf39d13c146103fa57600080fd5b80639943908914610371578063b5e337de14610382578063c008ce3914610395578063c2e524dc146103a857600080fd5b80633d48fd7d116101925780637680850c116101615780637680850c146103315780637c2b55a014610344578063853af1b71461034b57806399103f7b1461035e57600080fd5b80633d48fd7d146102e957806346fe9311146102fa5780635511cde11461030d57806362ffe6cb1461031e57600080fd5b80631a697341116101ce5780631a6973411461027b5780631e90b2a01461028e57806323368e47146102a157806329ddc3c0146102c657600080fd5b806307c2d2f614610200578063082e7420146102155780630e1512ac1461023b5780631079402a1461024e575b600080fd5b61021361020e36600461260c565b6104e0565b005b610228610223366004612663565b610626565b6040519081526020015b60405180910390f35b610213610249366004612680565b6106a7565b606d54606e54606f546070545b604080519485526020850193909352918301526060820152608001610232565b610213610289366004612663565b6106fa565b61021361029c3660046126f4565b610977565b6036546001600160a01b03165b6040516001600160a01b039091168152602001610232565b6102d96102d4366004612777565b610bdc565b6040519015158152602001610232565b60a55460a65460a75460a85461025b565b610213610308366004612663565b610c0b565b6035546001600160a01b03166102ae565b61022861032c366004612777565b610c7a565b61021361033f3660046127a3565b610ca3565b60676102ae565b6102136103593660046127ef565b611001565b61021361036c366004612822565b611047565b6000546001600160a01b03166102ae565b610213610390366004612663565b6111f1565b6102136103a33660046128e6565b61125d565b60385460395460408051928352602083019190915201610232565b60dd5460de5460df5460e05461025b565b6102136103e2366004612680565b61130d565b6102136103f5366004612663565b611351565b61021361040836600461291b565b6113bd565b61021361041b366004612680565b611400565b61021361042e366004612663565b611444565b606c546001600160a01b03166102ae565b610228610452366004612663565b6001600160a01b0316600090815260dc602052604090205490565b61021361047b366004612663565b6119b9565b60015460025460035460408051938452602084019290925290820152606001610232565b6104b76104b236600461260c565b611a25565b6040516102329190612982565b61022860a35481565b6102136104db366004612663565b611afa565b336104f36000546001600160a01b031690565b6001600160a01b03161461051a57604051630e6444a160e31b815260040160405180910390fd5b60008167ffffffffffffffff81111561053557610535612995565b60405190808252806020026020018201604052801561055e578160200160208202803683370190505b50905060005b828110156105e5576000848483818110610580576105806129ab565b90506020020160208101906105959190612663565b6001600160a01b038116600090815260dc602052604081205583519091508390839081106105c5576105c56129ab565b6020026020010160008152505080806105dd906129d7565b915050610564565b507f8c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c2348083838360405161061993929190612a2e565b60405180910390a1505050565b60006106a18260008054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa15801561067d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032c9190612a5e565b92915050565b6106af611eea565b6001600160a01b0316336001600160a01b0316146106e85760405162461bcd60e51b81526004016106df90612a77565b60405180910390fd5b6106f484848484611f18565b50505050565b603554604051636db349d160e11b81526001600160a01b038381166004830152600092169063db6693a29060240160a060405180830381865afa158015610745573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107699190612aea565b6036546040828101519051632623bd4f60e21b81526001600160a01b0391821660048201529293506000926107f192919091169063988ef53c90602401602060405180830381865afa1580156107c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e79190612a5e565b8360800151611fe7565b905060008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086b9190612a5e565b60385490915061087b8343612b72565b1180156108ac57506001600160a01b038416600090815260376020908152604080832084845290915290205460ff16155b156106f4576001600160a01b038416600081815260376020908152604080832085845290915290819020805460ff1916600117905551600080516020612dc283398151915290610900906004908590612b85565b60405180910390a260008054603954604051630bde081360e21b81526001600160a01b0390921692632f78204c9261093f928992918290600401612bb1565b600060405180830381600087803b15801561095957600080fd5b505af115801561096d573d6000803e3d6000fd5b5050505050505050565b61097f611eea565b6001600160a01b0316336001600160a01b0316146109af5760405162461bcd60e51b81526004016106df90612a77565b600084846040516109c1929190612bd9565b60405180910390209050600083836040516109dd929190612bd9565b604080519182900390912060008481526004602052919091205490915060ff16158015610a19575060008181526004602052604090205460ff16155b610a795760405162461bcd60e51b815260206004820152602b60248201527f536c617368446f75626c655369676e3a2065766964656e636520616c7265616460448201526a1e481cdd589b5a5d1d195960aa1b60648201526084016106df565b610a868787878787611ffe565b15610bd35760008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b039190612a5e565b6000848152600460205260408082208054600160ff19918216811790925586845292829020805490931617909155519091506001600160a01b03891690600080516020612dc283398151915290610b5e906003908590612b85565b60405180910390a260005460025460018054604051630bde081360e21b81526001600160a01b0390941693632f78204c93610b9f938e939192600401612bb1565b600060405180830381600087803b158015610bb957600080fd5b505af1158015610bcd573d6000803e3d6000fd5b50505050505b50505050505050565b6001600160a01b038216600090815260db6020908152604080832084845290915281205460ff165b9392505050565b610c13611eea565b6001600160a01b0316336001600160a01b031614610c435760405162461bcd60e51b81526004016106df90612a77565b806001600160a01b03163b600003610c6e57604051637bcd509160e01b815260040160405180910390fd5b610c77816120a8565b50565b6001600160a01b038216600090815260a460209081526040808320848452909152812054610c04565b33610cb66000546001600160a01b031690565b6001600160a01b031614610cdd57604051630e6444a160e31b815260040160405180910390fd5b60008060009054906101000a90046001600160a01b03166001600160a01b031663297a8fca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d559190612a5e565b60008054604051634de2b73560e01b815292935090916001600160a01b0390911690634de2b73590610d8d9088908890600401612be9565b600060405180830381865afa158015610daa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dd29190810190612c12565b606c5460405163ba30375560e01b81529192506000916001600160a01b039091169063ba30375590610e0e908990899088904390600401612cbf565b600060405180830381865afa158015610e2b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e539190810190612c12565b905060008567ffffffffffffffff811115610e7057610e70612995565b604051908082528060200260200182016040528015610e99578160200160208202803683370190505b50905060005b86811015610fbc576000888883818110610ebb57610ebb6129ab565b9050602002016020810190610ed09190612663565b90506000610ede8289610c7a565b90506000868481518110610ef457610ef46129ab565b602002602001015190506000868581518110610f1257610f126129ab565b6020026020010151905060008280610f275750815b610f3c57610f3760dd54856120fd565b610f3f565b60005b6001600160a01b038616600090815260dc602052604090205460de54919250610f69918390612113565b6001600160a01b038616600090815260dc602052604090208190558751889088908110610f9857610f986129ab565b60200260200101818152505050505050508080610fb4906129d7565b915050610e9f565b507f8c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c23480878783604051610ff093929190612a2e565b60405180910390a150505050505050565b611009611eea565b6001600160a01b0316336001600160a01b0316146110395760405162461bcd60e51b81526004016106df90612a77565b6110438282612130565b5050565b61011354610100900460ff1615808015611069575061011354600160ff909116105b806110845750303b15801561108457506101135460ff166001145b6110e75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106df565b610113805460ff19166001179055801561110c57610113805461ff0019166101001790555b6111158a612177565b61111e896120a8565b611127886121c5565b61113087612213565b61114986356020880135604089013560608a0135611f18565b61115885356020870135612130565b61116c843560208601356040870135612261565b61118583356020850135604086013560608701356122ae565b61119e823560208401356040850135606086013561236a565b80156111e557610113805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b6111f9611eea565b6001600160a01b0316336001600160a01b0316146112295760405162461bcd60e51b81526004016106df90612a77565b806001600160a01b03163b60000361125457604051637bcd509160e01b815260040160405180910390fd5b610c77816121c5565b336112706000546001600160a01b031690565b6001600160a01b03161461129757604051630e6444a160e31b815260040160405180910390fd5b816001036112d657826001600160a01b0316600080516020612dc28339815191526005836040516112c9929190612b85565b60405180910390a2505050565b8160020361130857826001600160a01b0316600080516020612dc28339815191526006836040516112c9929190612b85565b505050565b611315611eea565b6001600160a01b0316336001600160a01b0316146113455760405162461bcd60e51b81526004016106df90612a77565b6106f48484848461236a565b611359611eea565b6001600160a01b0316336001600160a01b0316146113895760405162461bcd60e51b81526004016106df90612a77565b806001600160a01b03163b6000036113b457604051637bcd509160e01b815260040160405180910390fd5b610c7781612177565b6113c5611eea565b6001600160a01b0316336001600160a01b0316146113f55760405162461bcd60e51b81526004016106df90612a77565b611308838383612261565b611408611eea565b6001600160a01b0316336001600160a01b0316146114385760405162461bcd60e51b81526004016106df90612a77565b6106f4848484846122ae565b600054604051635061f96960e11b81526001600160a01b0383811660048301529091169063a0c3f2d290602401602060405180830381865afa15801561148e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b29190612ce6565b6115245760405162461bcd60e51b815260206004820152603f60248201527f536c617368496e64696361746f723a20636f6e73656e7375732061646472657360448201527f73206d75737420626520612076616c696461746f722063616e6469646174650060648201526084016106df565b6000546040516304d971ab60e01b81526001600160a01b038381166004830152336024830152909116906304d971ab90604401602060405180830381865afa158015611574573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115989190612ce6565b61160a5760405162461bcd60e51b815260206004820152603760248201527f536c617368496e64696361746f723a206d6574686f642063616c6c6572206d7560448201527f737420626520612063616e6469646174652061646d696e00000000000000000060648201526084016106df565b60008054604051634b2c2fe160e11b81526001600160a01b038481166004830152839216906396585fc290602401606060405180830381865afa158015611655573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116799190612d01565b9250509150816116f15760405162461bcd60e51b815260206004820152603b60248201527f536c617368496e64696361746f723a2063616c6c6572206d757374206265206a60448201527f61696c656420696e207468652063757272656e7420706572696f64000000000060648201526084016106df565b60008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015611745573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117699190612a5e565b6001600160a01b038516600090815260db6020908152604080832084845290915290205490915060ff16156117fc5760405162461bcd60e51b815260206004820152603360248201527f536c617368496e64696361746f723a2076616c696461746f7220686173206261604482015272696c6564206f75742070726576696f75736c7960681b60648201526084016106df565b6001600160a01b038416600090815260dc602052604081205460df549091906118259085612d36565b9050808210156118955760405162461bcd60e51b815260206004820152603560248201527f536c617368496e64696361746f723a20696e73756666696369656e7420637265604482015274191a5d081cd8dbdc99481d1bc818985a5b081bdd5d605a1b60648201526084016106df565b600054604051630adaf5ef60e11b81526001600160a01b03888116600483015260248201869052909116906315b5ebde90604401600060405180830381600087803b1580156118e357600080fd5b505af11580156118f7573d6000803e3d6000fd5b505050506001600160a01b038616600090815260dc602052604081208054839290611923908490612b72565b90915550506001600160a01b038616600090815260a4602090815260408083208684529091528120556001600160a01b038616600081815260db60209081526040808320878452825291829020805460ff1916600117905581518681529081018490527f7ff9f7032d565c7e8919332964b2faa33c320b53604a65d9dd1f8112e12cd39d910160405180910390a2505050505050565b6119c1611eea565b6001600160a01b0316336001600160a01b0316146119f15760405162461bcd60e51b81526004016106df90612a77565b806001600160a01b03163b600003611a1c57604051637bcd509160e01b815260040160405180910390fd5b610c7781612213565b60608167ffffffffffffffff811115611a4057611a40612995565b604051908082528060200260200182016040528015611a69578160200160208202803683370190505b50905060005b8151811015611af35760dc6000858584818110611a8e57611a8e6129ab565b9050602002016020810190611aa39190612663565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110611ad657611ad66129ab565b602090810291909101015280611aeb816129d7565b915050611a6f565b5092915050565b60a3544311611b975760405162461bcd60e51b815260206004820152605c60248201527f536c617368496e64696361746f723a2063616e6e6f7420736c6173682061207660448201527f616c696461746f72207477696365206f7220736c617368206d6f72652074686160648201527f6e206f6e652076616c696461746f7220696e206f6e6520626c6f636b00000000608482015260a4016106df565b4360a355334114611c065760405162461bcd60e51b815260206004820152603360248201527f536c617368556e617661696c6162696c6974793a206d6574686f642063616c6c6044820152726572206d75737420626520636f696e6261736560681b60648201526084016106df565b611c0f8161248d565b15610c775760008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8c9190612a5e565b6001600160a01b038316600090815260a4602090815260408083208484529091528120805492935090918290611cc1906129d7565b919050819055905060a6548103611d7a57826001600160a01b0316600080516020612dc2833981519152600284604051611cfc929190612b85565b60405180910390a260005460a8546001600160a01b0390911690632f78204c908590611d289043612d4d565b60a75460006040518563ffffffff1660e01b8152600401611d4c9493929190612bb1565b600060405180830381600087803b158015611d6657600080fd5b505af1158015610bd3573d6000803e3d6000fd5b60a5548103611308576000611d8f8484610bdc565b905080611e3457836001600160a01b0316600080516020612dc2833981519152600185604051611dc0929190612b85565b60405180910390a260008054604051630bde081360e21b81526001600160a01b0390911691632f78204c91611dfd91889181908190600401612bb1565b600060405180830381600087803b158015611e1757600080fd5b505af1158015611e2b573d6000803e3d6000fd5b505050506106f4565b836001600160a01b0316600080516020612dc2833981519152600785604051611e5e929190612b85565b60405180910390a2600060a85443611e769190612d4d565b60005460a754604051630bde081360e21b81529293506001600160a01b0390911691632f78204c91611eb19189918691600190600401612bb1565b600060405180830381600087803b158015611ecb57600080fd5b505af1158015611edf573d6000803e3d6000fd5b505050505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b828411158015611f2a57506127108411155b8015611f3857506127108311155b611f845760405162461bcd60e51b815260206004820152601e60248201527f536c617368496e64696361746f723a20696e76616c696420726174696f73000060448201526064016106df565b606d849055606e839055606f82905560708190556040805185815260208101859052908101839052606081018290527fd24c671da2227c139fe1a5b34de15e5a67bef9b46e912916b9e0d025d51b3e3b906080015b60405180910390a150505050565b600081831015611ff75781610c04565b5090919050565b6040516000906067906001908390612022908a908a908a908a908a90602401612d89565b60408051601f198184030181529190526020810180516001600160e01b0316637fc3567760e01b17905280519091506120596125a2565b602083016020828483895afa61206e57600094505b503d61207957600093505b8361209757604051630fc2632160e01b815260040160405180910390fd5b5115159a9950505050505050505050565b606c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f31a33f126a5bae3c5bdf6cfc2cd6dcfffe2fe9634bdb09e21c44762993889e3b906020015b60405180910390a150565b60006121098383612593565b610c049084612b72565b60006121286121228486612d4d565b83612593565b949350505050565b6038829055603981905560408051838152602081018390527fbda9ec2980d7468ba6a9f363696315affca9f9770016396bdea2ac39c3e5d61a910160405180910390a15050565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906020016120f2565b603580546001600160a01b0319166001600160a01b0383169081179091556040519081527ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d7906020016120f2565b603680546001600160a01b0319166001600160a01b0383169081179091556040519081527f9125df97e014f5cc4f107fd784acd35e8e2188ca7c2a0f7caa478365747c1c83906020016120f2565b60018390556002829055600381905560408051848152602081018490529081018290527f913da102149f952dde560cef3349db8e8002e9d580c41a7551d6d45329f4306b90606001610619565b60a65460a55411156123115760405162461bcd60e51b815260206004820152602660248201527f536c617368556e617661696c6162696c6974793a20696e76616c696420746872604482015265195cda1bdb1960d21b60648201526084016106df565b60a584905560a683905560a782905560a88190556040805185815260208101859052908101839052606081018290527f442862e6143ad95854e7c13ff4947ec6e43bc87160e3b193e7c1abaf6e3aaa9890608001611fd9565b828411156123cb5760405162461bcd60e51b815260206004820152602860248201527f43726564697453636f72653a20696e76616c6964206372656469742073636f726044820152676520636f6e66696760c01b60648201526084016106df565b6127108111156124345760405162461bcd60e51b815260206004820152602e60248201527f43726564697453636f72653a20696e76616c696420637574206f66662070657260448201526d63656e7461676520636f6e66696760901b60648201526084016106df565b60dd84905560de83905560df82905560e08190556040805185815260208101859052908101839052606081018290527fe1f9c6c73554b5fa140eead3cfd4ec3e6d4824f3ed26fb25e38376f65b95470b90608001611fd9565b6000336001600160a01b038316148015906125115750600054604051633292276760e11b81526001600160a01b038481166004830152909116906365244ece90602401602060405180830381865afa1580156124ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125119190612ce6565b80156106a15750606c54604051630fbeb37f60e01b81526001600160a01b03848116600483015243602483015290911690630fbeb37f90604401602060405180830381865afa158015612568573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061258c9190612ce6565b1592915050565b6000818310611ff75781610c04565b60405180602001604052806001906020820280368337509192915050565b60008083601f8401126125d257600080fd5b50813567ffffffffffffffff8111156125ea57600080fd5b6020830191508360208260051b850101111561260557600080fd5b9250929050565b6000806020838503121561261f57600080fd5b823567ffffffffffffffff81111561263657600080fd5b612642858286016125c0565b90969095509350505050565b6001600160a01b0381168114610c7757600080fd5b60006020828403121561267557600080fd5b8135610c048161264e565b6000806000806080858703121561269657600080fd5b5050823594602084013594506040840135936060013592509050565b60008083601f8401126126c457600080fd5b50813567ffffffffffffffff8111156126dc57600080fd5b60208301915083602082850101111561260557600080fd5b60008060008060006060868803121561270c57600080fd5b85356127178161264e565b9450602086013567ffffffffffffffff8082111561273457600080fd5b61274089838a016126b2565b9096509450604088013591508082111561275957600080fd5b50612766888289016126b2565b969995985093965092949392505050565b6000806040838503121561278a57600080fd5b82356127958161264e565b946020939093013593505050565b6000806000604084860312156127b857600080fd5b833567ffffffffffffffff8111156127cf57600080fd5b6127db868287016125c0565b909790965060209590950135949350505050565b6000806040838503121561280257600080fd5b50508035926020909101359150565b80608081018310156106a157600080fd5b60008060008060008060008060006102a08a8c03121561284157600080fd5b893561284c8161264e565b985060208a013561285c8161264e565b975060408a013561286c8161264e565b965060608a013561287c8161264e565b955061288b8b60808c01612811565b94506101408a018b81111561289f57600080fd5b6101008b0194506101a08b018c8111156128b857600080fd5b8194506128c58d82612811565b935050506128d78b6102208c01612811565b90509295985092959850929598565b6000806000606084860312156128fb57600080fd5b83356129068161264e565b95602085013595506040909401359392505050565b60008060006060848603121561293057600080fd5b505081359360208301359350604090920135919050565b600081518084526020808501945080840160005b838110156129775781518752958201959082019060010161295b565b509495945050505050565b602081526000610c046020830184612947565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016129e9576129e96129c1565b5060010190565b8183526000602080850194508260005b85811015612977578135612a138161264e565b6001600160a01b031687529582019590820190600101612a00565b604081526000612a426040830185876129f0565b8281036020840152612a548185612947565b9695505050505050565b600060208284031215612a7057600080fd5b5051919050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff81118282101715612ae257612ae2612995565b604052919050565b600060a08284031215612afc57600080fd5b60405160a0810181811067ffffffffffffffff82111715612b1f57612b1f612995565b6040528251612b2d8161264e565b81526020830151612b3d8161264e565b60208201526040830151612b508161264e565b6040820152606083810151908201526080928301519281019290925250919050565b818103818111156106a1576106a16129c1565b6040810160088410612ba757634e487b7160e01b600052602160045260246000fd5b9281526020015290565b6001600160a01b03949094168452602084019290925260408301521515606082015260800190565b8183823760009101908152919050565b6020815260006121286020830184866129f0565b80518015158114612c0d57600080fd5b919050565b60006020808385031215612c2557600080fd5b825167ffffffffffffffff80821115612c3d57600080fd5b818501915085601f830112612c5157600080fd5b815181811115612c6357612c63612995565b8060051b9150612c74848301612ab9565b8181529183018401918481019088841115612c8e57600080fd5b938501935b83851015612cb357612ca485612bfd565b82529385019390850190612c93565b98975050505050505050565b606081526000612cd36060830186886129f0565b6020830194909452506040015292915050565b600060208284031215612cf857600080fd5b610c0482612bfd565b600080600060608486031215612d1657600080fd5b612d1f84612bfd565b925060208401519150604084015190509250925092565b80820281158282048414176106a1576106a16129c1565b808201808211156106a1576106a16129c1565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090612dae9083018688612d60565b8281036040840152612cb3818587612d6056fe607adba66cff84b627e3537d1c17d088a98556bccd0536a2f3590c56329023d9a264697066735822122052d46937559c29bd9386fa6f5c433cfee33a300aab406a067ccda8dc1528309464736f6c63430008110033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106101fb5760003560e01c8063994390891161011a578063d1737e27116100ad578063d73e81b81161007c578063d73e81b81461046d578063df4b6ee014610480578063f1001e78146104a4578063f562b3c4146104c4578063fd422cd0146104cd57600080fd5b8063d1737e271461040d578063d1f992f714610420578063d2cb215e14610433578063d3dd2bdf1461044457600080fd5b8063c6391fa2116100e9578063c6391fa2146103c3578063ccbb72ed146103d4578063cdf64a76146103e7578063cf39d13c146103fa57600080fd5b80639943908914610371578063b5e337de14610382578063c008ce3914610395578063c2e524dc146103a857600080fd5b80633d48fd7d116101925780637680850c116101615780637680850c146103315780637c2b55a014610344578063853af1b71461034b57806399103f7b1461035e57600080fd5b80633d48fd7d146102e957806346fe9311146102fa5780635511cde11461030d57806362ffe6cb1461031e57600080fd5b80631a697341116101ce5780631a6973411461027b5780631e90b2a01461028e57806323368e47146102a157806329ddc3c0146102c657600080fd5b806307c2d2f614610200578063082e7420146102155780630e1512ac1461023b5780631079402a1461024e575b600080fd5b61021361020e36600461260c565b6104e0565b005b610228610223366004612663565b610626565b6040519081526020015b60405180910390f35b610213610249366004612680565b6106a7565b606d54606e54606f546070545b604080519485526020850193909352918301526060820152608001610232565b610213610289366004612663565b6106fa565b61021361029c3660046126f4565b610977565b6036546001600160a01b03165b6040516001600160a01b039091168152602001610232565b6102d96102d4366004612777565b610bdc565b6040519015158152602001610232565b60a55460a65460a75460a85461025b565b610213610308366004612663565b610c0b565b6035546001600160a01b03166102ae565b61022861032c366004612777565b610c7a565b61021361033f3660046127a3565b610ca3565b60676102ae565b6102136103593660046127ef565b611001565b61021361036c366004612822565b611047565b6000546001600160a01b03166102ae565b610213610390366004612663565b6111f1565b6102136103a33660046128e6565b61125d565b60385460395460408051928352602083019190915201610232565b60dd5460de5460df5460e05461025b565b6102136103e2366004612680565b61130d565b6102136103f5366004612663565b611351565b61021361040836600461291b565b6113bd565b61021361041b366004612680565b611400565b61021361042e366004612663565b611444565b606c546001600160a01b03166102ae565b610228610452366004612663565b6001600160a01b0316600090815260dc602052604090205490565b61021361047b366004612663565b6119b9565b60015460025460035460408051938452602084019290925290820152606001610232565b6104b76104b236600461260c565b611a25565b6040516102329190612982565b61022860a35481565b6102136104db366004612663565b611afa565b336104f36000546001600160a01b031690565b6001600160a01b03161461051a57604051630e6444a160e31b815260040160405180910390fd5b60008167ffffffffffffffff81111561053557610535612995565b60405190808252806020026020018201604052801561055e578160200160208202803683370190505b50905060005b828110156105e5576000848483818110610580576105806129ab565b90506020020160208101906105959190612663565b6001600160a01b038116600090815260dc602052604081205583519091508390839081106105c5576105c56129ab565b6020026020010160008152505080806105dd906129d7565b915050610564565b507f8c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c2348083838360405161061993929190612a2e565b60405180910390a1505050565b60006106a18260008054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa15801561067d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061032c9190612a5e565b92915050565b6106af611eea565b6001600160a01b0316336001600160a01b0316146106e85760405162461bcd60e51b81526004016106df90612a77565b60405180910390fd5b6106f484848484611f18565b50505050565b603554604051636db349d160e11b81526001600160a01b038381166004830152600092169063db6693a29060240160a060405180830381865afa158015610745573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107699190612aea565b6036546040828101519051632623bd4f60e21b81526001600160a01b0391821660048201529293506000926107f192919091169063988ef53c90602401602060405180830381865afa1580156107c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107e79190612a5e565b8360800151611fe7565b905060008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610847573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086b9190612a5e565b60385490915061087b8343612b72565b1180156108ac57506001600160a01b038416600090815260376020908152604080832084845290915290205460ff16155b156106f4576001600160a01b038416600081815260376020908152604080832085845290915290819020805460ff1916600117905551600080516020612dc283398151915290610900906004908590612b85565b60405180910390a260008054603954604051630bde081360e21b81526001600160a01b0390921692632f78204c9261093f928992918290600401612bb1565b600060405180830381600087803b15801561095957600080fd5b505af115801561096d573d6000803e3d6000fd5b5050505050505050565b61097f611eea565b6001600160a01b0316336001600160a01b0316146109af5760405162461bcd60e51b81526004016106df90612a77565b600084846040516109c1929190612bd9565b60405180910390209050600083836040516109dd929190612bd9565b604080519182900390912060008481526004602052919091205490915060ff16158015610a19575060008181526004602052604090205460ff16155b610a795760405162461bcd60e51b815260206004820152602b60248201527f536c617368446f75626c655369676e3a2065766964656e636520616c7265616460448201526a1e481cdd589b5a5d1d195960aa1b60648201526084016106df565b610a868787878787611ffe565b15610bd35760008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610adf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b039190612a5e565b6000848152600460205260408082208054600160ff19918216811790925586845292829020805490931617909155519091506001600160a01b03891690600080516020612dc283398151915290610b5e906003908590612b85565b60405180910390a260005460025460018054604051630bde081360e21b81526001600160a01b0390941693632f78204c93610b9f938e939192600401612bb1565b600060405180830381600087803b158015610bb957600080fd5b505af1158015610bcd573d6000803e3d6000fd5b50505050505b50505050505050565b6001600160a01b038216600090815260db6020908152604080832084845290915281205460ff165b9392505050565b610c13611eea565b6001600160a01b0316336001600160a01b031614610c435760405162461bcd60e51b81526004016106df90612a77565b806001600160a01b03163b600003610c6e57604051637bcd509160e01b815260040160405180910390fd5b610c77816120a8565b50565b6001600160a01b038216600090815260a460209081526040808320848452909152812054610c04565b33610cb66000546001600160a01b031690565b6001600160a01b031614610cdd57604051630e6444a160e31b815260040160405180910390fd5b60008060009054906101000a90046001600160a01b03166001600160a01b031663297a8fca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d559190612a5e565b60008054604051634de2b73560e01b815292935090916001600160a01b0390911690634de2b73590610d8d9088908890600401612be9565b600060405180830381865afa158015610daa573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610dd29190810190612c12565b606c5460405163ba30375560e01b81529192506000916001600160a01b039091169063ba30375590610e0e908990899088904390600401612cbf565b600060405180830381865afa158015610e2b573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e539190810190612c12565b905060008567ffffffffffffffff811115610e7057610e70612995565b604051908082528060200260200182016040528015610e99578160200160208202803683370190505b50905060005b86811015610fbc576000888883818110610ebb57610ebb6129ab565b9050602002016020810190610ed09190612663565b90506000610ede8289610c7a565b90506000868481518110610ef457610ef46129ab565b602002602001015190506000868581518110610f1257610f126129ab565b6020026020010151905060008280610f275750815b610f3c57610f3760dd54856120fd565b610f3f565b60005b6001600160a01b038616600090815260dc602052604090205460de54919250610f69918390612113565b6001600160a01b038616600090815260dc602052604090208190558751889088908110610f9857610f986129ab565b60200260200101818152505050505050508080610fb4906129d7565b915050610e9f565b507f8c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c23480878783604051610ff093929190612a2e565b60405180910390a150505050505050565b611009611eea565b6001600160a01b0316336001600160a01b0316146110395760405162461bcd60e51b81526004016106df90612a77565b6110438282612130565b5050565b61011354610100900460ff1615808015611069575061011354600160ff909116105b806110845750303b15801561108457506101135460ff166001145b6110e75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016106df565b610113805460ff19166001179055801561110c57610113805461ff0019166101001790555b6111158a612177565b61111e896120a8565b611127886121c5565b61113087612213565b61114986356020880135604089013560608a0135611f18565b61115885356020870135612130565b61116c843560208601356040870135612261565b61118583356020850135604086013560608701356122ae565b61119e823560208401356040850135606086013561236a565b80156111e557610113805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b6111f9611eea565b6001600160a01b0316336001600160a01b0316146112295760405162461bcd60e51b81526004016106df90612a77565b806001600160a01b03163b60000361125457604051637bcd509160e01b815260040160405180910390fd5b610c77816121c5565b336112706000546001600160a01b031690565b6001600160a01b03161461129757604051630e6444a160e31b815260040160405180910390fd5b816001036112d657826001600160a01b0316600080516020612dc28339815191526005836040516112c9929190612b85565b60405180910390a2505050565b8160020361130857826001600160a01b0316600080516020612dc28339815191526006836040516112c9929190612b85565b505050565b611315611eea565b6001600160a01b0316336001600160a01b0316146113455760405162461bcd60e51b81526004016106df90612a77565b6106f48484848461236a565b611359611eea565b6001600160a01b0316336001600160a01b0316146113895760405162461bcd60e51b81526004016106df90612a77565b806001600160a01b03163b6000036113b457604051637bcd509160e01b815260040160405180910390fd5b610c7781612177565b6113c5611eea565b6001600160a01b0316336001600160a01b0316146113f55760405162461bcd60e51b81526004016106df90612a77565b611308838383612261565b611408611eea565b6001600160a01b0316336001600160a01b0316146114385760405162461bcd60e51b81526004016106df90612a77565b6106f4848484846122ae565b600054604051635061f96960e11b81526001600160a01b0383811660048301529091169063a0c3f2d290602401602060405180830381865afa15801561148e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114b29190612ce6565b6115245760405162461bcd60e51b815260206004820152603f60248201527f536c617368496e64696361746f723a20636f6e73656e7375732061646472657360448201527f73206d75737420626520612076616c696461746f722063616e6469646174650060648201526084016106df565b6000546040516304d971ab60e01b81526001600160a01b038381166004830152336024830152909116906304d971ab90604401602060405180830381865afa158015611574573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115989190612ce6565b61160a5760405162461bcd60e51b815260206004820152603760248201527f536c617368496e64696361746f723a206d6574686f642063616c6c6572206d7560448201527f737420626520612063616e6469646174652061646d696e00000000000000000060648201526084016106df565b60008054604051634b2c2fe160e11b81526001600160a01b038481166004830152839216906396585fc290602401606060405180830381865afa158015611655573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116799190612d01565b9250509150816116f15760405162461bcd60e51b815260206004820152603b60248201527f536c617368496e64696361746f723a2063616c6c6572206d757374206265206a60448201527f61696c656420696e207468652063757272656e7420706572696f64000000000060648201526084016106df565b60008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015611745573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117699190612a5e565b6001600160a01b038516600090815260db6020908152604080832084845290915290205490915060ff16156117fc5760405162461bcd60e51b815260206004820152603360248201527f536c617368496e64696361746f723a2076616c696461746f7220686173206261604482015272696c6564206f75742070726576696f75736c7960681b60648201526084016106df565b6001600160a01b038416600090815260dc602052604081205460df549091906118259085612d36565b9050808210156118955760405162461bcd60e51b815260206004820152603560248201527f536c617368496e64696361746f723a20696e73756666696369656e7420637265604482015274191a5d081cd8dbdc99481d1bc818985a5b081bdd5d605a1b60648201526084016106df565b600054604051630adaf5ef60e11b81526001600160a01b03888116600483015260248201869052909116906315b5ebde90604401600060405180830381600087803b1580156118e357600080fd5b505af11580156118f7573d6000803e3d6000fd5b505050506001600160a01b038616600090815260dc602052604081208054839290611923908490612b72565b90915550506001600160a01b038616600090815260a4602090815260408083208684529091528120556001600160a01b038616600081815260db60209081526040808320878452825291829020805460ff1916600117905581518681529081018490527f7ff9f7032d565c7e8919332964b2faa33c320b53604a65d9dd1f8112e12cd39d910160405180910390a2505050505050565b6119c1611eea565b6001600160a01b0316336001600160a01b0316146119f15760405162461bcd60e51b81526004016106df90612a77565b806001600160a01b03163b600003611a1c57604051637bcd509160e01b815260040160405180910390fd5b610c7781612213565b60608167ffffffffffffffff811115611a4057611a40612995565b604051908082528060200260200182016040528015611a69578160200160208202803683370190505b50905060005b8151811015611af35760dc6000858584818110611a8e57611a8e6129ab565b9050602002016020810190611aa39190612663565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110611ad657611ad66129ab565b602090810291909101015280611aeb816129d7565b915050611a6f565b5092915050565b60a3544311611b975760405162461bcd60e51b815260206004820152605c60248201527f536c617368496e64696361746f723a2063616e6e6f7420736c6173682061207660448201527f616c696461746f72207477696365206f7220736c617368206d6f72652074686160648201527f6e206f6e652076616c696461746f7220696e206f6e6520626c6f636b00000000608482015260a4016106df565b4360a355334114611c065760405162461bcd60e51b815260206004820152603360248201527f536c617368556e617661696c6162696c6974793a206d6574686f642063616c6c6044820152726572206d75737420626520636f696e6261736560681b60648201526084016106df565b611c0f8161248d565b15610c775760008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c68573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c8c9190612a5e565b6001600160a01b038316600090815260a4602090815260408083208484529091528120805492935090918290611cc1906129d7565b919050819055905060a6548103611d7a57826001600160a01b0316600080516020612dc2833981519152600284604051611cfc929190612b85565b60405180910390a260005460a8546001600160a01b0390911690632f78204c908590611d289043612d4d565b60a75460006040518563ffffffff1660e01b8152600401611d4c9493929190612bb1565b600060405180830381600087803b158015611d6657600080fd5b505af1158015610bd3573d6000803e3d6000fd5b60a5548103611308576000611d8f8484610bdc565b905080611e3457836001600160a01b0316600080516020612dc2833981519152600185604051611dc0929190612b85565b60405180910390a260008054604051630bde081360e21b81526001600160a01b0390911691632f78204c91611dfd91889181908190600401612bb1565b600060405180830381600087803b158015611e1757600080fd5b505af1158015611e2b573d6000803e3d6000fd5b505050506106f4565b836001600160a01b0316600080516020612dc2833981519152600785604051611e5e929190612b85565b60405180910390a2600060a85443611e769190612d4d565b60005460a754604051630bde081360e21b81529293506001600160a01b0390911691632f78204c91611eb19189918691600190600401612bb1565b600060405180830381600087803b158015611ecb57600080fd5b505af1158015611edf573d6000803e3d6000fd5b505050505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b828411158015611f2a57506127108411155b8015611f3857506127108311155b611f845760405162461bcd60e51b815260206004820152601e60248201527f536c617368496e64696361746f723a20696e76616c696420726174696f73000060448201526064016106df565b606d849055606e839055606f82905560708190556040805185815260208101859052908101839052606081018290527fd24c671da2227c139fe1a5b34de15e5a67bef9b46e912916b9e0d025d51b3e3b906080015b60405180910390a150505050565b600081831015611ff75781610c04565b5090919050565b6040516000906067906001908390612022908a908a908a908a908a90602401612d89565b60408051601f198184030181529190526020810180516001600160e01b0316637fc3567760e01b17905280519091506120596125a2565b602083016020828483895afa61206e57600094505b503d61207957600093505b8361209757604051630fc2632160e01b815260040160405180910390fd5b5115159a9950505050505050505050565b606c80546001600160a01b0319166001600160a01b0383169081179091556040519081527f31a33f126a5bae3c5bdf6cfc2cd6dcfffe2fe9634bdb09e21c44762993889e3b906020015b60405180910390a150565b60006121098383612593565b610c049084612b72565b60006121286121228486612d4d565b83612593565b949350505050565b6038829055603981905560408051838152602081018390527fbda9ec2980d7468ba6a9f363696315affca9f9770016396bdea2ac39c3e5d61a910160405180910390a15050565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906020016120f2565b603580546001600160a01b0319166001600160a01b0383169081179091556040519081527ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d7906020016120f2565b603680546001600160a01b0319166001600160a01b0383169081179091556040519081527f9125df97e014f5cc4f107fd784acd35e8e2188ca7c2a0f7caa478365747c1c83906020016120f2565b60018390556002829055600381905560408051848152602081018490529081018290527f913da102149f952dde560cef3349db8e8002e9d580c41a7551d6d45329f4306b90606001610619565b60a65460a55411156123115760405162461bcd60e51b815260206004820152602660248201527f536c617368556e617661696c6162696c6974793a20696e76616c696420746872604482015265195cda1bdb1960d21b60648201526084016106df565b60a584905560a683905560a782905560a88190556040805185815260208101859052908101839052606081018290527f442862e6143ad95854e7c13ff4947ec6e43bc87160e3b193e7c1abaf6e3aaa9890608001611fd9565b828411156123cb5760405162461bcd60e51b815260206004820152602860248201527f43726564697453636f72653a20696e76616c6964206372656469742073636f726044820152676520636f6e66696760c01b60648201526084016106df565b6127108111156124345760405162461bcd60e51b815260206004820152602e60248201527f43726564697453636f72653a20696e76616c696420637574206f66662070657260448201526d63656e7461676520636f6e66696760901b60648201526084016106df565b60dd84905560de83905560df82905560e08190556040805185815260208101859052908101839052606081018290527fe1f9c6c73554b5fa140eead3cfd4ec3e6d4824f3ed26fb25e38376f65b95470b90608001611fd9565b6000336001600160a01b038316148015906125115750600054604051633292276760e11b81526001600160a01b038481166004830152909116906365244ece90602401602060405180830381865afa1580156124ed573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125119190612ce6565b80156106a15750606c54604051630fbeb37f60e01b81526001600160a01b03848116600483015243602483015290911690630fbeb37f90604401602060405180830381865afa158015612568573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061258c9190612ce6565b1592915050565b6000818310611ff75781610c04565b60405180602001604052806001906020820280368337509192915050565b60008083601f8401126125d257600080fd5b50813567ffffffffffffffff8111156125ea57600080fd5b6020830191508360208260051b850101111561260557600080fd5b9250929050565b6000806020838503121561261f57600080fd5b823567ffffffffffffffff81111561263657600080fd5b612642858286016125c0565b90969095509350505050565b6001600160a01b0381168114610c7757600080fd5b60006020828403121561267557600080fd5b8135610c048161264e565b6000806000806080858703121561269657600080fd5b5050823594602084013594506040840135936060013592509050565b60008083601f8401126126c457600080fd5b50813567ffffffffffffffff8111156126dc57600080fd5b60208301915083602082850101111561260557600080fd5b60008060008060006060868803121561270c57600080fd5b85356127178161264e565b9450602086013567ffffffffffffffff8082111561273457600080fd5b61274089838a016126b2565b9096509450604088013591508082111561275957600080fd5b50612766888289016126b2565b969995985093965092949392505050565b6000806040838503121561278a57600080fd5b82356127958161264e565b946020939093013593505050565b6000806000604084860312156127b857600080fd5b833567ffffffffffffffff8111156127cf57600080fd5b6127db868287016125c0565b909790965060209590950135949350505050565b6000806040838503121561280257600080fd5b50508035926020909101359150565b80608081018310156106a157600080fd5b60008060008060008060008060006102a08a8c03121561284157600080fd5b893561284c8161264e565b985060208a013561285c8161264e565b975060408a013561286c8161264e565b965060608a013561287c8161264e565b955061288b8b60808c01612811565b94506101408a018b81111561289f57600080fd5b6101008b0194506101a08b018c8111156128b857600080fd5b8194506128c58d82612811565b935050506128d78b6102208c01612811565b90509295985092959850929598565b6000806000606084860312156128fb57600080fd5b83356129068161264e565b95602085013595506040909401359392505050565b60008060006060848603121561293057600080fd5b505081359360208301359350604090920135919050565b600081518084526020808501945080840160005b838110156129775781518752958201959082019060010161295b565b509495945050505050565b602081526000610c046020830184612947565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016129e9576129e96129c1565b5060010190565b8183526000602080850194508260005b85811015612977578135612a138161264e565b6001600160a01b031687529582019590820190600101612a00565b604081526000612a426040830185876129f0565b8281036020840152612a548185612947565b9695505050505050565b600060208284031215612a7057600080fd5b5051919050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b604051601f8201601f1916810167ffffffffffffffff81118282101715612ae257612ae2612995565b604052919050565b600060a08284031215612afc57600080fd5b60405160a0810181811067ffffffffffffffff82111715612b1f57612b1f612995565b6040528251612b2d8161264e565b81526020830151612b3d8161264e565b60208201526040830151612b508161264e565b6040820152606083810151908201526080928301519281019290925250919050565b818103818111156106a1576106a16129c1565b6040810160088410612ba757634e487b7160e01b600052602160045260246000fd5b9281526020015290565b6001600160a01b03949094168452602084019290925260408301521515606082015260800190565b8183823760009101908152919050565b6020815260006121286020830184866129f0565b80518015158114612c0d57600080fd5b919050565b60006020808385031215612c2557600080fd5b825167ffffffffffffffff80821115612c3d57600080fd5b818501915085601f830112612c5157600080fd5b815181811115612c6357612c63612995565b8060051b9150612c74848301612ab9565b8181529183018401918481019088841115612c8e57600080fd5b938501935b83851015612cb357612ca485612bfd565b82529385019390850190612c93565b98975050505050505050565b606081526000612cd36060830186886129f0565b6020830194909452506040015292915050565b600060208284031215612cf857600080fd5b610c0482612bfd565b600080600060608486031215612d1657600080fd5b612d1f84612bfd565b925060208401519150604084015190509250925092565b80820281158282048414176106a1576106a16129c1565b808201808211156106a1576106a16129c1565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090612dae9083018688612d60565b8281036040840152612cb3818587612d6056fe607adba66cff84b627e3537d1c17d088a98556bccd0536a2f3590c56329023d9a264697066735822122052d46937559c29bd9386fa6f5c433cfee33a300aab406a067ccda8dc1528309464736f6c63430008110033", + "numDeployments": 6, + "solcInputHash": "85b953b22882c536a643bf4b61b3153b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallPrecompiled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeGovernanceAdminContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeMaintenanceContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeRoninTrustedOrgContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"usedCreditScore\",\"type\":\"uint256\"}],\"name\":\"BailedOut\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"missingVotesRatioTier1\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"missingVotesRatioTier2\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailDurationForMissingVotesRatioTier2\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"skipBridgeOperatorSlashingThreshold\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorSlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bridgeVotingThreshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bridgeVotingSlashAmount\",\"type\":\"uint256\"}],\"name\":\"BridgeVotingSlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"gainCreditScore\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxCreditScore\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bailOutCostMultiplier\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cutOffPercentageAfterBailout\",\"type\":\"uint256\"}],\"name\":\"CreditScoreConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"validators\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"creditScores\",\"type\":\"uint256[]\"}],\"name\":\"CreditScoresUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashDoubleSignAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"doubleSigningJailUntilBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"doubleSigningOffsetLimitBlock\",\"type\":\"uint256\"}],\"name\":\"DoubleSignSlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"MaintenanceContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"RoninGovernanceAdminContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"RoninTrustedOrganizationContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"enum IBaseSlash.SlashType\",\"name\":\"slashType\",\"type\":\"uint8\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"Slashed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unavailabilityTier1Threshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unavailabilityTier2Threshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"slashAmountForUnavailabilityTier2Threshold\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailDurationForUnavailabilityTier2Threshold\",\"type\":\"uint256\"}],\"name\":\"UnavailabilitySlashingConfigsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"bailOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"checkBailedOutAtPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"}],\"name\":\"currentUnavailabilityIndicator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validators\",\"type\":\"address[]\"}],\"name\":\"execResetCreditScores\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_tier\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"execSlashBridgeOperator\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBridgeOperatorSlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"missingVotesRatioTier1_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"missingVotesRatioTier2_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jailDurationForMissingVotesRatioTier2_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"skipBridgeOperatorSlashingThreshold_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBridgeVotingSlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"bridgeVotingThreshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"bridgeVotingSlashAmount_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"}],\"name\":\"getCreditScore\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCreditScoreConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"gainCreditScore_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"maxCreditScore_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"bailOutCostMultiplier_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"cutOffPercentageAfterBailout_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getDoubleSignSlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"slashDoubleSignAmount_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"doubleSigningJailUntilBlock_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"doubleSigningOffsetLimitBlock_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validators\",\"type\":\"address[]\"}],\"name\":\"getManyCreditScores\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_resultList\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validator\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"getUnavailabilityIndicator\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getUnavailabilitySlashingConfigs\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"unavailabilityTier1Threshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"unavailabilityTier2Threshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"slashAmountForUnavailabilityTier2Threshold_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"jailDurationForUnavailabilityTier2Threshold_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__maintenanceContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninTrustedOrganizationContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninGovernanceAdminContract\",\"type\":\"address\"},{\"internalType\":\"uint256[4]\",\"name\":\"_bridgeOperatorSlashingConfigs\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[2]\",\"name\":\"_bridgeVotingSlashingConfigs\",\"type\":\"uint256[2]\"},{\"internalType\":\"uint256[3]\",\"name\":\"_doubleSignSlashingConfigs\",\"type\":\"uint256[3]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_unavailabilitySlashingConfigs\",\"type\":\"uint256[4]\"},{\"internalType\":\"uint256[4]\",\"name\":\"_creditScoreConfigs\",\"type\":\"uint256[4]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastUnavailabilitySlashedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maintenanceContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompileValidateDoubleSignAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninGovernanceAdminContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninTrustedOrganizationContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_ratioTier1\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_ratioTier2\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jailDurationTier2\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_skipSlashingThreshold\",\"type\":\"uint256\"}],\"name\":\"setBridgeOperatorSlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_slashAmount\",\"type\":\"uint256\"}],\"name\":\"setBridgeVotingSlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_gainScore\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxScore\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_bailOutMultiplier\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cutOffPercentage\",\"type\":\"uint256\"}],\"name\":\"setCreditScoreConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jailUntilBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_offsetLimitBlock\",\"type\":\"uint256\"}],\"name\":\"setDoubleSignSlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setMaintenanceContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setRoninGovernanceAdminContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setRoninTrustedOrganizationContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_tier1Threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_tier2Threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_slashAmountForTier2Threshold\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_jailDurationForTier2Threshold\",\"type\":\"uint256\"}],\"name\":\"setUnavailabilitySlashingConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"slashBridgeVoting\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_header1\",\"type\":\"bytes\"},{\"internalType\":\"bytes\",\"name\":\"_header2\",\"type\":\"bytes\"}],\"name\":\"slashDoubleSign\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorAddr\",\"type\":\"address\"}],\"name\":\"slashUnavailability\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validators\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"updateCreditScores\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallPrecompiled()\":[{\"details\":\"Error of call to precompile fails.\"}],\"ErrCallerMustBeGovernanceAdminContract()\":[{\"details\":\"Error of method caller must be goverance admin contract.\"}],\"ErrCallerMustBeMaintenanceContract()\":[{\"details\":\"Error of method caller must be maintenance contract.\"}],\"ErrCallerMustBeRoninTrustedOrgContract()\":[{\"details\":\"Error of method caller must be Ronin trusted org contract.\"}],\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"bailOut(address)\":{\"details\":\"A slashed validator use this method to get out of jail. Requirements: - The `_consensusAddr` must be a validator. - Only validator's admin can call this method. Emits the event `BailedOut`.\"},\"checkBailedOutAtPeriod(address,uint256)\":{\"details\":\"Returns the whether the `_validator` has been bailed out at the `_period`.\"},\"currentUnavailabilityIndicator(address)\":{\"details\":\"Returns the current unavailability indicator of a block producer.\"},\"execResetCreditScores(address[])\":{\"details\":\"Resets the credit score for the revoked validators. Requirements: - Only validator contract can call this method. - This method is only called at the end of each period. Emits the event `CreditScoresUpdated`.\"},\"execSlashBridgeOperator(address,uint256,uint256)\":{\"details\":\"Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\",\"params\":{\"_tier\":\"The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1` and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2` Requirements: - Only validator contract can invoke this method. - Should be called only at the end of period. - Should be called only when there is slash of bridge operator. Emits the event `Slashed`.\"}},\"getBridgeOperatorSlashingConfigs()\":{\"details\":\"Returns the configs related to bridge operator slashing.\",\"returns\":{\"jailDurationForMissingVotesRatioTier2_\":\"The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\",\"missingVotesRatioTier1_\":\"The bridge reward will be deprecated if (s)he missed more than this ratio.\",\"missingVotesRatioTier2_\":\"The bridge reward and mining reward will be deprecated and the corresponding block producer will be put in jail if (s)he misses more than this ratio.\",\"skipBridgeOperatorSlashingThreshold_\":\"The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\"}},\"getBridgeVotingSlashingConfigs()\":{\"details\":\"Returns the configs related to bridge voting slashing.\",\"returns\":{\"bridgeVotingSlashAmount_\":\"The amount of RON to slash bridge voting.\",\"bridgeVotingThreshold_\":\"The threshold to slash when a trusted organization does not vote for bridge operators.\"}},\"getCreditScore(address)\":{\"details\":\"Returns the current credit score of the validator.\"},\"getCreditScoreConfigs()\":{\"details\":\"Returns the configs related to credit score.\",\"returns\":{\"bailOutCostMultiplier_\":\"The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\",\"cutOffPercentageAfterBailout_\":\"The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\",\"gainCreditScore_\":\"The score to gain per period.\",\"maxCreditScore_\":\"The max number of credit score that a validator can hold.\"}},\"getDoubleSignSlashingConfigs()\":{\"details\":\"Returns the configs related to block producer slashing.\",\"params\":{\"_doubleSigningOffsetLimitBlock\":\"The number of block that the current block is at most far from the double signing block.\"},\"returns\":{\"doubleSigningJailUntilBlock_\":\"The block number that the punished validator will be jailed until, due to double signing.\",\"slashDoubleSignAmount_\":\"The amount of RON to slash double sign.\"}},\"getManyCreditScores(address[])\":{\"details\":\"Returns the current credit score of a list of validators.\"},\"getUnavailabilityIndicator(address,uint256)\":{\"details\":\"Helper for CreditScore contract to query indicator of the validator.\"},\"getUnavailabilitySlashingConfigs()\":{\"details\":\"Returns the configs related to block producer slashing.\",\"returns\":{\"jailDurationForUnavailabilityTier2Threshold_\":\"The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\",\"slashAmountForUnavailabilityTier2Threshold_\":\"The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with tier-2 or tier-3.\",\"unavailabilityTier1Threshold_\":\"The mining reward will be deprecated, if (s)he missed more than this threshold. This threshold is applied for tier-1 and tier-3 slash.\",\"unavailabilityTier2Threshold_\":\" The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\"}},\"initialize(address,address,address,address,uint256[4],uint256[2],uint256[3],uint256[4],uint256[4])\":{\"details\":\"Initializes the contract storage.\"},\"maintenanceContract()\":{\"details\":\"Returns the maintenance contract.\"},\"precompileValidateDoubleSignAddress()\":{\"details\":\"Gets the address of the precompile of validating double sign evidence\"},\"roninGovernanceAdminContract()\":{\"details\":\"Returns the ronin governance admin contract.\"},\"roninTrustedOrganizationContract()\":{\"details\":\"Returns the ronin trusted organization contract.\"},\"setBridgeOperatorSlashingConfigs(uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the configs to slash bridge operators. Requirements: - The method caller is admin. Emits the event `BridgeOperatorSlashingConfigsUpdated`.\",\"params\":{\"_jailDurationTier2\":\"The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\",\"_ratioTier1\":\"The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map to 0%-100%.\",\"_ratioTier2\":\"The bridge reward and mining reward will be deprecated and the corresponding block producer will be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\",\"_skipSlashingThreshold\":\"The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\"}},\"setBridgeVotingSlashingConfigs(uint256,uint256)\":{\"details\":\"Sets the configs to slash bridge voting. Requirements: - The method caller is admin. Emits the event `BridgeVotingSlashingConfigsUpdated`.\",\"params\":{\"_slashAmount\":\"The amount of RON to slash bridge voting.\",\"_threshold\":\"The threshold to slash when a trusted organization does not vote for bridge operators.\"}},\"setCreditScoreConfigs(uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the configs to credit score. Requirements: - The method caller is admin. Emits the event `CreditScoreConfigsUpdated`.\",\"params\":{\"_bailOutMultiplier\":\"The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\",\"_cutOffPercentage\":\"The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\",\"_gainScore\":\"The score to gain per period.\",\"_maxScore\":\"The max number of credit score that a validator can hold.\"}},\"setDoubleSignSlashingConfigs(uint256,uint256,uint256)\":{\"details\":\"Sets the configs to slash block producers. Requirements: - The method caller is admin. Emits the event `DoubleSignSlashingConfigsUpdated`.\",\"params\":{\"_doubleSigningOffsetLimitBlock\":\"The number of block that the current block is at most far from the double signing block.\",\"_jailUntilBlock\":\"The block number that the punished validator will be jailed until, due to double signing.\",\"_slashAmount\":\"The amount of RON to slash double sign.\"}},\"setMaintenanceContract(address)\":{\"details\":\"Sets the maintenance contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `MaintenanceContractUpdated`.\"},\"setRoninGovernanceAdminContract(address)\":{\"details\":\"Sets the ronin governance admin contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `RoninGovernanceAdminContractUpdated`.\"},\"setRoninTrustedOrganizationContract(address)\":{\"details\":\"Sets the ronin trusted organization contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `RoninTrustedOrganizationContractUpdated`.\"},\"setUnavailabilitySlashingConfigs(uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the configs to slash block producers. Requirements: - The method caller is admin. Emits the event `BridgeOperatorSlashingConfigsUpdated`.\",\"params\":{\"_jailDurationForTier2Threshold\":\"The number of blocks to jail a block producer when (s)he is slashed tier-2.\",\"_slashAmountForTier2Threshold\":\"The amount of RON to deduct from self-staking of a block producer when (s)he is slashed tier-2.\",\"_tier1Threshold\":\"The mining reward will be deprecated, if (s)he missed more than this threshold.\",\"_tier2Threshold\":\"The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted self-staking if (s)he misses more than this threshold.\"}},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"slashBridgeVoting(address)\":{\"details\":\"Slashes for bridge voter governance. Emits the event `Slashed`.\"},\"slashDoubleSign(address,bytes,bytes)\":{\"details\":\"Slashes for double signing. Requirements: - The method caller is coinbase. Emits the event `Slashed` if the double signing evidence of the two headers valid.\"},\"slashUnavailability(address)\":{\"details\":\"Slashes for unavailability by increasing the counter of block producer `_consensusAddr`. Requirements: - The method caller is coinbase. Emits the event `Slashed` when the threshold is reached.\"},\"updateCreditScores(address[],uint256)\":{\"details\":\"Updates the credit score for the validators. Requirements: - Only validator contract can call this method. - This method is only called at the end of each period. Emits the event `CreditScoresUpdated`.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/slash-indicator/SlashIndicator.sol\":\"SlashIndicator\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xdb7f5c28fc61cda0bd8ab60ce288e206b791643bcd3ba464a70cbec18895a2f5\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasMaintenanceContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasMaintenanceContract.sol\\\";\\nimport \\\"../../interfaces/IMaintenance.sol\\\";\\n\\ncontract HasMaintenanceContract is IHasMaintenanceContract, HasProxyAdmin {\\n IMaintenance internal _maintenanceContract;\\n\\n modifier onlyMaintenanceContract() {\\n if (maintenanceContract() != msg.sender) revert ErrCallerMustBeMaintenanceContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasMaintenanceContract\\n */\\n function maintenanceContract() public view override returns (address) {\\n return address(_maintenanceContract);\\n }\\n\\n /**\\n * @inheritdoc IHasMaintenanceContract\\n */\\n function setMaintenanceContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setMaintenanceContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the scheduled maintenance contract.\\n *\\n * Emits the event `MaintenanceContractUpdated`.\\n *\\n */\\n function _setMaintenanceContract(address _addr) internal {\\n _maintenanceContract = IMaintenance(_addr);\\n emit MaintenanceContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x117a29d878d44a20350df8ab539d34335713ba0f3b2c768a58124f61efb74357\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasRoninGovernanceAdminContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasRoninGovernanceAdminContract.sol\\\";\\nimport \\\"../../interfaces/IRoninGovernanceAdmin.sol\\\";\\n\\ncontract HasRoninGovernanceAdminContract is IHasRoninGovernanceAdminContract, HasProxyAdmin {\\n IRoninGovernanceAdmin internal _roninGovernanceAdminContract;\\n\\n modifier onlyRoninGovernanceAdminContract() {\\n if (roninGovernanceAdminContract() != msg.sender) revert ErrCallerMustBeGovernanceAdminContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasRoninGovernanceAdminContract\\n */\\n function roninGovernanceAdminContract() public view override returns (address) {\\n return address(_roninGovernanceAdminContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninGovernanceAdminContract\\n */\\n function setRoninGovernanceAdminContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setRoninGovernanceAdminContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the ronin governance admin contract.\\n *\\n * Emits the event `RoninGovernanceAdminContractUpdated`.\\n *\\n */\\n function _setRoninGovernanceAdminContract(address _addr) internal {\\n _roninGovernanceAdminContract = IRoninGovernanceAdmin(_addr);\\n emit RoninGovernanceAdminContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xbbb077c4c406c6b13d8602dd1bcac1031cd144e9c1965ec59311ded2b9fe8e3c\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\n\\ncontract HasRoninTrustedOrganizationContract is IHasRoninTrustedOrganizationContract, HasProxyAdmin {\\n IRoninTrustedOrganization internal _roninTrustedOrganizationContract;\\n\\n modifier onlyRoninTrustedOrganizationContract() {\\n if (roninTrustedOrganizationContract() != msg.sender) revert ErrCallerMustBeRoninTrustedOrgContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function roninTrustedOrganizationContract() public view override returns (address) {\\n return address(_roninTrustedOrganizationContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function setRoninTrustedOrganizationContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setRoninTrustedOrganizationContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function _setRoninTrustedOrganizationContract(address _addr) internal {\\n _roninTrustedOrganizationContract = IRoninTrustedOrganization(_addr);\\n emit RoninTrustedOrganizationContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x951fd730f4853d8c932da5484ea093f3094c8186735b603d31fb53035c395751\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IMaintenance {\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\\n */\\n function checkScheduled(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr`\\n */\\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\\n */\\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedules() external view returns (uint256 _count);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedules() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4f06c8f3ad7ec8b863882c655ddf443675d557272445e51d8a1e1f3454089d09\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x10f3b360430e6d03773c9959f54cbed6fb0346069645c05b05ef50cfb19f3753\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninGovernanceAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../libraries/BridgeOperatorsBallot.sol\\\";\\n\\ninterface IRoninGovernanceAdmin {\\n /// @dev Emitted when the bridge operators are approved.\\n event BridgeOperatorsApproved(uint256 _period, uint256 _epoch, address[] _operators);\\n /// @dev Emitted when an emergency exit poll is created.\\n event EmergencyExitPollCreated(\\n bytes32 _voteHash,\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n );\\n /// @dev Emitted when an emergency exit poll is approved.\\n event EmergencyExitPollApproved(bytes32 _voteHash);\\n /// @dev Emitted when an emergency exit poll is expired.\\n event EmergencyExitPollExpired(bytes32 _voteHash);\\n\\n /**\\n * @dev Returns the last voted block of the bridge voter.\\n */\\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256);\\n\\n /**\\n * @dev Returns the synced bridge operator set info.\\n */\\n function lastSyncedBridgeOperatorSetInfo()\\n external\\n view\\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory _bridgeOperatorSetInfo);\\n\\n /**\\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n */\\n function createEmergencyExitPoll(\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) external;\\n}\\n\",\"keccak256\":\"0x1aa218f9a8cad8fa9f865c179b257aa8f2614e034100dedebdd352da9a7d96d9\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeights() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganizations() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x1edb7a3f5d340e7efc141cb8d94c5499954dec869f026d3998ad92cbc714d604\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasMaintenanceContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasMaintenanceContract is IHasContract {\\n /// @dev Emitted when the maintenance contract is updated.\\n event MaintenanceContractUpdated(address);\\n\\n /// @dev Error of method caller must be maintenance contract.\\n error ErrCallerMustBeMaintenanceContract();\\n\\n /**\\n * @dev Returns the maintenance contract.\\n */\\n function maintenanceContract() external view returns (address);\\n\\n /**\\n * @dev Sets the maintenance contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `MaintenanceContractUpdated`.\\n *\\n */\\n function setMaintenanceContract(address) external;\\n}\\n\",\"keccak256\":\"0x0a0ef6ba14e2929c7c8dda0642a7a831c9997d1b0d049eb83f64dfc21ff0e72e\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasRoninGovernanceAdminContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasRoninGovernanceAdminContract is IHasContract {\\n /// @dev Emitted when the ronin governance admin contract is updated.\\n event RoninGovernanceAdminContractUpdated(address);\\n\\n /// @dev Error of method caller must be goverance admin contract.\\n error ErrCallerMustBeGovernanceAdminContract();\\n\\n /**\\n * @dev Returns the ronin governance admin contract.\\n */\\n function roninGovernanceAdminContract() external view returns (address);\\n\\n /**\\n * @dev Sets the ronin governance admin contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `RoninGovernanceAdminContractUpdated`.\\n *\\n */\\n function setRoninGovernanceAdminContract(address) external;\\n}\\n\",\"keccak256\":\"0x7143a90b75a403f79f017c5350f816375d1ad5858ddbfa896c964ab9c8d4225a\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\\n /// @dev Emitted when the ronin trusted organization contract is updated.\\n event RoninTrustedOrganizationContractUpdated(address);\\n\\n /// @dev Error of method caller must be Ronin trusted org contract.\\n error ErrCallerMustBeRoninTrustedOrgContract();\\n\\n /**\\n * @dev Returns the ronin trusted organization contract.\\n */\\n function roninTrustedOrganizationContract() external view returns (address);\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function setRoninTrustedOrganizationContract(address) external;\\n}\\n\",\"keccak256\":\"0x7d0a0b1d658e9cf4d69f4934748e0a5c1d22183024d26927f5d621fc61aff0b2\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/IBaseSlash.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseSlash {\\n enum SlashType {\\n UNKNOWN,\\n UNAVAILABILITY_TIER_1,\\n UNAVAILABILITY_TIER_2,\\n DOUBLE_SIGNING,\\n BRIDGE_VOTING,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\\n UNAVAILABILITY_TIER_3\\n }\\n\\n /// @dev Emitted when the validator is slashed.\\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\\n}\\n\",\"keccak256\":\"0x04d449f2852840566dfff4e3673929f6e9b8d9b5fc5b29744bf4f344dc7f9bc0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ICreditScore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICreditScore {\\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\\n event CreditScoreConfigsUpdated(\\n uint256 gainCreditScore,\\n uint256 maxCreditScore,\\n uint256 bailOutCostMultiplier,\\n uint256 cutOffPercentageAfterBailout\\n );\\n /// @dev Emitted the credit score of validators is updated.\\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\\n /// @dev Emitted when a validator bailed out of jail.\\n event BailedOut(address indexed validator, uint256 period, uint256 usedCreditScore);\\n\\n /**\\n * @dev Updates the credit score for the validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function updateCreditScores(address[] calldata _validators, uint256 _period) external;\\n\\n /**\\n * @dev Resets the credit score for the revoked validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function execResetCreditScores(address[] calldata _validators) external;\\n\\n /**\\n * @dev A slashed validator use this method to get out of jail.\\n *\\n * Requirements:\\n * - The `_consensusAddr` must be a validator.\\n * - Only validator's admin can call this method.\\n *\\n * Emits the event `BailedOut`.\\n *\\n */\\n function bailOut(address _consensusAddr) external;\\n\\n /**\\n * @dev Sets the configs to credit score.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CreditScoreConfigsUpdated`.\\n *\\n * @param _gainScore The score to gain per period.\\n * @param _maxScore The max number of credit score that a validator can hold.\\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to credit score.\\n *\\n * @return _gainCreditScore The score to gain per period.\\n * @return _maxCreditScore The max number of credit score that a validator can hold.\\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function getCreditScoreConfigs()\\n external\\n view\\n returns (\\n uint256 _gainCreditScore,\\n uint256 _maxCreditScore,\\n uint256 _bailOutCostMultiplier,\\n uint256 _cutOffPercentageAfterBailout\\n );\\n\\n /**\\n * @dev Returns the current credit score of the validator.\\n */\\n function getCreditScore(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the current credit score of a list of validators.\\n */\\n function getManyCreditScores(address[] calldata _validators) external view returns (uint256[] memory _resultList);\\n\\n /**\\n * @dev Returns the whether the `_validator` has been bailed out at the `_period`.\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5364db88efb971f73aac569e27e5604758a123f28567af757b9933fdddd14f8\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeOperator is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method\\n * `getBridgeOperatorSlashingConfigs` for param details.\\n */\\n event BridgeOperatorSlashingConfigsUpdated(\\n uint256 missingVotesRatioTier1,\\n uint256 missingVotesRatioTier2,\\n uint256 jailDurationForMissingVotesRatioTier2,\\n uint256 skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\\n * @param _tier The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1`\\n * and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2`\\n *\\n * Requirements:\\n * - Only validator contract can invoke this method.\\n * - Should be called only at the end of period.\\n * - Should be called only when there is slash of bridge operator.\\n *\\n * Emits the event `Slashed`.\\n */\\n function execSlashBridgeOperator(\\n address _consensusAddr,\\n uint256 _tier,\\n uint256 _period\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to bridge operator slashing.\\n *\\n * @return _missingVotesRatioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio.\\n * @return _missingVotesRatioTier2 The bridge reward and mining reward will be deprecated and the corresponding\\n * block producer will be put in jail if (s)he misses more than this ratio.\\n * @return _jailDurationForMissingVotesRatioTier2 The number of blocks to jail the corresponding block producer when\\n * its bridge operator is slashed tier-2.\\n * @return _skipBridgeOperatorSlashingThreshold The threshold to skip slashing the bridge operator in case the total\\n * number of votes in the bridge is too small.\\n *\\n */\\n function getBridgeOperatorSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _missingVotesRatioTier1,\\n uint256 _missingVotesRatioTier2,\\n uint256 _jailDurationForMissingVotesRatioTier2,\\n uint256 _skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash bridge operators.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _ratioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map\\n * to 0%-100%.\\n * @param _ratioTier2 The bridge reward and mining reward will be deprecated and the corresponding block producer will\\n * be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\\n * @param _jailDurationTier2 The number of blocks to jail the corresponding block producer when its bridge operator is\\n * slashed tier-2.\\n * @param _skipSlashingThreshold The threshold to skip slashing the bridge operator in case the total number of votes\\n * in the bridge is too small.\\n *\\n */\\n function setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x5c09ac11ead005bfa25ae58e970c441144849b14d58fd5f53fadc3b9be16e5d6\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeVoting is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge voting is updated. See the method `getBridgeVotingSlashingConfigs` for param\\n * details.\\n */\\n event BridgeVotingSlashingConfigsUpdated(uint256 bridgeVotingThreshold, uint256 bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Slashes for bridge voter governance.\\n *\\n * Emits the event `Slashed`.\\n */\\n function slashBridgeVoting(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the configs related to bridge voting slashing.\\n *\\n * @return _bridgeVotingThreshold The threshold to slash when a trusted organization does not vote for bridge\\n * operators.\\n * @return _bridgeVotingSlashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function getBridgeVotingSlashingConfigs()\\n external\\n view\\n returns (uint256 _bridgeVotingThreshold, uint256 _bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Sets the configs to slash bridge voting.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeVotingSlashingConfigsUpdated`.\\n *\\n * @param _threshold The threshold to slash when a trusted organization does not vote for bridge operators.\\n * @param _slashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external;\\n}\\n\",\"keccak256\":\"0x72c3bcfe3c49f946651caa3066bd5296d007871c9a56fa113e2d3c0f3db7eb99\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashDoubleSign is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\\n * for param details.\\n */\\n event DoubleSignSlashingConfigsUpdated(\\n uint256 slashDoubleSignAmount,\\n uint256 doubleSigningJailUntilBlock,\\n uint256 doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Slashes for double signing.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\\n */\\n function slashDoubleSign(\\n address _validatorAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\\n * double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function getDoubleSignSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _slashDoubleSignAmount,\\n uint256 _doubleSigningJailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\\n *\\n * @param _slashAmount The amount of RON to slash double sign.\\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n ) external;\\n}\\n\",\"keccak256\":\"0xe72708c42d468b0c40ffa0c72b3386899f11273e4149425aab490a78d5312222\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashIndicator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashDoubleSign.sol\\\";\\nimport \\\"./ISlashBridgeVoting.sol\\\";\\nimport \\\"./ISlashBridgeOperator.sol\\\";\\nimport \\\"./ISlashUnavailability.sol\\\";\\nimport \\\"./ICreditScore.sol\\\";\\n\\ninterface ISlashIndicator is\\n ISlashDoubleSign,\\n ISlashBridgeVoting,\\n ISlashBridgeOperator,\\n ISlashUnavailability,\\n ICreditScore\\n{}\\n\",\"keccak256\":\"0xe8b8fde3af614735cb304bc1eb82b05d65ede4df804b5d555787e5d5ecb95ec0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashUnavailability.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashUnavailability is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\\n * for param details.\\n */\\n event UnavailabilitySlashingConfigsUpdated(\\n uint256 unavailabilityTier1Threshold,\\n uint256 unavailabilityTier2Threshold,\\n uint256 slashAmountForUnavailabilityTier2Threshold,\\n uint256 jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Returns the last block that a block producer is slashed for unavailability.\\n */\\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Slashes for unavailability by increasing the counter of block producer `_consensusAddr`.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` when the threshold is reached.\\n *\\n */\\n function slashUnavailability(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the current unavailability indicator of a block producer.\\n */\\n function currentUnavailabilityIndicator(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the unavailability indicator in the period `_period` of a block producer.\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\\n * @return _unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\\n * @return _slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\\n * producer when (s)he is slashed with tier-2 or tier-3.\\n * @return _jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\\n * slashed with tier-2 or tier-3.\\n *\\n */\\n function getUnavailabilitySlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _unavailabilityTier1Threshold,\\n uint256 _unavailabilityTier2Threshold,\\n uint256 _slashAmountForUnavailabilityTier2Threshold,\\n uint256 _jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\\n * @param _tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\\n * self-staking if (s)he misses more than this threshold.\\n * @param _slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\\n * is slashed tier-2.\\n * @param _jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\\n *\\n */\\n function setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x92f7d8e9c6f80d4fedab80515c68db0a46cf4f8da143f8d766bf5f7582aa0a21\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/BridgeOperatorsBallot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nlibrary BridgeOperatorsBallot {\\n struct BridgeOperatorSet {\\n uint256 period;\\n uint256 epoch;\\n address[] operators;\\n }\\n\\n // keccak256(\\\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\\\");\\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\\n\\n /**\\n * @dev Verifies whether the ballot is valid or not.\\n *\\n * Requirements:\\n * - The ballot is not for an empty operator set.\\n * - The operator address list is in order.\\n *\\n */\\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\\n require(_ballot.operators.length > 0, \\\"BridgeOperatorsBallot: invalid array length\\\");\\n address _addr = _ballot.operators[0];\\n for (uint _i = 1; _i < _ballot.operators.length; _i++) {\\n require(_addr < _ballot.operators[_i], \\\"BridgeOperatorsBallot: invalid order of bridge operators\\\");\\n _addr = _ballot.operators[_i];\\n }\\n }\\n\\n /**\\n * @dev Returns hash of the ballot.\\n */\\n function hash(BridgeOperatorSet calldata _ballot) internal pure returns (bytes32) {\\n bytes32 _operatorsHash;\\n address[] memory _operators = _ballot.operators;\\n\\n assembly {\\n _operatorsHash := keccak256(add(_operators, 32), mul(mload(_operators), 32))\\n }\\n\\n return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\\n }\\n}\\n\",\"keccak256\":\"0x986425ebae2dcfcfa266c9ca825232ff300ec8ce796e8975da6714d87e921793\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xf719e74bc39be7aceb4e5cc455260f81b2b21e83aa693e0b50c390c9909e08c4\",\"license\":\"UNLICENSED\"},\"contracts/precompile-usages/PCUValidateDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUValidateDoubleSign is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of validating double sign evidence\\n function precompileValidateDoubleSignAddress() public view virtual returns (address) {\\n return address(0x67);\\n }\\n\\n /**\\n * @dev Validates the two submitted block header if they are produced by the same address\\n *\\n * Note: The recover process is done by pre-compiled contract. This function is marked as\\n * virtual for implementing mocking contract for testing purpose.\\n */\\n function _pcValidateEvidence(\\n address _consensusAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) internal view virtual returns (bool _validEvidence) {\\n address _smc = precompileValidateDoubleSignAddress();\\n bool _success = true;\\n\\n bytes memory _payload = abi.encodeWithSignature(\\n \\\"validatingDoubleSignProof(address,bytes,bytes)\\\",\\n _consensusAddr,\\n _header1,\\n _header2\\n );\\n uint _payloadLength = _payload.length;\\n uint[1] memory _output;\\n\\n assembly {\\n let _payloadStart := add(_payload, 0x20)\\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _output, 0x20)) {\\n _success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n _success := 0\\n }\\n }\\n\\n if (!_success) revert ErrCallPrecompiled();\\n return (_output[0] != 0);\\n }\\n}\\n\",\"keccak256\":\"0x9df5b8272e1cd963d776b94e29a69ba1139f0df7404b67c213b3c5ebe19e527b\",\"license\":\"MIT\"},\"contracts/precompile-usages/PrecompiledUsage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PrecompiledUsage {\\n /// @dev Error of call to precompile fails.\\n error ErrCallPrecompiled();\\n}\\n\",\"keccak256\":\"0x76facc3f3a8dd573c826bbbfedaa5cd8ef30963fbabd8c163c0c72b6efea5551\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/CreditScore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/slash-indicator/ICreditScore.sol\\\";\\nimport \\\"../../extensions/collections/HasMaintenanceContract.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\n\\nabstract contract CreditScore is ICreditScore, HasValidatorContract, HasMaintenanceContract, PercentageConsumer {\\n /// @dev Mapping from validator address => period index => whether bailed out before\\n mapping(address => mapping(uint256 => bool)) internal _checkBailedOutAtPeriod;\\n /// @dev Mapping from validator address => credit score\\n mapping(address => uint256) internal _creditScore;\\n\\n /// @dev The max gained number of credit score per period.\\n uint256 internal _gainCreditScore;\\n /// @dev The max number of credit score that a validator can hold.\\n uint256 internal _maxCreditScore;\\n /// @dev The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n uint256 internal _bailOutCostMultiplier;\\n /// @dev The percentage of reward to be cut off from the validator in the rest of the period after bailed out.\\n uint256 internal _cutOffPercentageAfterBailout;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function updateCreditScores(address[] calldata _validators, uint256 _period) external override onlyValidatorContract {\\n uint256 _periodStartAtBlock = _validatorContract.currentPeriodStartAtBlock();\\n\\n bool[] memory _jaileds = _validatorContract.checkManyJailed(_validators);\\n bool[] memory _maintaineds = _maintenanceContract.checkManyMaintainedInBlockRange(\\n _validators,\\n _periodStartAtBlock,\\n block.number\\n );\\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\\n\\n for (uint _i = 0; _i < _validators.length; _i++) {\\n address _validator = _validators[_i];\\n\\n uint256 _indicator = getUnavailabilityIndicator(_validator, _period);\\n bool _isJailedInPeriod = _jaileds[_i];\\n bool _isMaintainingInPeriod = _maintaineds[_i];\\n\\n uint256 _actualGain = (_isJailedInPeriod || _isMaintainingInPeriod)\\n ? 0\\n : Math.subNonNegative(_gainCreditScore, _indicator);\\n\\n _creditScore[_validator] = Math.addWithUpperbound(_creditScore[_validator], _actualGain, _maxCreditScore);\\n _updatedCreditScores[_i] = _creditScore[_validator];\\n }\\n\\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\\n }\\n\\n function execResetCreditScores(address[] calldata _validators) external override onlyValidatorContract {\\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\\n for (uint _i = 0; _i < _validators.length; _i++) {\\n address _validator = _validators[_i];\\n delete _creditScore[_validator];\\n delete _updatedCreditScores[_i];\\n }\\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function bailOut(address _consensusAddr) external override {\\n require(\\n _validatorContract.isValidatorCandidate(_consensusAddr),\\n \\\"SlashIndicator: consensus address must be a validator candidate\\\"\\n );\\n require(\\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\\n \\\"SlashIndicator: method caller must be a candidate admin\\\"\\n );\\n\\n (bool _isJailed, , uint256 _jailedEpochLeft) = _validatorContract.getJailedTimeLeft(_consensusAddr);\\n require(_isJailed, \\\"SlashIndicator: caller must be jailed in the current period\\\");\\n\\n uint256 _period = _validatorContract.currentPeriod();\\n require(!_checkBailedOutAtPeriod[_consensusAddr][_period], \\\"SlashIndicator: validator has bailed out previously\\\");\\n\\n uint256 _score = _creditScore[_consensusAddr];\\n uint256 _cost = _jailedEpochLeft * _bailOutCostMultiplier;\\n require(_score >= _cost, \\\"SlashIndicator: insufficient credit score to bail out\\\");\\n\\n _validatorContract.execBailOut(_consensusAddr, _period);\\n\\n _creditScore[_consensusAddr] -= _cost;\\n _setUnavailabilityIndicator(_consensusAddr, _period, 0);\\n _checkBailedOutAtPeriod[_consensusAddr][_period] = true;\\n emit BailedOut(_consensusAddr, _period, _cost);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) external override onlyAdmin {\\n _setCreditScoreConfigs(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\\n }\\n\\n /**\\n * @dev See `ISlashUnavailability`\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period) public view virtual returns (uint256);\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function getCreditScoreConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 gainCreditScore_,\\n uint256 maxCreditScore_,\\n uint256 bailOutCostMultiplier_,\\n uint256 cutOffPercentageAfterBailout_\\n )\\n {\\n return (_gainCreditScore, _maxCreditScore, _bailOutCostMultiplier, _cutOffPercentageAfterBailout);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function getCreditScore(address _validator) external view override returns (uint256) {\\n return _creditScore[_validator];\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function getManyCreditScores(address[] calldata _validators)\\n public\\n view\\n override\\n returns (uint256[] memory _resultList)\\n {\\n _resultList = new uint256[](_validators.length);\\n\\n for (uint _i = 0; _i < _resultList.length; _i++) {\\n _resultList[_i] = _creditScore[_validators[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual override returns (bool) {\\n return _checkBailedOutAtPeriod[_validator][_period];\\n }\\n\\n /**\\n * @dev See `SlashUnavailability`.\\n */\\n function _setUnavailabilityIndicator(\\n address _validator,\\n uint256 _period,\\n uint256 _indicator\\n ) internal virtual;\\n\\n /**\\n * @dev See `ICreditScore-setCreditScoreConfigs`.\\n */\\n function _setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) internal {\\n require(_gainScore <= _maxScore, \\\"CreditScore: invalid credit score config\\\");\\n require(_cutOffPercentage <= _MAX_PERCENTAGE, \\\"CreditScore: invalid cut off percentage config\\\");\\n\\n _gainCreditScore = _gainScore;\\n _maxCreditScore = _maxScore;\\n _bailOutCostMultiplier = _bailOutMultiplier;\\n _cutOffPercentageAfterBailout = _cutOffPercentage;\\n emit CreditScoreConfigsUpdated(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\\n }\\n}\\n\",\"keccak256\":\"0xe2a4b46731a462e0f71eda5a47b7b56bb1a77ca7e618e02f56acccc7bc759bab\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashBridgeOperator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../extensions/collections/HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashBridgeOperator.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\n\\nabstract contract SlashBridgeOperator is ISlashBridgeOperator, HasProxyAdmin, HasValidatorContract, PercentageConsumer {\\n /**\\n * @dev The bridge operators will be deprecated reward if (s)he missed more than the ratio.\\n * Values 0-10,000 map to 0%-100%.\\n */\\n uint256 internal _missingVotesRatioTier1;\\n /**\\n * @dev The bridge operators will be deprecated all rewards including bridge reward and mining reward if (s)he missed\\n * more than the ratio. Values 0-10,000 map to 0%-100%.\\n */\\n uint256 internal _missingVotesRatioTier2;\\n /// @dev The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\\n uint256 internal _jailDurationForMissingVotesRatioTier2;\\n /// @dev The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\\n uint256 internal _skipBridgeOperatorSlashingThreshold;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc ISlashBridgeOperator\\n */\\n function getBridgeOperatorSlashingConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 missingVotesRatioTier1_,\\n uint256 missingVotesRatioTier2_,\\n uint256 jailDurationForMissingVotesRatioTier2_,\\n uint256 skipBridgeOperatorSlashingThreshold_\\n )\\n {\\n return (\\n _missingVotesRatioTier1,\\n _missingVotesRatioTier2,\\n _jailDurationForMissingVotesRatioTier2,\\n _skipBridgeOperatorSlashingThreshold\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashBridgeOperator\\n */\\n function setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) external override onlyAdmin {\\n _setBridgeOperatorSlashingConfigs(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\\n }\\n\\n /**\\n * @inheritdoc ISlashBridgeOperator\\n */\\n function execSlashBridgeOperator(\\n address _consensusAddr,\\n uint256 _tier,\\n uint256 _period\\n ) external onlyValidatorContract {\\n if (_tier == 1) {\\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1, _period);\\n } else if (_tier == 2) {\\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2, _period);\\n }\\n }\\n\\n /**\\n * @dev See `ISlashBridgeOperator-setBridgeOperatorSlashingConfigs`.\\n */\\n function _setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) internal {\\n require(\\n _ratioTier1 <= _ratioTier2 && _ratioTier1 <= _MAX_PERCENTAGE && _ratioTier2 <= _MAX_PERCENTAGE,\\n \\\"SlashIndicator: invalid ratios\\\"\\n );\\n _missingVotesRatioTier1 = _ratioTier1;\\n _missingVotesRatioTier2 = _ratioTier2;\\n _jailDurationForMissingVotesRatioTier2 = _jailDurationTier2;\\n _skipBridgeOperatorSlashingThreshold = _skipSlashingThreshold;\\n emit BridgeOperatorSlashingConfigsUpdated(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\\n }\\n}\\n\",\"keccak256\":\"0x80fc557349f05e584737a6ba80f87dff5940bcae770db6215d62fb435342957a\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashBridgeVoting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashBridgeVoting.sol\\\";\\nimport \\\"../../extensions/collections/HasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../extensions/collections/HasRoninGovernanceAdminContract.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\n\\nabstract contract SlashBridgeVoting is\\n ISlashBridgeVoting,\\n HasValidatorContract,\\n HasRoninTrustedOrganizationContract,\\n HasRoninGovernanceAdminContract\\n{\\n /// @dev Mapping from validator address => period index => bridge voting slashed\\n mapping(address => mapping(uint256 => bool)) internal _bridgeVotingSlashed;\\n /// @dev The threshold to slash when a trusted organization does not vote for bridge operators.\\n uint256 internal _bridgeVotingThreshold;\\n /// @dev The amount of RON to slash bridge voting.\\n uint256 internal _bridgeVotingSlashAmount;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc ISlashBridgeVoting\\n */\\n function slashBridgeVoting(address _consensusAddr) external onlyAdmin {\\n IRoninTrustedOrganization.TrustedOrganization memory _org = _roninTrustedOrganizationContract\\n .getTrustedOrganization(_consensusAddr);\\n uint256 _lastVotedBlock = Math.max(_roninGovernanceAdminContract.lastVotedBlock(_org.bridgeVoter), _org.addedBlock);\\n uint256 _period = _validatorContract.currentPeriod();\\n\\n require(\\n block.number - _lastVotedBlock > _bridgeVotingThreshold && !_bridgeVotingSlashed[_consensusAddr][_period],\\n \\\"SlashBridgeVoting: invalid slash\\\"\\n );\\n\\n _bridgeVotingSlashed[_consensusAddr][_period] = true;\\n emit Slashed(_consensusAddr, SlashType.BRIDGE_VOTING, _period);\\n _validatorContract.execSlash(_consensusAddr, 0, _bridgeVotingSlashAmount, false);\\n }\\n\\n /**\\n * @inheritdoc ISlashBridgeVoting\\n */\\n function getBridgeVotingSlashingConfigs()\\n external\\n view\\n override\\n returns (uint256 bridgeVotingThreshold_, uint256 bridgeVotingSlashAmount_)\\n {\\n return (_bridgeVotingThreshold, _bridgeVotingSlashAmount);\\n }\\n\\n /**\\n * @inheritdoc ISlashBridgeVoting\\n */\\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external override onlyAdmin {\\n _setBridgeVotingSlashingConfigs(_threshold, _slashAmount);\\n }\\n\\n /**\\n * @dev See `ISlashBridgeVoting-setBridgeVotingSlashingConfigs`.\\n */\\n function _setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) internal {\\n _bridgeVotingThreshold = _threshold;\\n _bridgeVotingSlashAmount = _slashAmount;\\n emit BridgeVotingSlashingConfigsUpdated(_threshold, _slashAmount);\\n }\\n}\\n\",\"keccak256\":\"0x63eaf9d93feda26b62b814d45926569c0657b0f0bf7d7a8244c6688e9850502c\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/slash-indicator/ISlashDoubleSign.sol\\\";\\nimport \\\"../../precompile-usages/PCUValidateDoubleSign.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\n\\nabstract contract SlashDoubleSign is ISlashDoubleSign, HasValidatorContract, PCUValidateDoubleSign {\\n /// @dev The amount of RON to slash double sign.\\n uint256 internal _slashDoubleSignAmount;\\n /// @dev The block number that the punished validator will be jailed until, due to double signing.\\n uint256 internal _doubleSigningJailUntilBlock;\\n /** @dev The offset from the submitted block to the current block, from which double signing will be invalidated.\\n * This parameter is exposed for system transaction.\\n **/\\n uint256 internal _doubleSigningOffsetLimitBlock;\\n /// @dev Recording of submitted proof to prevent relay attack.\\n mapping(bytes32 => bool) _submittedEvidence;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] private ______gap;\\n\\n /**\\n * @inheritdoc ISlashDoubleSign\\n */\\n function slashDoubleSign(\\n address _consensusAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) external override onlyAdmin {\\n bytes32 _header1Checksum = keccak256(_header1);\\n bytes32 _header2Checksum = keccak256(_header2);\\n\\n require(\\n !_submittedEvidence[_header1Checksum] && !_submittedEvidence[_header2Checksum],\\n \\\"SlashDoubleSign: evidence already submitted\\\"\\n );\\n\\n if (_pcValidateEvidence(_consensusAddr, _header1, _header2)) {\\n uint256 _period = _validatorContract.currentPeriod();\\n _submittedEvidence[_header1Checksum] = true;\\n _submittedEvidence[_header2Checksum] = true;\\n emit Slashed(_consensusAddr, SlashType.DOUBLE_SIGNING, _period);\\n _validatorContract.execSlash(_consensusAddr, _doubleSigningJailUntilBlock, _slashDoubleSignAmount, true);\\n }\\n }\\n\\n /**\\n * @inheritdoc ISlashDoubleSign\\n */\\n function getDoubleSignSlashingConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 slashDoubleSignAmount_,\\n uint256 doubleSigningJailUntilBlock_,\\n uint256 doubleSigningOffsetLimitBlock_\\n )\\n {\\n return (_slashDoubleSignAmount, _doubleSigningJailUntilBlock, _doubleSigningOffsetLimitBlock);\\n }\\n\\n /**\\n * @inheritdoc ISlashDoubleSign\\n */\\n function setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _offsetLimitBlock\\n ) external override onlyAdmin {\\n _setDoubleSignSlashingConfigs(_slashAmount, _jailUntilBlock, _offsetLimitBlock);\\n }\\n\\n /**\\n * @dev See `ISlashDoubleSign-setDoubleSignSlashingConfigs`.\\n */\\n function _setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _offsetLimitBlock\\n ) internal {\\n _slashDoubleSignAmount = _slashAmount;\\n _doubleSigningJailUntilBlock = _jailUntilBlock;\\n _doubleSigningOffsetLimitBlock = _offsetLimitBlock;\\n emit DoubleSignSlashingConfigsUpdated(_slashAmount, _jailUntilBlock, _doubleSigningOffsetLimitBlock);\\n }\\n\\n /**\\n * @dev Returns whether the account `_addr` should be slashed or not.\\n */\\n function _shouldSlash(address _addr) internal view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xc0a3f6c59aa50b857e81fbb1ea1cb52ea631ddd1a0efb34b3619b1f4fd3a567a\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashIndicator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashIndicator.sol\\\";\\nimport \\\"./SlashDoubleSign.sol\\\";\\nimport \\\"./SlashBridgeVoting.sol\\\";\\nimport \\\"./SlashBridgeOperator.sol\\\";\\nimport \\\"./SlashUnavailability.sol\\\";\\nimport \\\"./CreditScore.sol\\\";\\n\\ncontract SlashIndicator is\\n ISlashIndicator,\\n SlashDoubleSign,\\n SlashBridgeVoting,\\n SlashBridgeOperator,\\n SlashUnavailability,\\n CreditScore,\\n Initializable\\n{\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n address __maintenanceContract,\\n address __roninTrustedOrganizationContract,\\n address __roninGovernanceAdminContract,\\n // _bridgeOperatorSlashingConfigs[0]: _missingVotesRatioTier1\\n // _bridgeOperatorSlashingConfigs[1]: _missingVotesRatioTier2\\n // _bridgeOperatorSlashingConfigs[2]: _jailDurationForMissingVotesRatioTier2\\n // _bridgeOperatorSlashingConfigs[3]: _skipBridgeOperatorSlashingThreshold\\n uint256[4] calldata _bridgeOperatorSlashingConfigs,\\n // _bridgeVotingSlashingConfigs[0]: _bridgeVotingThreshold\\n // _bridgeVotingSlashingConfigs[1]: _bridgeVotingSlashAmount\\n uint256[2] calldata _bridgeVotingSlashingConfigs,\\n // _doubleSignSlashingConfigs[0]: _slashDoubleSignAmount\\n // _doubleSignSlashingConfigs[1]: _doubleSigningJailUntilBlock\\n // _doubleSignSlashingConfigs[2]: _doubleSigningOffsetLimitBlock\\n uint256[3] calldata _doubleSignSlashingConfigs,\\n // _unavailabilitySlashingConfigs[0]: _unavailabilityTier1Threshold\\n // _unavailabilitySlashingConfigs[1]: _unavailabilityTier2Threshold\\n // _unavailabilitySlashingConfigs[2]: _slashAmountForUnavailabilityTier2Threshold\\n // _unavailabilitySlashingConfigs[3]: _jailDurationForUnavailabilityTier2Threshold\\n uint256[4] calldata _unavailabilitySlashingConfigs,\\n // _creditScoreConfigs[0]: _gainCreditScore\\n // _creditScoreConfigs[1]: _maxCreditScore\\n // _creditScoreConfigs[2]: _bailOutCostMultiplier\\n // _creditScoreConfigs[3]: _cutOffPercentageAfterBailout\\n uint256[4] calldata _creditScoreConfigs\\n ) external initializer {\\n _setValidatorContract(__validatorContract);\\n _setMaintenanceContract(__maintenanceContract);\\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\\n _setRoninGovernanceAdminContract(__roninGovernanceAdminContract);\\n _setBridgeOperatorSlashingConfigs(\\n _bridgeOperatorSlashingConfigs[0],\\n _bridgeOperatorSlashingConfigs[1],\\n _bridgeOperatorSlashingConfigs[2],\\n _bridgeOperatorSlashingConfigs[3]\\n );\\n _setBridgeVotingSlashingConfigs(_bridgeVotingSlashingConfigs[0], _bridgeVotingSlashingConfigs[1]);\\n _setDoubleSignSlashingConfigs(\\n _doubleSignSlashingConfigs[0],\\n _doubleSignSlashingConfigs[1],\\n _doubleSignSlashingConfigs[2]\\n );\\n _setUnavailabilitySlashingConfigs(\\n _unavailabilitySlashingConfigs[0],\\n _unavailabilitySlashingConfigs[1],\\n _unavailabilitySlashingConfigs[2],\\n _unavailabilitySlashingConfigs[3]\\n );\\n _setCreditScoreConfigs(\\n _creditScoreConfigs[0],\\n _creditScoreConfigs[1],\\n _creditScoreConfigs[2],\\n _creditScoreConfigs[3]\\n );\\n }\\n\\n /**\\n * @dev Helper for CreditScore contract to reset the indicator of the validator after bailing out.\\n */\\n function _setUnavailabilityIndicator(\\n address _validator,\\n uint256 _period,\\n uint256 _indicator\\n ) internal override(CreditScore, SlashUnavailability) {\\n SlashUnavailability._setUnavailabilityIndicator(_validator, _period, _indicator);\\n }\\n\\n /**\\n * @dev Helper for CreditScore contract to query indicator of the validator.\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period)\\n public\\n view\\n override(CreditScore, ISlashUnavailability, SlashUnavailability)\\n returns (uint256)\\n {\\n return SlashUnavailability.getUnavailabilityIndicator(_validator, _period);\\n }\\n\\n /**\\n * @inheritdoc ICreditScore\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period)\\n public\\n view\\n override(CreditScore, ICreditScore, SlashUnavailability)\\n returns (bool)\\n {\\n return CreditScore.checkBailedOutAtPeriod(_validator, _period);\\n }\\n\\n /**\\n * @dev Sanity check the address to be slashed\\n */\\n function _shouldSlash(address _addr) internal view override(SlashDoubleSign, SlashUnavailability) returns (bool) {\\n return\\n (msg.sender != _addr) &&\\n _validatorContract.isBlockProducer(_addr) &&\\n !_maintenanceContract.checkMaintained(_addr, block.number);\\n }\\n}\\n\",\"keccak256\":\"0x4e8ed6197fb42f52420fae0ebe09f46d891c5e6c56f4ee0fb8b3c2ffc879b648\",\"license\":\"MIT\"},\"contracts/ronin/slash-indicator/SlashUnavailability.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./CreditScore.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashUnavailability.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\n\\nabstract contract SlashUnavailability is ISlashUnavailability, HasValidatorContract {\\n /// @dev The last block that a validator is slashed for unavailability.\\n uint256 public lastUnavailabilitySlashedBlock;\\n /// @dev Mapping from validator address => period index => unavailability indicator.\\n mapping(address => mapping(uint256 => uint256)) internal _unavailabilityIndicator;\\n\\n /**\\n * @dev The mining reward will be deprecated, if (s)he missed more than this threshold.\\n * This threshold is applied for tier-1 and tier-3 of unavailability slash.\\n */\\n uint256 internal _unavailabilityTier1Threshold;\\n /**\\n * @dev The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\\n * self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\\n */\\n uint256 internal _unavailabilityTier2Threshold;\\n /**\\n * @dev The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with\\n * tier-2 or tier-3.\\n **/\\n uint256 internal _slashAmountForUnavailabilityTier2Threshold;\\n /// @dev The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\\n uint256 internal _jailDurationForUnavailabilityTier2Threshold;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n modifier oncePerBlock() {\\n require(\\n block.number > lastUnavailabilitySlashedBlock,\\n \\\"SlashIndicator: cannot slash a validator twice or slash more than one validator in one block\\\"\\n );\\n lastUnavailabilitySlashedBlock = block.number;\\n _;\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function slashUnavailability(address _validatorAddr) external override oncePerBlock {\\n require(msg.sender == block.coinbase, \\\"SlashUnavailability: method caller must be coinbase\\\");\\n if (!_shouldSlash(_validatorAddr)) {\\n // Should return instead of throwing error since this is a part of system transaction.\\n return;\\n }\\n\\n uint256 _period = _validatorContract.currentPeriod();\\n uint256 _count = ++_unavailabilityIndicator[_validatorAddr][_period];\\n uint256 _newJailedUntilBlock = Math.addIfNonZero(block.number, _jailDurationForUnavailabilityTier2Threshold);\\n\\n if (_count == _unavailabilityTier2Threshold) {\\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_2, _period);\\n _validatorContract.execSlash(\\n _validatorAddr,\\n _newJailedUntilBlock,\\n _slashAmountForUnavailabilityTier2Threshold,\\n false\\n );\\n } else if (_count == _unavailabilityTier1Threshold) {\\n bool _tier1SecondTime = checkBailedOutAtPeriod(_validatorAddr, _period);\\n if (!_tier1SecondTime) {\\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_1, _period);\\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\\n } else {\\n /// Handles tier-3\\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_3, _period);\\n _validatorContract.execSlash(\\n _validatorAddr,\\n _newJailedUntilBlock,\\n _slashAmountForUnavailabilityTier2Threshold,\\n true\\n );\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) external override onlyAdmin {\\n _setUnavailabilitySlashingConfigs(\\n _tier1Threshold,\\n _tier2Threshold,\\n _slashAmountForTier2Threshold,\\n _jailDurationForTier2Threshold\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function getUnavailabilitySlashingConfigs()\\n external\\n view\\n override\\n returns (\\n uint256 unavailabilityTier1Threshold_,\\n uint256 unavailabilityTier2Threshold_,\\n uint256 slashAmountForUnavailabilityTier2Threshold_,\\n uint256 jailDurationForUnavailabilityTier2Threshold_\\n )\\n {\\n return (\\n _unavailabilityTier1Threshold,\\n _unavailabilityTier2Threshold,\\n _slashAmountForUnavailabilityTier2Threshold,\\n _jailDurationForUnavailabilityTier2Threshold\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function currentUnavailabilityIndicator(address _validator) external view override returns (uint256) {\\n return getUnavailabilityIndicator(_validator, _validatorContract.currentPeriod());\\n }\\n\\n /**\\n * @inheritdoc ISlashUnavailability\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period)\\n public\\n view\\n virtual\\n override\\n returns (uint256)\\n {\\n return _unavailabilityIndicator[_validator][_period];\\n }\\n\\n /**\\n * @dev Sets the unavailability indicator of the `_validator` at `_period`.\\n */\\n function _setUnavailabilityIndicator(\\n address _validator,\\n uint256 _period,\\n uint256 _indicator\\n ) internal virtual {\\n _unavailabilityIndicator[_validator][_period] = _indicator;\\n }\\n\\n /**\\n * @dev See `ISlashUnavailability-setUnavailabilitySlashingConfigs`.\\n */\\n function _setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) internal {\\n require(_unavailabilityTier1Threshold <= _unavailabilityTier2Threshold, \\\"SlashUnavailability: invalid threshold\\\");\\n _unavailabilityTier1Threshold = _tier1Threshold;\\n _unavailabilityTier2Threshold = _tier2Threshold;\\n _slashAmountForUnavailabilityTier2Threshold = _slashAmountForTier2Threshold;\\n _jailDurationForUnavailabilityTier2Threshold = _jailDurationForTier2Threshold;\\n emit UnavailabilitySlashingConfigsUpdated(\\n _tier1Threshold,\\n _tier2Threshold,\\n _slashAmountForTier2Threshold,\\n _jailDurationForTier2Threshold\\n );\\n }\\n\\n /**\\n * @dev Returns whether the account `_addr` should be slashed or not.\\n */\\n function _shouldSlash(address _addr) internal view virtual returns (bool);\\n\\n /**\\n * @dev See `ICreditScore-checkBailedOutAtPeriod`\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual returns (bool);\\n}\\n\",\"keccak256\":\"0xf725c5d1992bad9a7e952bf1b2e0b0fec11858be35cf8d91ffc001fcf64b0e02\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e7565b61011354610100900460ff1615620000905760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b6101135460ff9081161015620000e557610113805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b612e0e80620000f76000396000f3fe608060405234801561001057600080fd5b506004361061018b5760003560e01c806307c2d2f614610190578063082e7420146101a55780630e1512ac146101cb5780631079402a146101de5780631a697341146101fb5780631e90b2a01461020e57806323368e471461022157806329ddc3c01461023b5780633d48fd7d1461025e57806346fe93111461026f5780635511cde11461028257806362ffe6cb146102935780637680850c146102a65780637c2b55a0146102b9578063853af1b7146102c057806399103f7b146102d357806399439089146102e6578063b5e337de146102ee578063c008ce3914610301578063c2e524dc14610314578063c6391fa21461032f578063ccbb72ed14610340578063cdf64a7614610353578063cf39d13c14610366578063d1737e2714610379578063d1f992f71461038c578063d2cb215e1461039f578063d3dd2bdf146103b0578063d73e81b8146103d9578063df4b6ee0146103ec578063f1001e7814610410578063f562b3c414610430578063fd422cd014610439575b600080fd5b6101a361019e3660046125a2565b61044c565b005b6101b86101b33660046125f8565b610575565b6040519081526020015b60405180910390f35b6101a36101d9366004612615565b6105f6565b606d54606e54606f546070545b6040516101c29493929190612647565b6101a36102093660046125f8565b610649565b6101a361021c3660046126a3565b610947565b6036546001600160a01b03165b6040516101c29190612725565b61024e610249366004612739565b610bac565b60405190151581526020016101c2565b60a55460a65460a75460a8546101eb565b6101a361027d3660046125f8565b610bdb565b6035546001600160a01b031661022e565b6101b86102a1366004612739565b610c4a565b6101a36102b4366004612765565b610c73565b606761022e565b6101a36102ce3660046127b0565b610fb4565b6101a36102e13660046127e3565b610ffa565b61022e6111a4565b6101a36102fc3660046125f8565b6111b3565b6101a361030f3660046128a7565b61121f565b603854603954604080519283526020830191909152016101c2565b60dd5460de5460df5460e0546101eb565b6101a361034e366004612615565b6112c5565b6101a36103613660046125f8565b611309565b6101a36103743660046128dc565b611375565b6101a3610387366004612615565b6113b8565b6101a361039a3660046125f8565b6113fc565b606c546001600160a01b031661022e565b6101b86103be3660046125f8565b6001600160a01b0316600090815260dc602052604090205490565b6101a36103e73660046125f8565b61196d565b600154600254600354604080519384526020840192909252908201526060016101c2565b61042361041e3660046125a2565b6119d9565b6040516101c29190612943565b6101b860a35481565b6101a36104473660046125f8565b611aad565b336104556111a4565b6001600160a01b03161461047c57604051630e6444a160e31b815260040160405180910390fd5b6000816001600160401b0381111561049657610496612956565b6040519080825280602002602001820160405280156104bf578160200160208202803683370190505b50905060005b828110156105465760008484838181106104e1576104e161296c565b90506020020160208101906104f691906125f8565b6001600160a01b038116600090815260dc602052604081205583519091508390839081106105265761052661296c565b60200260200101600081525050808061053e90612998565b9150506104c5565b50600080516020612db9833981519152838383604051610568939291906129ef565b60405180910390a1505050565b60006105f08260008054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a19190612a1f565b92915050565b6105fe611e91565b6001600160a01b0316336001600160a01b0316146106375760405162461bcd60e51b815260040161062e90612a38565b60405180910390fd5b61064384848484611ebf565b50505050565b610651611e91565b6001600160a01b0316336001600160a01b0316146106815760405162461bcd60e51b815260040161062e90612a38565b603554604051636db349d160e11b81526000916001600160a01b03169063db6693a2906106b2908590600401612725565b60a060405180830381865afa1580156106cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f39190612aaa565b6036546040808301519051632623bd4f60e21b815292935060009261077a926001600160a01b03169163988ef53c9161072f9190600401612725565b602060405180830381865afa15801561074c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107709190612a1f565b8360800151611f83565b905060008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f49190612a1f565b6038549091506108048343612b31565b11801561083557506001600160a01b038416600090815260376020908152604080832084845290915290205460ff16155b6108815760405162461bcd60e51b815260206004820181905260248201527f536c617368427269646765566f74696e673a20696e76616c696420736c617368604482015260640161062e565b6001600160a01b038416600081815260376020908152604080832085845290915290819020805460ff1916600117905551600080516020612d99833981519152906108d0906004908590612b44565b60405180910390a260008054603954604051630bde081360e21b81526001600160a01b0390921692632f78204c9261090f928992918290600401612b70565b600060405180830381600087803b15801561092957600080fd5b505af115801561093d573d6000803e3d6000fd5b5050505050505050565b61094f611e91565b6001600160a01b0316336001600160a01b03161461097f5760405162461bcd60e51b815260040161062e90612a38565b60008484604051610991929190612b98565b60405180910390209050600083836040516109ad929190612b98565b604080519182900390912060008481526004602052919091205490915060ff161580156109e9575060008181526004602052604090205460ff16155b610a495760405162461bcd60e51b815260206004820152602b60248201527f536c617368446f75626c655369676e3a2065766964656e636520616c7265616460448201526a1e481cdd589b5a5d1d195960aa1b606482015260840161062e565b610a568787878787611f9a565b15610ba35760008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad39190612a1f565b6000848152600460205260408082208054600160ff19918216811790925586845292829020805490931617909155519091506001600160a01b03891690600080516020612d9983398151915290610b2e906003908590612b44565b60405180910390a260005460025460018054604051630bde081360e21b81526001600160a01b0390941693632f78204c93610b6f938e939192600401612b70565b600060405180830381600087803b158015610b8957600080fd5b505af1158015610b9d573d6000803e3d6000fd5b50505050505b50505050505050565b6001600160a01b038216600090815260db6020908152604080832084845290915281205460ff165b9392505050565b610be3611e91565b6001600160a01b0316336001600160a01b031614610c135760405162461bcd60e51b815260040161062e90612a38565b806001600160a01b03163b600003610c3e57604051637bcd509160e01b815260040160405180910390fd5b610c4781612044565b50565b6001600160a01b038216600090815260a460209081526040808320848452909152812054610bd4565b33610c7c6111a4565b6001600160a01b031614610ca357604051630e6444a160e31b815260040160405180910390fd5b60008060009054906101000a90046001600160a01b03166001600160a01b031663297a8fca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1b9190612a1f565b60008054604051634de2b73560e01b815292935090916001600160a01b0390911690634de2b73590610d539088908890600401612ba8565b600060405180830381865afa158015610d70573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d989190810190612bd1565b606c5460405163ba30375560e01b81529192506000916001600160a01b039091169063ba30375590610dd4908990899088904390600401612c7d565b600060405180830381865afa158015610df1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e199190810190612bd1565b90506000856001600160401b03811115610e3557610e35612956565b604051908082528060200260200182016040528015610e5e578160200160208202803683370190505b50905060005b86811015610f81576000888883818110610e8057610e8061296c565b9050602002016020810190610e9591906125f8565b90506000610ea38289610c4a565b90506000868481518110610eb957610eb961296c565b602002602001015190506000868581518110610ed757610ed761296c565b6020026020010151905060008280610eec5750815b610f0157610efc60dd548561209a565b610f04565b60005b6001600160a01b038616600090815260dc602052604090205460de54919250610f2e9183906120b4565b6001600160a01b038616600090815260dc602052604090208190558751889088908110610f5d57610f5d61296c565b60200260200101818152505050505050508080610f7990612998565b915050610e64565b50600080516020612db9833981519152878783604051610fa3939291906129ef565b60405180910390a150505050505050565b610fbc611e91565b6001600160a01b0316336001600160a01b031614610fec5760405162461bcd60e51b815260040161062e90612a38565b610ff682826120d1565b5050565b61011354610100900460ff161580801561101c575061011354600160ff909116105b806110375750303b15801561103757506101135460ff166001145b61109a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161062e565b610113805460ff1916600117905580156110bf57610113805461ff0019166101001790555b6110c88a612118565b6110d189612044565b6110da88612163565b6110e3876121ae565b6110fc86356020880135604089013560608a0135611ebf565b61110b853560208701356120d1565b61111f8435602086013560408701356121f9565b6111388335602085013560408601356060870135612246565b61115182356020840135604085013560608601356122f3565b801561119857610113805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b6000546001600160a01b031690565b6111bb611e91565b6001600160a01b0316336001600160a01b0316146111eb5760405162461bcd60e51b815260040161062e90612a38565b806001600160a01b03163b60000361121657604051637bcd509160e01b815260040160405180910390fd5b610c4781612163565b336112286111a4565b6001600160a01b03161461124f57604051630e6444a160e31b815260040160405180910390fd5b8160010361128e57826001600160a01b0316600080516020612d99833981519152600583604051611281929190612b44565b60405180910390a2505050565b816002036112c057826001600160a01b0316600080516020612d99833981519152600683604051611281929190612b44565b505050565b6112cd611e91565b6001600160a01b0316336001600160a01b0316146112fd5760405162461bcd60e51b815260040161062e90612a38565b610643848484846122f3565b611311611e91565b6001600160a01b0316336001600160a01b0316146113415760405162461bcd60e51b815260040161062e90612a38565b806001600160a01b03163b60000361136c57604051637bcd509160e01b815260040160405180910390fd5b610c4781612118565b61137d611e91565b6001600160a01b0316336001600160a01b0316146113ad5760405162461bcd60e51b815260040161062e90612a38565b6112c08383836121f9565b6113c0611e91565b6001600160a01b0316336001600160a01b0316146113f05760405162461bcd60e51b815260040161062e90612a38565b61064384848484612246565b600054604051635061f96960e11b81526001600160a01b039091169063a0c3f2d29061142c908490600401612725565b602060405180830381865afa158015611449573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146d9190612ca4565b6114df5760405162461bcd60e51b815260206004820152603f60248201527f536c617368496e64696361746f723a20636f6e73656e7375732061646472657360448201527f73206d75737420626520612076616c696461746f722063616e64696461746500606482015260840161062e565b6000546040516304d971ab60e01b81526001600160a01b038381166004830152336024830152909116906304d971ab90604401602060405180830381865afa15801561152f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115539190612ca4565b6115bf5760405162461bcd60e51b815260206004820152603760248201527f536c617368496e64696361746f723a206d6574686f642063616c6c6572206d7560448201527639ba10313290309031b0b73234b230ba329030b236b4b760491b606482015260840161062e565b60008054604051634b2c2fe160e11b815282916001600160a01b0316906396585fc2906115f0908690600401612725565b606060405180830381865afa15801561160d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116319190612cbf565b9250509150816116a75760405162461bcd60e51b815260206004820152603b60248201527f536c617368496e64696361746f723a2063616c6c6572206d757374206265206a60448201527a185a5b1959081a5b881d1a194818dd5c9c995b9d081c195c9a5bd9602a1b606482015260840161062e565b60008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171f9190612a1f565b6001600160a01b038516600090815260db6020908152604080832084845290915290205490915060ff16156117b25760405162461bcd60e51b815260206004820152603360248201527f536c617368496e64696361746f723a2076616c696461746f7220686173206261604482015272696c6564206f75742070726576696f75736c7960681b606482015260840161062e565b6001600160a01b038416600090815260dc602052604081205460df549091906117db9085612cf4565b90508082101561184b5760405162461bcd60e51b815260206004820152603560248201527f536c617368496e64696361746f723a20696e73756666696369656e7420637265604482015274191a5d081cd8dbdc99481d1bc818985a5b081bdd5d605a1b606482015260840161062e565b600054604051630adaf5ef60e11b81526001600160a01b03909116906315b5ebde9061187d9089908790600401612d0b565b600060405180830381600087803b15801561189757600080fd5b505af11580156118ab573d6000803e3d6000fd5b505050506001600160a01b038616600090815260dc6020526040812080548392906118d7908490612b31565b90915550506001600160a01b038616600090815260a4602090815260408083208684529091528120556001600160a01b038616600081815260db60209081526040808320878452825291829020805460ff1916600117905581518681529081018490527f7ff9f7032d565c7e8919332964b2faa33c320b53604a65d9dd1f8112e12cd39d910160405180910390a2505050505050565b611975611e91565b6001600160a01b0316336001600160a01b0316146119a55760405162461bcd60e51b815260040161062e90612a38565b806001600160a01b03163b6000036119d057604051637bcd509160e01b815260040160405180910390fd5b610c47816121ae565b6060816001600160401b038111156119f3576119f3612956565b604051908082528060200260200182016040528015611a1c578160200160208202803683370190505b50905060005b8151811015611aa65760dc6000858584818110611a4157611a4161296c565b9050602002016020810190611a5691906125f8565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110611a8957611a8961296c565b602090810291909101015280611a9e81612998565b915050611a22565b5092915050565b60a3544311611b495760405162461bcd60e51b815260206004820152605c60248201527f536c617368496e64696361746f723a2063616e6e6f7420736c6173682061207660448201527f616c696461746f72207477696365206f7220736c617368206d6f72652074686160648201527b6e206f6e652076616c696461746f7220696e206f6e6520626c6f636b60201b608482015260a40161062e565b4360a355334114611bb85760405162461bcd60e51b815260206004820152603360248201527f536c617368556e617661696c6162696c6974793a206d6574686f642063616c6c6044820152726572206d75737420626520636f696e6261736560681b606482015260840161062e565b611bc181612407565b15610c475760008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3e9190612a1f565b6001600160a01b038316600090815260a4602090815260408083208484529091528120805492935090918290611c7390612998565b91905081905590506000611c894360a85461250f565b905060a6548203611d3357836001600160a01b0316600080516020612d99833981519152600285604051611cbe929190612b44565b60405180910390a26000805460a754604051630bde081360e21b81526001600160a01b0390921692632f78204c92611cfc9289928792600401612b70565b600060405180830381600087803b158015611d1657600080fd5b505af1158015611d2a573d6000803e3d6000fd5b50505050610643565b60a5548203610643576000611d488585610bac565b905080611ded57846001600160a01b0316600080516020612d99833981519152600186604051611d79929190612b44565b60405180910390a260008054604051630bde081360e21b81526001600160a01b0390911691632f78204c91611db691899181908190600401612b70565b600060405180830381600087803b158015611dd057600080fd5b505af1158015611de4573d6000803e3d6000fd5b50505050611e8a565b846001600160a01b0316600080516020612d99833981519152600786604051611e17929190612b44565b60405180910390a260005460a754604051630bde081360e21b81526001600160a01b0390921691632f78204c91611e579189918791600190600401612b70565b600060405180830381600087803b158015611e7157600080fd5b505af1158015611e85573d6000803e3d6000fd5b505050505b5050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b828411158015611ed157506127108411155b8015611edf57506127108311155b611f2b5760405162461bcd60e51b815260206004820152601e60248201527f536c617368496e64696361746f723a20696e76616c696420726174696f730000604482015260640161062e565b606d849055606e839055606f82905560708190556040517fd24c671da2227c139fe1a5b34de15e5a67bef9b46e912916b9e0d025d51b3e3b90611f75908690869086908690612647565b60405180910390a150505050565b600081831015611f935781610bd4565b5090919050565b6040516000906067906001908390611fbe908a908a908a908a908a90602401612d4d565b60408051601f198184030181529190526020810180516001600160e01b0316637fc3567760e01b1790528051909150611ff5612539565b602083016020828483895afa61200a57600094505b503d61201557600093505b8361203357604051630fc2632160e01b815260040160405180910390fd5b5115159a9950505050505050505050565b606c80546001600160a01b0319166001600160a01b0383161790556040517f31a33f126a5bae3c5bdf6cfc2cd6dcfffe2fe9634bdb09e21c44762993889e3b9061208f908390612725565b60405180910390a150565b60008183116120aa576000610bd4565b610bd48284612b31565b60006120c96120c38486612d85565b8361252a565b949350505050565b6038829055603981905560408051838152602081018390527fbda9ec2980d7468ba6a9f363696315affca9f9770016396bdea2ac39c3e5d61a910160405180910390a15050565b600080546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b68361699061208f908390612725565b603580546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d79061208f908390612725565b603680546001600160a01b0319166001600160a01b0383161790556040517f9125df97e014f5cc4f107fd784acd35e8e2188ca7c2a0f7caa478365747c1c839061208f908390612725565b60018390556002829055600381905560408051848152602081018490529081018290527f913da102149f952dde560cef3349db8e8002e9d580c41a7551d6d45329f4306b90606001610568565b60a65460a55411156122a95760405162461bcd60e51b815260206004820152602660248201527f536c617368556e617661696c6162696c6974793a20696e76616c696420746872604482015265195cda1bdb1960d21b606482015260840161062e565b60a584905560a683905560a782905560a88190556040517f442862e6143ad95854e7c13ff4947ec6e43bc87160e3b193e7c1abaf6e3aaa9890611f75908690869086908690612647565b828411156123545760405162461bcd60e51b815260206004820152602860248201527f43726564697453636f72653a20696e76616c6964206372656469742073636f726044820152676520636f6e66696760c01b606482015260840161062e565b6127108111156123bd5760405162461bcd60e51b815260206004820152602e60248201527f43726564697453636f72653a20696e76616c696420637574206f66662070657260448201526d63656e7461676520636f6e66696760901b606482015260840161062e565b60dd84905560de83905560df82905560e08190556040517fe1f9c6c73554b5fa140eead3cfd4ec3e6d4824f3ed26fb25e38376f65b95470b90611f75908690869086908690612647565b6000336001600160a01b0383161480159061248e5750600054604051633292276760e11b81526001600160a01b03909116906365244ece9061244d908590600401612725565b602060405180830381865afa15801561246a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248e9190612ca4565b80156105f05750606c54604051630fbeb37f60e01b81526001600160a01b0390911690630fbeb37f906124c79085904390600401612d0b565b602060405180830381865afa1580156124e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125089190612ca4565b1592915050565b600081600003612520576000610bd4565b610bd48284612d85565b6000818310611f935781610bd4565b60405180602001604052806001906020820280368337509192915050565b60008083601f84011261256957600080fd5b5081356001600160401b0381111561258057600080fd5b6020830191508360208260051b850101111561259b57600080fd5b9250929050565b600080602083850312156125b557600080fd5b82356001600160401b038111156125cb57600080fd5b6125d785828601612557565b90969095509350505050565b6001600160a01b0381168114610c4757600080fd5b60006020828403121561260a57600080fd5b8135610bd4816125e3565b6000806000806080858703121561262b57600080fd5b5050823594602084013594506040840135936060013592509050565b93845260208401929092526040830152606082015260800190565b60008083601f84011261267457600080fd5b5081356001600160401b0381111561268b57600080fd5b60208301915083602082850101111561259b57600080fd5b6000806000806000606086880312156126bb57600080fd5b85356126c6816125e3565b945060208601356001600160401b03808211156126e257600080fd5b6126ee89838a01612662565b9096509450604088013591508082111561270757600080fd5b5061271488828901612662565b969995985093965092949392505050565b6001600160a01b0391909116815260200190565b6000806040838503121561274c57600080fd5b8235612757816125e3565b946020939093013593505050565b60008060006040848603121561277a57600080fd5b83356001600160401b0381111561279057600080fd5b61279c86828701612557565b909790965060209590950135949350505050565b600080604083850312156127c357600080fd5b50508035926020909101359150565b80608081018310156105f057600080fd5b60008060008060008060008060006102a08a8c03121561280257600080fd5b893561280d816125e3565b985060208a013561281d816125e3565b975060408a013561282d816125e3565b965060608a013561283d816125e3565b955061284c8b60808c016127d2565b94506101408a018b81111561286057600080fd5b6101008b0194506101a08b018c81111561287957600080fd5b8194506128868d826127d2565b935050506128988b6102208c016127d2565b90509295985092959850929598565b6000806000606084860312156128bc57600080fd5b83356128c7816125e3565b95602085013595506040909401359392505050565b6000806000606084860312156128f157600080fd5b505081359360208301359350604090920135919050565b600081518084526020808501945080840160005b838110156129385781518752958201959082019060010161291c565b509495945050505050565b602081526000610bd46020830184612908565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016129aa576129aa612982565b5060010190565b8183526000602080850194508260005b858110156129385781356129d4816125e3565b6001600160a01b0316875295820195908201906001016129c1565b604081526000612a036040830185876129b1565b8281036020840152612a158185612908565b9695505050505050565b600060208284031215612a3157600080fd5b5051919050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b604051601f8201601f191681016001600160401b0381118282101715612aa257612aa2612956565b604052919050565b600060a08284031215612abc57600080fd5b60405160a081016001600160401b0381118282101715612ade57612ade612956565b6040528251612aec816125e3565b81526020830151612afc816125e3565b60208201526040830151612b0f816125e3565b6040820152606083810151908201526080928301519281019290925250919050565b818103818111156105f0576105f0612982565b6040810160088410612b6657634e487b7160e01b600052602160045260246000fd5b9281526020015290565b6001600160a01b03949094168452602084019290925260408301521515606082015260800190565b8183823760009101908152919050565b6020815260006120c96020830184866129b1565b80518015158114612bcc57600080fd5b919050565b60006020808385031215612be457600080fd5b82516001600160401b0380821115612bfb57600080fd5b818501915085601f830112612c0f57600080fd5b815181811115612c2157612c21612956565b8060051b9150612c32848301612a7a565b8181529183018401918481019088841115612c4c57600080fd5b938501935b83851015612c7157612c6285612bbc565b82529385019390850190612c51565b98975050505050505050565b606081526000612c916060830186886129b1565b6020830194909452506040015292915050565b600060208284031215612cb657600080fd5b610bd482612bbc565b600080600060608486031215612cd457600080fd5b612cdd84612bbc565b925060208401519150604084015190509250925092565b80820281158282048414176105f0576105f0612982565b6001600160a01b03929092168252602082015260400190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090612d729083018688612d24565b8281036040840152612c71818587612d24565b808201808211156105f0576105f061298256fe607adba66cff84b627e3537d1c17d088a98556bccd0536a2f3590c56329023d98c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c23480a2646970667358221220bbb9c8a18d14676fde8bc85398a11a7545f7fb8cce3da08ee81c2ef3b251559464736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b506004361061018b5760003560e01c806307c2d2f614610190578063082e7420146101a55780630e1512ac146101cb5780631079402a146101de5780631a697341146101fb5780631e90b2a01461020e57806323368e471461022157806329ddc3c01461023b5780633d48fd7d1461025e57806346fe93111461026f5780635511cde11461028257806362ffe6cb146102935780637680850c146102a65780637c2b55a0146102b9578063853af1b7146102c057806399103f7b146102d357806399439089146102e6578063b5e337de146102ee578063c008ce3914610301578063c2e524dc14610314578063c6391fa21461032f578063ccbb72ed14610340578063cdf64a7614610353578063cf39d13c14610366578063d1737e2714610379578063d1f992f71461038c578063d2cb215e1461039f578063d3dd2bdf146103b0578063d73e81b8146103d9578063df4b6ee0146103ec578063f1001e7814610410578063f562b3c414610430578063fd422cd014610439575b600080fd5b6101a361019e3660046125a2565b61044c565b005b6101b86101b33660046125f8565b610575565b6040519081526020015b60405180910390f35b6101a36101d9366004612615565b6105f6565b606d54606e54606f546070545b6040516101c29493929190612647565b6101a36102093660046125f8565b610649565b6101a361021c3660046126a3565b610947565b6036546001600160a01b03165b6040516101c29190612725565b61024e610249366004612739565b610bac565b60405190151581526020016101c2565b60a55460a65460a75460a8546101eb565b6101a361027d3660046125f8565b610bdb565b6035546001600160a01b031661022e565b6101b86102a1366004612739565b610c4a565b6101a36102b4366004612765565b610c73565b606761022e565b6101a36102ce3660046127b0565b610fb4565b6101a36102e13660046127e3565b610ffa565b61022e6111a4565b6101a36102fc3660046125f8565b6111b3565b6101a361030f3660046128a7565b61121f565b603854603954604080519283526020830191909152016101c2565b60dd5460de5460df5460e0546101eb565b6101a361034e366004612615565b6112c5565b6101a36103613660046125f8565b611309565b6101a36103743660046128dc565b611375565b6101a3610387366004612615565b6113b8565b6101a361039a3660046125f8565b6113fc565b606c546001600160a01b031661022e565b6101b86103be3660046125f8565b6001600160a01b0316600090815260dc602052604090205490565b6101a36103e73660046125f8565b61196d565b600154600254600354604080519384526020840192909252908201526060016101c2565b61042361041e3660046125a2565b6119d9565b6040516101c29190612943565b6101b860a35481565b6101a36104473660046125f8565b611aad565b336104556111a4565b6001600160a01b03161461047c57604051630e6444a160e31b815260040160405180910390fd5b6000816001600160401b0381111561049657610496612956565b6040519080825280602002602001820160405280156104bf578160200160208202803683370190505b50905060005b828110156105465760008484838181106104e1576104e161296c565b90506020020160208101906104f691906125f8565b6001600160a01b038116600090815260dc602052604081205583519091508390839081106105265761052661296c565b60200260200101600081525050808061053e90612998565b9150506104c5565b50600080516020612db9833981519152838383604051610568939291906129ef565b60405180910390a1505050565b60006105f08260008054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156105cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102a19190612a1f565b92915050565b6105fe611e91565b6001600160a01b0316336001600160a01b0316146106375760405162461bcd60e51b815260040161062e90612a38565b60405180910390fd5b61064384848484611ebf565b50505050565b610651611e91565b6001600160a01b0316336001600160a01b0316146106815760405162461bcd60e51b815260040161062e90612a38565b603554604051636db349d160e11b81526000916001600160a01b03169063db6693a2906106b2908590600401612725565b60a060405180830381865afa1580156106cf573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106f39190612aaa565b6036546040808301519051632623bd4f60e21b815292935060009261077a926001600160a01b03169163988ef53c9161072f9190600401612725565b602060405180830381865afa15801561074c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107709190612a1f565b8360800151611f83565b905060008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156107d0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107f49190612a1f565b6038549091506108048343612b31565b11801561083557506001600160a01b038416600090815260376020908152604080832084845290915290205460ff16155b6108815760405162461bcd60e51b815260206004820181905260248201527f536c617368427269646765566f74696e673a20696e76616c696420736c617368604482015260640161062e565b6001600160a01b038416600081815260376020908152604080832085845290915290819020805460ff1916600117905551600080516020612d99833981519152906108d0906004908590612b44565b60405180910390a260008054603954604051630bde081360e21b81526001600160a01b0390921692632f78204c9261090f928992918290600401612b70565b600060405180830381600087803b15801561092957600080fd5b505af115801561093d573d6000803e3d6000fd5b5050505050505050565b61094f611e91565b6001600160a01b0316336001600160a01b03161461097f5760405162461bcd60e51b815260040161062e90612a38565b60008484604051610991929190612b98565b60405180910390209050600083836040516109ad929190612b98565b604080519182900390912060008481526004602052919091205490915060ff161580156109e9575060008181526004602052604090205460ff16155b610a495760405162461bcd60e51b815260206004820152602b60248201527f536c617368446f75626c655369676e3a2065766964656e636520616c7265616460448201526a1e481cdd589b5a5d1d195960aa1b606482015260840161062e565b610a568787878787611f9a565b15610ba35760008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ad39190612a1f565b6000848152600460205260408082208054600160ff19918216811790925586845292829020805490931617909155519091506001600160a01b03891690600080516020612d9983398151915290610b2e906003908590612b44565b60405180910390a260005460025460018054604051630bde081360e21b81526001600160a01b0390941693632f78204c93610b6f938e939192600401612b70565b600060405180830381600087803b158015610b8957600080fd5b505af1158015610b9d573d6000803e3d6000fd5b50505050505b50505050505050565b6001600160a01b038216600090815260db6020908152604080832084845290915281205460ff165b9392505050565b610be3611e91565b6001600160a01b0316336001600160a01b031614610c135760405162461bcd60e51b815260040161062e90612a38565b806001600160a01b03163b600003610c3e57604051637bcd509160e01b815260040160405180910390fd5b610c4781612044565b50565b6001600160a01b038216600090815260a460209081526040808320848452909152812054610bd4565b33610c7c6111a4565b6001600160a01b031614610ca357604051630e6444a160e31b815260040160405180910390fd5b60008060009054906101000a90046001600160a01b03166001600160a01b031663297a8fca6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cf7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d1b9190612a1f565b60008054604051634de2b73560e01b815292935090916001600160a01b0390911690634de2b73590610d539088908890600401612ba8565b600060405180830381865afa158015610d70573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d989190810190612bd1565b606c5460405163ba30375560e01b81529192506000916001600160a01b039091169063ba30375590610dd4908990899088904390600401612c7d565b600060405180830381865afa158015610df1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610e199190810190612bd1565b90506000856001600160401b03811115610e3557610e35612956565b604051908082528060200260200182016040528015610e5e578160200160208202803683370190505b50905060005b86811015610f81576000888883818110610e8057610e8061296c565b9050602002016020810190610e9591906125f8565b90506000610ea38289610c4a565b90506000868481518110610eb957610eb961296c565b602002602001015190506000868581518110610ed757610ed761296c565b6020026020010151905060008280610eec5750815b610f0157610efc60dd548561209a565b610f04565b60005b6001600160a01b038616600090815260dc602052604090205460de54919250610f2e9183906120b4565b6001600160a01b038616600090815260dc602052604090208190558751889088908110610f5d57610f5d61296c565b60200260200101818152505050505050508080610f7990612998565b915050610e64565b50600080516020612db9833981519152878783604051610fa3939291906129ef565b60405180910390a150505050505050565b610fbc611e91565b6001600160a01b0316336001600160a01b031614610fec5760405162461bcd60e51b815260040161062e90612a38565b610ff682826120d1565b5050565b61011354610100900460ff161580801561101c575061011354600160ff909116105b806110375750303b15801561103757506101135460ff166001145b61109a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161062e565b610113805460ff1916600117905580156110bf57610113805461ff0019166101001790555b6110c88a612118565b6110d189612044565b6110da88612163565b6110e3876121ae565b6110fc86356020880135604089013560608a0135611ebf565b61110b853560208701356120d1565b61111f8435602086013560408701356121f9565b6111388335602085013560408601356060870135612246565b61115182356020840135604085013560608601356122f3565b801561119857610113805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050565b6000546001600160a01b031690565b6111bb611e91565b6001600160a01b0316336001600160a01b0316146111eb5760405162461bcd60e51b815260040161062e90612a38565b806001600160a01b03163b60000361121657604051637bcd509160e01b815260040160405180910390fd5b610c4781612163565b336112286111a4565b6001600160a01b03161461124f57604051630e6444a160e31b815260040160405180910390fd5b8160010361128e57826001600160a01b0316600080516020612d99833981519152600583604051611281929190612b44565b60405180910390a2505050565b816002036112c057826001600160a01b0316600080516020612d99833981519152600683604051611281929190612b44565b505050565b6112cd611e91565b6001600160a01b0316336001600160a01b0316146112fd5760405162461bcd60e51b815260040161062e90612a38565b610643848484846122f3565b611311611e91565b6001600160a01b0316336001600160a01b0316146113415760405162461bcd60e51b815260040161062e90612a38565b806001600160a01b03163b60000361136c57604051637bcd509160e01b815260040160405180910390fd5b610c4781612118565b61137d611e91565b6001600160a01b0316336001600160a01b0316146113ad5760405162461bcd60e51b815260040161062e90612a38565b6112c08383836121f9565b6113c0611e91565b6001600160a01b0316336001600160a01b0316146113f05760405162461bcd60e51b815260040161062e90612a38565b61064384848484612246565b600054604051635061f96960e11b81526001600160a01b039091169063a0c3f2d29061142c908490600401612725565b602060405180830381865afa158015611449573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061146d9190612ca4565b6114df5760405162461bcd60e51b815260206004820152603f60248201527f536c617368496e64696361746f723a20636f6e73656e7375732061646472657360448201527f73206d75737420626520612076616c696461746f722063616e64696461746500606482015260840161062e565b6000546040516304d971ab60e01b81526001600160a01b038381166004830152336024830152909116906304d971ab90604401602060405180830381865afa15801561152f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115539190612ca4565b6115bf5760405162461bcd60e51b815260206004820152603760248201527f536c617368496e64696361746f723a206d6574686f642063616c6c6572206d7560448201527639ba10313290309031b0b73234b230ba329030b236b4b760491b606482015260840161062e565b60008054604051634b2c2fe160e11b815282916001600160a01b0316906396585fc2906115f0908690600401612725565b606060405180830381865afa15801561160d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116319190612cbf565b9250509150816116a75760405162461bcd60e51b815260206004820152603b60248201527f536c617368496e64696361746f723a2063616c6c6572206d757374206265206a60448201527a185a5b1959081a5b881d1a194818dd5c9c995b9d081c195c9a5bd9602a1b606482015260840161062e565b60008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116fb573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061171f9190612a1f565b6001600160a01b038516600090815260db6020908152604080832084845290915290205490915060ff16156117b25760405162461bcd60e51b815260206004820152603360248201527f536c617368496e64696361746f723a2076616c696461746f7220686173206261604482015272696c6564206f75742070726576696f75736c7960681b606482015260840161062e565b6001600160a01b038416600090815260dc602052604081205460df549091906117db9085612cf4565b90508082101561184b5760405162461bcd60e51b815260206004820152603560248201527f536c617368496e64696361746f723a20696e73756666696369656e7420637265604482015274191a5d081cd8dbdc99481d1bc818985a5b081bdd5d605a1b606482015260840161062e565b600054604051630adaf5ef60e11b81526001600160a01b03909116906315b5ebde9061187d9089908790600401612d0b565b600060405180830381600087803b15801561189757600080fd5b505af11580156118ab573d6000803e3d6000fd5b505050506001600160a01b038616600090815260dc6020526040812080548392906118d7908490612b31565b90915550506001600160a01b038616600090815260a4602090815260408083208684529091528120556001600160a01b038616600081815260db60209081526040808320878452825291829020805460ff1916600117905581518681529081018490527f7ff9f7032d565c7e8919332964b2faa33c320b53604a65d9dd1f8112e12cd39d910160405180910390a2505050505050565b611975611e91565b6001600160a01b0316336001600160a01b0316146119a55760405162461bcd60e51b815260040161062e90612a38565b806001600160a01b03163b6000036119d057604051637bcd509160e01b815260040160405180910390fd5b610c47816121ae565b6060816001600160401b038111156119f3576119f3612956565b604051908082528060200260200182016040528015611a1c578160200160208202803683370190505b50905060005b8151811015611aa65760dc6000858584818110611a4157611a4161296c565b9050602002016020810190611a5691906125f8565b6001600160a01b03166001600160a01b0316815260200190815260200160002054828281518110611a8957611a8961296c565b602090810291909101015280611a9e81612998565b915050611a22565b5092915050565b60a3544311611b495760405162461bcd60e51b815260206004820152605c60248201527f536c617368496e64696361746f723a2063616e6e6f7420736c6173682061207660448201527f616c696461746f72207477696365206f7220736c617368206d6f72652074686160648201527b6e206f6e652076616c696461746f7220696e206f6e6520626c6f636b60201b608482015260a40161062e565b4360a355334114611bb85760405162461bcd60e51b815260206004820152603360248201527f536c617368556e617661696c6162696c6974793a206d6574686f642063616c6c6044820152726572206d75737420626520636f696e6261736560681b606482015260840161062e565b611bc181612407565b15610c475760008060009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015611c1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c3e9190612a1f565b6001600160a01b038316600090815260a4602090815260408083208484529091528120805492935090918290611c7390612998565b91905081905590506000611c894360a85461250f565b905060a6548203611d3357836001600160a01b0316600080516020612d99833981519152600285604051611cbe929190612b44565b60405180910390a26000805460a754604051630bde081360e21b81526001600160a01b0390921692632f78204c92611cfc9289928792600401612b70565b600060405180830381600087803b158015611d1657600080fd5b505af1158015611d2a573d6000803e3d6000fd5b50505050610643565b60a5548203610643576000611d488585610bac565b905080611ded57846001600160a01b0316600080516020612d99833981519152600186604051611d79929190612b44565b60405180910390a260008054604051630bde081360e21b81526001600160a01b0390911691632f78204c91611db691899181908190600401612b70565b600060405180830381600087803b158015611dd057600080fd5b505af1158015611de4573d6000803e3d6000fd5b50505050611e8a565b846001600160a01b0316600080516020612d99833981519152600786604051611e17929190612b44565b60405180910390a260005460a754604051630bde081360e21b81526001600160a01b0390921691632f78204c91611e579189918791600190600401612b70565b600060405180830381600087803b158015611e7157600080fd5b505af1158015611e85573d6000803e3d6000fd5b505050505b5050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b828411158015611ed157506127108411155b8015611edf57506127108311155b611f2b5760405162461bcd60e51b815260206004820152601e60248201527f536c617368496e64696361746f723a20696e76616c696420726174696f730000604482015260640161062e565b606d849055606e839055606f82905560708190556040517fd24c671da2227c139fe1a5b34de15e5a67bef9b46e912916b9e0d025d51b3e3b90611f75908690869086908690612647565b60405180910390a150505050565b600081831015611f935781610bd4565b5090919050565b6040516000906067906001908390611fbe908a908a908a908a908a90602401612d4d565b60408051601f198184030181529190526020810180516001600160e01b0316637fc3567760e01b1790528051909150611ff5612539565b602083016020828483895afa61200a57600094505b503d61201557600093505b8361203357604051630fc2632160e01b815260040160405180910390fd5b5115159a9950505050505050505050565b606c80546001600160a01b0319166001600160a01b0383161790556040517f31a33f126a5bae3c5bdf6cfc2cd6dcfffe2fe9634bdb09e21c44762993889e3b9061208f908390612725565b60405180910390a150565b60008183116120aa576000610bd4565b610bd48284612b31565b60006120c96120c38486612d85565b8361252a565b949350505050565b6038829055603981905560408051838152602081018390527fbda9ec2980d7468ba6a9f363696315affca9f9770016396bdea2ac39c3e5d61a910160405180910390a15050565b600080546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b68361699061208f908390612725565b603580546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d79061208f908390612725565b603680546001600160a01b0319166001600160a01b0383161790556040517f9125df97e014f5cc4f107fd784acd35e8e2188ca7c2a0f7caa478365747c1c839061208f908390612725565b60018390556002829055600381905560408051848152602081018490529081018290527f913da102149f952dde560cef3349db8e8002e9d580c41a7551d6d45329f4306b90606001610568565b60a65460a55411156122a95760405162461bcd60e51b815260206004820152602660248201527f536c617368556e617661696c6162696c6974793a20696e76616c696420746872604482015265195cda1bdb1960d21b606482015260840161062e565b60a584905560a683905560a782905560a88190556040517f442862e6143ad95854e7c13ff4947ec6e43bc87160e3b193e7c1abaf6e3aaa9890611f75908690869086908690612647565b828411156123545760405162461bcd60e51b815260206004820152602860248201527f43726564697453636f72653a20696e76616c6964206372656469742073636f726044820152676520636f6e66696760c01b606482015260840161062e565b6127108111156123bd5760405162461bcd60e51b815260206004820152602e60248201527f43726564697453636f72653a20696e76616c696420637574206f66662070657260448201526d63656e7461676520636f6e66696760901b606482015260840161062e565b60dd84905560de83905560df82905560e08190556040517fe1f9c6c73554b5fa140eead3cfd4ec3e6d4824f3ed26fb25e38376f65b95470b90611f75908690869086908690612647565b6000336001600160a01b0383161480159061248e5750600054604051633292276760e11b81526001600160a01b03909116906365244ece9061244d908590600401612725565b602060405180830381865afa15801561246a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061248e9190612ca4565b80156105f05750606c54604051630fbeb37f60e01b81526001600160a01b0390911690630fbeb37f906124c79085904390600401612d0b565b602060405180830381865afa1580156124e4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125089190612ca4565b1592915050565b600081600003612520576000610bd4565b610bd48284612d85565b6000818310611f935781610bd4565b60405180602001604052806001906020820280368337509192915050565b60008083601f84011261256957600080fd5b5081356001600160401b0381111561258057600080fd5b6020830191508360208260051b850101111561259b57600080fd5b9250929050565b600080602083850312156125b557600080fd5b82356001600160401b038111156125cb57600080fd5b6125d785828601612557565b90969095509350505050565b6001600160a01b0381168114610c4757600080fd5b60006020828403121561260a57600080fd5b8135610bd4816125e3565b6000806000806080858703121561262b57600080fd5b5050823594602084013594506040840135936060013592509050565b93845260208401929092526040830152606082015260800190565b60008083601f84011261267457600080fd5b5081356001600160401b0381111561268b57600080fd5b60208301915083602082850101111561259b57600080fd5b6000806000806000606086880312156126bb57600080fd5b85356126c6816125e3565b945060208601356001600160401b03808211156126e257600080fd5b6126ee89838a01612662565b9096509450604088013591508082111561270757600080fd5b5061271488828901612662565b969995985093965092949392505050565b6001600160a01b0391909116815260200190565b6000806040838503121561274c57600080fd5b8235612757816125e3565b946020939093013593505050565b60008060006040848603121561277a57600080fd5b83356001600160401b0381111561279057600080fd5b61279c86828701612557565b909790965060209590950135949350505050565b600080604083850312156127c357600080fd5b50508035926020909101359150565b80608081018310156105f057600080fd5b60008060008060008060008060006102a08a8c03121561280257600080fd5b893561280d816125e3565b985060208a013561281d816125e3565b975060408a013561282d816125e3565b965060608a013561283d816125e3565b955061284c8b60808c016127d2565b94506101408a018b81111561286057600080fd5b6101008b0194506101a08b018c81111561287957600080fd5b8194506128868d826127d2565b935050506128988b6102208c016127d2565b90509295985092959850929598565b6000806000606084860312156128bc57600080fd5b83356128c7816125e3565b95602085013595506040909401359392505050565b6000806000606084860312156128f157600080fd5b505081359360208301359350604090920135919050565b600081518084526020808501945080840160005b838110156129385781518752958201959082019060010161291c565b509495945050505050565b602081526000610bd46020830184612908565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016129aa576129aa612982565b5060010190565b8183526000602080850194508260005b858110156129385781356129d4816125e3565b6001600160a01b0316875295820195908201906001016129c1565b604081526000612a036040830185876129b1565b8281036020840152612a158185612908565b9695505050505050565b600060208284031215612a3157600080fd5b5051919050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b604051601f8201601f191681016001600160401b0381118282101715612aa257612aa2612956565b604052919050565b600060a08284031215612abc57600080fd5b60405160a081016001600160401b0381118282101715612ade57612ade612956565b6040528251612aec816125e3565b81526020830151612afc816125e3565b60208201526040830151612b0f816125e3565b6040820152606083810151908201526080928301519281019290925250919050565b818103818111156105f0576105f0612982565b6040810160088410612b6657634e487b7160e01b600052602160045260246000fd5b9281526020015290565b6001600160a01b03949094168452602084019290925260408301521515606082015260800190565b8183823760009101908152919050565b6020815260006120c96020830184866129b1565b80518015158114612bcc57600080fd5b919050565b60006020808385031215612be457600080fd5b82516001600160401b0380821115612bfb57600080fd5b818501915085601f830112612c0f57600080fd5b815181811115612c2157612c21612956565b8060051b9150612c32848301612a7a565b8181529183018401918481019088841115612c4c57600080fd5b938501935b83851015612c7157612c6285612bbc565b82529385019390850190612c51565b98975050505050505050565b606081526000612c916060830186886129b1565b6020830194909452506040015292915050565b600060208284031215612cb657600080fd5b610bd482612bbc565b600080600060608486031215612cd457600080fd5b612cdd84612bbc565b925060208401519150604084015190509250925092565b80820281158282048414176105f0576105f0612982565b6001600160a01b03929092168252602082015260400190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b0386168152606060208201819052600090612d729083018688612d24565b8281036040840152612c71818587612d24565b808201808211156105f0576105f061298256fe607adba66cff84b627e3537d1c17d088a98556bccd0536a2f3590c56329023d98c02b2ccee964dc50649a48bd0a0446f0f9e88ecdb72d099f4ace07c39c23480a2646970667358221220bbb9c8a18d14676fde8bc85398a11a7545f7fb8cce3da08ee81c2ef3b251559464736f6c63430008110033", "devdoc": { "errors": { "ErrCallPrecompiled()": [ @@ -1198,15 +1198,15 @@ "storageLayout": { "storage": [ { - "astId": 6462, + "astId": 7051, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_validatorContract", "offset": 0, "slot": "0", - "type": "t_contract(IRoninValidatorSet)11978" + "type": "t_contract(IRoninValidatorSet)11973" }, { - "astId": 25381, + "astId": 26705, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_slashDoubleSignAmount", "offset": 0, @@ -1214,7 +1214,7 @@ "type": "t_uint256" }, { - "astId": 25384, + "astId": 26708, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_doubleSigningJailUntilBlock", "offset": 0, @@ -1222,7 +1222,7 @@ "type": "t_uint256" }, { - "astId": 25387, + "astId": 26711, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_doubleSigningOffsetLimitBlock", "offset": 0, @@ -1230,7 +1230,7 @@ "type": "t_uint256" }, { - "astId": 25392, + "astId": 26716, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_submittedEvidence", "offset": 0, @@ -1238,7 +1238,7 @@ "type": "t_mapping(t_bytes32,t_bool)" }, { - "astId": 25397, + "astId": 26721, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______gap", "offset": 0, @@ -1246,23 +1246,23 @@ "type": "t_array(t_uint256)48_storage" }, { - "astId": 6146, + "astId": 6735, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_roninTrustedOrganizationContract", "offset": 0, "slot": "53", - "type": "t_contract(IRoninTrustedOrganization)10196" + "type": "t_contract(IRoninTrustedOrganization)10182" }, { - "astId": 6067, + "astId": 6656, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_roninGovernanceAdminContract", "offset": 0, "slot": "54", - "type": "t_contract(IRoninGovernanceAdmin)10017" + "type": "t_contract(IRoninGovernanceAdmin)10003" }, { - "astId": 25227, + "astId": 26547, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_bridgeVotingSlashed", "offset": 0, @@ -1270,7 +1270,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 25230, + "astId": 26550, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_bridgeVotingThreshold", "offset": 0, @@ -1278,7 +1278,7 @@ "type": "t_uint256" }, { - "astId": 25233, + "astId": 26553, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_bridgeVotingSlashAmount", "offset": 0, @@ -1286,7 +1286,7 @@ "type": "t_uint256" }, { - "astId": 25238, + "astId": 26558, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______gap", "offset": 0, @@ -1294,15 +1294,15 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 5955, + "astId": 6544, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_maintenanceContract", "offset": 0, "slot": "108", - "type": "t_contract(IMaintenance)9709" + "type": "t_contract(IMaintenance)9657" }, { - "astId": 25059, + "astId": 26379, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_missingVotesRatioTier1", "offset": 0, @@ -1310,7 +1310,7 @@ "type": "t_uint256" }, { - "astId": 25062, + "astId": 26382, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_missingVotesRatioTier2", "offset": 0, @@ -1318,7 +1318,7 @@ "type": "t_uint256" }, { - "astId": 25065, + "astId": 26385, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_jailDurationForMissingVotesRatioTier2", "offset": 0, @@ -1326,7 +1326,7 @@ "type": "t_uint256" }, { - "astId": 25068, + "astId": 26388, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_skipBridgeOperatorSlashingThreshold", "offset": 0, @@ -1334,7 +1334,7 @@ "type": "t_uint256" }, { - "astId": 25073, + "astId": 26393, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______gap", "offset": 0, @@ -1342,7 +1342,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 25807, + "astId": 27131, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "lastUnavailabilitySlashedBlock", "offset": 0, @@ -1350,7 +1350,7 @@ "type": "t_uint256" }, { - "astId": 25814, + "astId": 27138, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_unavailabilityIndicator", "offset": 0, @@ -1358,7 +1358,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_uint256))" }, { - "astId": 25817, + "astId": 27141, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_unavailabilityTier1Threshold", "offset": 0, @@ -1366,7 +1366,7 @@ "type": "t_uint256" }, { - "astId": 25820, + "astId": 27144, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_unavailabilityTier2Threshold", "offset": 0, @@ -1374,7 +1374,7 @@ "type": "t_uint256" }, { - "astId": 25823, + "astId": 27147, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_slashAmountForUnavailabilityTier2Threshold", "offset": 0, @@ -1382,7 +1382,7 @@ "type": "t_uint256" }, { - "astId": 25826, + "astId": 27150, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_jailDurationForUnavailabilityTier2Threshold", "offset": 0, @@ -1390,7 +1390,7 @@ "type": "t_uint256" }, { - "astId": 25831, + "astId": 27155, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______gap", "offset": 0, @@ -1398,7 +1398,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 24534, + "astId": 25854, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_checkBailedOutAtPeriod", "offset": 0, @@ -1406,7 +1406,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 24539, + "astId": 25859, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_creditScore", "offset": 0, @@ -1414,7 +1414,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 24542, + "astId": 25862, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_gainCreditScore", "offset": 0, @@ -1422,7 +1422,7 @@ "type": "t_uint256" }, { - "astId": 24545, + "astId": 25865, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_maxCreditScore", "offset": 0, @@ -1430,7 +1430,7 @@ "type": "t_uint256" }, { - "astId": 24548, + "astId": 25868, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_bailOutCostMultiplier", "offset": 0, @@ -1438,7 +1438,7 @@ "type": "t_uint256" }, { - "astId": 24551, + "astId": 25871, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "_cutOffPercentageAfterBailout", "offset": 0, @@ -1446,7 +1446,7 @@ "type": "t_uint256" }, { - "astId": 24556, + "astId": 25876, "contract": "contracts/ronin/slash-indicator/SlashIndicator.sol:SlashIndicator", "label": "______gap", "offset": 0, @@ -1498,22 +1498,22 @@ "label": "bytes32", "numberOfBytes": "32" }, - "t_contract(IMaintenance)9709": { + "t_contract(IMaintenance)9657": { "encoding": "inplace", "label": "contract IMaintenance", "numberOfBytes": "20" }, - "t_contract(IRoninGovernanceAdmin)10017": { + "t_contract(IRoninGovernanceAdmin)10003": { "encoding": "inplace", "label": "contract IRoninGovernanceAdmin", "numberOfBytes": "20" }, - "t_contract(IRoninTrustedOrganization)10196": { + "t_contract(IRoninTrustedOrganization)10182": { "encoding": "inplace", "label": "contract IRoninTrustedOrganization", "numberOfBytes": "20" }, - "t_contract(IRoninValidatorSet)11978": { + "t_contract(IRoninValidatorSet)11973": { "encoding": "inplace", "label": "contract IRoninValidatorSet", "numberOfBytes": "20" diff --git a/deployments/ronin-testnet/StakingLogic.json b/deployments/ronin-testnet/StakingLogic.json index 51a5c1373..fe86cc5de 100644 --- a/deployments/ronin-testnet/StakingLogic.json +++ b/deployments/ronin-testnet/StakingLogic.json @@ -1,5 +1,5 @@ { - "address": "0x851eC2f96867486EF6cc85BAcDc151fBE9055b55", + "address": "0xf283a521a533fFbe652779Ae2592c362cecB6965", "abi": [ { "inputs": [], @@ -144,6 +144,25 @@ "name": "ErrZeroValue", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "minRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "maxRate", + "type": "uint256" + } + ], + "name": "CommissionRateRangeUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -195,19 +214,6 @@ "name": "Initialized", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "maxRate", - "type": "uint256" - } - ], - "name": "MaxCommissionRateUpdated", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -558,6 +564,32 @@ "stateMutability": "payable", "type": "fallback" }, + { + "inputs": [], + "name": "DEFAULT_ADDITION_GAS", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "PERIOD_DURATION", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -743,6 +775,24 @@ "stateMutability": "payable", "type": "function" }, + { + "inputs": [], + "name": "getCommissionRateRange", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -996,19 +1046,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "maxCommissionRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "minValidatorStakingAmount", @@ -1098,11 +1135,16 @@ "inputs": [ { "internalType": "uint256", - "name": "_cooldownSecs", + "name": "_minRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxRate", "type": "uint256" } ], - "name": "setCooldownSecsToUndelegate", + "name": "setCommissionRateRange", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1111,11 +1153,11 @@ "inputs": [ { "internalType": "uint256", - "name": "_maxRate", + "name": "_cooldownSecs", "type": "uint256" } ], - "name": "setMaxCommissionRate", + "name": "setCooldownSecsToUndelegate", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1239,41 +1281,41 @@ "type": "receive" } ], - "transactionHash": "0x5ccbeb37b1b66c23a0b7c0fee2e790d0888fc5a51b5fffd6693515c322acfde2", + "transactionHash": "0xa18a695d48f9a99f64fe6d4d5e78186a3c991439368e51bb924c7e52c05686aa", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0x851eC2f96867486EF6cc85BAcDc151fBE9055b55", - "transactionIndex": 1, - "gasUsed": "3324144", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000010000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000", - "blockHash": "0xac5764cd57ffcbbd834f3acf6f55c729953a2be651589bb7d504c37c85b69197", - "transactionHash": "0x5ccbeb37b1b66c23a0b7c0fee2e790d0888fc5a51b5fffd6693515c322acfde2", + "contractAddress": "0xf283a521a533fFbe652779Ae2592c362cecB6965", + "transactionIndex": 0, + "gasUsed": "3401979", + "logsBloom": "0x00000000000000000000001000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000", + "blockHash": "0x34b47b9e50015c2fc12c67beb81103e4581be6c5a5325287a96a3bac70226099", + "transactionHash": "0xa18a695d48f9a99f64fe6d4d5e78186a3c991439368e51bb924c7e52c05686aa", "logs": [ { - "transactionIndex": 1, - "blockNumber": 14861152, - "transactionHash": "0x5ccbeb37b1b66c23a0b7c0fee2e790d0888fc5a51b5fffd6693515c322acfde2", - "address": "0x851eC2f96867486EF6cc85BAcDc151fBE9055b55", + "transactionIndex": 0, + "blockNumber": 16816873, + "transactionHash": "0xa18a695d48f9a99f64fe6d4d5e78186a3c991439368e51bb924c7e52c05686aa", + "address": "0xf283a521a533fFbe652779Ae2592c362cecB6965", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", - "logIndex": 6, - "blockHash": "0xac5764cd57ffcbbd834f3acf6f55c729953a2be651589bb7d504c37c85b69197" + "logIndex": 0, + "blockHash": "0x34b47b9e50015c2fc12c67beb81103e4581be6c5a5325287a96a3bac70226099" } ], - "blockNumber": 14861152, - "cumulativeGasUsed": "3698110", + "blockNumber": 16816873, + "cumulativeGasUsed": "3401979", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 9, - "solcInputHash": "496d5ba113d6511f02e611e47b8a6065", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"ErrAdminOfAnyActivePoolForbidden\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"extraInfo\",\"type\":\"string\"}],\"name\":\"ErrCannotInitTransferRON\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCannotTransferRON\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"}],\"name\":\"ErrInactivePool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientDelegatingAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientStakingAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidArrays\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidPoolShare\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrOnlyPoolAdminAllowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrPoolAdminForbidden\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrStakingAmountLeft\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrThreeInteractionAddrsNotEqual\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrThreeOperationAddrsNotDistinct\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUndelegateTooEarly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUndelegateZeroAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnstakeTooEarly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnstakeZeroAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroValue\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minSecs\",\"type\":\"uint256\"}],\"name\":\"CooldownSecsToUndelegateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxRate\",\"type\":\"uint256\"}],\"name\":\"MaxCommissionRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"MinValidatorStakingAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"PoolApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"PoolSharesUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"validator\",\"type\":\"address[]\"}],\"name\":\"PoolsDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"}],\"name\":\"PoolsUpdateConflicted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"rewards\",\"type\":\"uint256[]\"}],\"name\":\"PoolsUpdateFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"aRps\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"shares\",\"type\":\"uint256[]\"}],\"name\":\"PoolsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingAmountDeductFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingAmountTransferFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Undelegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debited\",\"type\":\"uint256\"}],\"name\":\"UserRewardUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"secs\",\"type\":\"uint256\"}],\"name\":\"WaitingSecsToRevokeUpdated\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"applyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"bulkUndelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrList\",\"type\":\"address[]\"}],\"name\":\"claimRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownSecsToUndelegate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrList\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"_consensusAddrDst\",\"type\":\"address\"}],\"name\":\"delegateRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"execDeductStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_actualDeductingAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_pools\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_newPeriod\",\"type\":\"uint256\"}],\"name\":\"execDeprecatePools\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_rewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"execRecordRewards\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_pools\",\"type\":\"address[]\"}],\"name\":\"getManySelfStakings\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_selfStakings\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddrs\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_userList\",\"type\":\"address[]\"}],\"name\":\"getManyStakingAmounts\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_stakingAmounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolList\",\"type\":\"address[]\"}],\"name\":\"getManyStakingTotals\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_stakingAmounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAdminAddr\",\"type\":\"address\"}],\"name\":\"getPoolAddressOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"}],\"name\":\"getPoolDetail\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_stakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_stakingTotal\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_poolAddrList\",\"type\":\"address[]\"}],\"name\":\"getRewards\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_rewards\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"}],\"name\":\"getStakingTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__minValidatorStakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxCommissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__cooldownSecsToUndelegate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__waitingSecsToRevoke\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAdminAddr\",\"type\":\"address\"}],\"name\":\"isAdminOfActivePool\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxCommissionRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minValidatorStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddrSrc\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddrDst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"redelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"requestEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"requestRenounce\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_effectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"requestUpdateCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_cooldownSecs\",\"type\":\"uint256\"}],\"name\":\"setCooldownSecsToUndelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxRate\",\"type\":\"uint256\"}],\"name\":\"setMaxCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_threshold\",\"type\":\"uint256\"}],\"name\":\"setMinValidatorStakingAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_secs\",\"type\":\"uint256\"}],\"name\":\"setWaitingSecsToRevoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"undelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"waitingSecsToRevoke\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrAdminOfAnyActivePoolForbidden(address)\":[{\"details\":\"Error of admin of any active pool cannot delegate.\"}],\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrCannotInitTransferRON(address,string)\":[{\"details\":\"Error of cannot transfer RON to specified target.\"}],\"ErrCannotTransferRON()\":[{\"details\":\"Error of cannot transfer RON.\"}],\"ErrInactivePool(address)\":[{\"details\":\"Error of querying inactive pool.\"}],\"ErrInsufficientBalance()\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrInsufficientDelegatingAmount()\":[{\"details\":\"Error of undelegating insufficient amount.\"}],\"ErrInsufficientStakingAmount()\":[{\"details\":\"Error of insufficient staking amount for unstaking.\"}],\"ErrInvalidArrays()\":[{\"details\":\"Error of length of input arrays are not of the same.\"}],\"ErrInvalidCommissionRate()\":[{\"details\":\"Error of setting commission rate exceeds max allowed.\"}],\"ErrInvalidPoolShare()\":[{\"details\":\"Error of invalid pool share.\"}],\"ErrOnlyPoolAdminAllowed()\":[{\"details\":\"Error of no one is allowed to call but the pool's admin.\"}],\"ErrPoolAdminForbidden()\":[{\"details\":\"Error of pool admin is not allowed to call.\"}],\"ErrRecipientRevert()\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrStakingAmountLeft()\":[{\"details\":\"Error of invalid staking amount left after deducted.\"}],\"ErrThreeInteractionAddrsNotEqual()\":[{\"details\":\"Error of three interaction addresses must be of the same in applying for validator candidate.\"}],\"ErrThreeOperationAddrsNotDistinct()\":[{\"details\":\"Error of three operation addresses must be distinct in applying for validator candidate.\"}],\"ErrUndelegateTooEarly()\":[{\"details\":\"Error of undelegating too early.\"}],\"ErrUndelegateZeroAmount()\":[{\"details\":\"Error of undelegating zero amount.\"}],\"ErrUnstakeTooEarly()\":[{\"details\":\"Error of unstaking too early.\"}],\"ErrUnstakeZeroAmount()\":[{\"details\":\"Error of unstaking zero amount.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}],\"ErrZeroValue()\":[{\"details\":\"Error of receiving zero message value.\"}]},\"kind\":\"dev\",\"methods\":{\"applyValidatorCandidate(address,address,address,address,uint256)\":{\"details\":\"Proposes a candidate to become a validator. Requirements: - The method caller is able to receive RON. - The treasury is able to receive RON. - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`. Emits the event `PoolApproved`.\",\"params\":{\"_candidateAdmin\":\"the candidate admin will be stored in the validator contract, used for calling function that affects to its candidate, e.g. scheduling maintenance.\"}},\"bulkUndelegate(address[],uint256[])\":{\"details\":\"Bulk unstakes from a list of candidates. Requirements: - The method caller is not the pool admin. Emits the events `Undelegated`.\"},\"claimRewards(address[])\":{\"details\":\"Claims the reward of method caller. Emits the `RewardClaimed` event.\"},\"cooldownSecsToUndelegate()\":{\"details\":\"Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\"},\"delegate(address)\":{\"details\":\"Stakes for a validator candidate `_consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is not the pool admin. Emits the `Delegated` event.\"},\"delegateRewards(address[],address)\":{\"details\":\"Claims the rewards and delegates them to the consensus address. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `RewardClaimed` event and the `Delegated` event.\"},\"execDeductStakingAmount(address,uint256)\":{\"details\":\"Deducts from staking amount of the validator `_consensusAddr` for `_amount`. Requirements: - The method caller must be validator contract. Emits the event `Unstaked`.\"},\"execDeprecatePools(address[],uint256)\":{\"details\":\"Deprecates the pool. - Deduct self-staking amount of the pool admin to zero. - Transfer the deducted amount to the pool admin. - Deactivate the pool admin address in the mapping of active pool admins Requirements: - The method caller is validator contract. Emits the event `PoolsDeprecated` and `Unstaked` events. Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\"},\"execRecordRewards(address[],uint256[],uint256)\":{\"details\":\"Records the amount of rewards `_rewards` for the pools `_consensusAddrs`. Requirements: - The method caller must be validator contract. Emits the event `PoolsUpdated` once the contract recorded the rewards successfully. Emits the event `PoolsUpdateFailed` once the input array lengths are not equal. Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period. Note: This method should be called once at the period ending.\"},\"getManySelfStakings(address[])\":{\"details\":\"Returns the self-staking amounts of the pools.\"},\"getManyStakingAmounts(address[],address[])\":{\"details\":\"Returns the staking amounts of the users.\"},\"getManyStakingTotals(address[])\":{\"details\":\"Returns the total staking amounts of all users for the pools `_poolAddrs`.\"},\"getPoolAddressOf(address)\":{\"details\":\"Returns the consensus address corresponding to the pool admin.\"},\"getPoolDetail(address)\":{\"details\":\"Returns the staking pool detail.\"},\"getReward(address,address)\":{\"details\":\"Returns the reward amount that user claimable.\"},\"getRewards(address,address[])\":{\"details\":\"Returns the claimable reward of the user `_user`.\"},\"getStakingAmount(address,address)\":{\"details\":\"Returns the staking amount of an user.\"},\"getStakingTotal(address)\":{\"details\":\"Returns the total staking amount of all users for a pool.\"},\"initialize(address,uint256,uint256,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"isAdminOfActivePool(address)\":{\"details\":\"Returns whether the `_poolAdminAddr` is currently active.\"},\"maxCommissionRate()\":{\"details\":\"Returns the max commission rate that the candidate can set.\"},\"minValidatorStakingAmount()\":{\"details\":\"Returns the minimum threshold for being a validator candidate.\"},\"redelegate(address,address,uint256)\":{\"details\":\"Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `Undelegated` event and the `Delegated` event.\"},\"requestEmergencyExit(address)\":{\"details\":\"Renounces being a validator candidate and takes back the delegating/staking amount. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin.\"},\"requestRenounce(address)\":{\"details\":\"Renounces being a validator candidate and takes back the delegating/staking amount. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin.\"},\"requestUpdateCommissionRate(address,uint256,uint256)\":{\"details\":\"Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}. - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdated`.\"},\"setCooldownSecsToUndelegate(uint256)\":{\"details\":\"Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated. Requirements: - The method caller is admin. Emits the event `CooldownSecsToUndelegateUpdated`.\"},\"setMaxCommissionRate(uint256)\":{\"details\":\"Sets the max commission rate that a candidate can set. Requirements: - The method caller is admin. Emits the `MaxCommissionRateUpdated` event.\"},\"setMinValidatorStakingAmount(uint256)\":{\"details\":\"Sets the minimum threshold for being a validator candidate. Requirements: - The method caller is admin. Emits the `MinValidatorStakingAmountUpdated` event.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"setWaitingSecsToRevoke(uint256)\":{\"details\":\"Sets the number of seconds that a candidate must wait to be revoked. Requirements: - The method caller is admin. Emits the event `WaitingSecsToRevokeUpdated`.\"},\"stake(address)\":{\"details\":\"Self-delegates to the validator candidate `_consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `msg.value` is larger than 0. Emits the event `Staked`.\"},\"undelegate(address,uint256)\":{\"details\":\"Unstakes from a validator candidate `_consensusAddr` for `_amount`. Requirements: - The method caller is not the pool admin. Emits the `Undelegated` event.\"},\"unstake(address,uint256)\":{\"details\":\"Unstakes from the validator candidate `_consensusAddr` for `_amount`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. Emits the event `Unstaked`.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"},\"waitingSecsToRevoke()\":{\"details\":\"Returns the number of seconds that a candidate must wait for the renounce request gets affected.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/staking/Staking.sol\":\"Staking\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x0e9621f60b2faabe65549f7ed0f24e8853a45c1b7990d47e8160e523683f3935\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/RONTransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract RONTransferHelper {\\n /// @dev Error of recipient not accepting RON when transfer RON.\\n error ErrRecipientRevert();\\n /// @dev Error of sender has insufficient balance.\\n error ErrInsufficientBalance();\\n\\n /**\\n * @dev See `_sendRON`.\\n * Reverts if the recipient does not receive RON.\\n */\\n function _transferRON(address payable _recipient, uint256 _amount) internal {\\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\\n }\\n\\n /**\\n * @dev Send `_amount` RON to the address `_recipient`.\\n * Returns whether the recipient receives RON or not.\\n * Reverts once the contract balance is insufficient.\\n *\\n * Note: consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\\n return _unsafeSendRON(_recipient, _amount);\\n }\\n\\n /**\\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\\n * the call does not revert.\\n *\\n * Note:\\n * - Does not assert whether the balance of sender is sufficient.\\n * - Does not assert whether the recipient accepts RON.\\n * - Consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount }(\\\"\\\");\\n }\\n\\n /**\\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\\n */\\n function _unsafeSendRON(\\n address payable _recipient,\\n uint256 _amount,\\n uint256 _gas\\n ) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbf47d40b2431cf190fa737b803e4cb6fb55aee3f8804470da57a9e340f7914f8\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface PeriodWrapperConsumer {\\n struct PeriodWrapper {\\n // Inner value.\\n uint256 inner;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n}\\n\",\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseStaking {\\n struct PoolDetail {\\n // Address of the pool i.e. consensus address of the validator\\n address addr;\\n // Pool admin address\\n address admin;\\n // Self-staking amount\\n uint256 stakingAmount;\\n // Total number of RON staking for the pool\\n uint256 stakingTotal;\\n // Mapping from delegator => delegating amount\\n mapping(address => uint256) delegatingAmount;\\n // Mapping from delegator => the last timestamp that delegator staked\\n mapping(address => uint256) lastDelegatingTimestamp;\\n }\\n\\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\\n event WaitingSecsToRevokeUpdated(uint256 secs);\\n\\n /// @dev Error of cannot transfer RON.\\n error ErrCannotTransferRON();\\n /// @dev Error of receiving zero message value.\\n error ErrZeroValue();\\n /// @dev Error of pool admin is not allowed to call.\\n error ErrPoolAdminForbidden();\\n /// @dev Error of no one is allowed to call but the pool's admin.\\n error ErrOnlyPoolAdminAllowed();\\n /// @dev Error of admin of any active pool cannot delegate.\\n error ErrAdminOfAnyActivePoolForbidden(address admin);\\n /// @dev Error of querying inactive pool.\\n error ErrInactivePool(address poolAddr);\\n /// @dev Error of length of input arrays are not of the same.\\n error ErrInvalidArrays();\\n\\n /**\\n * @dev Returns whether the `_poolAdminAddr` is currently active.\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the consensus address corresponding to the pool admin.\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\\n\\n /**\\n * @dev Returns the staking pool detail.\\n */\\n function getPoolDetail(address)\\n external\\n view\\n returns (\\n address _admin,\\n uint256 _stakingAmount,\\n uint256 _stakingTotal\\n );\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\\n */\\n function waitingSecsToRevoke() external view returns (uint256);\\n\\n /**\\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external;\\n}\\n\",\"keccak256\":\"0x008b3d42a3104820de7b7edb5ea4b21c75d4417767fc0791f89f00ac9a2cce8d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface ICandidateStaking is IRewardPool {\\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\\n event MinValidatorStakingAmountUpdated(uint256 threshold);\\n /// @dev Emitted when the max commission rate is updated.\\n event MaxCommissionRateUpdated(uint256 maxRate);\\n\\n /// @dev Emitted when the pool admin staked for themself.\\n event Staked(address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\\n event Unstaked(address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Emitted when the validator pool is approved.\\n event PoolApproved(address indexed validator, address indexed admin);\\n /// @dev Emitted when the validator pool is deprecated.\\n event PoolsDeprecated(address[] validator);\\n /// @dev Emitted when the staking amount transfer failed.\\n event StakingAmountTransferFailed(\\n address indexed validator,\\n address indexed admin,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\\n event StakingAmountDeductFailed(\\n address indexed validator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Error of cannot transfer RON to specified target.\\n error ErrCannotInitTransferRON(address addr, string extraInfo);\\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\\n error ErrThreeInteractionAddrsNotEqual();\\n /// @dev Error of three operation addresses must be distinct in applying for validator candidate.\\n error ErrThreeOperationAddrsNotDistinct();\\n /// @dev Error of unstaking zero amount.\\n error ErrUnstakeZeroAmount();\\n /// @dev Error of invalid staking amount left after deducted.\\n error ErrStakingAmountLeft();\\n /// @dev Error of insufficient staking amount for unstaking.\\n error ErrInsufficientStakingAmount();\\n /// @dev Error of unstaking too early.\\n error ErrUnstakeTooEarly();\\n /// @dev Error of setting commission rate exceeds max allowed.\\n error ErrInvalidCommissionRate();\\n\\n /**\\n * @dev Returns the minimum threshold for being a validator candidate.\\n */\\n function minValidatorStakingAmount() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max commission rate that the candidate can set.\\n */\\n function maxCommissionRate() external view returns (uint256);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function setMinValidatorStakingAmount(uint256) external;\\n\\n /**\\n * @dev Sets the max commission rate that a candidate can set.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxCommissionRateUpdated` event.\\n *\\n */\\n function setMaxCommissionRate(uint256 _maxRate) external;\\n\\n /**\\n * @dev Proposes a candidate to become a validator.\\n *\\n * Requirements:\\n * - The method caller is able to receive RON.\\n * - The treasury is able to receive RON.\\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\\n *\\n * Emits the event `PoolApproved`.\\n *\\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\\n * to its candidate, e.g. scheduling maintenance.\\n *\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external payable;\\n\\n /**\\n * @dev Deprecates the pool.\\n * - Deduct self-staking amount of the pool admin to zero.\\n * - Transfer the deducted amount to the pool admin.\\n * - Deactivate the pool admin address in the mapping of active pool admins\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\\n *\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\\n\\n /**\\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `msg.value` is larger than 0.\\n *\\n * Emits the event `Staked`.\\n *\\n */\\n function stake(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function unstake(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdated`.\\n *\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestRenounce(address _consensusAddr) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestEmergencyExit(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4160e8b8dc00df59a35823589d69dcbf5655d7024f5d8e17e823e243ffb44b9d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface IDelegatorStaking is IRewardPool {\\n /// @dev Emitted when the delegator staked for a validator candidate.\\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the delegator unstaked from a validator candidate.\\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Error of undelegating zero amount.\\n error ErrUndelegateZeroAmount();\\n /// @dev Error of undelegating insufficient amount.\\n error ErrInsufficientDelegatingAmount();\\n /// @dev Error of undelegating too early.\\n error ErrUndelegateTooEarly();\\n\\n /**\\n * @dev Stakes for a validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n */\\n function delegate(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Undelegated` event.\\n *\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Bulk unstakes from a list of candidates.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the events `Undelegated`.\\n *\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\\n\\n /**\\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `Undelegated` event and the `Delegated` event.\\n *\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external;\\n\\n /**\\n * @dev Returns the claimable reward of the user `_user`.\\n */\\n function getRewards(address _user, address[] calldata _poolAddrList)\\n external\\n view\\n returns (uint256[] memory _rewards);\\n\\n /**\\n * @dev Claims the reward of method caller.\\n *\\n * Emits the `RewardClaimed` event.\\n *\\n */\\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `RewardClaimed` event and the `Delegated` event.\\n *\\n */\\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\\n external\\n returns (uint256 _amount);\\n}\\n\",\"keccak256\":\"0x5ce840a920ed06139f9e33d306c8ee50b2a81e4bd2ac6ed24b47297c348576b8\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IRewardPool.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/consumers/PeriodWrapperConsumer.sol\\\";\\n\\ninterface IRewardPool is PeriodWrapperConsumer {\\n struct UserRewardFields {\\n // Recorded reward amount.\\n uint256 debited;\\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\\n uint256 aRps;\\n // Lowest staking amount in the period.\\n uint256 lowestAmount;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n\\n struct PoolFields {\\n // Accumulated of the amount rewards per share (one unit staking).\\n uint256 aRps;\\n // The staking total to share reward of the current period.\\n PeriodWrapper shares;\\n }\\n\\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\\n /// @dev Emitted when the user claimed their reward\\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\\n\\n /// @dev Emitted when the pool shares are updated\\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\\n /// @dev Emitted when the pools are updated\\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\\n /// @dev Emitted when the contract fails when updating the pools\\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\\n /// @dev Emitted when the contract fails when updating the pools that already set\\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\\n\\n /// @dev Error of invalid pool share.\\n error ErrInvalidPoolShare();\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amount of an user.\\n */\\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amounts of the users.\\n */\\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total staking amount of all users for a pool.\\n */\\n function getStakingTotal(address _poolAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\\n */\\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\\n}\\n\",\"keccak256\":\"0x92315ca9d6d93f55a7752adf2567adb86745f708198bfcd74b9a626b6570208f\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseStaking.sol\\\";\\nimport \\\"./ICandidateStaking.sol\\\";\\nimport \\\"./IDelegatorStaking.sol\\\";\\n\\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable;\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\\n external\\n returns (uint256 _actualDeductingAmount);\\n}\\n\",\"keccak256\":\"0xb7942c5032c16ea567ac0bfc07ecacd84840d6de134735ea538aa22fc6da05a5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0xe4060b7e3b04a0043bd334011fe4ba67c990b0484dad52d7f14b35040989b6ab\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n // Error thrown when receives RON from neither staking vesting contract nor staking contract\\\"\\n error ErrUnauthorizedReceiveRON();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0x4e81a61359a3f8bcc9d452615e3df7b0d0201823ce88f763530ddd4f00c2fc48\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address[] calldata _blockProducers) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address[] calldata _blockProducers, uint256 _period)\\n external\\n view\\n returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the current period.\\n */\\n\\n function checkBridgeRewardDeprecated(address _consensusAddr) external view returns (bool _result);\\n}\\n\",\"keccak256\":\"0x853e7d0ac33ad868721733fc2ab4b78f2e613973a579eb0ea485cbdaa750e057\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator or not.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0xbd10b0207a749e3a7a2aadcb6e93784cb17343a5266d056a3d0b79acb7c5c93d\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool) {\\n bytes32 _thisHash;\\n bytes32 _otherHash;\\n\\n assembly {\\n _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n }\\n\\n return _thisHash == _otherHash;\\n }\\n}\\n\",\"keccak256\":\"0xea4ac2b0783926a0e6ae257bc069fa37ea864ce77bfb25dd327d4727a38ad0ea\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - min(a, b);\\n }\\n}\\n\",\"keccak256\":\"0xa9e2a3ad43d7999a3cdbfb040b0f2dec282eae91ff8fe6ad26fdd19087121ce7\",\"license\":\"UNLICENSED\"},\"contracts/ronin/staking/BaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/staking/IBaseStaking.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"./RewardCalculation.sol\\\";\\n\\nabstract contract BaseStaking is\\n RONTransferHelper,\\n ReentrancyGuard,\\n RewardCalculation,\\n HasValidatorContract,\\n IBaseStaking\\n{\\n /// @dev Mapping from pool address => staking pool detail\\n mapping(address => PoolDetail) internal _stakingPool;\\n\\n /// @dev The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n uint256 internal _cooldownSecsToUndelegate;\\n /// @dev The number of seconds that a candidate must wait to be revoked and take the self-staking amount back.\\n uint256 internal _waitingSecsToRevoke;\\n\\n /// @dev Mapping from admin address of an active pool => consensus address.\\n mapping(address => address) internal _adminOfActivePoolMapping;\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] private ______gap;\\n\\n modifier noEmptyValue() {\\n if (msg.value == 0) revert ErrZeroValue();\\n _;\\n }\\n\\n modifier notPoolAdmin(PoolDetail storage _pool, address _delegator) {\\n if (_pool.admin == _delegator) revert ErrPoolAdminForbidden();\\n _;\\n }\\n\\n modifier onlyPoolAdmin(PoolDetail storage _pool, address _requester) {\\n if (_pool.admin != _requester) revert ErrOnlyPoolAdminAllowed();\\n _;\\n }\\n\\n modifier poolIsActive(address _poolAddr) {\\n if (!_validatorContract.isValidatorCandidate(_poolAddr)) revert ErrInactivePool(_poolAddr);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) public view override returns (bool) {\\n return _adminOfActivePoolMapping[_poolAdminAddr] != address(0);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view override returns (address) {\\n return _adminOfActivePoolMapping[_poolAdminAddr];\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getPoolDetail(address _poolAddr)\\n external\\n view\\n returns (\\n address _admin,\\n uint256 _stakingAmount,\\n uint256 _stakingTotal\\n )\\n {\\n PoolDetail storage _pool = _stakingPool[_poolAddr];\\n return (_pool.admin, _pool.stakingAmount, _pool.stakingTotal);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getManySelfStakings(address[] calldata _pools) external view returns (uint256[] memory _selfStakings) {\\n _selfStakings = new uint256[](_pools.length);\\n for (uint _i = 0; _i < _pools.length; _i++) {\\n _selfStakings[_i] = _stakingPool[_pools[_i]].stakingAmount;\\n }\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingTotal(address _poolAddr) public view override returns (uint256) {\\n return _stakingPool[_poolAddr].stakingTotal;\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingTotals(address[] calldata _poolList)\\n public\\n view\\n override\\n returns (uint256[] memory _stakingAmounts)\\n {\\n _stakingAmounts = new uint256[](_poolList.length);\\n for (uint _i = 0; _i < _poolList.length; _i++) {\\n _stakingAmounts[_i] = getStakingTotal(_poolList[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingAmount(address _poolAddr, address _user) public view override returns (uint256) {\\n return _stakingPool[_poolAddr].delegatingAmount[_user];\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\\n external\\n view\\n override\\n returns (uint256[] memory _stakingAmounts)\\n {\\n if (_poolAddrs.length != _userList.length) revert ErrInvalidArrays();\\n _stakingAmounts = new uint256[](_poolAddrs.length);\\n for (uint _i = 0; _i < _stakingAmounts.length; _i++) {\\n _stakingAmounts[_i] = _stakingPool[_poolAddrs[_i]].delegatingAmount[_userList[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256) {\\n return _cooldownSecsToUndelegate;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function waitingSecsToRevoke() external view returns (uint256) {\\n return _waitingSecsToRevoke;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external override onlyAdmin {\\n _setCooldownSecsToUndelegate(_cooldownSecs);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external override onlyAdmin {\\n _setWaitingSecsToRevoke(_secs);\\n }\\n\\n /**\\n * @dev Sets the minium number of seconds to undelegate.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function _setCooldownSecsToUndelegate(uint256 _cooldownSecs) internal {\\n _cooldownSecsToUndelegate = _cooldownSecs;\\n emit CooldownSecsToUndelegateUpdated(_cooldownSecs);\\n }\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function _setWaitingSecsToRevoke(uint256 _secs) internal {\\n _waitingSecsToRevoke = _secs;\\n emit WaitingSecsToRevokeUpdated(_secs);\\n }\\n\\n /**\\n * @dev Changes the delegate amount.\\n */\\n function _changeDelegatingAmount(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _newDelegatingAmount,\\n uint256 _newStakingTotal\\n ) internal {\\n _syncUserReward(_pool.addr, _delegator, _newDelegatingAmount);\\n _pool.stakingTotal = _newStakingTotal;\\n _pool.delegatingAmount[_delegator] = _newDelegatingAmount;\\n }\\n}\\n\",\"keccak256\":\"0xdf7889af5ad6b206a2d4eceb8947fcc26f90b7c8411806ec76eb19bc3363afd0\",\"license\":\"MIT\"},\"contracts/ronin/staking/CandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../libraries/AddressArrayUtils.sol\\\";\\nimport \\\"../../interfaces/staking/ICandidateStaking.sol\\\";\\nimport \\\"./BaseStaking.sol\\\";\\n\\nabstract contract CandidateStaking is BaseStaking, ICandidateStaking, PercentageConsumer {\\n /// @dev The minimum threshold for being a validator candidate.\\n uint256 internal _minValidatorStakingAmount;\\n\\n /// @dev The max commission rate that the validator can set (in range of [0;100_00] means [0-100%])\\n uint256 internal _maxCommissionRate;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] ______gap;\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function minValidatorStakingAmount() public view override returns (uint256) {\\n return _minValidatorStakingAmount;\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function maxCommissionRate() external view override returns (uint256) {\\n return _maxCommissionRate;\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function setMinValidatorStakingAmount(uint256 _threshold) external override onlyAdmin {\\n _setMinValidatorStakingAmount(_threshold);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function setMaxCommissionRate(uint256 _maxRate) external override onlyAdmin {\\n _setMaxCommissionRate(_maxRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external payable override nonReentrant {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n if (_commissionRate > _maxCommissionRate) revert ErrInvalidCommissionRate();\\n\\n uint256 _amount = msg.value;\\n address payable _poolAdmin = payable(msg.sender);\\n _applyValidatorCandidate(\\n _poolAdmin,\\n _candidateAdmin,\\n _consensusAddr,\\n _treasuryAddr,\\n _bridgeOperatorAddr,\\n _commissionRate,\\n _amount\\n );\\n\\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\\n _pool.admin = _poolAdmin;\\n _pool.addr = _consensusAddr;\\n _adminOfActivePoolMapping[_poolAdmin] = _consensusAddr;\\n\\n _stake(_stakingPool[_consensusAddr], _poolAdmin, _amount);\\n emit PoolApproved(_consensusAddr, _poolAdmin);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) {\\n if (_commissionRate > _maxCommissionRate) revert ErrInvalidCommissionRate();\\n _validatorContract.execRequestUpdateCommissionRate(_consensusAddr, _effectiveDaysOnwards, _commissionRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _newPeriod) external override onlyValidatorContract {\\n if (_pools.length == 0) {\\n return;\\n }\\n\\n for (uint _i = 0; _i < _pools.length; _i++) {\\n PoolDetail storage _pool = _stakingPool[_pools[_i]];\\n // Deactivate the pool admin in the active mapping.\\n delete _adminOfActivePoolMapping[_pool.admin];\\n\\n // Deduct and transfer the self staking amount to the pool admin.\\n uint256 _deductingAmount = _pool.stakingAmount;\\n if (_deductingAmount > 0) {\\n _deductStakingAmount(_pool, _deductingAmount);\\n if (!_unsafeSendRON(payable(_pool.admin), _deductingAmount, 3500)) {\\n emit StakingAmountTransferFailed(_pool.addr, _pool.admin, _deductingAmount, address(this).balance);\\n }\\n }\\n\\n // Settle the unclaimed reward and transfer to the pool admin.\\n uint256 _lastRewardAmount = _claimReward(_pools[_i], _pool.admin, _newPeriod);\\n if (_lastRewardAmount > 0) {\\n _unsafeSendRON(payable(_pool.admin), _lastRewardAmount, 3500);\\n }\\n }\\n\\n emit PoolsDeprecated(_pools);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function stake(address _consensusAddr) external payable override noEmptyValue poolIsActive(_consensusAddr) {\\n _stake(_stakingPool[_consensusAddr], msg.sender, msg.value);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function unstake(address _consensusAddr, uint256 _amount)\\n external\\n override\\n nonReentrant\\n poolIsActive(_consensusAddr)\\n {\\n if (_amount == 0) revert ErrUnstakeZeroAmount();\\n address _requester = msg.sender;\\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\\n uint256 _remainAmount = _pool.stakingAmount - _amount;\\n if (_remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft();\\n\\n _unstake(_pool, _requester, _amount);\\n if (!_unsafeSendRON(payable(_requester), _amount, 3500)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestRenounce(address _consensusAddr)\\n external\\n override\\n poolIsActive(_consensusAddr)\\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\\n {\\n _validatorContract.execRequestRenounceCandidate(_consensusAddr, _waitingSecsToRevoke);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestEmergencyExit(address _consensusAddr)\\n external\\n override\\n poolIsActive(_consensusAddr)\\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\\n {\\n _validatorContract.execEmergencyExit(_consensusAddr, _waitingSecsToRevoke);\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-applyValidatorCandidate`\\n */\\n function _applyValidatorCandidate(\\n address payable _poolAdmin,\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate,\\n uint256 _amount\\n ) internal {\\n if (!_unsafeSendRON(_poolAdmin, 0)) revert ErrCannotInitTransferRON(_poolAdmin, \\\"pool admin\\\");\\n if (!_unsafeSendRON(_treasuryAddr, 0)) revert ErrCannotInitTransferRON(_treasuryAddr, \\\"treasury\\\");\\n if (_amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount();\\n if (_commissionRate > _maxCommissionRate) revert ErrInvalidCommissionRate();\\n\\n if (_poolAdmin != _candidateAdmin || _candidateAdmin != _treasuryAddr) revert ErrThreeInteractionAddrsNotEqual();\\n\\n address[] memory _diffAddrs = new address[](3);\\n _diffAddrs[0] = _poolAdmin;\\n _diffAddrs[1] = _consensusAddr;\\n _diffAddrs[2] = _bridgeOperatorAddr;\\n if (AddressArrayUtils.hasDuplicate(_diffAddrs)) revert ErrThreeOperationAddrsNotDistinct();\\n\\n _validatorContract.execApplyValidatorCandidate(\\n _candidateAdmin,\\n _consensusAddr,\\n _treasuryAddr,\\n _bridgeOperatorAddr,\\n _commissionRate\\n );\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-stake`\\n */\\n function _stake(\\n PoolDetail storage _pool,\\n address _requester,\\n uint256 _amount\\n ) internal onlyPoolAdmin(_pool, _requester) {\\n _pool.stakingAmount += _amount;\\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal + _amount);\\n _pool.lastDelegatingTimestamp[_requester] = block.timestamp;\\n emit Staked(_pool.addr, _amount);\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-unstake`\\n */\\n function _unstake(\\n PoolDetail storage _pool,\\n address _requester,\\n uint256 _amount\\n ) internal onlyPoolAdmin(_pool, _requester) {\\n if (_amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount();\\n if (_pool.lastDelegatingTimestamp[_requester] + _cooldownSecsToUndelegate > block.timestamp) {\\n revert ErrUnstakeTooEarly();\\n }\\n\\n _pool.stakingAmount -= _amount;\\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal - _amount);\\n emit Unstaked(_pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Emits the event `Unstaked`.\\n *\\n * @return The actual deducted amount\\n */\\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount) internal virtual returns (uint256);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function _setMinValidatorStakingAmount(uint256 _threshold) internal {\\n _minValidatorStakingAmount = _threshold;\\n emit MinValidatorStakingAmountUpdated(_threshold);\\n }\\n\\n /**\\n * @dev Sets the max commission rate that a candidate can set.\\n *\\n * Emits the `MaxCommissionRateUpdated` event.\\n *\\n */\\n function _setMaxCommissionRate(uint256 _maxRate) internal {\\n if (_maxRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\\n _maxCommissionRate = _maxRate;\\n emit MaxCommissionRateUpdated(_maxRate);\\n }\\n}\\n\",\"keccak256\":\"0x8d9a2911b458fed374b9a6d0a56b1831024d9b04f5c383741a7168fdc27c5a84\",\"license\":\"MIT\"},\"contracts/ronin/staking/DelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/staking/IDelegatorStaking.sol\\\";\\nimport \\\"./BaseStaking.sol\\\";\\n\\nabstract contract DelegatorStaking is BaseStaking, IDelegatorStaking {\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function delegate(address _consensusAddr) external payable noEmptyValue poolIsActive(_consensusAddr) {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n _delegate(_stakingPool[_consensusAddr], msg.sender, msg.value);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external nonReentrant {\\n address payable _delegator = payable(msg.sender);\\n _undelegate(_stakingPool[_consensusAddr], _delegator, _amount);\\n if (!_sendRON(_delegator, _amount)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external nonReentrant {\\n if (_consensusAddrs.length == 0 || _consensusAddrs.length != _amounts.length) revert ErrInvalidArrays();\\n\\n address payable _delegator = payable(msg.sender);\\n uint256 _total;\\n\\n for (uint _i = 0; _i < _consensusAddrs.length; _i++) {\\n _total += _amounts[_i];\\n _undelegate(_stakingPool[_consensusAddrs[_i]], _delegator, _amounts[_i]);\\n }\\n\\n if (!_sendRON(_delegator, _total)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external nonReentrant poolIsActive(_consensusAddrDst) {\\n address _delegator = msg.sender;\\n _undelegate(_stakingPool[_consensusAddrSrc], _delegator, _amount);\\n _delegate(_stakingPool[_consensusAddrDst], _delegator, _amount);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function claimRewards(address[] calldata _consensusAddrList)\\n external\\n override\\n nonReentrant\\n returns (uint256 _amount)\\n {\\n _amount = _claimRewards(msg.sender, _consensusAddrList);\\n _transferRON(payable(msg.sender), _amount);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\\n external\\n override\\n nonReentrant\\n poolIsActive(_consensusAddrDst)\\n returns (uint256 _amount)\\n {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n return _delegateRewards(msg.sender, _consensusAddrList, _consensusAddrDst);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function getRewards(address _user, address[] calldata _poolAddrList)\\n external\\n view\\n returns (uint256[] memory _rewards)\\n {\\n address _consensusAddr;\\n uint256 _period = _validatorContract.currentPeriod();\\n _rewards = new uint256[](_poolAddrList.length);\\n\\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\\n _consensusAddr = _poolAddrList[_i];\\n _rewards[_i] = _getReward(_consensusAddr, _user, _period, getStakingAmount(_consensusAddr, _user));\\n }\\n }\\n\\n /**\\n * @dev Delegates from a validator address.\\n *\\n * Requirements:\\n * - The delegator is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n * Note: This function does not verify the `msg.value` with the amount.\\n *\\n */\\n function _delegate(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _amount\\n ) internal notPoolAdmin(_pool, _delegator) {\\n _changeDelegatingAmount(\\n _pool,\\n _delegator,\\n _pool.delegatingAmount[_delegator] + _amount,\\n _pool.stakingTotal + _amount\\n );\\n _pool.lastDelegatingTimestamp[_delegator] = block.timestamp;\\n emit Delegated(_delegator, _pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Undelegates from a validator address.\\n *\\n * Requirements:\\n * - The delegator is not the pool admin.\\n * - The amount is larger than 0.\\n * - The delegating amount is larger than or equal to the undelegating amount.\\n *\\n * Emits the `Undelegated` event.\\n *\\n * Note: Consider transferring back the amount of RON after calling this function.\\n *\\n */\\n function _undelegate(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _amount\\n ) private notPoolAdmin(_pool, _delegator) {\\n if (_amount == 0) revert ErrUndelegateZeroAmount();\\n if (_pool.delegatingAmount[_delegator] < _amount) revert ErrInsufficientDelegatingAmount();\\n if (_pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp) {\\n revert ErrUndelegateTooEarly();\\n }\\n\\n _changeDelegatingAmount(\\n _pool,\\n _delegator,\\n _pool.delegatingAmount[_delegator] - _amount,\\n _pool.stakingTotal - _amount\\n );\\n emit Undelegated(_delegator, _pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Claims rewards from the pools `_poolAddrList`.\\n * Note: This function does not transfer reward to user.\\n */\\n function _claimRewards(address _user, address[] memory _poolAddrList) internal returns (uint256 _amount) {\\n uint256 _period = _currentPeriod();\\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\\n _amount += _claimReward(_poolAddrList[_i], _user, _period);\\n }\\n }\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n */\\n function _delegateRewards(\\n address _user,\\n address[] calldata _poolAddrList,\\n address _poolAddrDst\\n ) internal returns (uint256 _amount) {\\n _amount = _claimRewards(_user, _poolAddrList);\\n _delegate(_stakingPool[_poolAddrDst], _user, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x4bd0b183ac8838e8800b2768ef2f854fd8ee75327f0933f895816794d556fbb0\",\"license\":\"MIT\"},\"contracts/ronin/staking/RewardCalculation.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/staking/IRewardPool.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\n\\n/**\\n * @title RewardCalculation contract\\n * @dev This contract mainly contains the methods to calculate reward for staking contract.\\n */\\nabstract contract RewardCalculation is IRewardPool {\\n /// @dev Mapping from pool address => period number => accumulated rewards per share (one unit staking)\\n mapping(address => mapping(uint256 => PeriodWrapper)) private _accumulatedRps;\\n /// @dev Mapping from the pool address => user address => the reward info of the user\\n mapping(address => mapping(address => UserRewardFields)) private _userReward;\\n /// @dev Mapping from the pool address => reward pool fields\\n mapping(address => PoolFields) private _stakingPool;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256) {\\n return _getReward(_poolAddr, _user, _currentPeriod(), getStakingAmount(_poolAddr, _user));\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingAmount(address _poolAddr, address _user) public view virtual returns (uint256);\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingTotal(address _poolAddr) public view virtual returns (uint256);\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function _getReward(\\n address _poolAddr,\\n address _user,\\n uint256 _latestPeriod,\\n uint256 _latestStakingAmount\\n ) internal view returns (uint256) {\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n\\n if (_reward.lastPeriod == _latestPeriod) {\\n return _reward.debited;\\n }\\n\\n uint256 _aRps;\\n uint256 _lastPeriodReward;\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n PeriodWrapper storage _wrappedArps = _accumulatedRps[_poolAddr][_reward.lastPeriod];\\n\\n if (_wrappedArps.lastPeriod > 0) {\\n // Calculates the last period reward if the aRps at the period is set\\n _aRps = _wrappedArps.inner;\\n _lastPeriodReward = _reward.lowestAmount * (_aRps - _reward.aRps);\\n } else {\\n // Fallbacks to the previous aRps in case the aRps is not set\\n _aRps = _reward.aRps;\\n }\\n\\n uint256 _newPeriodsReward = _latestStakingAmount * (_pool.aRps - _aRps);\\n return _reward.debited + (_lastPeriodReward + _newPeriodsReward) / 1e18;\\n }\\n\\n /**\\n * @dev Syncs the user reward.\\n *\\n * Emits the event `UserRewardUpdated` once the debit amount is updated.\\n * Emits the event `PoolSharesUpdated` once the pool share is updated.\\n *\\n * Note: The method should be called whenever the user's staking amount changes.\\n *\\n */\\n function _syncUserReward(\\n address _poolAddr,\\n address _user,\\n uint256 _newStakingAmount\\n ) internal {\\n uint256 _period = _currentPeriod();\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n uint256 _lastShares = _pool.shares.inner;\\n\\n // Updates the pool shares if it is outdated\\n if (_pool.shares.lastPeriod < _period) {\\n _pool.shares = PeriodWrapper(getStakingTotal(_poolAddr), _period);\\n }\\n\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\\n uint256 _debited = _getReward(_poolAddr, _user, _period, _currentStakingAmount);\\n\\n if (_reward.debited != _debited) {\\n _reward.debited = _debited;\\n emit UserRewardUpdated(_poolAddr, _user, _debited);\\n }\\n\\n _syncMinStakingAmount(_pool, _reward, _period, _newStakingAmount, _currentStakingAmount);\\n _reward.aRps = _pool.aRps;\\n _reward.lastPeriod = _period;\\n\\n if (_pool.shares.inner != _lastShares) {\\n emit PoolSharesUpdated(_period, _poolAddr, _pool.shares.inner);\\n }\\n }\\n\\n /**\\n * @dev Syncs the minimum staking amount of an user in the current period.\\n */\\n function _syncMinStakingAmount(\\n PoolFields storage _pool,\\n UserRewardFields storage _reward,\\n uint256 _latestPeriod,\\n uint256 _newStakingAmount,\\n uint256 _currentStakingAmount\\n ) internal {\\n if (_reward.lastPeriod < _latestPeriod) {\\n _reward.lowestAmount = _currentStakingAmount;\\n }\\n\\n uint256 _lowestAmount = Math.min(_reward.lowestAmount, _newStakingAmount);\\n uint256 _diffAmount = _reward.lowestAmount - _lowestAmount;\\n if (_diffAmount > 0) {\\n _reward.lowestAmount = _lowestAmount;\\n if (_pool.shares.inner < _diffAmount) revert ErrInvalidPoolShare();\\n _pool.shares.inner -= _diffAmount;\\n }\\n }\\n\\n /**\\n * @dev Claims the settled reward for a specific user.\\n *\\n * @param _lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or\\n * `_currentPeriod + 1` in case of calculating the reward for revoked validators.\\n *\\n * Emits the `RewardClaimed` event and the `UserRewardUpdated` event.\\n *\\n * Note: This method should be called before transferring rewards for the user.\\n *\\n */\\n function _claimReward(\\n address _poolAddr,\\n address _user,\\n uint256 _lastPeriod\\n ) internal returns (uint256 _amount) {\\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\\n _amount = _getReward(_poolAddr, _user, _lastPeriod, _currentStakingAmount);\\n emit RewardClaimed(_poolAddr, _user, _amount);\\n\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n _reward.debited = 0;\\n _syncMinStakingAmount(_stakingPool[_poolAddr], _reward, _lastPeriod, _currentStakingAmount, _currentStakingAmount);\\n _reward.lastPeriod = _lastPeriod;\\n _reward.aRps = _stakingPool[_poolAddr].aRps;\\n emit UserRewardUpdated(_poolAddr, _user, 0);\\n }\\n\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_poolAddrs`.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolUpdateConflicted` when the pool is already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function _recordRewards(\\n address[] memory _poolAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) internal {\\n if (_poolAddrs.length != _rewards.length) {\\n emit PoolsUpdateFailed(_period, _poolAddrs, _rewards);\\n return;\\n }\\n\\n uint256 _rps;\\n uint256 _count;\\n address _poolAddr;\\n uint256 _stakingTotal;\\n uint256[] memory _aRps = new uint256[](_poolAddrs.length);\\n uint256[] memory _shares = new uint256[](_poolAddrs.length);\\n address[] memory _conflicted = new address[](_poolAddrs.length);\\n\\n for (uint _i = 0; _i < _poolAddrs.length; _i++) {\\n _poolAddr = _poolAddrs[_i];\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n _stakingTotal = getStakingTotal(_poolAddr);\\n\\n if (_accumulatedRps[_poolAddr][_period].lastPeriod == _period) {\\n _conflicted[_count++] = _poolAddr;\\n continue;\\n }\\n\\n // Updates the pool shares if it is outdated\\n if (_pool.shares.lastPeriod < _period) {\\n _pool.shares = PeriodWrapper(_stakingTotal, _period);\\n }\\n\\n // The rps is 0 if no one stakes for the pool\\n _rps = _pool.shares.inner == 0 ? 0 : (_rewards[_i] * 1e18) / _pool.shares.inner;\\n _aRps[_i - _count] = _pool.aRps += _rps;\\n _accumulatedRps[_poolAddr][_period] = PeriodWrapper(_pool.aRps, _period);\\n _pool.shares.inner = _stakingTotal;\\n _shares[_i - _count] = _pool.shares.inner;\\n _poolAddrs[_i - _count] = _poolAddr;\\n }\\n\\n if (_count > 0) {\\n assembly {\\n mstore(_conflicted, _count)\\n mstore(_poolAddrs, sub(mload(_poolAddrs), _count))\\n }\\n emit PoolsUpdateConflicted(_period, _conflicted);\\n }\\n\\n if (_poolAddrs.length > 0) {\\n emit PoolsUpdated(_period, _poolAddrs, _aRps, _shares);\\n }\\n }\\n\\n /**\\n * @dev Returns the current period.\\n */\\n function _currentPeriod() internal view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x492fc376e3a866dca702f22f25fe30d3005c28cace7503822ac7e73606611278\",\"license\":\"MIT\"},\"contracts/ronin/staking/Staking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"./CandidateStaking.sol\\\";\\nimport \\\"./DelegatorStaking.sol\\\";\\n\\ncontract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable {\\n constructor() {\\n _disableInitializers();\\n }\\n\\n receive() external payable onlyValidatorContract {}\\n\\n fallback() external payable onlyValidatorContract {}\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 __minValidatorStakingAmount,\\n uint256 __maxCommissionRate,\\n uint256 __cooldownSecsToUndelegate,\\n uint256 __waitingSecsToRevoke\\n ) external initializer {\\n _setValidatorContract(__validatorContract);\\n _setMinValidatorStakingAmount(__minValidatorStakingAmount);\\n _setMaxCommissionRate(__maxCommissionRate);\\n _setCooldownSecsToUndelegate(__cooldownSecsToUndelegate);\\n _setWaitingSecsToRevoke(__waitingSecsToRevoke);\\n }\\n\\n /**\\n * @inheritdoc IStaking\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable override onlyValidatorContract {\\n _recordRewards(_consensusAddrs, _rewards, _period);\\n }\\n\\n /**\\n * @inheritdoc IStaking\\n */\\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\\n external\\n override\\n onlyValidatorContract\\n returns (uint256 _actualDeductingAmount)\\n {\\n _actualDeductingAmount = _deductStakingAmount(_stakingPool[_consensusAddr], _amount);\\n address payable _recipientAddr = payable(validatorContract());\\n if (!_unsafeSendRON(_recipientAddr, _actualDeductingAmount, 3500)) {\\n emit StakingAmountDeductFailed(_consensusAddr, _recipientAddr, _actualDeductingAmount, address(this).balance);\\n }\\n }\\n\\n /**\\n * @inheritdoc RewardCalculation\\n */\\n function _currentPeriod() internal view virtual override returns (uint256) {\\n return _validatorContract.currentPeriod();\\n }\\n\\n /**\\n * @inheritdoc CandidateStaking\\n */\\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount)\\n internal\\n override\\n returns (uint256 _actualDeductingAmount)\\n {\\n _actualDeductingAmount = Math.min(_pool.stakingAmount, _amount);\\n\\n _pool.stakingAmount -= _actualDeductingAmount;\\n _changeDelegatingAmount(_pool, _pool.admin, _pool.stakingAmount, _pool.stakingTotal - _actualDeductingAmount);\\n emit Unstaked(_pool.addr, _actualDeductingAmount);\\n }\\n}\\n\",\"keccak256\":\"0xe8b36ee07b3db366b18a700263cde6195c4127e31c13c20041f34ff9006cca7a\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b5060016000556200002162000027565b620000e9565b60d154610100900460ff1615620000945760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60d15460ff9081161015620000e75760d1805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b613a4f80620000f96000396000f3fe6080604052600436106102135760003560e01c806391f8723f11610118578063c2a672e0116100a0578063d01b8eed1161006f578063d01b8eed1461067f578063e22d1c9d146106f0578063e5376f5414610710578063f92ad21914610723578063f9f031df1461074357610254565b8063c2a672e0146105f1578063c508700314610611578063c673316c1461064a578063cdf64a761461065f57610254565b806399439089116100e75780639943908914610557578063aa15a6fd14610589578063acd79c46146105a9578063af245429146105bc578063b78b5e41146105d157610254565b806391f8723f146104d7578063924f081e146104f75780639488e4e914610517578063969ffc141461053757610254565b80634d99dd161161019b5780636bd8f8041161016a5780636bd8f8041461042957806376664b6514610449578063888b9ae914610469578063895ab74214610489578063909791dd146104c257610254565b80634d99dd16146103b65780635c19a95c146103d6578063679a6e43146103e95780636b0916951461040957610254565b806326476204116101e257806326476204146102f85780632715805e1461030b5780633d8e846e1461032b57806342e0c4081461034b57806342ef3c341461039657610254565b80630682e8fa14610267578063095f64751461028b578063097e4a9d146102b85780631658c86e146102d857610254565b36610254573361022b6036546001600160a01b031690565b6001600160a01b03161461025257604051630e6444a160e31b815260040160405180910390fd5b005b3361022b6036546001600160a01b031690565b34801561027357600080fd5b506038545b6040519081526020015b60405180910390f35b34801561029757600080fd5b506102ab6102a636600461334d565b610763565b60405161028291906133f3565b3480156102c457600080fd5b506102786102d336600461341b565b6108a5565b3480156102e457600080fd5b506102526102f3366004613471565b6109c0565b610252610306366004613471565b610b08565b34801561031757600080fd5b50610278610326366004613495565b610be6565b34801561033757600080fd5b506102ab6103463660046134c1565b610cbd565b34801561035757600080fd5b50610386610366366004613471565b6001600160a01b039081166000908152603a602052604090205416151590565b6040519015158152602001610282565b3480156103a257600080fd5b506102ab6103b1366004613515565b610e01565b3480156103c257600080fd5b506102526103d1366004613495565b610ed0565b6102526103e4366004613471565b610f4c565b3480156103f557600080fd5b50610252610404366004613556565b61105f565b34801561041557600080fd5b5061027861042436600461356f565b6110a3565b34801561043557600080fd5b506102526104443660046135a8565b6110c5565b34801561045557600080fd5b5061027861046436600461356f565b6111d6565b34801561047557600080fd5b50610252610484366004613556565b611205565b34801561049557600080fd5b506102786104a4366004613471565b6001600160a01b031660009081526037602052604090206003015490565b3480156104ce57600080fd5b50606c54610278565b3480156104e357600080fd5b506102ab6104f2366004613515565b611246565b34801561050357600080fd5b506102526105123660046135e9565b6112f0565b34801561052357600080fd5b5061025261053236600461334d565b611460565b34801561054357600080fd5b50610252610552366004613556565b611599565b34801561056357600080fd5b506036546001600160a01b03165b6040516001600160a01b039091168152602001610282565b34801561059557600080fd5b506102526105a4366004613471565b6115da565b6102526105b736600461361e565b6116ee565b3480156105c857600080fd5b50603954610278565b3480156105dd57600080fd5b506102526105ec366004613556565b611770565b3480156105fd57600080fd5b5061025261060c366004613495565b6117b1565b34801561061d57600080fd5b5061057161062c366004613471565b6001600160a01b039081166000908152603a60205260409020541690565b34801561065657600080fd5b50606d54610278565b34801561066b57600080fd5b5061025261067a366004613471565b6118f7565b34801561068b57600080fd5b506106cb61069a366004613471565b6001600160a01b03808216600090815260376020526040902060018101546002820154600390920154921693909250565b604080516001600160a01b039094168452602084019290925290820152606001610282565b3480156106fc57600080fd5b5061025261070b366004613691565b611963565b61025261071e3660046136dc565b611b5d565b34801561072f57600080fd5b5061025261073e366004613740565b611ca1565b34801561074f57600080fd5b5061027861075e366004613515565b611ddc565b6060838214610785576040516376081a7b60e11b815260040160405180910390fd5b836001600160401b0381111561079d5761079d613784565b6040519080825280602002602001820160405280156107c6578160200160208202803683370190505b50905060005b815181101561089c57603760008787848181106107eb576107eb61379a565b90506020020160208101906108009190613471565b6001600160a01b03166001600160a01b0316815260200190815260200160002060040160008585848181106108375761083761379a565b905060200201602081019061084c9190613471565b6001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061087f5761087f61379a565b602090810291909101015280610894816137c6565b9150506107cc565b50949350505050565b60006002600054036108d25760405162461bcd60e51b81526004016108c9906137df565b60405180910390fd5b6002600055603654604051635061f96960e11b81526001600160a01b0380851660048301528492169063a0c3f2d290602401602060405180830381865afa158015610921573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109459190613816565b61096d57604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b336000908152603a60205260409020546001600160a01b0316156109a657604051632fc6bfb160e21b81523360048201526024016108c9565b6109b233868686611e5c565b600160005595945050505050565b603654604051635061f96960e11b81526001600160a01b0380841660048301528392169063a0c3f2d290602401602060405180830381865afa158015610a0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2e9190613816565b610a5657604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b6001600160a01b038083166000908152603760205260409020600181015490913391168114610a9857604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163dd716ad360e01b81526001600160a01b038781166004830152602482019290925291169063dd716ad3906044015b600060405180830381600087803b158015610aea57600080fd5b505af1158015610afe573d6000803e3d6000fd5b5050505050505050565b34600003610b2957604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b81526001600160a01b0380841660048301528392169063a0c3f2d290602401602060405180830381865afa158015610b73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b979190613816565b610bbf57604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b6001600160a01b0382166000908152603760205260409020610be2903334611ec9565b5050565b600033610bfb6036546001600160a01b031690565b6001600160a01b031614610c2257604051630e6444a160e31b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260409020610c449083611f9c565b90506000610c5a6036546001600160a01b031690565b9050610c698183610dac61203a565b610cb657604080518381524760208201526001600160a01b0380841692908716917f63701cd972aa3c7f87898aab145c972e52185beab07d6e39380a998d334cf6c8910160405180910390a35b5092915050565b6060600080603660009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d399190613838565b9050836001600160401b03811115610d5357610d53613784565b604051908082528060200260200182016040528015610d7c578160200160208202803683370190505b50925060005b84811015610df757858582818110610d9c57610d9c61379a565b9050602002016020810190610db19190613471565b9250610dc8838884610dc3878c6111d6565b61209a565b848281518110610dda57610dda61379a565b602090810291909101015280610def816137c6565b915050610d82565b5050509392505050565b6060816001600160401b03811115610e1b57610e1b613784565b604051908082528060200260200182016040528015610e44578160200160208202803683370190505b50905060005b82811015610cb65760376000858584818110610e6857610e6861379a565b9050602002016020810190610e7d9190613471565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020154828281518110610eb357610eb361379a565b602090810291909101015280610ec8816137c6565b915050610e4a565b600260005403610ef25760405162461bcd60e51b81526004016108c9906137df565b600260009081556001600160a01b03831681526037602052604090203390610f1b908284612196565b610f2581836122f7565b610f4257604051635ff7115760e11b815260040160405180910390fd5b5050600160005550565b34600003610f6d57604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b81526001600160a01b0380841660048301528392169063a0c3f2d290602401602060405180830381865afa158015610fb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fdb9190613816565b61100357604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b336000908152603a60205260409020546001600160a01b03161561103c57604051632fc6bfb160e21b81523360048201526024016108c9565b6001600160a01b0382166000908152603760205260409020610be2903334612324565b6110676123ec565b6001600160a01b0316336001600160a01b0316146110975760405162461bcd60e51b81526004016108c990613851565b6110a08161241a565b50565b60006110bc83836110b2612456565b610dc387876111d6565b90505b92915050565b6002600054036110e75760405162461bcd60e51b81526004016108c9906137df565b6002600055603654604051635061f96960e11b81526001600160a01b0380851660048301528492169063a0c3f2d290602401602060405180830381865afa158015611136573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115a9190613816565b61118257604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b6001600160a01b038416600090815260376020526040902033906111a7908285612196565b6001600160a01b03841660009081526037602052604090206111ca908285612324565b50506001600055505050565b6001600160a01b0391821660009081526037602090815260408083209390941682526004909201909152205490565b61120d6123ec565b6001600160a01b0316336001600160a01b03161461123d5760405162461bcd60e51b81526004016108c990613851565b6110a0816124c8565b6060816001600160401b0381111561126057611260613784565b604051908082528060200260200182016040528015611289578160200160208202803683370190505b50905060005b82811015610cb6576112c18484838181106112ac576112ac61379a565b90506020020160208101906104a49190613471565b8282815181106112d3576112d361379a565b6020908102919091010152806112e8816137c6565b91505061128f565b603654604051635061f96960e11b81526001600160a01b0380861660048301528592169063a0c3f2d290602401602060405180830381865afa15801561133a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135e9190613816565b61138657604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b6001600160a01b0380851660009081526037602052604090206001810154909133911681146113c857604051637bc65bd760e11b815260040160405180910390fd5b606d548411156113eb57604051631b8454a360e21b815260040160405180910390fd5b60365460405163e5125a1d60e01b81526001600160a01b03888116600483015260248201889052604482018790529091169063e5125a1d90606401600060405180830381600087803b15801561144057600080fd5b505af1158015611454573d6000803e3d6000fd5b50505050505050505050565b6002600054036114825760405162461bcd60e51b81526004016108c9906137df565b60026000558215806114945750828114155b156114b2576040516376081a7b60e11b815260040160405180910390fd5b336000805b85811015611564578484828181106114d1576114d161379a565b90506020020135826114e39190613893565b9150611552603760008989858181106114fe576114fe61379a565b90506020020160208101906115139190613471565b6001600160a01b03166001600160a01b03168152602001908152602001600020848787858181106115465761154661379a565b90506020020135612196565b8061155c816137c6565b9150506114b7565b5061156f82826122f7565b61158c57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550505050565b6115a16123ec565b6001600160a01b0316336001600160a01b0316146115d15760405162461bcd60e51b81526004016108c990613851565b6110a0816124fd565b603654604051635061f96960e11b81526001600160a01b0380841660048301528392169063a0c3f2d290602401602060405180830381865afa158015611624573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116489190613816565b61167057604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b6001600160a01b0380831660009081526037602052604090206001810154909133911681146116b257604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163a7c2f11960e01b81526001600160a01b038781166004830152602482019290925291169063a7c2f11990604401610ad0565b336117016036546001600160a01b031690565b6001600160a01b03161461172857604051630e6444a160e31b815260040160405180910390fd5b611769858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250879250869150859050612532565b5050505050565b6117786123ec565b6001600160a01b0316336001600160a01b0316146117a85760405162461bcd60e51b81526004016108c990613851565b6110a081612966565b6002600054036117d35760405162461bcd60e51b81526004016108c9906137df565b6002600055603654604051635061f96960e11b81526001600160a01b0380851660048301528492169063a0c3f2d290602401602060405180830381865afa158015611822573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118469190613816565b61186e57604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b8160000361188f576040516331d9f7d760e01b815260040160405180910390fd5b6001600160a01b038316600090815260376020526040812060028101543392906118ba9086906138a6565b9050606c548110156118df5760405163ef0a995760e01b815260040160405180910390fd5b6118ea8284876129be565b61156f8386610dac61203a565b6118ff6123ec565b6001600160a01b0316336001600160a01b03161461192f5760405162461bcd60e51b81526004016108c990613851565b806001600160a01b03163b60000361195a57604051637bcd509160e01b815260040160405180910390fd5b6110a081612ad2565b336119766036546001600160a01b031690565b6001600160a01b03161461199d57604051630e6444a160e31b815260040160405180910390fd5b8115611b585760005b82811015611b1d576000603760008686858181106119c6576119c661379a565b90506020020160208101906119db9190613471565b6001600160a01b0390811682526020808301939093526040918201600090812060018101549092168152603a909352912080546001600160a01b031916905560028101549091508015611aa257611a328282611f9c565b506001820154611a4e906001600160a01b031682610dac61203a565b611aa25760018201548254604080518481524760208201526001600160a01b0393841693909216917f7dc5115a5aba081f5a174f56a3d02eea582824783322a4ac03f7bd388f444194910160405180910390a35b6000611ae2878786818110611ab957611ab961379a565b9050602002016020810190611ace9190613471565b60018501546001600160a01b031687612b20565b90508015611b07576001830154611b05906001600160a01b031682610dac61203a565b505b5050508080611b15906137c6565b9150506119a6565b507f4f257d3ba23679d338f1d94296086bba5724af341b7fa31aa0ff297bfcdc62d88383604051611b4f9291906138b9565b60405180910390a15b505050565b600260005403611b7f5760405162461bcd60e51b81526004016108c9906137df565b60026000908155338152603a60205260409020546001600160a01b031615611bbc57604051632fc6bfb160e21b81523360048201526024016108c9565b606d54811115611bdf57604051631b8454a360e21b815260040160405180910390fd5b3433611bf081888888888888612c32565b6001600160a01b0380871660008181526037602081815260408084206001810180549789166001600160a01b0319988916811790915581548816871782558552603a835290842080549096168517909555929091529052611c52818385611ec9565b816001600160a01b0316876001600160a01b03167ffc1f1e73948cbc47c5b7f90e5601b7daccd9ad7173218486ccc74bdd051d05e860405160405180910390a350506001600055505050505050565b60d154610100900460ff1615808015611cc1575060d154600160ff909116105b80611cdb5750303b158015611cdb575060d15460ff166001145b611d3e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016108c9565b60d1805460ff191660011790558015611d615760d1805461ff0019166101001790555b611d6a86612ad2565b611d738561241a565b611d7c84612966565b611d85836124c8565b611d8e826124fd565b8015611dd45760d1805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6000600260005403611e005760405162461bcd60e51b81526004016108c9906137df565b6002600081905550611e4533848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612ee192505050565b9050611e513382612f44565b600160005592915050565b6000611e9b85858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612ee192505050565b6001600160a01b0383166000908152603760205260409020909150611ec1908683612324565b949350505050565b6001830154839083906001600160a01b03808316911614611efd57604051637bc65bd760e11b815260040160405180910390fd5b82856002016000828254611f119190613893565b92505081905550611f3785858760020154868960030154611f329190613893565b612f6b565b6001600160a01b03808516600090815260058701602052604090819020429055865490519116907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611f8d9086815260200190565b60405180910390a25050505050565b6000611fac836002015483612fa6565b905080836002016000828254611fc291906138a6565b9091555050600183015460028401546003850154611ff39286926001600160a01b0390911691611f329086906138a6565b82546040518281526001600160a01b03909116907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f759060200160405180910390a292915050565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d806000811461208a576040519150601f19603f3d011682016040523d82523d6000602084013e61208f565b606091505b509095945050505050565b6001600160a01b038085166000908152600260209081526040808320938716835292905290812060038101548490036120d557549050611ec1565b6001600160a01b03861660009081526003602081815260408084206001808452828620948701548652939092528320918201548392901561213a578054600186015490945061212490856138a6565b85600201546121339190613907565b9250612142565b846001015493505b81546000906121529086906138a6565b61215c9089613907565b9050670de0b6b3a76400006121718286613893565b61217b919061391e565b86546121879190613893565b9b9a5050505050505050505050565b6001830154839083906001600160a01b038083169116036121ca57604051639feb934760e01b815260040160405180910390fd5b826000036121eb57604051637ab0c6ad60e11b815260040160405180910390fd5b6001600160a01b038416600090815260048601602052604090205483111561222657604051630695534560e31b815260040160405180910390fd5b6038546001600160a01b0385166000908152600587016020526040902054429161224f91613893565b1061226d5760405163f19f52bd60e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546122ab908690869061229b9087906138a6565b868960030154611f3291906138a6565b84546040518481526001600160a01b03918216918616907f4d10bd049775c77bd7f255195afba5088028ecb3c7c277d393ccff7934f2f92c906020015b60405180910390a35050505050565b60008147101561231a576040516304611a4560e11b815260040160405180910390fd5b6110bc8383612fbc565b6001830154839083906001600160a01b0380831691160361235857604051639feb934760e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546123969086908690612386908790613893565b868960030154611f329190613893565b6001600160a01b03808516600081815260058801602052604090819020429055875490519216917fe5541a6b6103d4fa7e021ed54fad39c66f27a76bd13d374cf6240ae6bd0bb72b906122e89087815260200190565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b606c8190556040518181527f372bbdb8d72373b0012f84ee5a11671e5fb72b8bea902ebca93a19cb45d32be2906020015b60405180910390a150565b6036546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa15801561249f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c39190613838565b905090565b60388190556040518181527f4956b65267b8f1e642284bcb5037116c69a9c78d9ca576beeae0974737a4872a9060200161244b565b60398190556040518181527f02be0b73b597f2c0f138aebee162b3b0e25d5b5a26854c15dcf79176e9a1c6789060200161244b565b8351821461257b57807fae52c603227f64e4c6101dde593aa9790a16b3ac77546bd746d758511e9560a585858560405161256e93929190613979565b60405180910390a2612960565b600080600080600088516001600160401b0381111561259c5761259c613784565b6040519080825280602002602001820160405280156125c5578160200160208202803683370190505b509050600089516001600160401b038111156125e3576125e3613784565b60405190808252806020026020018201604052801561260c578160200160208202803683370190505b50905060008a516001600160401b0381111561262a5761262a613784565b604051908082528060200260200182016040528015612653578160200160208202803683370190505b50905060005b8b518110156128cb578b81815181106126745761267461379a565b6020908102919091018101516001600160a01b038116600090815260038084526040808320603790955290912001549097506001600160a01b03881660009081526001602081815260408084208f855290915290912001549096508a900361271a578683896126e2816137c6565b9a50815181106126f4576126f461379a565b60200260200101906001600160a01b031690816001600160a01b031681525050506128b9565b60028101548a111561274857604080518082019091528681526020018a905260018101869055600281018a90555b6001810154156127925760018101548c8c848181106127695761276961379a565b90506020020135670de0b6b3a76400006127839190613907565b61278d919061391e565b612795565b60005b9850888160000160008282546127ab9190613893565b91829055509050856127bd8a856138a6565b815181106127cd576127cd61379a565b6020026020010181815250506040518060400160405280826000015481526020018b81525060016000896001600160a01b03166001600160a01b0316815260200190815260200160002060008c81526020019081526020016000206000820151816000015560208201518160010155905050858160010160000181905550806001016000015484898461286091906138a6565b815181106128705761287061379a565b6020908102919091010152868d6128878a856138a6565b815181106128975761289761379a565b60200260200101906001600160a01b031690816001600160a01b031681525050505b806128c3816137c6565b915050612659565b50851561291457858152858b51038b52877fee74f10cc50bf4b7e57fd36be7d46288795f3a9151dae97505b718b392ba14a38260405161290b91906139c3565b60405180910390a25b8a511561295857877f0e54e0485f70f0f63bc25889ddbf01ce1269ad6f07fdb2df573a0fbdb4d66f888c858560405161294f939291906139d6565b60405180910390a25b505050505050505b50505050565b61271081111561298957604051631b8454a360e21b815260040160405180910390fd5b606d8190556040518181527f774069781371d65424b3b0b101c1d40014532cac040f979595b99a3fcf8ce08c9060200161244b565b6001830154839083906001600160a01b038083169116146129f257604051637bc65bd760e11b815260040160405180910390fd5b8460020154831115612a1757604051630a8d7fa760e21b815260040160405180910390fd5b6038546001600160a01b03851660009081526005870160205260409020544291612a4091613893565b1115612a5f576040516303db082960e11b815260040160405180910390fd5b82856002016000828254612a7391906138a6565b92505081905550612a9485858760020154868960030154611f3291906138a6565b84546040518481526001600160a01b03909116907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f7590602001611f8d565b603680546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b68361699060200161244b565b600080612b2d85856111d6565b9050612b3b8585858461209a565b9150836001600160a01b0316856001600160a01b03167f0aa4d283470c904c551d18bb894d37e17674920f3261a7f854be501e25f421b784604051612b8291815260200190565b60405180910390a36001600160a01b03808616600081815260026020908152604080832094891683529381528382208281559282526003905291909120612bcc9082868580613018565b60038181018590556001600160a01b03878116600081815260209384526040808220546001870155519081529188169290917faa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ad910160405180910390a350509392505050565b612c3d876000612fbc565b612c88576040805163338f030160e01b81526001600160a01b03891660048201526024810191909152600a6044820152693837b7b61030b236b4b760b11b60648201526084016108c9565b612c93846000612fbc565b612cdc576040805163338f030160e01b81526001600160a01b038616600482015260248101919091526008604482015267747265617375727960c01b60648201526084016108c9565b606c54811015612cff57604051630a8d7fa760e21b815260040160405180910390fd5b606d54821115612d2257604051631b8454a360e21b815260040160405180910390fd5b856001600160a01b0316876001600160a01b0316141580612d555750836001600160a01b0316866001600160a01b031614155b15612d735760405163dc1d04ff60e01b815260040160405180910390fd5b60408051600380825260808201909252600091602082016060803683370190505090508781600081518110612daa57612daa61379a565b60200260200101906001600160a01b031690816001600160a01b0316815250508581600181518110612dde57612dde61379a565b60200260200101906001600160a01b031690816001600160a01b0316815250508381600281518110612e1257612e1261379a565b60200260200101906001600160a01b031690816001600160a01b031681525050612e3b816130aa565b15612e59576040516329d55f9360e11b815260040160405180910390fd5b6036546040516302209ca560e31b81526001600160a01b0389811660048301528881166024830152878116604483015286811660648301526084820186905290911690631104e5289060a401600060405180830381600087803b158015612ebf57600080fd5b505af1158015612ed3573d6000803e3d6000fd5b505050505050505050505050565b600080612eec612456565b905060005b8351811015612f3c57612f1e848281518110612f0f57612f0f61379a565b60200260200101518684612b20565b612f289084613893565b925080612f34816137c6565b915050612ef1565b505092915050565b612f4e82826122f7565b610be257604051630c3e69bb60e11b815260040160405180910390fd5b8354612f81906001600160a01b03168484613171565b60038401556001600160a01b0390911660009081526004909201602052604090912055565b6000818310612fb557816110bc565b5090919050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613009576040519150601f19603f3d011682016040523d82523d6000602084013e61300e565b606091505b5090949350505050565b828460030154101561302c57600284018190555b600061303c856002015484612fa6565b9050600081866002015461305091906138a6565b905080156130a157600286018290556001870154811115613084576040516352e521bf60e11b815260040160405180910390fd5b8087600101600001600082825461309b91906138a6565b90915550505b50505050505050565b600081516000036130bd57506000919050565b60005b600183516130ce91906138a6565b8110156131685760006130e2826001613893565b90505b8351811015613155578381815181106131005761310061379a565b60200260200101516001600160a01b03168483815181106131235761312361379a565b60200260200101516001600160a01b031603613143575060019392505050565b8061314d816137c6565b9150506130e5565b5080613160816137c6565b9150506130c0565b50600092915050565b600061317b612456565b6001600160a01b03851660009081526003602052604090206001810154600282015492935090918311156131ef5760405180604001604052806131d6886001600160a01b031660009081526037602052604090206003015490565b8152602090810185905281516001850155015160028301555b6001600160a01b03808716600090815260026020908152604080832093891683529290529081209061322188886111d6565b905060006132318989888561209a565b83549091508114613283578083556040518181526001600160a01b0389811691908b16907faa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ad9060200160405180910390a35b6132908584888a86613018565b84546001808501919091556003840187905585015484146132f757886001600160a01b0316867f81faf50e2aaf52eaba2ab841071efb9f6f0850a3e7d008b1336e6001d3d4963c87600101600001546040516132ee91815260200190565b60405180910390a35b505050505050505050565b60008083601f84011261331457600080fd5b5081356001600160401b0381111561332b57600080fd5b6020830191508360208260051b850101111561334657600080fd5b9250929050565b6000806000806040858703121561336357600080fd5b84356001600160401b038082111561337a57600080fd5b61338688838901613302565b9096509450602087013591508082111561339f57600080fd5b506133ac87828801613302565b95989497509550505050565b600081518084526020808501945080840160005b838110156133e8578151875295820195908201906001016133cc565b509495945050505050565b6020815260006110bc60208301846133b8565b6001600160a01b03811681146110a057600080fd5b60008060006040848603121561343057600080fd5b83356001600160401b0381111561344657600080fd5b61345286828701613302565b909450925050602084013561346681613406565b809150509250925092565b60006020828403121561348357600080fd5b813561348e81613406565b9392505050565b600080604083850312156134a857600080fd5b82356134b381613406565b946020939093013593505050565b6000806000604084860312156134d657600080fd5b83356134e181613406565b925060208401356001600160401b038111156134fc57600080fd5b61350886828701613302565b9497909650939450505050565b6000806020838503121561352857600080fd5b82356001600160401b0381111561353e57600080fd5b61354a85828601613302565b90969095509350505050565b60006020828403121561356857600080fd5b5035919050565b6000806040838503121561358257600080fd5b823561358d81613406565b9150602083013561359d81613406565b809150509250929050565b6000806000606084860312156135bd57600080fd5b83356135c881613406565b925060208401356135d881613406565b929592945050506040919091013590565b6000806000606084860312156135fe57600080fd5b833561360981613406565b95602085013595506040909401359392505050565b60008060008060006060868803121561363657600080fd5b85356001600160401b038082111561364d57600080fd5b61365989838a01613302565b9097509550602088013591508082111561367257600080fd5b5061367f88828901613302565b96999598509660400135949350505050565b6000806000604084860312156136a657600080fd5b83356001600160401b038111156136bc57600080fd5b6136c886828701613302565b909790965060209590950135949350505050565b600080600080600060a086880312156136f457600080fd5b85356136ff81613406565b9450602086013561370f81613406565b9350604086013561371f81613406565b9250606086013561372f81613406565b949793965091946080013592915050565b600080600080600060a0868803121561375857600080fd5b853561376381613406565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016137d8576137d86137b0565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561382857600080fd5b8151801515811461348e57600080fd5b60006020828403121561384a57600080fd5b5051919050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b808201808211156110bf576110bf6137b0565b818103818111156110bf576110bf6137b0565b60208082528181018390526000908460408401835b868110156138fc5782356138e181613406565b6001600160a01b0316825291830191908301906001016138ce565b509695505050505050565b80820281158282048414176110bf576110bf6137b0565b60008261393b57634e487b7160e01b600052601260045260246000fd5b500490565b600081518084526020808501945080840160005b838110156133e85781516001600160a01b031687529582019590820190600101613954565b60408152600061398c6040830186613940565b82810360208401528381526001600160fb1b038411156139ab57600080fd5b8360051b808660208401370160200195945050505050565b6020815260006110bc6020830184613940565b6060815260006139e96060830186613940565b82810360208401526139fb81866133b8565b90508281036040840152613a0f81856133b8565b969550505050505056fea2646970667358221220839f85d23f0ab1f03cccdeafa2f98f931424069923da73144e66990297f8743064736f6c63430008110033", - "deployedBytecode": "0x6080604052600436106102135760003560e01c806391f8723f11610118578063c2a672e0116100a0578063d01b8eed1161006f578063d01b8eed1461067f578063e22d1c9d146106f0578063e5376f5414610710578063f92ad21914610723578063f9f031df1461074357610254565b8063c2a672e0146105f1578063c508700314610611578063c673316c1461064a578063cdf64a761461065f57610254565b806399439089116100e75780639943908914610557578063aa15a6fd14610589578063acd79c46146105a9578063af245429146105bc578063b78b5e41146105d157610254565b806391f8723f146104d7578063924f081e146104f75780639488e4e914610517578063969ffc141461053757610254565b80634d99dd161161019b5780636bd8f8041161016a5780636bd8f8041461042957806376664b6514610449578063888b9ae914610469578063895ab74214610489578063909791dd146104c257610254565b80634d99dd16146103b65780635c19a95c146103d6578063679a6e43146103e95780636b0916951461040957610254565b806326476204116101e257806326476204146102f85780632715805e1461030b5780633d8e846e1461032b57806342e0c4081461034b57806342ef3c341461039657610254565b80630682e8fa14610267578063095f64751461028b578063097e4a9d146102b85780631658c86e146102d857610254565b36610254573361022b6036546001600160a01b031690565b6001600160a01b03161461025257604051630e6444a160e31b815260040160405180910390fd5b005b3361022b6036546001600160a01b031690565b34801561027357600080fd5b506038545b6040519081526020015b60405180910390f35b34801561029757600080fd5b506102ab6102a636600461334d565b610763565b60405161028291906133f3565b3480156102c457600080fd5b506102786102d336600461341b565b6108a5565b3480156102e457600080fd5b506102526102f3366004613471565b6109c0565b610252610306366004613471565b610b08565b34801561031757600080fd5b50610278610326366004613495565b610be6565b34801561033757600080fd5b506102ab6103463660046134c1565b610cbd565b34801561035757600080fd5b50610386610366366004613471565b6001600160a01b039081166000908152603a602052604090205416151590565b6040519015158152602001610282565b3480156103a257600080fd5b506102ab6103b1366004613515565b610e01565b3480156103c257600080fd5b506102526103d1366004613495565b610ed0565b6102526103e4366004613471565b610f4c565b3480156103f557600080fd5b50610252610404366004613556565b61105f565b34801561041557600080fd5b5061027861042436600461356f565b6110a3565b34801561043557600080fd5b506102526104443660046135a8565b6110c5565b34801561045557600080fd5b5061027861046436600461356f565b6111d6565b34801561047557600080fd5b50610252610484366004613556565b611205565b34801561049557600080fd5b506102786104a4366004613471565b6001600160a01b031660009081526037602052604090206003015490565b3480156104ce57600080fd5b50606c54610278565b3480156104e357600080fd5b506102ab6104f2366004613515565b611246565b34801561050357600080fd5b506102526105123660046135e9565b6112f0565b34801561052357600080fd5b5061025261053236600461334d565b611460565b34801561054357600080fd5b50610252610552366004613556565b611599565b34801561056357600080fd5b506036546001600160a01b03165b6040516001600160a01b039091168152602001610282565b34801561059557600080fd5b506102526105a4366004613471565b6115da565b6102526105b736600461361e565b6116ee565b3480156105c857600080fd5b50603954610278565b3480156105dd57600080fd5b506102526105ec366004613556565b611770565b3480156105fd57600080fd5b5061025261060c366004613495565b6117b1565b34801561061d57600080fd5b5061057161062c366004613471565b6001600160a01b039081166000908152603a60205260409020541690565b34801561065657600080fd5b50606d54610278565b34801561066b57600080fd5b5061025261067a366004613471565b6118f7565b34801561068b57600080fd5b506106cb61069a366004613471565b6001600160a01b03808216600090815260376020526040902060018101546002820154600390920154921693909250565b604080516001600160a01b039094168452602084019290925290820152606001610282565b3480156106fc57600080fd5b5061025261070b366004613691565b611963565b61025261071e3660046136dc565b611b5d565b34801561072f57600080fd5b5061025261073e366004613740565b611ca1565b34801561074f57600080fd5b5061027861075e366004613515565b611ddc565b6060838214610785576040516376081a7b60e11b815260040160405180910390fd5b836001600160401b0381111561079d5761079d613784565b6040519080825280602002602001820160405280156107c6578160200160208202803683370190505b50905060005b815181101561089c57603760008787848181106107eb576107eb61379a565b90506020020160208101906108009190613471565b6001600160a01b03166001600160a01b0316815260200190815260200160002060040160008585848181106108375761083761379a565b905060200201602081019061084c9190613471565b6001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061087f5761087f61379a565b602090810291909101015280610894816137c6565b9150506107cc565b50949350505050565b60006002600054036108d25760405162461bcd60e51b81526004016108c9906137df565b60405180910390fd5b6002600055603654604051635061f96960e11b81526001600160a01b0380851660048301528492169063a0c3f2d290602401602060405180830381865afa158015610921573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109459190613816565b61096d57604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b336000908152603a60205260409020546001600160a01b0316156109a657604051632fc6bfb160e21b81523360048201526024016108c9565b6109b233868686611e5c565b600160005595945050505050565b603654604051635061f96960e11b81526001600160a01b0380841660048301528392169063a0c3f2d290602401602060405180830381865afa158015610a0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a2e9190613816565b610a5657604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b6001600160a01b038083166000908152603760205260409020600181015490913391168114610a9857604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163dd716ad360e01b81526001600160a01b038781166004830152602482019290925291169063dd716ad3906044015b600060405180830381600087803b158015610aea57600080fd5b505af1158015610afe573d6000803e3d6000fd5b5050505050505050565b34600003610b2957604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b81526001600160a01b0380841660048301528392169063a0c3f2d290602401602060405180830381865afa158015610b73573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b979190613816565b610bbf57604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b6001600160a01b0382166000908152603760205260409020610be2903334611ec9565b5050565b600033610bfb6036546001600160a01b031690565b6001600160a01b031614610c2257604051630e6444a160e31b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260409020610c449083611f9c565b90506000610c5a6036546001600160a01b031690565b9050610c698183610dac61203a565b610cb657604080518381524760208201526001600160a01b0380841692908716917f63701cd972aa3c7f87898aab145c972e52185beab07d6e39380a998d334cf6c8910160405180910390a35b5092915050565b6060600080603660009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d399190613838565b9050836001600160401b03811115610d5357610d53613784565b604051908082528060200260200182016040528015610d7c578160200160208202803683370190505b50925060005b84811015610df757858582818110610d9c57610d9c61379a565b9050602002016020810190610db19190613471565b9250610dc8838884610dc3878c6111d6565b61209a565b848281518110610dda57610dda61379a565b602090810291909101015280610def816137c6565b915050610d82565b5050509392505050565b6060816001600160401b03811115610e1b57610e1b613784565b604051908082528060200260200182016040528015610e44578160200160208202803683370190505b50905060005b82811015610cb65760376000858584818110610e6857610e6861379a565b9050602002016020810190610e7d9190613471565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020154828281518110610eb357610eb361379a565b602090810291909101015280610ec8816137c6565b915050610e4a565b600260005403610ef25760405162461bcd60e51b81526004016108c9906137df565b600260009081556001600160a01b03831681526037602052604090203390610f1b908284612196565b610f2581836122f7565b610f4257604051635ff7115760e11b815260040160405180910390fd5b5050600160005550565b34600003610f6d57604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b81526001600160a01b0380841660048301528392169063a0c3f2d290602401602060405180830381865afa158015610fb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fdb9190613816565b61100357604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b336000908152603a60205260409020546001600160a01b03161561103c57604051632fc6bfb160e21b81523360048201526024016108c9565b6001600160a01b0382166000908152603760205260409020610be2903334612324565b6110676123ec565b6001600160a01b0316336001600160a01b0316146110975760405162461bcd60e51b81526004016108c990613851565b6110a08161241a565b50565b60006110bc83836110b2612456565b610dc387876111d6565b90505b92915050565b6002600054036110e75760405162461bcd60e51b81526004016108c9906137df565b6002600055603654604051635061f96960e11b81526001600160a01b0380851660048301528492169063a0c3f2d290602401602060405180830381865afa158015611136573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061115a9190613816565b61118257604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b6001600160a01b038416600090815260376020526040902033906111a7908285612196565b6001600160a01b03841660009081526037602052604090206111ca908285612324565b50506001600055505050565b6001600160a01b0391821660009081526037602090815260408083209390941682526004909201909152205490565b61120d6123ec565b6001600160a01b0316336001600160a01b03161461123d5760405162461bcd60e51b81526004016108c990613851565b6110a0816124c8565b6060816001600160401b0381111561126057611260613784565b604051908082528060200260200182016040528015611289578160200160208202803683370190505b50905060005b82811015610cb6576112c18484838181106112ac576112ac61379a565b90506020020160208101906104a49190613471565b8282815181106112d3576112d361379a565b6020908102919091010152806112e8816137c6565b91505061128f565b603654604051635061f96960e11b81526001600160a01b0380861660048301528592169063a0c3f2d290602401602060405180830381865afa15801561133a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135e9190613816565b61138657604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b6001600160a01b0380851660009081526037602052604090206001810154909133911681146113c857604051637bc65bd760e11b815260040160405180910390fd5b606d548411156113eb57604051631b8454a360e21b815260040160405180910390fd5b60365460405163e5125a1d60e01b81526001600160a01b03888116600483015260248201889052604482018790529091169063e5125a1d90606401600060405180830381600087803b15801561144057600080fd5b505af1158015611454573d6000803e3d6000fd5b50505050505050505050565b6002600054036114825760405162461bcd60e51b81526004016108c9906137df565b60026000558215806114945750828114155b156114b2576040516376081a7b60e11b815260040160405180910390fd5b336000805b85811015611564578484828181106114d1576114d161379a565b90506020020135826114e39190613893565b9150611552603760008989858181106114fe576114fe61379a565b90506020020160208101906115139190613471565b6001600160a01b03166001600160a01b03168152602001908152602001600020848787858181106115465761154661379a565b90506020020135612196565b8061155c816137c6565b9150506114b7565b5061156f82826122f7565b61158c57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550505050565b6115a16123ec565b6001600160a01b0316336001600160a01b0316146115d15760405162461bcd60e51b81526004016108c990613851565b6110a0816124fd565b603654604051635061f96960e11b81526001600160a01b0380841660048301528392169063a0c3f2d290602401602060405180830381865afa158015611624573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116489190613816565b61167057604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b6001600160a01b0380831660009081526037602052604090206001810154909133911681146116b257604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163a7c2f11960e01b81526001600160a01b038781166004830152602482019290925291169063a7c2f11990604401610ad0565b336117016036546001600160a01b031690565b6001600160a01b03161461172857604051630e6444a160e31b815260040160405180910390fd5b611769858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250879250869150859050612532565b5050505050565b6117786123ec565b6001600160a01b0316336001600160a01b0316146117a85760405162461bcd60e51b81526004016108c990613851565b6110a081612966565b6002600054036117d35760405162461bcd60e51b81526004016108c9906137df565b6002600055603654604051635061f96960e11b81526001600160a01b0380851660048301528492169063a0c3f2d290602401602060405180830381865afa158015611822573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118469190613816565b61186e57604051630fd0c64560e11b81526001600160a01b03821660048201526024016108c9565b8160000361188f576040516331d9f7d760e01b815260040160405180910390fd5b6001600160a01b038316600090815260376020526040812060028101543392906118ba9086906138a6565b9050606c548110156118df5760405163ef0a995760e01b815260040160405180910390fd5b6118ea8284876129be565b61156f8386610dac61203a565b6118ff6123ec565b6001600160a01b0316336001600160a01b03161461192f5760405162461bcd60e51b81526004016108c990613851565b806001600160a01b03163b60000361195a57604051637bcd509160e01b815260040160405180910390fd5b6110a081612ad2565b336119766036546001600160a01b031690565b6001600160a01b03161461199d57604051630e6444a160e31b815260040160405180910390fd5b8115611b585760005b82811015611b1d576000603760008686858181106119c6576119c661379a565b90506020020160208101906119db9190613471565b6001600160a01b0390811682526020808301939093526040918201600090812060018101549092168152603a909352912080546001600160a01b031916905560028101549091508015611aa257611a328282611f9c565b506001820154611a4e906001600160a01b031682610dac61203a565b611aa25760018201548254604080518481524760208201526001600160a01b0393841693909216917f7dc5115a5aba081f5a174f56a3d02eea582824783322a4ac03f7bd388f444194910160405180910390a35b6000611ae2878786818110611ab957611ab961379a565b9050602002016020810190611ace9190613471565b60018501546001600160a01b031687612b20565b90508015611b07576001830154611b05906001600160a01b031682610dac61203a565b505b5050508080611b15906137c6565b9150506119a6565b507f4f257d3ba23679d338f1d94296086bba5724af341b7fa31aa0ff297bfcdc62d88383604051611b4f9291906138b9565b60405180910390a15b505050565b600260005403611b7f5760405162461bcd60e51b81526004016108c9906137df565b60026000908155338152603a60205260409020546001600160a01b031615611bbc57604051632fc6bfb160e21b81523360048201526024016108c9565b606d54811115611bdf57604051631b8454a360e21b815260040160405180910390fd5b3433611bf081888888888888612c32565b6001600160a01b0380871660008181526037602081815260408084206001810180549789166001600160a01b0319988916811790915581548816871782558552603a835290842080549096168517909555929091529052611c52818385611ec9565b816001600160a01b0316876001600160a01b03167ffc1f1e73948cbc47c5b7f90e5601b7daccd9ad7173218486ccc74bdd051d05e860405160405180910390a350506001600055505050505050565b60d154610100900460ff1615808015611cc1575060d154600160ff909116105b80611cdb5750303b158015611cdb575060d15460ff166001145b611d3e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016108c9565b60d1805460ff191660011790558015611d615760d1805461ff0019166101001790555b611d6a86612ad2565b611d738561241a565b611d7c84612966565b611d85836124c8565b611d8e826124fd565b8015611dd45760d1805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6000600260005403611e005760405162461bcd60e51b81526004016108c9906137df565b6002600081905550611e4533848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612ee192505050565b9050611e513382612f44565b600160005592915050565b6000611e9b85858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612ee192505050565b6001600160a01b0383166000908152603760205260409020909150611ec1908683612324565b949350505050565b6001830154839083906001600160a01b03808316911614611efd57604051637bc65bd760e11b815260040160405180910390fd5b82856002016000828254611f119190613893565b92505081905550611f3785858760020154868960030154611f329190613893565b612f6b565b6001600160a01b03808516600090815260058701602052604090819020429055865490519116907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611f8d9086815260200190565b60405180910390a25050505050565b6000611fac836002015483612fa6565b905080836002016000828254611fc291906138a6565b9091555050600183015460028401546003850154611ff39286926001600160a01b0390911691611f329086906138a6565b82546040518281526001600160a01b03909116907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f759060200160405180910390a292915050565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d806000811461208a576040519150601f19603f3d011682016040523d82523d6000602084013e61208f565b606091505b509095945050505050565b6001600160a01b038085166000908152600260209081526040808320938716835292905290812060038101548490036120d557549050611ec1565b6001600160a01b03861660009081526003602081815260408084206001808452828620948701548652939092528320918201548392901561213a578054600186015490945061212490856138a6565b85600201546121339190613907565b9250612142565b846001015493505b81546000906121529086906138a6565b61215c9089613907565b9050670de0b6b3a76400006121718286613893565b61217b919061391e565b86546121879190613893565b9b9a5050505050505050505050565b6001830154839083906001600160a01b038083169116036121ca57604051639feb934760e01b815260040160405180910390fd5b826000036121eb57604051637ab0c6ad60e11b815260040160405180910390fd5b6001600160a01b038416600090815260048601602052604090205483111561222657604051630695534560e31b815260040160405180910390fd5b6038546001600160a01b0385166000908152600587016020526040902054429161224f91613893565b1061226d5760405163f19f52bd60e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546122ab908690869061229b9087906138a6565b868960030154611f3291906138a6565b84546040518481526001600160a01b03918216918616907f4d10bd049775c77bd7f255195afba5088028ecb3c7c277d393ccff7934f2f92c906020015b60405180910390a35050505050565b60008147101561231a576040516304611a4560e11b815260040160405180910390fd5b6110bc8383612fbc565b6001830154839083906001600160a01b0380831691160361235857604051639feb934760e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546123969086908690612386908790613893565b868960030154611f329190613893565b6001600160a01b03808516600081815260058801602052604090819020429055875490519216917fe5541a6b6103d4fa7e021ed54fad39c66f27a76bd13d374cf6240ae6bd0bb72b906122e89087815260200190565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b606c8190556040518181527f372bbdb8d72373b0012f84ee5a11671e5fb72b8bea902ebca93a19cb45d32be2906020015b60405180910390a150565b6036546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa15801561249f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124c39190613838565b905090565b60388190556040518181527f4956b65267b8f1e642284bcb5037116c69a9c78d9ca576beeae0974737a4872a9060200161244b565b60398190556040518181527f02be0b73b597f2c0f138aebee162b3b0e25d5b5a26854c15dcf79176e9a1c6789060200161244b565b8351821461257b57807fae52c603227f64e4c6101dde593aa9790a16b3ac77546bd746d758511e9560a585858560405161256e93929190613979565b60405180910390a2612960565b600080600080600088516001600160401b0381111561259c5761259c613784565b6040519080825280602002602001820160405280156125c5578160200160208202803683370190505b509050600089516001600160401b038111156125e3576125e3613784565b60405190808252806020026020018201604052801561260c578160200160208202803683370190505b50905060008a516001600160401b0381111561262a5761262a613784565b604051908082528060200260200182016040528015612653578160200160208202803683370190505b50905060005b8b518110156128cb578b81815181106126745761267461379a565b6020908102919091018101516001600160a01b038116600090815260038084526040808320603790955290912001549097506001600160a01b03881660009081526001602081815260408084208f855290915290912001549096508a900361271a578683896126e2816137c6565b9a50815181106126f4576126f461379a565b60200260200101906001600160a01b031690816001600160a01b031681525050506128b9565b60028101548a111561274857604080518082019091528681526020018a905260018101869055600281018a90555b6001810154156127925760018101548c8c848181106127695761276961379a565b90506020020135670de0b6b3a76400006127839190613907565b61278d919061391e565b612795565b60005b9850888160000160008282546127ab9190613893565b91829055509050856127bd8a856138a6565b815181106127cd576127cd61379a565b6020026020010181815250506040518060400160405280826000015481526020018b81525060016000896001600160a01b03166001600160a01b0316815260200190815260200160002060008c81526020019081526020016000206000820151816000015560208201518160010155905050858160010160000181905550806001016000015484898461286091906138a6565b815181106128705761287061379a565b6020908102919091010152868d6128878a856138a6565b815181106128975761289761379a565b60200260200101906001600160a01b031690816001600160a01b031681525050505b806128c3816137c6565b915050612659565b50851561291457858152858b51038b52877fee74f10cc50bf4b7e57fd36be7d46288795f3a9151dae97505b718b392ba14a38260405161290b91906139c3565b60405180910390a25b8a511561295857877f0e54e0485f70f0f63bc25889ddbf01ce1269ad6f07fdb2df573a0fbdb4d66f888c858560405161294f939291906139d6565b60405180910390a25b505050505050505b50505050565b61271081111561298957604051631b8454a360e21b815260040160405180910390fd5b606d8190556040518181527f774069781371d65424b3b0b101c1d40014532cac040f979595b99a3fcf8ce08c9060200161244b565b6001830154839083906001600160a01b038083169116146129f257604051637bc65bd760e11b815260040160405180910390fd5b8460020154831115612a1757604051630a8d7fa760e21b815260040160405180910390fd5b6038546001600160a01b03851660009081526005870160205260409020544291612a4091613893565b1115612a5f576040516303db082960e11b815260040160405180910390fd5b82856002016000828254612a7391906138a6565b92505081905550612a9485858760020154868960030154611f3291906138a6565b84546040518481526001600160a01b03909116907f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f7590602001611f8d565b603680546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b68361699060200161244b565b600080612b2d85856111d6565b9050612b3b8585858461209a565b9150836001600160a01b0316856001600160a01b03167f0aa4d283470c904c551d18bb894d37e17674920f3261a7f854be501e25f421b784604051612b8291815260200190565b60405180910390a36001600160a01b03808616600081815260026020908152604080832094891683529381528382208281559282526003905291909120612bcc9082868580613018565b60038181018590556001600160a01b03878116600081815260209384526040808220546001870155519081529188169290917faa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ad910160405180910390a350509392505050565b612c3d876000612fbc565b612c88576040805163338f030160e01b81526001600160a01b03891660048201526024810191909152600a6044820152693837b7b61030b236b4b760b11b60648201526084016108c9565b612c93846000612fbc565b612cdc576040805163338f030160e01b81526001600160a01b038616600482015260248101919091526008604482015267747265617375727960c01b60648201526084016108c9565b606c54811015612cff57604051630a8d7fa760e21b815260040160405180910390fd5b606d54821115612d2257604051631b8454a360e21b815260040160405180910390fd5b856001600160a01b0316876001600160a01b0316141580612d555750836001600160a01b0316866001600160a01b031614155b15612d735760405163dc1d04ff60e01b815260040160405180910390fd5b60408051600380825260808201909252600091602082016060803683370190505090508781600081518110612daa57612daa61379a565b60200260200101906001600160a01b031690816001600160a01b0316815250508581600181518110612dde57612dde61379a565b60200260200101906001600160a01b031690816001600160a01b0316815250508381600281518110612e1257612e1261379a565b60200260200101906001600160a01b031690816001600160a01b031681525050612e3b816130aa565b15612e59576040516329d55f9360e11b815260040160405180910390fd5b6036546040516302209ca560e31b81526001600160a01b0389811660048301528881166024830152878116604483015286811660648301526084820186905290911690631104e5289060a401600060405180830381600087803b158015612ebf57600080fd5b505af1158015612ed3573d6000803e3d6000fd5b505050505050505050505050565b600080612eec612456565b905060005b8351811015612f3c57612f1e848281518110612f0f57612f0f61379a565b60200260200101518684612b20565b612f289084613893565b925080612f34816137c6565b915050612ef1565b505092915050565b612f4e82826122f7565b610be257604051630c3e69bb60e11b815260040160405180910390fd5b8354612f81906001600160a01b03168484613171565b60038401556001600160a01b0390911660009081526004909201602052604090912055565b6000818310612fb557816110bc565b5090919050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613009576040519150601f19603f3d011682016040523d82523d6000602084013e61300e565b606091505b5090949350505050565b828460030154101561302c57600284018190555b600061303c856002015484612fa6565b9050600081866002015461305091906138a6565b905080156130a157600286018290556001870154811115613084576040516352e521bf60e11b815260040160405180910390fd5b8087600101600001600082825461309b91906138a6565b90915550505b50505050505050565b600081516000036130bd57506000919050565b60005b600183516130ce91906138a6565b8110156131685760006130e2826001613893565b90505b8351811015613155578381815181106131005761310061379a565b60200260200101516001600160a01b03168483815181106131235761312361379a565b60200260200101516001600160a01b031603613143575060019392505050565b8061314d816137c6565b9150506130e5565b5080613160816137c6565b9150506130c0565b50600092915050565b600061317b612456565b6001600160a01b03851660009081526003602052604090206001810154600282015492935090918311156131ef5760405180604001604052806131d6886001600160a01b031660009081526037602052604090206003015490565b8152602090810185905281516001850155015160028301555b6001600160a01b03808716600090815260026020908152604080832093891683529290529081209061322188886111d6565b905060006132318989888561209a565b83549091508114613283578083556040518181526001600160a01b0389811691908b16907faa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ad9060200160405180910390a35b6132908584888a86613018565b84546001808501919091556003840187905585015484146132f757886001600160a01b0316867f81faf50e2aaf52eaba2ab841071efb9f6f0850a3e7d008b1336e6001d3d4963c87600101600001546040516132ee91815260200190565b60405180910390a35b505050505050505050565b60008083601f84011261331457600080fd5b5081356001600160401b0381111561332b57600080fd5b6020830191508360208260051b850101111561334657600080fd5b9250929050565b6000806000806040858703121561336357600080fd5b84356001600160401b038082111561337a57600080fd5b61338688838901613302565b9096509450602087013591508082111561339f57600080fd5b506133ac87828801613302565b95989497509550505050565b600081518084526020808501945080840160005b838110156133e8578151875295820195908201906001016133cc565b509495945050505050565b6020815260006110bc60208301846133b8565b6001600160a01b03811681146110a057600080fd5b60008060006040848603121561343057600080fd5b83356001600160401b0381111561344657600080fd5b61345286828701613302565b909450925050602084013561346681613406565b809150509250925092565b60006020828403121561348357600080fd5b813561348e81613406565b9392505050565b600080604083850312156134a857600080fd5b82356134b381613406565b946020939093013593505050565b6000806000604084860312156134d657600080fd5b83356134e181613406565b925060208401356001600160401b038111156134fc57600080fd5b61350886828701613302565b9497909650939450505050565b6000806020838503121561352857600080fd5b82356001600160401b0381111561353e57600080fd5b61354a85828601613302565b90969095509350505050565b60006020828403121561356857600080fd5b5035919050565b6000806040838503121561358257600080fd5b823561358d81613406565b9150602083013561359d81613406565b809150509250929050565b6000806000606084860312156135bd57600080fd5b83356135c881613406565b925060208401356135d881613406565b929592945050506040919091013590565b6000806000606084860312156135fe57600080fd5b833561360981613406565b95602085013595506040909401359392505050565b60008060008060006060868803121561363657600080fd5b85356001600160401b038082111561364d57600080fd5b61365989838a01613302565b9097509550602088013591508082111561367257600080fd5b5061367f88828901613302565b96999598509660400135949350505050565b6000806000604084860312156136a657600080fd5b83356001600160401b038111156136bc57600080fd5b6136c886828701613302565b909790965060209590950135949350505050565b600080600080600060a086880312156136f457600080fd5b85356136ff81613406565b9450602086013561370f81613406565b9350604086013561371f81613406565b9250606086013561372f81613406565b949793965091946080013592915050565b600080600080600060a0868803121561375857600080fd5b853561376381613406565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016137d8576137d86137b0565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561382857600080fd5b8151801515811461348e57600080fd5b60006020828403121561384a57600080fd5b5051919050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b808201808211156110bf576110bf6137b0565b818103818111156110bf576110bf6137b0565b60208082528181018390526000908460408401835b868110156138fc5782356138e181613406565b6001600160a01b0316825291830191908301906001016138ce565b509695505050505050565b80820281158282048414176110bf576110bf6137b0565b60008261393b57634e487b7160e01b600052601260045260246000fd5b500490565b600081518084526020808501945080840160005b838110156133e85781516001600160a01b031687529582019590820190600101613954565b60408152600061398c6040830186613940565b82810360208401528381526001600160fb1b038411156139ab57600080fd5b8360051b808660208401370160200195945050505050565b6020815260006110bc6020830184613940565b6060815260006139e96060830186613940565b82810360208401526139fb81866133b8565b90508281036040840152613a0f81856133b8565b969550505050505056fea2646970667358221220839f85d23f0ab1f03cccdeafa2f98f931424069923da73144e66990297f8743064736f6c63430008110033", + "numDeployments": 10, + "solcInputHash": "85b953b22882c536a643bf4b61b3153b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"ErrAdminOfAnyActivePoolForbidden\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"extraInfo\",\"type\":\"string\"}],\"name\":\"ErrCannotInitTransferRON\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCannotTransferRON\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"}],\"name\":\"ErrInactivePool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientDelegatingAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientStakingAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidArrays\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidPoolShare\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrOnlyPoolAdminAllowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrPoolAdminForbidden\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrStakingAmountLeft\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrThreeInteractionAddrsNotEqual\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrThreeOperationAddrsNotDistinct\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUndelegateTooEarly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUndelegateZeroAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnstakeTooEarly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnstakeZeroAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroValue\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minRate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxRate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateRangeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minSecs\",\"type\":\"uint256\"}],\"name\":\"CooldownSecsToUndelegateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"MinValidatorStakingAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"PoolApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"PoolSharesUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"validator\",\"type\":\"address[]\"}],\"name\":\"PoolsDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"}],\"name\":\"PoolsUpdateConflicted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"rewards\",\"type\":\"uint256[]\"}],\"name\":\"PoolsUpdateFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"aRps\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"shares\",\"type\":\"uint256[]\"}],\"name\":\"PoolsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingAmountDeductFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingAmountTransferFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Undelegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debited\",\"type\":\"uint256\"}],\"name\":\"UserRewardUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"secs\",\"type\":\"uint256\"}],\"name\":\"WaitingSecsToRevokeUpdated\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADDITION_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERIOD_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"applyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"bulkUndelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrList\",\"type\":\"address[]\"}],\"name\":\"claimRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownSecsToUndelegate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrList\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"_consensusAddrDst\",\"type\":\"address\"}],\"name\":\"delegateRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"execDeductStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_actualDeductingAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_pools\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_newPeriod\",\"type\":\"uint256\"}],\"name\":\"execDeprecatePools\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_rewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"execRecordRewards\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCommissionRateRange\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_pools\",\"type\":\"address[]\"}],\"name\":\"getManySelfStakings\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_selfStakings\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddrs\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_userList\",\"type\":\"address[]\"}],\"name\":\"getManyStakingAmounts\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_stakingAmounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolList\",\"type\":\"address[]\"}],\"name\":\"getManyStakingTotals\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_stakingAmounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAdminAddr\",\"type\":\"address\"}],\"name\":\"getPoolAddressOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"}],\"name\":\"getPoolDetail\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_stakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_stakingTotal\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_poolAddrList\",\"type\":\"address[]\"}],\"name\":\"getRewards\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_rewards\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"}],\"name\":\"getStakingTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__minValidatorStakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxCommissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__cooldownSecsToUndelegate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__waitingSecsToRevoke\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAdminAddr\",\"type\":\"address\"}],\"name\":\"isAdminOfActivePool\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minValidatorStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddrSrc\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddrDst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"redelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"requestEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"requestRenounce\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_effectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"requestUpdateCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxRate\",\"type\":\"uint256\"}],\"name\":\"setCommissionRateRange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_cooldownSecs\",\"type\":\"uint256\"}],\"name\":\"setCooldownSecsToUndelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_threshold\",\"type\":\"uint256\"}],\"name\":\"setMinValidatorStakingAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_secs\",\"type\":\"uint256\"}],\"name\":\"setWaitingSecsToRevoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"undelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"waitingSecsToRevoke\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrAdminOfAnyActivePoolForbidden(address)\":[{\"details\":\"Error of admin of any active pool cannot delegate.\"}],\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrCannotInitTransferRON(address,string)\":[{\"details\":\"Error of cannot transfer RON to specified target.\"}],\"ErrCannotTransferRON()\":[{\"details\":\"Error of cannot transfer RON.\"}],\"ErrInactivePool(address)\":[{\"details\":\"Error of querying inactive pool.\"}],\"ErrInsufficientBalance()\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrInsufficientDelegatingAmount()\":[{\"details\":\"Error of undelegating insufficient amount.\"}],\"ErrInsufficientStakingAmount()\":[{\"details\":\"Error of insufficient staking amount for unstaking.\"}],\"ErrInvalidArrays()\":[{\"details\":\"Error of length of input arrays are not of the same.\"}],\"ErrInvalidCommissionRate()\":[{\"details\":\"Error of setting commission rate exceeds max allowed.\"}],\"ErrInvalidPoolShare()\":[{\"details\":\"Error of invalid pool share.\"}],\"ErrOnlyPoolAdminAllowed()\":[{\"details\":\"Error of no one is allowed to call but the pool's admin.\"}],\"ErrPoolAdminForbidden()\":[{\"details\":\"Error of pool admin is not allowed to call.\"}],\"ErrRecipientRevert()\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrStakingAmountLeft()\":[{\"details\":\"Error of invalid staking amount left after deducted.\"}],\"ErrThreeInteractionAddrsNotEqual()\":[{\"details\":\"Error of three interaction addresses must be of the same in applying for validator candidate.\"}],\"ErrThreeOperationAddrsNotDistinct()\":[{\"details\":\"Error of three operation addresses must be distinct in applying for validator candidate.\"}],\"ErrUndelegateTooEarly()\":[{\"details\":\"Error of undelegating too early.\"}],\"ErrUndelegateZeroAmount()\":[{\"details\":\"Error of undelegating zero amount.\"}],\"ErrUnstakeTooEarly()\":[{\"details\":\"Error of unstaking too early.\"}],\"ErrUnstakeZeroAmount()\":[{\"details\":\"Error of unstaking zero amount.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}],\"ErrZeroValue()\":[{\"details\":\"Error of receiving zero message value.\"}]},\"kind\":\"dev\",\"methods\":{\"applyValidatorCandidate(address,address,address,address,uint256)\":{\"details\":\"Proposes a candidate to become a validator. Requirements: - The method caller is able to receive RON. - The treasury is able to receive RON. - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`. Emits the event `PoolApproved`.\",\"params\":{\"_candidateAdmin\":\"the candidate admin will be stored in the validator contract, used for calling function that affects to its candidate, e.g. scheduling maintenance.\"}},\"bulkUndelegate(address[],uint256[])\":{\"details\":\"Bulk unstakes from a list of candidates. Requirements: - The method caller is not the pool admin. Emits the events `Undelegated`.\"},\"claimRewards(address[])\":{\"details\":\"Claims the reward of method caller. Emits the `RewardClaimed` event.\"},\"cooldownSecsToUndelegate()\":{\"details\":\"Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\"},\"delegate(address)\":{\"details\":\"Stakes for a validator candidate `_consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is not the pool admin. Emits the `Delegated` event.\"},\"delegateRewards(address[],address)\":{\"details\":\"Claims the rewards and delegates them to the consensus address. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `RewardClaimed` event and the `Delegated` event.\"},\"execDeductStakingAmount(address,uint256)\":{\"details\":\"Deducts from staking amount of the validator `_consensusAddr` for `_amount`. Requirements: - The method caller must be validator contract. Emits the event `Unstaked`.\"},\"execDeprecatePools(address[],uint256)\":{\"details\":\"Deprecates the pool. - Deduct self-staking amount of the pool admin to zero. - Transfer the deducted amount to the pool admin. - Deactivate the pool admin address in the mapping of active pool admins Requirements: - The method caller is validator contract. Emits the event `PoolsDeprecated` and `Unstaked` events. Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\"},\"execRecordRewards(address[],uint256[],uint256)\":{\"details\":\"Records the amount of rewards `_rewards` for the pools `_consensusAddrs`. Requirements: - The method caller must be validator contract. Emits the event `PoolsUpdated` once the contract recorded the rewards successfully. Emits the event `PoolsUpdateFailed` once the input array lengths are not equal. Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period. Note: This method should be called once at the period ending.\"},\"getCommissionRateRange()\":{\"details\":\"Returns the commission rate range that the candidate can set.\"},\"getManySelfStakings(address[])\":{\"details\":\"Returns the self-staking amounts of the pools.\"},\"getManyStakingAmounts(address[],address[])\":{\"details\":\"Returns the staking amounts of the users.\"},\"getManyStakingTotals(address[])\":{\"details\":\"Returns the total staking amounts of all users for the pools `_poolAddrs`.\"},\"getPoolAddressOf(address)\":{\"details\":\"Returns the consensus address corresponding to the pool admin.\"},\"getPoolDetail(address)\":{\"details\":\"Returns the staking pool detail.\"},\"getReward(address,address)\":{\"details\":\"Returns the reward amount that user claimable.\"},\"getRewards(address,address[])\":{\"details\":\"Returns the claimable reward of the user `_user`.\"},\"getStakingAmount(address,address)\":{\"details\":\"Returns the staking amount of an user.\"},\"getStakingTotal(address)\":{\"details\":\"Returns the total staking amount of all users for a pool.\"},\"initialize(address,uint256,uint256,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"isAdminOfActivePool(address)\":{\"details\":\"Returns whether the `_poolAdminAddr` is currently active.\"},\"minValidatorStakingAmount()\":{\"details\":\"Returns the minimum threshold for being a validator candidate.\"},\"redelegate(address,address,uint256)\":{\"details\":\"Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `Undelegated` event and the `Delegated` event.\"},\"requestEmergencyExit(address)\":{\"details\":\"Renounces being a validator candidate and takes back the delegating/staking amount. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin.\"},\"requestRenounce(address)\":{\"details\":\"Renounces being a validator candidate and takes back the delegating/staking amount. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin.\"},\"requestUpdateCommissionRate(address,uint256,uint256)\":{\"details\":\"Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}. - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdated`.\"},\"setCommissionRateRange(uint256,uint256)\":{\"details\":\"Sets the commission rate range that a candidate can set. Requirements: - The method caller is admin. Emits the `CommissionRateRangeUpdated` event.\"},\"setCooldownSecsToUndelegate(uint256)\":{\"details\":\"Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated. Requirements: - The method caller is admin. Emits the event `CooldownSecsToUndelegateUpdated`.\"},\"setMinValidatorStakingAmount(uint256)\":{\"details\":\"Sets the minimum threshold for being a validator candidate. Requirements: - The method caller is admin. Emits the `MinValidatorStakingAmountUpdated` event.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"setWaitingSecsToRevoke(uint256)\":{\"details\":\"Sets the number of seconds that a candidate must wait to be revoked. Requirements: - The method caller is admin. Emits the event `WaitingSecsToRevokeUpdated`.\"},\"stake(address)\":{\"details\":\"Self-delegates to the validator candidate `_consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `msg.value` is larger than 0. Emits the event `Staked`.\"},\"undelegate(address,uint256)\":{\"details\":\"Unstakes from a validator candidate `_consensusAddr` for `_amount`. Requirements: - The method caller is not the pool admin. Emits the `Undelegated` event.\"},\"unstake(address,uint256)\":{\"details\":\"Unstakes from the validator candidate `_consensusAddr` for `_amount`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. Emits the event `Unstaked`.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"},\"waitingSecsToRevoke()\":{\"details\":\"Returns the number of seconds that a candidate must wait for the renounce request gets affected.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/staking/Staking.sol\":\"Staking\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x0e9621f60b2faabe65549f7ed0f24e8853a45c1b7990d47e8160e523683f3935\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/RONTransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract RONTransferHelper {\\n /// @dev Error of recipient not accepting RON when transfer RON.\\n error ErrRecipientRevert();\\n /// @dev Error of sender has insufficient balance.\\n error ErrInsufficientBalance();\\n\\n /**\\n * @dev See `_sendRON`.\\n * Reverts if the recipient does not receive RON.\\n */\\n function _transferRON(address payable _recipient, uint256 _amount) internal {\\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\\n }\\n\\n /**\\n * @dev Send `_amount` RON to the address `_recipient`.\\n * Returns whether the recipient receives RON or not.\\n * Reverts once the contract balance is insufficient.\\n *\\n * Note: consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\\n return _unsafeSendRON(_recipient, _amount);\\n }\\n\\n /**\\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\\n * the call does not revert.\\n *\\n * Note:\\n * - Does not assert whether the balance of sender is sufficient.\\n * - Does not assert whether the recipient accepts RON.\\n * - Consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount }(\\\"\\\");\\n }\\n\\n /**\\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\\n */\\n function _unsafeSendRON(\\n address payable _recipient,\\n uint256 _amount,\\n uint256 _gas\\n ) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbf47d40b2431cf190fa737b803e4cb6fb55aee3f8804470da57a9e340f7914f8\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/extensions/consumers/GlobalConfigConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract GlobalConfigConsumer {\\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\\n /// @dev The length of a period in second.\\n uint256 public constant PERIOD_DURATION = 1 days;\\n}\\n\",\"keccak256\":\"0x96d6b1ea4c8e126a8c2468683e7513d195f8e05456d85dd8f259ab049347b527\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface PeriodWrapperConsumer {\\n struct PeriodWrapper {\\n // Inner value.\\n uint256 inner;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n}\\n\",\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseStaking {\\n struct PoolDetail {\\n // Address of the pool i.e. consensus address of the validator\\n address addr;\\n // Pool admin address\\n address admin;\\n // Self-staking amount\\n uint256 stakingAmount;\\n // Total number of RON staking for the pool\\n uint256 stakingTotal;\\n // Mapping from delegator => delegating amount\\n mapping(address => uint256) delegatingAmount;\\n // Mapping from delegator => the last timestamp that delegator staked\\n mapping(address => uint256) lastDelegatingTimestamp;\\n }\\n\\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\\n event WaitingSecsToRevokeUpdated(uint256 secs);\\n\\n /// @dev Error of cannot transfer RON.\\n error ErrCannotTransferRON();\\n /// @dev Error of receiving zero message value.\\n error ErrZeroValue();\\n /// @dev Error of pool admin is not allowed to call.\\n error ErrPoolAdminForbidden();\\n /// @dev Error of no one is allowed to call but the pool's admin.\\n error ErrOnlyPoolAdminAllowed();\\n /// @dev Error of admin of any active pool cannot delegate.\\n error ErrAdminOfAnyActivePoolForbidden(address admin);\\n /// @dev Error of querying inactive pool.\\n error ErrInactivePool(address poolAddr);\\n /// @dev Error of length of input arrays are not of the same.\\n error ErrInvalidArrays();\\n\\n /**\\n * @dev Returns whether the `_poolAdminAddr` is currently active.\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the consensus address corresponding to the pool admin.\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\\n\\n /**\\n * @dev Returns the staking pool detail.\\n */\\n function getPoolDetail(address)\\n external\\n view\\n returns (\\n address _admin,\\n uint256 _stakingAmount,\\n uint256 _stakingTotal\\n );\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\\n */\\n function waitingSecsToRevoke() external view returns (uint256);\\n\\n /**\\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external;\\n}\\n\",\"keccak256\":\"0x008b3d42a3104820de7b7edb5ea4b21c75d4417767fc0791f89f00ac9a2cce8d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface ICandidateStaking is IRewardPool {\\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\\n event MinValidatorStakingAmountUpdated(uint256 threshold);\\n /// @dev Emitted when the commission rate range is updated.\\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\\n\\n /// @dev Emitted when the pool admin staked for themself.\\n event Staked(address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\\n event Unstaked(address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Emitted when the validator pool is approved.\\n event PoolApproved(address indexed validator, address indexed admin);\\n /// @dev Emitted when the validator pool is deprecated.\\n event PoolsDeprecated(address[] validator);\\n /// @dev Emitted when the staking amount transfer failed.\\n event StakingAmountTransferFailed(\\n address indexed validator,\\n address indexed admin,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\\n event StakingAmountDeductFailed(\\n address indexed validator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Error of cannot transfer RON to specified target.\\n error ErrCannotInitTransferRON(address addr, string extraInfo);\\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\\n error ErrThreeInteractionAddrsNotEqual();\\n /// @dev Error of three operation addresses must be distinct in applying for validator candidate.\\n error ErrThreeOperationAddrsNotDistinct();\\n /// @dev Error of unstaking zero amount.\\n error ErrUnstakeZeroAmount();\\n /// @dev Error of invalid staking amount left after deducted.\\n error ErrStakingAmountLeft();\\n /// @dev Error of insufficient staking amount for unstaking.\\n error ErrInsufficientStakingAmount();\\n /// @dev Error of unstaking too early.\\n error ErrUnstakeTooEarly();\\n /// @dev Error of setting commission rate exceeds max allowed.\\n error ErrInvalidCommissionRate();\\n\\n /**\\n * @dev Returns the minimum threshold for being a validator candidate.\\n */\\n function minValidatorStakingAmount() external view returns (uint256);\\n\\n /**\\n * @dev Returns the commission rate range that the candidate can set.\\n */\\n function getCommissionRateRange() external view returns (uint256 _minRange, uint256 _maxRange);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function setMinValidatorStakingAmount(uint256) external;\\n\\n /**\\n * @dev Sets the commission rate range that a candidate can set.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `CommissionRateRangeUpdated` event.\\n *\\n */\\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external;\\n\\n /**\\n * @dev Proposes a candidate to become a validator.\\n *\\n * Requirements:\\n * - The method caller is able to receive RON.\\n * - The treasury is able to receive RON.\\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\\n *\\n * Emits the event `PoolApproved`.\\n *\\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\\n * to its candidate, e.g. scheduling maintenance.\\n *\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external payable;\\n\\n /**\\n * @dev Deprecates the pool.\\n * - Deduct self-staking amount of the pool admin to zero.\\n * - Transfer the deducted amount to the pool admin.\\n * - Deactivate the pool admin address in the mapping of active pool admins\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\\n *\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\\n\\n /**\\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `msg.value` is larger than 0.\\n *\\n * Emits the event `Staked`.\\n *\\n */\\n function stake(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function unstake(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdated`.\\n *\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestRenounce(address _consensusAddr) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestEmergencyExit(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x5681cd641c0014aa2cc0ae336e110ebd9a5b28419ae387acd720683ba54ca89f\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface IDelegatorStaking is IRewardPool {\\n /// @dev Emitted when the delegator staked for a validator candidate.\\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the delegator unstaked from a validator candidate.\\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Error of undelegating zero amount.\\n error ErrUndelegateZeroAmount();\\n /// @dev Error of undelegating insufficient amount.\\n error ErrInsufficientDelegatingAmount();\\n /// @dev Error of undelegating too early.\\n error ErrUndelegateTooEarly();\\n\\n /**\\n * @dev Stakes for a validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n */\\n function delegate(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Undelegated` event.\\n *\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Bulk unstakes from a list of candidates.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the events `Undelegated`.\\n *\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\\n\\n /**\\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `Undelegated` event and the `Delegated` event.\\n *\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external;\\n\\n /**\\n * @dev Returns the claimable reward of the user `_user`.\\n */\\n function getRewards(address _user, address[] calldata _poolAddrList)\\n external\\n view\\n returns (uint256[] memory _rewards);\\n\\n /**\\n * @dev Claims the reward of method caller.\\n *\\n * Emits the `RewardClaimed` event.\\n *\\n */\\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `RewardClaimed` event and the `Delegated` event.\\n *\\n */\\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\\n external\\n returns (uint256 _amount);\\n}\\n\",\"keccak256\":\"0x5ce840a920ed06139f9e33d306c8ee50b2a81e4bd2ac6ed24b47297c348576b8\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IRewardPool.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/consumers/PeriodWrapperConsumer.sol\\\";\\n\\ninterface IRewardPool is PeriodWrapperConsumer {\\n struct UserRewardFields {\\n // Recorded reward amount.\\n uint256 debited;\\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\\n uint256 aRps;\\n // Lowest staking amount in the period.\\n uint256 lowestAmount;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n\\n struct PoolFields {\\n // Accumulated of the amount rewards per share (one unit staking).\\n uint256 aRps;\\n // The staking total to share reward of the current period.\\n PeriodWrapper shares;\\n }\\n\\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\\n /// @dev Emitted when the user claimed their reward\\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\\n\\n /// @dev Emitted when the pool shares are updated\\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\\n /// @dev Emitted when the pools are updated\\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\\n /// @dev Emitted when the contract fails when updating the pools\\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\\n /// @dev Emitted when the contract fails when updating the pools that already set\\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\\n\\n /// @dev Error of invalid pool share.\\n error ErrInvalidPoolShare();\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amount of an user.\\n */\\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amounts of the users.\\n */\\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total staking amount of all users for a pool.\\n */\\n function getStakingTotal(address _poolAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\\n */\\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\\n}\\n\",\"keccak256\":\"0x92315ca9d6d93f55a7752adf2567adb86745f708198bfcd74b9a626b6570208f\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseStaking.sol\\\";\\nimport \\\"./ICandidateStaking.sol\\\";\\nimport \\\"./IDelegatorStaking.sol\\\";\\n\\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable;\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\\n external\\n returns (uint256 _actualDeductingAmount);\\n}\\n\",\"keccak256\":\"0xb7942c5032c16ea567ac0bfc07ecacd84840d6de134735ea538aa22fc6da05a5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool) {\\n bytes32 _thisHash;\\n bytes32 _otherHash;\\n\\n assembly {\\n _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n }\\n\\n return _thisHash == _otherHash;\\n }\\n}\\n\",\"keccak256\":\"0xea4ac2b0783926a0e6ae257bc069fa37ea864ce77bfb25dd327d4727a38ad0ea\",\"license\":\"UNLICENSED\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xf719e74bc39be7aceb4e5cc455260f81b2b21e83aa693e0b50c390c9909e08c4\",\"license\":\"UNLICENSED\"},\"contracts/ronin/staking/BaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/staking/IBaseStaking.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"./RewardCalculation.sol\\\";\\n\\nabstract contract BaseStaking is\\n RONTransferHelper,\\n ReentrancyGuard,\\n RewardCalculation,\\n HasValidatorContract,\\n IBaseStaking\\n{\\n /// @dev Mapping from pool address => staking pool detail\\n mapping(address => PoolDetail) internal _stakingPool;\\n\\n /// @dev The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n uint256 internal _cooldownSecsToUndelegate;\\n /// @dev The number of seconds that a candidate must wait to be revoked and take the self-staking amount back.\\n uint256 internal _waitingSecsToRevoke;\\n\\n /// @dev Mapping from admin address of an active pool => consensus address.\\n mapping(address => address) internal _adminOfActivePoolMapping;\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] private ______gap;\\n\\n modifier noEmptyValue() {\\n if (msg.value == 0) revert ErrZeroValue();\\n _;\\n }\\n\\n modifier notPoolAdmin(PoolDetail storage _pool, address _delegator) {\\n if (_pool.admin == _delegator) revert ErrPoolAdminForbidden();\\n _;\\n }\\n\\n modifier onlyPoolAdmin(PoolDetail storage _pool, address _requester) {\\n if (_pool.admin != _requester) revert ErrOnlyPoolAdminAllowed();\\n _;\\n }\\n\\n modifier poolIsActive(address _poolAddr) {\\n if (!_validatorContract.isValidatorCandidate(_poolAddr)) revert ErrInactivePool(_poolAddr);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) public view override returns (bool) {\\n return _adminOfActivePoolMapping[_poolAdminAddr] != address(0);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view override returns (address) {\\n return _adminOfActivePoolMapping[_poolAdminAddr];\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getPoolDetail(address _poolAddr)\\n external\\n view\\n returns (\\n address _admin,\\n uint256 _stakingAmount,\\n uint256 _stakingTotal\\n )\\n {\\n PoolDetail storage _pool = _stakingPool[_poolAddr];\\n return (_pool.admin, _pool.stakingAmount, _pool.stakingTotal);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getManySelfStakings(address[] calldata _pools) external view returns (uint256[] memory _selfStakings) {\\n _selfStakings = new uint256[](_pools.length);\\n for (uint _i = 0; _i < _pools.length; _i++) {\\n _selfStakings[_i] = _stakingPool[_pools[_i]].stakingAmount;\\n }\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingTotal(address _poolAddr) public view override returns (uint256) {\\n return _stakingPool[_poolAddr].stakingTotal;\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingTotals(address[] calldata _poolList)\\n public\\n view\\n override\\n returns (uint256[] memory _stakingAmounts)\\n {\\n _stakingAmounts = new uint256[](_poolList.length);\\n for (uint _i = 0; _i < _poolList.length; _i++) {\\n _stakingAmounts[_i] = getStakingTotal(_poolList[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingAmount(address _poolAddr, address _user) public view override returns (uint256) {\\n return _stakingPool[_poolAddr].delegatingAmount[_user];\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\\n external\\n view\\n override\\n returns (uint256[] memory _stakingAmounts)\\n {\\n if (_poolAddrs.length != _userList.length) revert ErrInvalidArrays();\\n _stakingAmounts = new uint256[](_poolAddrs.length);\\n for (uint _i = 0; _i < _stakingAmounts.length; _i++) {\\n _stakingAmounts[_i] = _stakingPool[_poolAddrs[_i]].delegatingAmount[_userList[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256) {\\n return _cooldownSecsToUndelegate;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function waitingSecsToRevoke() external view returns (uint256) {\\n return _waitingSecsToRevoke;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external override onlyAdmin {\\n _setCooldownSecsToUndelegate(_cooldownSecs);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external override onlyAdmin {\\n _setWaitingSecsToRevoke(_secs);\\n }\\n\\n /**\\n * @dev Sets the minium number of seconds to undelegate.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function _setCooldownSecsToUndelegate(uint256 _cooldownSecs) internal {\\n _cooldownSecsToUndelegate = _cooldownSecs;\\n emit CooldownSecsToUndelegateUpdated(_cooldownSecs);\\n }\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function _setWaitingSecsToRevoke(uint256 _secs) internal {\\n _waitingSecsToRevoke = _secs;\\n emit WaitingSecsToRevokeUpdated(_secs);\\n }\\n\\n /**\\n * @dev Changes the delegate amount.\\n */\\n function _changeDelegatingAmount(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _newDelegatingAmount,\\n uint256 _newStakingTotal\\n ) internal {\\n _syncUserReward(_pool.addr, _delegator, _newDelegatingAmount);\\n _pool.stakingTotal = _newStakingTotal;\\n _pool.delegatingAmount[_delegator] = _newDelegatingAmount;\\n }\\n}\\n\",\"keccak256\":\"0xdf7889af5ad6b206a2d4eceb8947fcc26f90b7c8411806ec76eb19bc3363afd0\",\"license\":\"MIT\"},\"contracts/ronin/staking/CandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/consumers/GlobalConfigConsumer.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../libraries/AddressArrayUtils.sol\\\";\\nimport \\\"../../interfaces/staking/ICandidateStaking.sol\\\";\\nimport \\\"./BaseStaking.sol\\\";\\n\\nabstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConfigConsumer, PercentageConsumer {\\n /// @dev The minimum threshold for being a validator candidate.\\n uint256 internal _minValidatorStakingAmount;\\n\\n /// @dev The max commission rate that the validator can set (in range of [0;100_00] means [0-100%])\\n uint256 internal _maxCommissionRate;\\n /// @dev The min commission rate that the validator can set (in range of [0;100_00] means [0-100%])\\n uint256 internal _minCommissionRate;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] ______gap;\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function minValidatorStakingAmount() public view override returns (uint256) {\\n return _minValidatorStakingAmount;\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function getCommissionRateRange() external view override returns (uint256, uint256) {\\n return (_minCommissionRate, _maxCommissionRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function setMinValidatorStakingAmount(uint256 _threshold) external override onlyAdmin {\\n _setMinValidatorStakingAmount(_threshold);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external override onlyAdmin {\\n _setCommissionRateRange(_minRate, _maxRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external payable override nonReentrant {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\\n\\n uint256 _amount = msg.value;\\n address payable _poolAdmin = payable(msg.sender);\\n _applyValidatorCandidate(\\n _poolAdmin,\\n _candidateAdmin,\\n _consensusAddr,\\n _treasuryAddr,\\n _bridgeOperatorAddr,\\n _commissionRate,\\n _amount\\n );\\n\\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\\n _pool.admin = _poolAdmin;\\n _pool.addr = _consensusAddr;\\n _adminOfActivePoolMapping[_poolAdmin] = _consensusAddr;\\n\\n _stake(_stakingPool[_consensusAddr], _poolAdmin, _amount);\\n emit PoolApproved(_consensusAddr, _poolAdmin);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) {\\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\\n _validatorContract.execRequestUpdateCommissionRate(_consensusAddr, _effectiveDaysOnwards, _commissionRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _newPeriod) external override onlyValidatorContract {\\n if (_pools.length == 0) {\\n return;\\n }\\n\\n for (uint _i = 0; _i < _pools.length; _i++) {\\n PoolDetail storage _pool = _stakingPool[_pools[_i]];\\n // Deactivate the pool admin in the active mapping.\\n delete _adminOfActivePoolMapping[_pool.admin];\\n\\n // Deduct and transfer the self staking amount to the pool admin.\\n uint256 _deductingAmount = _pool.stakingAmount;\\n if (_deductingAmount > 0) {\\n _deductStakingAmount(_pool, _deductingAmount);\\n if (!_unsafeSendRON(payable(_pool.admin), _deductingAmount, DEFAULT_ADDITION_GAS)) {\\n emit StakingAmountTransferFailed(_pool.addr, _pool.admin, _deductingAmount, address(this).balance);\\n }\\n }\\n\\n // Settle the unclaimed reward and transfer to the pool admin.\\n uint256 _lastRewardAmount = _claimReward(_pools[_i], _pool.admin, _newPeriod);\\n if (_lastRewardAmount > 0) {\\n _unsafeSendRON(payable(_pool.admin), _lastRewardAmount, DEFAULT_ADDITION_GAS);\\n }\\n }\\n\\n emit PoolsDeprecated(_pools);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function stake(address _consensusAddr) external payable override noEmptyValue poolIsActive(_consensusAddr) {\\n _stake(_stakingPool[_consensusAddr], msg.sender, msg.value);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function unstake(address _consensusAddr, uint256 _amount)\\n external\\n override\\n nonReentrant\\n poolIsActive(_consensusAddr)\\n {\\n if (_amount == 0) revert ErrUnstakeZeroAmount();\\n address _requester = msg.sender;\\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\\n uint256 _remainAmount = _pool.stakingAmount - _amount;\\n if (_remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft();\\n\\n _unstake(_pool, _requester, _amount);\\n if (!_unsafeSendRON(payable(_requester), _amount, DEFAULT_ADDITION_GAS)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestRenounce(address _consensusAddr)\\n external\\n override\\n poolIsActive(_consensusAddr)\\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\\n {\\n _validatorContract.execRequestRenounceCandidate(_consensusAddr, _waitingSecsToRevoke);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestEmergencyExit(address _consensusAddr)\\n external\\n override\\n poolIsActive(_consensusAddr)\\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\\n {\\n _validatorContract.execEmergencyExit(_consensusAddr, _waitingSecsToRevoke);\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-applyValidatorCandidate`\\n */\\n function _applyValidatorCandidate(\\n address payable _poolAdmin,\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate,\\n uint256 _amount\\n ) internal {\\n if (!_unsafeSendRON(_poolAdmin, 0)) revert ErrCannotInitTransferRON(_poolAdmin, \\\"pool admin\\\");\\n if (!_unsafeSendRON(_treasuryAddr, 0)) revert ErrCannotInitTransferRON(_treasuryAddr, \\\"treasury\\\");\\n if (_amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount();\\n if (_poolAdmin != _candidateAdmin || _candidateAdmin != _treasuryAddr) revert ErrThreeInteractionAddrsNotEqual();\\n\\n address[] memory _diffAddrs = new address[](3);\\n _diffAddrs[0] = _poolAdmin;\\n _diffAddrs[1] = _consensusAddr;\\n _diffAddrs[2] = _bridgeOperatorAddr;\\n if (AddressArrayUtils.hasDuplicate(_diffAddrs)) revert ErrThreeOperationAddrsNotDistinct();\\n\\n _validatorContract.execApplyValidatorCandidate(\\n _candidateAdmin,\\n _consensusAddr,\\n _treasuryAddr,\\n _bridgeOperatorAddr,\\n _commissionRate\\n );\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-stake`\\n */\\n function _stake(\\n PoolDetail storage _pool,\\n address _requester,\\n uint256 _amount\\n ) internal onlyPoolAdmin(_pool, _requester) {\\n _pool.stakingAmount += _amount;\\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal + _amount);\\n _pool.lastDelegatingTimestamp[_requester] = block.timestamp;\\n emit Staked(_pool.addr, _amount);\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-unstake`\\n */\\n function _unstake(\\n PoolDetail storage _pool,\\n address _requester,\\n uint256 _amount\\n ) internal onlyPoolAdmin(_pool, _requester) {\\n if (_amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount();\\n if (_pool.lastDelegatingTimestamp[_requester] + _cooldownSecsToUndelegate > block.timestamp) {\\n revert ErrUnstakeTooEarly();\\n }\\n\\n _pool.stakingAmount -= _amount;\\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal - _amount);\\n emit Unstaked(_pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Emits the event `Unstaked`.\\n *\\n * @return The actual deducted amount\\n */\\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount) internal virtual returns (uint256);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function _setMinValidatorStakingAmount(uint256 _threshold) internal {\\n _minValidatorStakingAmount = _threshold;\\n emit MinValidatorStakingAmountUpdated(_threshold);\\n }\\n\\n /**\\n * @dev Sets the max commission rate that a candidate can set.\\n *\\n * Emits the `MaxCommissionRateUpdated` event.\\n *\\n */\\n function _setCommissionRateRange(uint256 _minRate, uint256 _maxRate) internal {\\n if (_maxRate > _MAX_PERCENTAGE || _minRate > _maxRate) revert ErrInvalidCommissionRate();\\n _maxCommissionRate = _maxRate;\\n _minCommissionRate = _minRate;\\n emit CommissionRateRangeUpdated(_minRate, _maxRate);\\n }\\n}\\n\",\"keccak256\":\"0x324360faf9e3da3b7a83824c8d0e383da16902965abbee3cb7bf8a7e398dffac\",\"license\":\"MIT\"},\"contracts/ronin/staking/DelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/staking/IDelegatorStaking.sol\\\";\\nimport \\\"./BaseStaking.sol\\\";\\n\\nabstract contract DelegatorStaking is BaseStaking, IDelegatorStaking {\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function delegate(address _consensusAddr) external payable noEmptyValue poolIsActive(_consensusAddr) {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n _delegate(_stakingPool[_consensusAddr], msg.sender, msg.value);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external nonReentrant {\\n address payable _delegator = payable(msg.sender);\\n _undelegate(_stakingPool[_consensusAddr], _delegator, _amount);\\n if (!_sendRON(_delegator, _amount)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external nonReentrant {\\n if (_consensusAddrs.length == 0 || _consensusAddrs.length != _amounts.length) revert ErrInvalidArrays();\\n\\n address payable _delegator = payable(msg.sender);\\n uint256 _total;\\n\\n for (uint _i = 0; _i < _consensusAddrs.length; _i++) {\\n _total += _amounts[_i];\\n _undelegate(_stakingPool[_consensusAddrs[_i]], _delegator, _amounts[_i]);\\n }\\n\\n if (!_sendRON(_delegator, _total)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external nonReentrant poolIsActive(_consensusAddrDst) {\\n address _delegator = msg.sender;\\n _undelegate(_stakingPool[_consensusAddrSrc], _delegator, _amount);\\n _delegate(_stakingPool[_consensusAddrDst], _delegator, _amount);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function claimRewards(address[] calldata _consensusAddrList)\\n external\\n override\\n nonReentrant\\n returns (uint256 _amount)\\n {\\n _amount = _claimRewards(msg.sender, _consensusAddrList);\\n _transferRON(payable(msg.sender), _amount);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\\n external\\n override\\n nonReentrant\\n poolIsActive(_consensusAddrDst)\\n returns (uint256 _amount)\\n {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n return _delegateRewards(msg.sender, _consensusAddrList, _consensusAddrDst);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function getRewards(address _user, address[] calldata _poolAddrList)\\n external\\n view\\n returns (uint256[] memory _rewards)\\n {\\n address _consensusAddr;\\n uint256 _period = _validatorContract.currentPeriod();\\n _rewards = new uint256[](_poolAddrList.length);\\n\\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\\n _consensusAddr = _poolAddrList[_i];\\n _rewards[_i] = _getReward(_consensusAddr, _user, _period, getStakingAmount(_consensusAddr, _user));\\n }\\n }\\n\\n /**\\n * @dev Delegates from a validator address.\\n *\\n * Requirements:\\n * - The delegator is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n * Note: This function does not verify the `msg.value` with the amount.\\n *\\n */\\n function _delegate(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _amount\\n ) internal notPoolAdmin(_pool, _delegator) {\\n _changeDelegatingAmount(\\n _pool,\\n _delegator,\\n _pool.delegatingAmount[_delegator] + _amount,\\n _pool.stakingTotal + _amount\\n );\\n _pool.lastDelegatingTimestamp[_delegator] = block.timestamp;\\n emit Delegated(_delegator, _pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Undelegates from a validator address.\\n *\\n * Requirements:\\n * - The delegator is not the pool admin.\\n * - The amount is larger than 0.\\n * - The delegating amount is larger than or equal to the undelegating amount.\\n *\\n * Emits the `Undelegated` event.\\n *\\n * Note: Consider transferring back the amount of RON after calling this function.\\n *\\n */\\n function _undelegate(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _amount\\n ) private notPoolAdmin(_pool, _delegator) {\\n if (_amount == 0) revert ErrUndelegateZeroAmount();\\n if (_pool.delegatingAmount[_delegator] < _amount) revert ErrInsufficientDelegatingAmount();\\n\\n if (\\n _validatorContract.isValidatorCandidate(_pool.addr) &&\\n _validatorContract.getCandidateInfo(_pool.addr).revokingTimestamp == 0 && // if candidate is not on renunciation\\n _pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp // delegator is still in cooldown\\n ) revert ErrUndelegateTooEarly();\\n\\n _changeDelegatingAmount(\\n _pool,\\n _delegator,\\n _pool.delegatingAmount[_delegator] - _amount,\\n _pool.stakingTotal - _amount\\n );\\n emit Undelegated(_delegator, _pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Claims rewards from the pools `_poolAddrList`.\\n * Note: This function does not transfer reward to user.\\n */\\n function _claimRewards(address _user, address[] memory _poolAddrList) internal returns (uint256 _amount) {\\n uint256 _period = _currentPeriod();\\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\\n _amount += _claimReward(_poolAddrList[_i], _user, _period);\\n }\\n }\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n */\\n function _delegateRewards(\\n address _user,\\n address[] calldata _poolAddrList,\\n address _poolAddrDst\\n ) internal returns (uint256 _amount) {\\n _amount = _claimRewards(_user, _poolAddrList);\\n _delegate(_stakingPool[_poolAddrDst], _user, _amount);\\n }\\n}\\n\",\"keccak256\":\"0xbc60590d1ae7fab32f9fddee11cb4a2b39f53d059fb4682d19ead9341f1f7f14\",\"license\":\"MIT\"},\"contracts/ronin/staking/RewardCalculation.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/staking/IRewardPool.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\n\\n/**\\n * @title RewardCalculation contract\\n * @dev This contract mainly contains the methods to calculate reward for staking contract.\\n */\\nabstract contract RewardCalculation is IRewardPool {\\n /// @dev Mapping from pool address => period number => accumulated rewards per share (one unit staking)\\n mapping(address => mapping(uint256 => PeriodWrapper)) private _accumulatedRps;\\n /// @dev Mapping from the pool address => user address => the reward info of the user\\n mapping(address => mapping(address => UserRewardFields)) private _userReward;\\n /// @dev Mapping from the pool address => reward pool fields\\n mapping(address => PoolFields) private _stakingPool;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256) {\\n return _getReward(_poolAddr, _user, _currentPeriod(), getStakingAmount(_poolAddr, _user));\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingAmount(address _poolAddr, address _user) public view virtual returns (uint256);\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingTotal(address _poolAddr) public view virtual returns (uint256);\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function _getReward(\\n address _poolAddr,\\n address _user,\\n uint256 _latestPeriod,\\n uint256 _latestStakingAmount\\n ) internal view returns (uint256) {\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n\\n if (_reward.lastPeriod == _latestPeriod) {\\n return _reward.debited;\\n }\\n\\n uint256 _aRps;\\n uint256 _lastPeriodReward;\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n PeriodWrapper storage _wrappedArps = _accumulatedRps[_poolAddr][_reward.lastPeriod];\\n\\n if (_wrappedArps.lastPeriod > 0) {\\n // Calculates the last period reward if the aRps at the period is set\\n _aRps = _wrappedArps.inner;\\n _lastPeriodReward = _reward.lowestAmount * (_aRps - _reward.aRps);\\n } else {\\n // Fallbacks to the previous aRps in case the aRps is not set\\n _aRps = _reward.aRps;\\n }\\n\\n uint256 _newPeriodsReward = _latestStakingAmount * (_pool.aRps - _aRps);\\n return _reward.debited + (_lastPeriodReward + _newPeriodsReward) / 1e18;\\n }\\n\\n /**\\n * @dev Syncs the user reward.\\n *\\n * Emits the event `UserRewardUpdated` once the debit amount is updated.\\n * Emits the event `PoolSharesUpdated` once the pool share is updated.\\n *\\n * Note: The method should be called whenever the user's staking amount changes.\\n *\\n */\\n function _syncUserReward(\\n address _poolAddr,\\n address _user,\\n uint256 _newStakingAmount\\n ) internal {\\n uint256 _period = _currentPeriod();\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n uint256 _lastShares = _pool.shares.inner;\\n\\n // Updates the pool shares if it is outdated\\n if (_pool.shares.lastPeriod < _period) {\\n _pool.shares = PeriodWrapper(getStakingTotal(_poolAddr), _period);\\n }\\n\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\\n uint256 _debited = _getReward(_poolAddr, _user, _period, _currentStakingAmount);\\n\\n if (_reward.debited != _debited) {\\n _reward.debited = _debited;\\n emit UserRewardUpdated(_poolAddr, _user, _debited);\\n }\\n\\n _syncMinStakingAmount(_pool, _reward, _period, _newStakingAmount, _currentStakingAmount);\\n _reward.aRps = _pool.aRps;\\n _reward.lastPeriod = _period;\\n\\n if (_pool.shares.inner != _lastShares) {\\n emit PoolSharesUpdated(_period, _poolAddr, _pool.shares.inner);\\n }\\n }\\n\\n /**\\n * @dev Syncs the minimum staking amount of an user in the current period.\\n */\\n function _syncMinStakingAmount(\\n PoolFields storage _pool,\\n UserRewardFields storage _reward,\\n uint256 _latestPeriod,\\n uint256 _newStakingAmount,\\n uint256 _currentStakingAmount\\n ) internal {\\n if (_reward.lastPeriod < _latestPeriod) {\\n _reward.lowestAmount = _currentStakingAmount;\\n }\\n\\n uint256 _lowestAmount = Math.min(_reward.lowestAmount, _newStakingAmount);\\n uint256 _diffAmount = _reward.lowestAmount - _lowestAmount;\\n if (_diffAmount > 0) {\\n _reward.lowestAmount = _lowestAmount;\\n if (_pool.shares.inner < _diffAmount) revert ErrInvalidPoolShare();\\n _pool.shares.inner -= _diffAmount;\\n }\\n }\\n\\n /**\\n * @dev Claims the settled reward for a specific user.\\n *\\n * @param _lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or\\n * `_currentPeriod + 1` in case of calculating the reward for revoked validators.\\n *\\n * Emits the `RewardClaimed` event and the `UserRewardUpdated` event.\\n *\\n * Note: This method should be called before transferring rewards for the user.\\n *\\n */\\n function _claimReward(\\n address _poolAddr,\\n address _user,\\n uint256 _lastPeriod\\n ) internal returns (uint256 _amount) {\\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\\n _amount = _getReward(_poolAddr, _user, _lastPeriod, _currentStakingAmount);\\n emit RewardClaimed(_poolAddr, _user, _amount);\\n\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n _reward.debited = 0;\\n _syncMinStakingAmount(_stakingPool[_poolAddr], _reward, _lastPeriod, _currentStakingAmount, _currentStakingAmount);\\n _reward.lastPeriod = _lastPeriod;\\n _reward.aRps = _stakingPool[_poolAddr].aRps;\\n emit UserRewardUpdated(_poolAddr, _user, 0);\\n }\\n\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_poolAddrs`.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolUpdateConflicted` when the pool is already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function _recordRewards(\\n address[] memory _poolAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) internal {\\n if (_poolAddrs.length != _rewards.length) {\\n emit PoolsUpdateFailed(_period, _poolAddrs, _rewards);\\n return;\\n }\\n\\n uint256 _rps;\\n uint256 _count;\\n address _poolAddr;\\n uint256 _stakingTotal;\\n uint256[] memory _aRps = new uint256[](_poolAddrs.length);\\n uint256[] memory _shares = new uint256[](_poolAddrs.length);\\n address[] memory _conflicted = new address[](_poolAddrs.length);\\n\\n for (uint _i = 0; _i < _poolAddrs.length; _i++) {\\n _poolAddr = _poolAddrs[_i];\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n _stakingTotal = getStakingTotal(_poolAddr);\\n\\n if (_accumulatedRps[_poolAddr][_period].lastPeriod == _period) {\\n _conflicted[_count++] = _poolAddr;\\n continue;\\n }\\n\\n // Updates the pool shares if it is outdated\\n if (_pool.shares.lastPeriod < _period) {\\n _pool.shares = PeriodWrapper(_stakingTotal, _period);\\n }\\n\\n // The rps is 0 if no one stakes for the pool\\n _rps = _pool.shares.inner == 0 ? 0 : (_rewards[_i] * 1e18) / _pool.shares.inner;\\n _aRps[_i - _count] = _pool.aRps += _rps;\\n _accumulatedRps[_poolAddr][_period] = PeriodWrapper(_pool.aRps, _period);\\n _pool.shares.inner = _stakingTotal;\\n _shares[_i - _count] = _pool.shares.inner;\\n _poolAddrs[_i - _count] = _poolAddr;\\n }\\n\\n if (_count > 0) {\\n assembly {\\n mstore(_conflicted, _count)\\n mstore(_poolAddrs, sub(mload(_poolAddrs), _count))\\n }\\n emit PoolsUpdateConflicted(_period, _conflicted);\\n }\\n\\n if (_poolAddrs.length > 0) {\\n emit PoolsUpdated(_period, _poolAddrs, _aRps, _shares);\\n }\\n }\\n\\n /**\\n * @dev Returns the current period.\\n */\\n function _currentPeriod() internal view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x492fc376e3a866dca702f22f25fe30d3005c28cace7503822ac7e73606611278\",\"license\":\"MIT\"},\"contracts/ronin/staking/Staking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"./CandidateStaking.sol\\\";\\nimport \\\"./DelegatorStaking.sol\\\";\\n\\ncontract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable {\\n constructor() {\\n _disableInitializers();\\n }\\n\\n receive() external payable onlyValidatorContract {}\\n\\n fallback() external payable onlyValidatorContract {}\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 __minValidatorStakingAmount,\\n uint256 __maxCommissionRate,\\n uint256 __cooldownSecsToUndelegate,\\n uint256 __waitingSecsToRevoke\\n ) external initializer {\\n _setValidatorContract(__validatorContract);\\n _setMinValidatorStakingAmount(__minValidatorStakingAmount);\\n _setCommissionRateRange(0, __maxCommissionRate);\\n _setCooldownSecsToUndelegate(__cooldownSecsToUndelegate);\\n _setWaitingSecsToRevoke(__waitingSecsToRevoke);\\n }\\n\\n /**\\n * @inheritdoc IStaking\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable override onlyValidatorContract {\\n _recordRewards(_consensusAddrs, _rewards, _period);\\n }\\n\\n /**\\n * @inheritdoc IStaking\\n */\\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\\n external\\n override\\n onlyValidatorContract\\n returns (uint256 _actualDeductingAmount)\\n {\\n _actualDeductingAmount = _deductStakingAmount(_stakingPool[_consensusAddr], _amount);\\n address payable _validatorContractAddr = payable(validatorContract());\\n if (!_unsafeSendRON(_validatorContractAddr, _actualDeductingAmount)) {\\n emit StakingAmountDeductFailed(\\n _consensusAddr,\\n _validatorContractAddr,\\n _actualDeductingAmount,\\n address(this).balance\\n );\\n }\\n }\\n\\n /**\\n * @inheritdoc RewardCalculation\\n */\\n function _currentPeriod() internal view virtual override returns (uint256) {\\n return _validatorContract.currentPeriod();\\n }\\n\\n /**\\n * @inheritdoc CandidateStaking\\n */\\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount)\\n internal\\n override\\n returns (uint256 _actualDeductingAmount)\\n {\\n _actualDeductingAmount = Math.min(_pool.stakingAmount, _amount);\\n\\n _pool.stakingAmount -= _actualDeductingAmount;\\n _changeDelegatingAmount(\\n _pool,\\n _pool.admin,\\n _pool.stakingAmount,\\n Math.subNonNegative(_pool.stakingTotal, _actualDeductingAmount)\\n );\\n emit Unstaked(_pool.addr, _actualDeductingAmount);\\n }\\n}\\n\",\"keccak256\":\"0x6c126a036c4cc2b6946b3ffa83b6620e517eef682b6415dd76763d341e321c8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060016000556200002162000027565b620000e9565b60d154610100900460ff1615620000945760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60d15460ff9081161015620000e75760d1805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b613bb880620000f96000396000f3fe6080604052600436106101b95760003560e01c806303827884146101f95780630682e8fa14610222578063095f647514610237578063097e4a9d146102645780631658c86e1461028457806326476204146102a45780632715805e146102b75780633d8e846e146102d757806342e0c408146102f757806342ef3c34146103275780634530d202146103475780634d99dd161461036f578063574734471461038f5780635c19a95c146103af5780636558954f146103c2578063679a6e43146103d95780636b091695146103f95780636bd8f8041461041957806376664b6514610439578063888b9ae914610459578063895ab74214610479578063909791dd1461049957806391f8723f146104ae578063924f081e146104ce5780639488e4e9146104ee578063969ffc141461050e578063994390891461052e578063aa15a6fd14610550578063acd79c4614610570578063af24542914610583578063c2a672e014610598578063c5087003146105b8578063cdf64a76146105f1578063d01b8eed14610611578063e22d1c9d1461066c578063e5376f541461068c578063f92ad2191461069f578063f9f031df146106bf576101f0565b366101f057336101c76106df565b6001600160a01b0316146101ee57604051630e6444a160e31b815260040160405180910390fd5b005b336101c76106df565b34801561020557600080fd5b5061020f6104b081565b6040519081526020015b60405180910390f35b34801561022e57600080fd5b5060385461020f565b34801561024357600080fd5b5061025761025236600461334b565b6106ee565b60405161021991906133f1565b34801561027057600080fd5b5061020f61027f366004613419565b610830565b34801561029057600080fd5b506101ee61029f36600461346f565b610935565b6101ee6102b236600461346f565b610a73565b3480156102c357600080fd5b5061020f6102d2366004613493565b610b4b565b3480156102e357600080fd5b506102576102f23660046134bf565b610c0b565b34801561030357600080fd5b5061031761031236600461346f565b610d4f565b6040519015158152602001610219565b34801561033357600080fd5b50610257610342366004613513565b610d6f565b34801561035357600080fd5b50606e54606d5460408051928352602083019190915201610219565b34801561037b57600080fd5b506101ee61038a366004613493565b610e3e565b34801561039b57600080fd5b506101ee6103aa366004613554565b610eba565b6101ee6103bd36600461346f565b610efc565b3480156103ce57600080fd5b5061020f6201518081565b3480156103e557600080fd5b506101ee6103f4366004613576565b610ff9565b34801561040557600080fd5b5061020f61041436600461358f565b61103d565b34801561042557600080fd5b506101ee6104343660046135c8565b61105f565b34801561044557600080fd5b5061020f61045436600461358f565b61116a565b34801561046557600080fd5b506101ee610474366004613576565b611199565b34801561048557600080fd5b5061020f61049436600461346f565b6111da565b3480156104a557600080fd5b50606c5461020f565b3480156104ba57600080fd5b506102576104c9366004613513565b6111f8565b3480156104da57600080fd5b506101ee6104e9366004613609565b6112a2565b3480156104fa57600080fd5b506101ee61050936600461334b565b611411565b34801561051a57600080fd5b506101ee610529366004613576565b61154a565b34801561053a57600080fd5b506105436106df565b604051610219919061363e565b34801561055c57600080fd5b506101ee61056b36600461346f565b61158b565b6101ee61057e366004613652565b611691565b34801561058f57600080fd5b5060395461020f565b3480156105a457600080fd5b506101ee6105b3366004613493565b611709565b3480156105c457600080fd5b506105436105d336600461346f565b6001600160a01b039081166000908152603a60205260409020541690565b3480156105fd57600080fd5b506101ee61060c36600461346f565b611849565b34801561061d57600080fd5b5061065d61062c36600461346f565b6001600160a01b03808216600090815260376020526040902060018101546002820154600390920154921693909250565b604051610219939291906136c5565b34801561067857600080fd5b506101ee6106873660046136e6565b6118b5565b6101ee61069a366004613731565b611aa5565b3480156106ab57600080fd5b506101ee6106ba366004613795565b611be6565b3480156106cb57600080fd5b5061020f6106da366004613513565b611d23565b6036546001600160a01b031690565b6060838214610710576040516376081a7b60e11b815260040160405180910390fd5b836001600160401b03811115610728576107286137d9565b604051908082528060200260200182016040528015610751578160200160208202803683370190505b50905060005b81518110156108275760376000878784818110610776576107766137ef565b905060200201602081019061078b919061346f565b6001600160a01b03166001600160a01b0316815260200190815260200160002060040160008585848181106107c2576107c26137ef565b90506020020160208101906107d7919061346f565b6001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061080a5761080a6137ef565b60209081029190910101528061081f8161381b565b915050610757565b50949350505050565b600060026000540361085d5760405162461bcd60e51b815260040161085490613834565b60405180910390fd5b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d29061089290849060040161363e565b602060405180830381865afa1580156108af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d3919061386b565b6108f25780604051630fd0c64560e11b8152600401610854919061363e565b6108fb33610d4f565b1561091b5733604051632fc6bfb160e21b8152600401610854919061363e565b61092733868686611da3565b600160005595945050505050565b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d29061096590849060040161363e565b602060405180830381865afa158015610982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a6919061386b565b6109c55780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b038083166000908152603760205260409020600181015490913391168114610a0757604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163dd716ad360e01b81526001600160a01b039092169163dd716ad391610a3b9188919060040161388d565b600060405180830381600087803b158015610a5557600080fd5b505af1158015610a69573d6000803e3d6000fd5b5050505050505050565b34600003610a9457604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d290610ac490849060040161363e565b602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b05919061386b565b610b245780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b0382166000908152603760205260409020610b47903334611e10565b5050565b600033610b566106df565b6001600160a01b031614610b7d57604051630e6444a160e31b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260409020610b9f9083611ee3565b90506000610bab6106df565b9050610bb78183611f6e565b610c0457604080518381524760208201526001600160a01b0380841692908716917f63701cd972aa3c7f87898aab145c972e52185beab07d6e39380a998d334cf6c8910160405180910390a35b5092915050565b6060600080603660009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8791906138a6565b9050836001600160401b03811115610ca157610ca16137d9565b604051908082528060200260200182016040528015610cca578160200160208202803683370190505b50925060005b84811015610d4557858582818110610cea57610cea6137ef565b9050602002016020810190610cff919061346f565b9250610d16838884610d11878c61116a565b611fca565b848281518110610d2857610d286137ef565b602090810291909101015280610d3d8161381b565b915050610cd0565b5050509392505050565b6001600160a01b039081166000908152603a602052604090205416151590565b6060816001600160401b03811115610d8957610d896137d9565b604051908082528060200260200182016040528015610db2578160200160208202803683370190505b50905060005b82811015610c045760376000858584818110610dd657610dd66137ef565b9050602002016020810190610deb919061346f565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020154828281518110610e2157610e216137ef565b602090810291909101015280610e368161381b565b915050610db8565b600260005403610e605760405162461bcd60e51b815260040161085490613834565b600260009081556001600160a01b03831681526037602052604090203390610e899082846120c6565b610e938183612326565b610eb057604051635ff7115760e11b815260040160405180910390fd5b5050600160005550565b610ec2612353565b6001600160a01b0316336001600160a01b031614610ef25760405162461bcd60e51b8152600401610854906138bf565b610b478282612381565b34600003610f1d57604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d290610f4d90849060040161363e565b602060405180830381865afa158015610f6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8e919061386b565b610fad5780604051630fd0c64560e11b8152600401610854919061363e565b610fb633610d4f565b15610fd65733604051632fc6bfb160e21b8152600401610854919061363e565b6001600160a01b0382166000908152603760205260409020610b479033346123f5565b611001612353565b6001600160a01b0316336001600160a01b0316146110315760405162461bcd60e51b8152600401610854906138bf565b61103a816124bd565b50565b6000611056838361104c6124f9565b610d11878761116a565b90505b92915050565b6002600054036110815760405162461bcd60e51b815260040161085490613834565b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d2906110b690849060040161363e565b602060405180830381865afa1580156110d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f7919061386b565b6111165780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b0384166000908152603760205260409020339061113b9082856120c6565b6001600160a01b038416600090815260376020526040902061115e9082856123f5565b50506001600055505050565b6001600160a01b0391821660009081526037602090815260408083209390941682526004909201909152205490565b6111a1612353565b6001600160a01b0316336001600160a01b0316146111d15760405162461bcd60e51b8152600401610854906138bf565b61103a8161256b565b6001600160a01b031660009081526037602052604090206003015490565b6060816001600160401b03811115611212576112126137d9565b60405190808252806020026020018201604052801561123b578160200160208202803683370190505b50905060005b82811015610c045761127384848381811061125e5761125e6137ef565b9050602002016020810190610494919061346f565b828281518110611285576112856137ef565b60209081029190910101528061129a8161381b565b915050611241565b603654604051635061f96960e11b815284916001600160a01b03169063a0c3f2d2906112d290849060040161363e565b602060405180830381865afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611313919061386b565b6113325780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b03808516600090815260376020526040902060018101549091339116811461137457604051637bc65bd760e11b815260040160405180910390fd5b606d548411806113855750606e5484105b156113a357604051631b8454a360e21b815260040160405180910390fd5b60365460405163e5125a1d60e01b81526001600160a01b039091169063e5125a1d906113d7908990899089906004016136c5565b600060405180830381600087803b1580156113f157600080fd5b505af1158015611405573d6000803e3d6000fd5b50505050505050505050565b6002600054036114335760405162461bcd60e51b815260040161085490613834565b60026000558215806114455750828114155b15611463576040516376081a7b60e11b815260040160405180910390fd5b336000805b8581101561151557848482818110611482576114826137ef565b90506020020135826114949190613901565b9150611503603760008989858181106114af576114af6137ef565b90506020020160208101906114c4919061346f565b6001600160a01b03166001600160a01b03168152602001908152602001600020848787858181106114f7576114f76137ef565b905060200201356120c6565b8061150d8161381b565b915050611468565b506115208282612326565b61153d57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550505050565b611552612353565b6001600160a01b0316336001600160a01b0316146115825760405162461bcd60e51b8152600401610854906138bf565b61103a816125a0565b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d2906115bb90849060040161363e565b602060405180830381865afa1580156115d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115fc919061386b565b61161b5780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b03808316600090815260376020526040902060018101549091339116811461165d57604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163a7c2f11960e01b81526001600160a01b039092169163a7c2f11991610a3b9188919060040161388d565b3361169a6106df565b6001600160a01b0316146116c157604051630e6444a160e31b815260040160405180910390fd5b6117028585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508792508691508590506125d5565b5050505050565b60026000540361172b5760405162461bcd60e51b815260040161085490613834565b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d29061176090849060040161363e565b602060405180830381865afa15801561177d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a1919061386b565b6117c05780604051630fd0c64560e11b8152600401610854919061363e565b816000036117e1576040516331d9f7d760e01b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260408120600281015433929061180c908690613914565b9050606c548110156118315760405163ef0a995760e01b815260040160405180910390fd5b61183c828487612a13565b61152083866104b0612b15565b611851612353565b6001600160a01b0316336001600160a01b0316146118815760405162461bcd60e51b8152600401610854906138bf565b806001600160a01b03163b6000036118ac57604051637bcd509160e01b815260040160405180910390fd5b61103a81612b75565b336118be6106df565b6001600160a01b0316146118e557604051630e6444a160e31b815260040160405180910390fd5b8115611aa05760005b82811015611a655760006037600086868581811061190e5761190e6137ef565b9050602002016020810190611923919061346f565b6001600160a01b0390811682526020808301939093526040918201600090812060018101549092168152603a909352912080546001600160a01b0319169055600281015490915080156119ea5761197a8282611ee3565b506001820154611996906001600160a01b0316826104b0612b15565b6119ea5760018201548254604080518481524760208201526001600160a01b0393841693909216917f7dc5115a5aba081f5a174f56a3d02eea582824783322a4ac03f7bd388f444194910160405180910390a35b6000611a2a878786818110611a0157611a016137ef565b9050602002016020810190611a16919061346f565b60018501546001600160a01b031687612bc0565b90508015611a4f576001830154611a4d906001600160a01b0316826104b0612b15565b505b5050508080611a5d9061381b565b9150506118ee565b507f4f257d3ba23679d338f1d94296086bba5724af341b7fa31aa0ff297bfcdc62d88383604051611a97929190613927565b60405180910390a15b505050565b600260005403611ac75760405162461bcd60e51b815260040161085490613834565b6002600055611ad533610d4f565b15611af55733604051632fc6bfb160e21b8152600401610854919061363e565b606d54811180611b065750606e5481105b15611b2457604051631b8454a360e21b815260040160405180910390fd5b3433611b3581888888888888612cc0565b6001600160a01b0380871660008181526037602081815260408084206001810180549789166001600160a01b0319988916811790915581548816871782558552603a835290842080549096168517909555929091529052611b97818385611e10565b816001600160a01b0316876001600160a01b03167ffc1f1e73948cbc47c5b7f90e5601b7daccd9ad7173218486ccc74bdd051d05e860405160405180910390a350506001600055505050505050565b60d154610100900460ff1615808015611c06575060d154600160ff909116105b80611c205750303b158015611c20575060d15460ff166001145b611c835760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610854565b60d1805460ff191660011790558015611ca65760d1805461ff0019166101001790555b611caf86612b75565b611cb8856124bd565b611cc3600085612381565b611ccc8361256b565b611cd5826125a0565b8015611d1b5760d1805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6000600260005403611d475760405162461bcd60e51b815260040161085490613834565b6002600081905550611d8c33848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612f4c92505050565b9050611d983382612faf565b600160005592915050565b6000611de285858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612f4c92505050565b6001600160a01b0383166000908152603760205260409020909150611e089086836123f5565b949350505050565b6001830154839083906001600160a01b03808316911614611e4457604051637bc65bd760e11b815260040160405180910390fd5b82856002016000828254611e589190613901565b92505081905550611e7e85858760020154868960030154611e799190613901565b612fd6565b6001600160a01b03808516600090815260058701602052604090819020429055865490519116907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611ed49086815260200190565b60405180910390a25050505050565b6000611ef3836002015483613011565b905080836002016000828254611f099190613914565b9091555050600183015460028401546003850154611f399286926001600160a01b0390911691611e799086613027565b82546040518281526001600160a01b0390911690600080516020613b438339815191529060200160405180910390a292915050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611fbb576040519150601f19603f3d011682016040523d82523d6000602084013e611fc0565b606091505b5090949350505050565b6001600160a01b0380851660009081526002602090815260408083209387168352929052908120600381015484900361200557549050611e08565b6001600160a01b03861660009081526003602081815260408084206001808452828620948701548652939092528320918201548392901561206a57805460018601549094506120549085613914565b85600201546120639190613975565b9250612072565b846001015493505b8154600090612082908690613914565b61208c9089613975565b9050670de0b6b3a76400006120a18286613901565b6120ab919061398c565b86546120b79190613901565b9b9a5050505050505050505050565b6001830154839083906001600160a01b038083169116036120fa57604051639feb934760e01b815260040160405180910390fd5b8260000361211b57604051637ab0c6ad60e11b815260040160405180910390fd5b6001600160a01b038416600090815260048601602052604090205483111561215657604051630695534560e31b815260040160405180910390fd5b6036548554604051635061f96960e11b81526001600160a01b039283169263a0c3f2d2926121899291169060040161363e565b602060405180830381865afa1580156121a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ca919061386b565b801561224b575060365485546040516328bde1e160e01b81526001600160a01b03928316926328bde1e1926122049291169060040161363e565b60e060405180830381865afa158015612221573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224591906139be565b60a00151155b801561227e57506038546001600160a01b0385166000908152600587016020526040902054429161227b91613901565b10155b1561229c5760405163f19f52bd60e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546122da90869086906122ca908790613914565b868960030154611e799190613914565b84546040518481526001600160a01b03918216918616907f4d10bd049775c77bd7f255195afba5088028ecb3c7c277d393ccff7934f2f92c906020015b60405180910390a35050505050565b600081471015612349576040516304611a4560e11b815260040160405180910390fd5b6110568383611f6e565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b61271081118061239057508082115b156123ae57604051631b8454a360e21b815260040160405180910390fd5b606d819055606e82905560408051838152602081018390527f677752f5bf9541b14288833909e5ec5a478103131c1ec08c4638943be5826c14910160405180910390a15050565b6001830154839083906001600160a01b0380831691160361242957604051639feb934760e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546124679086908690612457908790613901565b868960030154611e799190613901565b6001600160a01b03808516600081815260058801602052604090819020429055875490519216917fe5541a6b6103d4fa7e021ed54fad39c66f27a76bd13d374cf6240ae6bd0bb72b906123179087815260200190565b606c8190556040518181527f372bbdb8d72373b0012f84ee5a11671e5fb72b8bea902ebca93a19cb45d32be2906020015b60405180910390a150565b6036546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa158015612542573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256691906138a6565b905090565b60388190556040518181527f4956b65267b8f1e642284bcb5037116c69a9c78d9ca576beeae0974737a4872a906020016124ee565b60398190556040518181527f02be0b73b597f2c0f138aebee162b3b0e25d5b5a26854c15dcf79176e9a1c678906020016124ee565b8351821461261e57807fae52c603227f64e4c6101dde593aa9790a16b3ac77546bd746d758511e9560a585858560405161261193929190613aa2565b60405180910390a2612a0d565b600080600080600088516001600160401b0381111561263f5761263f6137d9565b604051908082528060200260200182016040528015612668578160200160208202803683370190505b509050600089516001600160401b03811115612686576126866137d9565b6040519080825280602002602001820160405280156126af578160200160208202803683370190505b50905060008a516001600160401b038111156126cd576126cd6137d9565b6040519080825280602002602001820160405280156126f6578160200160208202803683370190505b50905060005b8b51811015612978578b8181518110612717576127176137ef565b60200260200101519550600060036000886001600160a01b03166001600160a01b031681526020019081526020016000209050612753876111da565b6001600160a01b03881660009081526001602081815260408084208f855290915290912001549096508a90036127c75786838961278f8161381b565b9a50815181106127a1576127a16137ef565b60200260200101906001600160a01b031690816001600160a01b03168152505050612966565b60028101548a11156127f557604080518082019091528681526020018a905260018101869055600281018a90555b60018101541561283f5760018101548c8c84818110612816576128166137ef565b90506020020135670de0b6b3a76400006128309190613975565b61283a919061398c565b612842565b60005b9850888160000160008282546128589190613901565b918290555090508561286a8a85613914565b8151811061287a5761287a6137ef565b6020026020010181815250506040518060400160405280826000015481526020018b81525060016000896001600160a01b03166001600160a01b0316815260200190815260200160002060008c81526020019081526020016000206000820151816000015560208201518160010155905050858160010160000181905550806001016000015484898461290d9190613914565b8151811061291d5761291d6137ef565b6020908102919091010152868d6129348a85613914565b81518110612944576129446137ef565b60200260200101906001600160a01b031690816001600160a01b031681525050505b806129708161381b565b9150506126fc565b5085156129c157858152858b51038b52877fee74f10cc50bf4b7e57fd36be7d46288795f3a9151dae97505b718b392ba14a3826040516129b89190613aec565b60405180910390a25b8a5115612a0557877f0e54e0485f70f0f63bc25889ddbf01ce1269ad6f07fdb2df573a0fbdb4d66f888c85856040516129fc93929190613aff565b60405180910390a25b505050505050505b50505050565b6001830154839083906001600160a01b03808316911614612a4757604051637bc65bd760e11b815260040160405180910390fd5b8460020154831115612a6c57604051630a8d7fa760e21b815260040160405180910390fd5b6038546001600160a01b03851660009081526005870160205260409020544291612a9591613901565b1115612ab4576040516303db082960e11b815260040160405180910390fd5b82856002016000828254612ac89190613914565b92505081905550612ae985858760020154868960030154611e799190613914565b84546040518481526001600160a01b0390911690600080516020613b4383398151915290602001611ed4565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d8060008114612b65576040519150601f19603f3d011682016040523d82523d6000602084013e612b6a565b606091505b509095945050505050565b603680546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906124ee90839061363e565b600080612bcd858561116a565b9050612bdb85858584611fca565b9150836001600160a01b0316856001600160a01b03167f0aa4d283470c904c551d18bb894d37e17674920f3261a7f854be501e25f421b784604051612c2291815260200190565b60405180910390a36001600160a01b03808616600081815260026020908152604080832094891683529381528382208281559282526003905291909120612c6c9082868580613041565b60038181018590556001600160a01b0387811660008181526020938452604080822054600187015551908152918816929091600080516020613b63833981519152910160405180910390a350509392505050565b612ccb876000611f6e565b612d16576040805163338f030160e01b81526001600160a01b03891660048201526024810191909152600a6044820152693837b7b61030b236b4b760b11b6064820152608401610854565b612d21846000611f6e565b612d6a576040805163338f030160e01b81526001600160a01b038616600482015260248101919091526008604482015267747265617375727960c01b6064820152608401610854565b606c54811015612d8d57604051630a8d7fa760e21b815260040160405180910390fd5b856001600160a01b0316876001600160a01b0316141580612dc05750836001600160a01b0316866001600160a01b031614155b15612dde5760405163dc1d04ff60e01b815260040160405180910390fd5b60408051600380825260808201909252600091602082016060803683370190505090508781600081518110612e1557612e156137ef565b60200260200101906001600160a01b031690816001600160a01b0316815250508581600181518110612e4957612e496137ef565b60200260200101906001600160a01b031690816001600160a01b0316815250508381600281518110612e7d57612e7d6137ef565b60200260200101906001600160a01b031690816001600160a01b031681525050612ea6816130d3565b15612ec4576040516329d55f9360e11b815260040160405180910390fd5b6036546040516302209ca560e31b81526001600160a01b0389811660048301528881166024830152878116604483015286811660648301526084820186905290911690631104e5289060a401600060405180830381600087803b158015612f2a57600080fd5b505af1158015612f3e573d6000803e3d6000fd5b505050505050505050505050565b600080612f576124f9565b905060005b8351811015612fa757612f89848281518110612f7a57612f7a6137ef565b60200260200101518684612bc0565b612f939084613901565b925080612f9f8161381b565b915050612f5c565b505092915050565b612fb98282612326565b610b4757604051630c3e69bb60e11b815260040160405180910390fd5b8354612fec906001600160a01b0316848461319a565b60038401556001600160a01b0390911660009081526004909201602052604090912055565b60008183106130205781611056565b5090919050565b6000818311613037576000611056565b6110568284613914565b828460030154101561305557600284018190555b6000613065856002015484613011565b905060008186600201546130799190613914565b905080156130ca576002860182905560018701548111156130ad576040516352e521bf60e11b815260040160405180910390fd5b808760010160000160008282546130c49190613914565b90915550505b50505050505050565b600081516000036130e657506000919050565b60005b600183516130f79190613914565b81101561319157600061310b826001613901565b90505b835181101561317e57838181518110613129576131296137ef565b60200260200101516001600160a01b031684838151811061314c5761314c6137ef565b60200260200101516001600160a01b03160361316c575060019392505050565b806131768161381b565b91505061310e565b50806131898161381b565b9150506130e9565b50600092915050565b60006131a46124f9565b6001600160a01b03851660009081526003602052604090206001810154600282015492935090918311156131ff5760405180604001604052806131e6886111da565b8152602090810185905281516001850155015160028301555b6001600160a01b038087166000908152600260209081526040808320938916835292905290812090613231888861116a565b9050600061324189898885611fca565b83549091508114613281578083556040518181526001600160a01b0389811691908b1690600080516020613b638339815191529060200160405180910390a35b61328e8584888a86613041565b84546001808501919091556003840187905585015484146132f557886001600160a01b0316867f81faf50e2aaf52eaba2ab841071efb9f6f0850a3e7d008b1336e6001d3d4963c87600101600001546040516132ec91815260200190565b60405180910390a35b505050505050505050565b60008083601f84011261331257600080fd5b5081356001600160401b0381111561332957600080fd5b6020830191508360208260051b850101111561334457600080fd5b9250929050565b6000806000806040858703121561336157600080fd5b84356001600160401b038082111561337857600080fd5b61338488838901613300565b9096509450602087013591508082111561339d57600080fd5b506133aa87828801613300565b95989497509550505050565b600081518084526020808501945080840160005b838110156133e6578151875295820195908201906001016133ca565b509495945050505050565b60208152600061105660208301846133b6565b6001600160a01b038116811461103a57600080fd5b60008060006040848603121561342e57600080fd5b83356001600160401b0381111561344457600080fd5b61345086828701613300565b909450925050602084013561346481613404565b809150509250925092565b60006020828403121561348157600080fd5b813561348c81613404565b9392505050565b600080604083850312156134a657600080fd5b82356134b181613404565b946020939093013593505050565b6000806000604084860312156134d457600080fd5b83356134df81613404565b925060208401356001600160401b038111156134fa57600080fd5b61350686828701613300565b9497909650939450505050565b6000806020838503121561352657600080fd5b82356001600160401b0381111561353c57600080fd5b61354885828601613300565b90969095509350505050565b6000806040838503121561356757600080fd5b50508035926020909101359150565b60006020828403121561358857600080fd5b5035919050565b600080604083850312156135a257600080fd5b82356135ad81613404565b915060208301356135bd81613404565b809150509250929050565b6000806000606084860312156135dd57600080fd5b83356135e881613404565b925060208401356135f881613404565b929592945050506040919091013590565b60008060006060848603121561361e57600080fd5b833561362981613404565b95602085013595506040909401359392505050565b6001600160a01b0391909116815260200190565b60008060008060006060868803121561366a57600080fd5b85356001600160401b038082111561368157600080fd5b61368d89838a01613300565b909750955060208801359150808211156136a657600080fd5b506136b388828901613300565b96999598509660400135949350505050565b6001600160a01b039390931683526020830191909152604082015260600190565b6000806000604084860312156136fb57600080fd5b83356001600160401b0381111561371157600080fd5b61371d86828701613300565b909790965060209590950135949350505050565b600080600080600060a0868803121561374957600080fd5b853561375481613404565b9450602086013561376481613404565b9350604086013561377481613404565b9250606086013561378481613404565b949793965091946080013592915050565b600080600080600060a086880312156137ad57600080fd5b85356137b881613404565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161382d5761382d613805565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561387d57600080fd5b8151801515811461348c57600080fd5b6001600160a01b03929092168252602082015260400190565b6000602082840312156138b857600080fd5b5051919050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b8082018082111561105957611059613805565b8181038181111561105957611059613805565b60208082528181018390526000908460408401835b8681101561396a57823561394f81613404565b6001600160a01b03168252918301919083019060010161393c565b509695505050505050565b808202811582820484141761105957611059613805565b6000826139a957634e487b7160e01b600052601260045260246000fd5b500490565b80516139b981613404565b919050565b600060e082840312156139d057600080fd5b60405160e081016001600160401b0381118282101715613a0057634e487b7160e01b600052604160045260246000fd5b604052613a0c836139ae565b8152613a1a602084016139ae565b6020820152613a2b604084016139ae565b6040820152613a3c606084016139ae565b60608201526080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b600081518084526020808501945080840160005b838110156133e65781516001600160a01b031687529582019590820190600101613a7d565b604081526000613ab56040830186613a69565b82810360208401528381526001600160fb1b03841115613ad457600080fd5b8360051b808660208401370160200195945050505050565b6020815260006110566020830184613a69565b606081526000613b126060830186613a69565b8281036020840152613b2481866133b6565b90508281036040840152613b3881856133b6565b969550505050505056fe0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75aa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ada264697066735822122084a2646a7e3b284e947649e3c4cea51c75829bcabae922a4d19175bd5ef9292564736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106101b95760003560e01c806303827884146101f95780630682e8fa14610222578063095f647514610237578063097e4a9d146102645780631658c86e1461028457806326476204146102a45780632715805e146102b75780633d8e846e146102d757806342e0c408146102f757806342ef3c34146103275780634530d202146103475780634d99dd161461036f578063574734471461038f5780635c19a95c146103af5780636558954f146103c2578063679a6e43146103d95780636b091695146103f95780636bd8f8041461041957806376664b6514610439578063888b9ae914610459578063895ab74214610479578063909791dd1461049957806391f8723f146104ae578063924f081e146104ce5780639488e4e9146104ee578063969ffc141461050e578063994390891461052e578063aa15a6fd14610550578063acd79c4614610570578063af24542914610583578063c2a672e014610598578063c5087003146105b8578063cdf64a76146105f1578063d01b8eed14610611578063e22d1c9d1461066c578063e5376f541461068c578063f92ad2191461069f578063f9f031df146106bf576101f0565b366101f057336101c76106df565b6001600160a01b0316146101ee57604051630e6444a160e31b815260040160405180910390fd5b005b336101c76106df565b34801561020557600080fd5b5061020f6104b081565b6040519081526020015b60405180910390f35b34801561022e57600080fd5b5060385461020f565b34801561024357600080fd5b5061025761025236600461334b565b6106ee565b60405161021991906133f1565b34801561027057600080fd5b5061020f61027f366004613419565b610830565b34801561029057600080fd5b506101ee61029f36600461346f565b610935565b6101ee6102b236600461346f565b610a73565b3480156102c357600080fd5b5061020f6102d2366004613493565b610b4b565b3480156102e357600080fd5b506102576102f23660046134bf565b610c0b565b34801561030357600080fd5b5061031761031236600461346f565b610d4f565b6040519015158152602001610219565b34801561033357600080fd5b50610257610342366004613513565b610d6f565b34801561035357600080fd5b50606e54606d5460408051928352602083019190915201610219565b34801561037b57600080fd5b506101ee61038a366004613493565b610e3e565b34801561039b57600080fd5b506101ee6103aa366004613554565b610eba565b6101ee6103bd36600461346f565b610efc565b3480156103ce57600080fd5b5061020f6201518081565b3480156103e557600080fd5b506101ee6103f4366004613576565b610ff9565b34801561040557600080fd5b5061020f61041436600461358f565b61103d565b34801561042557600080fd5b506101ee6104343660046135c8565b61105f565b34801561044557600080fd5b5061020f61045436600461358f565b61116a565b34801561046557600080fd5b506101ee610474366004613576565b611199565b34801561048557600080fd5b5061020f61049436600461346f565b6111da565b3480156104a557600080fd5b50606c5461020f565b3480156104ba57600080fd5b506102576104c9366004613513565b6111f8565b3480156104da57600080fd5b506101ee6104e9366004613609565b6112a2565b3480156104fa57600080fd5b506101ee61050936600461334b565b611411565b34801561051a57600080fd5b506101ee610529366004613576565b61154a565b34801561053a57600080fd5b506105436106df565b604051610219919061363e565b34801561055c57600080fd5b506101ee61056b36600461346f565b61158b565b6101ee61057e366004613652565b611691565b34801561058f57600080fd5b5060395461020f565b3480156105a457600080fd5b506101ee6105b3366004613493565b611709565b3480156105c457600080fd5b506105436105d336600461346f565b6001600160a01b039081166000908152603a60205260409020541690565b3480156105fd57600080fd5b506101ee61060c36600461346f565b611849565b34801561061d57600080fd5b5061065d61062c36600461346f565b6001600160a01b03808216600090815260376020526040902060018101546002820154600390920154921693909250565b604051610219939291906136c5565b34801561067857600080fd5b506101ee6106873660046136e6565b6118b5565b6101ee61069a366004613731565b611aa5565b3480156106ab57600080fd5b506101ee6106ba366004613795565b611be6565b3480156106cb57600080fd5b5061020f6106da366004613513565b611d23565b6036546001600160a01b031690565b6060838214610710576040516376081a7b60e11b815260040160405180910390fd5b836001600160401b03811115610728576107286137d9565b604051908082528060200260200182016040528015610751578160200160208202803683370190505b50905060005b81518110156108275760376000878784818110610776576107766137ef565b905060200201602081019061078b919061346f565b6001600160a01b03166001600160a01b0316815260200190815260200160002060040160008585848181106107c2576107c26137ef565b90506020020160208101906107d7919061346f565b6001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061080a5761080a6137ef565b60209081029190910101528061081f8161381b565b915050610757565b50949350505050565b600060026000540361085d5760405162461bcd60e51b815260040161085490613834565b60405180910390fd5b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d29061089290849060040161363e565b602060405180830381865afa1580156108af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d3919061386b565b6108f25780604051630fd0c64560e11b8152600401610854919061363e565b6108fb33610d4f565b1561091b5733604051632fc6bfb160e21b8152600401610854919061363e565b61092733868686611da3565b600160005595945050505050565b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d29061096590849060040161363e565b602060405180830381865afa158015610982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a6919061386b565b6109c55780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b038083166000908152603760205260409020600181015490913391168114610a0757604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163dd716ad360e01b81526001600160a01b039092169163dd716ad391610a3b9188919060040161388d565b600060405180830381600087803b158015610a5557600080fd5b505af1158015610a69573d6000803e3d6000fd5b5050505050505050565b34600003610a9457604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d290610ac490849060040161363e565b602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b05919061386b565b610b245780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b0382166000908152603760205260409020610b47903334611e10565b5050565b600033610b566106df565b6001600160a01b031614610b7d57604051630e6444a160e31b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260409020610b9f9083611ee3565b90506000610bab6106df565b9050610bb78183611f6e565b610c0457604080518381524760208201526001600160a01b0380841692908716917f63701cd972aa3c7f87898aab145c972e52185beab07d6e39380a998d334cf6c8910160405180910390a35b5092915050565b6060600080603660009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8791906138a6565b9050836001600160401b03811115610ca157610ca16137d9565b604051908082528060200260200182016040528015610cca578160200160208202803683370190505b50925060005b84811015610d4557858582818110610cea57610cea6137ef565b9050602002016020810190610cff919061346f565b9250610d16838884610d11878c61116a565b611fca565b848281518110610d2857610d286137ef565b602090810291909101015280610d3d8161381b565b915050610cd0565b5050509392505050565b6001600160a01b039081166000908152603a602052604090205416151590565b6060816001600160401b03811115610d8957610d896137d9565b604051908082528060200260200182016040528015610db2578160200160208202803683370190505b50905060005b82811015610c045760376000858584818110610dd657610dd66137ef565b9050602002016020810190610deb919061346f565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020154828281518110610e2157610e216137ef565b602090810291909101015280610e368161381b565b915050610db8565b600260005403610e605760405162461bcd60e51b815260040161085490613834565b600260009081556001600160a01b03831681526037602052604090203390610e899082846120c6565b610e938183612326565b610eb057604051635ff7115760e11b815260040160405180910390fd5b5050600160005550565b610ec2612353565b6001600160a01b0316336001600160a01b031614610ef25760405162461bcd60e51b8152600401610854906138bf565b610b478282612381565b34600003610f1d57604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d290610f4d90849060040161363e565b602060405180830381865afa158015610f6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8e919061386b565b610fad5780604051630fd0c64560e11b8152600401610854919061363e565b610fb633610d4f565b15610fd65733604051632fc6bfb160e21b8152600401610854919061363e565b6001600160a01b0382166000908152603760205260409020610b479033346123f5565b611001612353565b6001600160a01b0316336001600160a01b0316146110315760405162461bcd60e51b8152600401610854906138bf565b61103a816124bd565b50565b6000611056838361104c6124f9565b610d11878761116a565b90505b92915050565b6002600054036110815760405162461bcd60e51b815260040161085490613834565b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d2906110b690849060040161363e565b602060405180830381865afa1580156110d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f7919061386b565b6111165780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b0384166000908152603760205260409020339061113b9082856120c6565b6001600160a01b038416600090815260376020526040902061115e9082856123f5565b50506001600055505050565b6001600160a01b0391821660009081526037602090815260408083209390941682526004909201909152205490565b6111a1612353565b6001600160a01b0316336001600160a01b0316146111d15760405162461bcd60e51b8152600401610854906138bf565b61103a8161256b565b6001600160a01b031660009081526037602052604090206003015490565b6060816001600160401b03811115611212576112126137d9565b60405190808252806020026020018201604052801561123b578160200160208202803683370190505b50905060005b82811015610c045761127384848381811061125e5761125e6137ef565b9050602002016020810190610494919061346f565b828281518110611285576112856137ef565b60209081029190910101528061129a8161381b565b915050611241565b603654604051635061f96960e11b815284916001600160a01b03169063a0c3f2d2906112d290849060040161363e565b602060405180830381865afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611313919061386b565b6113325780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b03808516600090815260376020526040902060018101549091339116811461137457604051637bc65bd760e11b815260040160405180910390fd5b606d548411806113855750606e5484105b156113a357604051631b8454a360e21b815260040160405180910390fd5b60365460405163e5125a1d60e01b81526001600160a01b039091169063e5125a1d906113d7908990899089906004016136c5565b600060405180830381600087803b1580156113f157600080fd5b505af1158015611405573d6000803e3d6000fd5b50505050505050505050565b6002600054036114335760405162461bcd60e51b815260040161085490613834565b60026000558215806114455750828114155b15611463576040516376081a7b60e11b815260040160405180910390fd5b336000805b8581101561151557848482818110611482576114826137ef565b90506020020135826114949190613901565b9150611503603760008989858181106114af576114af6137ef565b90506020020160208101906114c4919061346f565b6001600160a01b03166001600160a01b03168152602001908152602001600020848787858181106114f7576114f76137ef565b905060200201356120c6565b8061150d8161381b565b915050611468565b506115208282612326565b61153d57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550505050565b611552612353565b6001600160a01b0316336001600160a01b0316146115825760405162461bcd60e51b8152600401610854906138bf565b61103a816125a0565b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d2906115bb90849060040161363e565b602060405180830381865afa1580156115d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115fc919061386b565b61161b5780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b03808316600090815260376020526040902060018101549091339116811461165d57604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163a7c2f11960e01b81526001600160a01b039092169163a7c2f11991610a3b9188919060040161388d565b3361169a6106df565b6001600160a01b0316146116c157604051630e6444a160e31b815260040160405180910390fd5b6117028585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508792508691508590506125d5565b5050505050565b60026000540361172b5760405162461bcd60e51b815260040161085490613834565b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d29061176090849060040161363e565b602060405180830381865afa15801561177d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a1919061386b565b6117c05780604051630fd0c64560e11b8152600401610854919061363e565b816000036117e1576040516331d9f7d760e01b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260408120600281015433929061180c908690613914565b9050606c548110156118315760405163ef0a995760e01b815260040160405180910390fd5b61183c828487612a13565b61152083866104b0612b15565b611851612353565b6001600160a01b0316336001600160a01b0316146118815760405162461bcd60e51b8152600401610854906138bf565b806001600160a01b03163b6000036118ac57604051637bcd509160e01b815260040160405180910390fd5b61103a81612b75565b336118be6106df565b6001600160a01b0316146118e557604051630e6444a160e31b815260040160405180910390fd5b8115611aa05760005b82811015611a655760006037600086868581811061190e5761190e6137ef565b9050602002016020810190611923919061346f565b6001600160a01b0390811682526020808301939093526040918201600090812060018101549092168152603a909352912080546001600160a01b0319169055600281015490915080156119ea5761197a8282611ee3565b506001820154611996906001600160a01b0316826104b0612b15565b6119ea5760018201548254604080518481524760208201526001600160a01b0393841693909216917f7dc5115a5aba081f5a174f56a3d02eea582824783322a4ac03f7bd388f444194910160405180910390a35b6000611a2a878786818110611a0157611a016137ef565b9050602002016020810190611a16919061346f565b60018501546001600160a01b031687612bc0565b90508015611a4f576001830154611a4d906001600160a01b0316826104b0612b15565b505b5050508080611a5d9061381b565b9150506118ee565b507f4f257d3ba23679d338f1d94296086bba5724af341b7fa31aa0ff297bfcdc62d88383604051611a97929190613927565b60405180910390a15b505050565b600260005403611ac75760405162461bcd60e51b815260040161085490613834565b6002600055611ad533610d4f565b15611af55733604051632fc6bfb160e21b8152600401610854919061363e565b606d54811180611b065750606e5481105b15611b2457604051631b8454a360e21b815260040160405180910390fd5b3433611b3581888888888888612cc0565b6001600160a01b0380871660008181526037602081815260408084206001810180549789166001600160a01b0319988916811790915581548816871782558552603a835290842080549096168517909555929091529052611b97818385611e10565b816001600160a01b0316876001600160a01b03167ffc1f1e73948cbc47c5b7f90e5601b7daccd9ad7173218486ccc74bdd051d05e860405160405180910390a350506001600055505050505050565b60d154610100900460ff1615808015611c06575060d154600160ff909116105b80611c205750303b158015611c20575060d15460ff166001145b611c835760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610854565b60d1805460ff191660011790558015611ca65760d1805461ff0019166101001790555b611caf86612b75565b611cb8856124bd565b611cc3600085612381565b611ccc8361256b565b611cd5826125a0565b8015611d1b5760d1805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6000600260005403611d475760405162461bcd60e51b815260040161085490613834565b6002600081905550611d8c33848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612f4c92505050565b9050611d983382612faf565b600160005592915050565b6000611de285858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612f4c92505050565b6001600160a01b0383166000908152603760205260409020909150611e089086836123f5565b949350505050565b6001830154839083906001600160a01b03808316911614611e4457604051637bc65bd760e11b815260040160405180910390fd5b82856002016000828254611e589190613901565b92505081905550611e7e85858760020154868960030154611e799190613901565b612fd6565b6001600160a01b03808516600090815260058701602052604090819020429055865490519116907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611ed49086815260200190565b60405180910390a25050505050565b6000611ef3836002015483613011565b905080836002016000828254611f099190613914565b9091555050600183015460028401546003850154611f399286926001600160a01b0390911691611e799086613027565b82546040518281526001600160a01b0390911690600080516020613b438339815191529060200160405180910390a292915050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611fbb576040519150601f19603f3d011682016040523d82523d6000602084013e611fc0565b606091505b5090949350505050565b6001600160a01b0380851660009081526002602090815260408083209387168352929052908120600381015484900361200557549050611e08565b6001600160a01b03861660009081526003602081815260408084206001808452828620948701548652939092528320918201548392901561206a57805460018601549094506120549085613914565b85600201546120639190613975565b9250612072565b846001015493505b8154600090612082908690613914565b61208c9089613975565b9050670de0b6b3a76400006120a18286613901565b6120ab919061398c565b86546120b79190613901565b9b9a5050505050505050505050565b6001830154839083906001600160a01b038083169116036120fa57604051639feb934760e01b815260040160405180910390fd5b8260000361211b57604051637ab0c6ad60e11b815260040160405180910390fd5b6001600160a01b038416600090815260048601602052604090205483111561215657604051630695534560e31b815260040160405180910390fd5b6036548554604051635061f96960e11b81526001600160a01b039283169263a0c3f2d2926121899291169060040161363e565b602060405180830381865afa1580156121a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ca919061386b565b801561224b575060365485546040516328bde1e160e01b81526001600160a01b03928316926328bde1e1926122049291169060040161363e565b60e060405180830381865afa158015612221573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224591906139be565b60a00151155b801561227e57506038546001600160a01b0385166000908152600587016020526040902054429161227b91613901565b10155b1561229c5760405163f19f52bd60e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546122da90869086906122ca908790613914565b868960030154611e799190613914565b84546040518481526001600160a01b03918216918616907f4d10bd049775c77bd7f255195afba5088028ecb3c7c277d393ccff7934f2f92c906020015b60405180910390a35050505050565b600081471015612349576040516304611a4560e11b815260040160405180910390fd5b6110568383611f6e565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b61271081118061239057508082115b156123ae57604051631b8454a360e21b815260040160405180910390fd5b606d819055606e82905560408051838152602081018390527f677752f5bf9541b14288833909e5ec5a478103131c1ec08c4638943be5826c14910160405180910390a15050565b6001830154839083906001600160a01b0380831691160361242957604051639feb934760e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546124679086908690612457908790613901565b868960030154611e799190613901565b6001600160a01b03808516600081815260058801602052604090819020429055875490519216917fe5541a6b6103d4fa7e021ed54fad39c66f27a76bd13d374cf6240ae6bd0bb72b906123179087815260200190565b606c8190556040518181527f372bbdb8d72373b0012f84ee5a11671e5fb72b8bea902ebca93a19cb45d32be2906020015b60405180910390a150565b6036546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa158015612542573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256691906138a6565b905090565b60388190556040518181527f4956b65267b8f1e642284bcb5037116c69a9c78d9ca576beeae0974737a4872a906020016124ee565b60398190556040518181527f02be0b73b597f2c0f138aebee162b3b0e25d5b5a26854c15dcf79176e9a1c678906020016124ee565b8351821461261e57807fae52c603227f64e4c6101dde593aa9790a16b3ac77546bd746d758511e9560a585858560405161261193929190613aa2565b60405180910390a2612a0d565b600080600080600088516001600160401b0381111561263f5761263f6137d9565b604051908082528060200260200182016040528015612668578160200160208202803683370190505b509050600089516001600160401b03811115612686576126866137d9565b6040519080825280602002602001820160405280156126af578160200160208202803683370190505b50905060008a516001600160401b038111156126cd576126cd6137d9565b6040519080825280602002602001820160405280156126f6578160200160208202803683370190505b50905060005b8b51811015612978578b8181518110612717576127176137ef565b60200260200101519550600060036000886001600160a01b03166001600160a01b031681526020019081526020016000209050612753876111da565b6001600160a01b03881660009081526001602081815260408084208f855290915290912001549096508a90036127c75786838961278f8161381b565b9a50815181106127a1576127a16137ef565b60200260200101906001600160a01b031690816001600160a01b03168152505050612966565b60028101548a11156127f557604080518082019091528681526020018a905260018101869055600281018a90555b60018101541561283f5760018101548c8c84818110612816576128166137ef565b90506020020135670de0b6b3a76400006128309190613975565b61283a919061398c565b612842565b60005b9850888160000160008282546128589190613901565b918290555090508561286a8a85613914565b8151811061287a5761287a6137ef565b6020026020010181815250506040518060400160405280826000015481526020018b81525060016000896001600160a01b03166001600160a01b0316815260200190815260200160002060008c81526020019081526020016000206000820151816000015560208201518160010155905050858160010160000181905550806001016000015484898461290d9190613914565b8151811061291d5761291d6137ef565b6020908102919091010152868d6129348a85613914565b81518110612944576129446137ef565b60200260200101906001600160a01b031690816001600160a01b031681525050505b806129708161381b565b9150506126fc565b5085156129c157858152858b51038b52877fee74f10cc50bf4b7e57fd36be7d46288795f3a9151dae97505b718b392ba14a3826040516129b89190613aec565b60405180910390a25b8a5115612a0557877f0e54e0485f70f0f63bc25889ddbf01ce1269ad6f07fdb2df573a0fbdb4d66f888c85856040516129fc93929190613aff565b60405180910390a25b505050505050505b50505050565b6001830154839083906001600160a01b03808316911614612a4757604051637bc65bd760e11b815260040160405180910390fd5b8460020154831115612a6c57604051630a8d7fa760e21b815260040160405180910390fd5b6038546001600160a01b03851660009081526005870160205260409020544291612a9591613901565b1115612ab4576040516303db082960e11b815260040160405180910390fd5b82856002016000828254612ac89190613914565b92505081905550612ae985858760020154868960030154611e799190613914565b84546040518481526001600160a01b0390911690600080516020613b4383398151915290602001611ed4565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d8060008114612b65576040519150601f19603f3d011682016040523d82523d6000602084013e612b6a565b606091505b509095945050505050565b603680546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906124ee90839061363e565b600080612bcd858561116a565b9050612bdb85858584611fca565b9150836001600160a01b0316856001600160a01b03167f0aa4d283470c904c551d18bb894d37e17674920f3261a7f854be501e25f421b784604051612c2291815260200190565b60405180910390a36001600160a01b03808616600081815260026020908152604080832094891683529381528382208281559282526003905291909120612c6c9082868580613041565b60038181018590556001600160a01b0387811660008181526020938452604080822054600187015551908152918816929091600080516020613b63833981519152910160405180910390a350509392505050565b612ccb876000611f6e565b612d16576040805163338f030160e01b81526001600160a01b03891660048201526024810191909152600a6044820152693837b7b61030b236b4b760b11b6064820152608401610854565b612d21846000611f6e565b612d6a576040805163338f030160e01b81526001600160a01b038616600482015260248101919091526008604482015267747265617375727960c01b6064820152608401610854565b606c54811015612d8d57604051630a8d7fa760e21b815260040160405180910390fd5b856001600160a01b0316876001600160a01b0316141580612dc05750836001600160a01b0316866001600160a01b031614155b15612dde5760405163dc1d04ff60e01b815260040160405180910390fd5b60408051600380825260808201909252600091602082016060803683370190505090508781600081518110612e1557612e156137ef565b60200260200101906001600160a01b031690816001600160a01b0316815250508581600181518110612e4957612e496137ef565b60200260200101906001600160a01b031690816001600160a01b0316815250508381600281518110612e7d57612e7d6137ef565b60200260200101906001600160a01b031690816001600160a01b031681525050612ea6816130d3565b15612ec4576040516329d55f9360e11b815260040160405180910390fd5b6036546040516302209ca560e31b81526001600160a01b0389811660048301528881166024830152878116604483015286811660648301526084820186905290911690631104e5289060a401600060405180830381600087803b158015612f2a57600080fd5b505af1158015612f3e573d6000803e3d6000fd5b505050505050505050505050565b600080612f576124f9565b905060005b8351811015612fa757612f89848281518110612f7a57612f7a6137ef565b60200260200101518684612bc0565b612f939084613901565b925080612f9f8161381b565b915050612f5c565b505092915050565b612fb98282612326565b610b4757604051630c3e69bb60e11b815260040160405180910390fd5b8354612fec906001600160a01b0316848461319a565b60038401556001600160a01b0390911660009081526004909201602052604090912055565b60008183106130205781611056565b5090919050565b6000818311613037576000611056565b6110568284613914565b828460030154101561305557600284018190555b6000613065856002015484613011565b905060008186600201546130799190613914565b905080156130ca576002860182905560018701548111156130ad576040516352e521bf60e11b815260040160405180910390fd5b808760010160000160008282546130c49190613914565b90915550505b50505050505050565b600081516000036130e657506000919050565b60005b600183516130f79190613914565b81101561319157600061310b826001613901565b90505b835181101561317e57838181518110613129576131296137ef565b60200260200101516001600160a01b031684838151811061314c5761314c6137ef565b60200260200101516001600160a01b03160361316c575060019392505050565b806131768161381b565b91505061310e565b50806131898161381b565b9150506130e9565b50600092915050565b60006131a46124f9565b6001600160a01b03851660009081526003602052604090206001810154600282015492935090918311156131ff5760405180604001604052806131e6886111da565b8152602090810185905281516001850155015160028301555b6001600160a01b038087166000908152600260209081526040808320938916835292905290812090613231888861116a565b9050600061324189898885611fca565b83549091508114613281578083556040518181526001600160a01b0389811691908b1690600080516020613b638339815191529060200160405180910390a35b61328e8584888a86613041565b84546001808501919091556003840187905585015484146132f557886001600160a01b0316867f81faf50e2aaf52eaba2ab841071efb9f6f0850a3e7d008b1336e6001d3d4963c87600101600001546040516132ec91815260200190565b60405180910390a35b505050505050505050565b60008083601f84011261331257600080fd5b5081356001600160401b0381111561332957600080fd5b6020830191508360208260051b850101111561334457600080fd5b9250929050565b6000806000806040858703121561336157600080fd5b84356001600160401b038082111561337857600080fd5b61338488838901613300565b9096509450602087013591508082111561339d57600080fd5b506133aa87828801613300565b95989497509550505050565b600081518084526020808501945080840160005b838110156133e6578151875295820195908201906001016133ca565b509495945050505050565b60208152600061105660208301846133b6565b6001600160a01b038116811461103a57600080fd5b60008060006040848603121561342e57600080fd5b83356001600160401b0381111561344457600080fd5b61345086828701613300565b909450925050602084013561346481613404565b809150509250925092565b60006020828403121561348157600080fd5b813561348c81613404565b9392505050565b600080604083850312156134a657600080fd5b82356134b181613404565b946020939093013593505050565b6000806000604084860312156134d457600080fd5b83356134df81613404565b925060208401356001600160401b038111156134fa57600080fd5b61350686828701613300565b9497909650939450505050565b6000806020838503121561352657600080fd5b82356001600160401b0381111561353c57600080fd5b61354885828601613300565b90969095509350505050565b6000806040838503121561356757600080fd5b50508035926020909101359150565b60006020828403121561358857600080fd5b5035919050565b600080604083850312156135a257600080fd5b82356135ad81613404565b915060208301356135bd81613404565b809150509250929050565b6000806000606084860312156135dd57600080fd5b83356135e881613404565b925060208401356135f881613404565b929592945050506040919091013590565b60008060006060848603121561361e57600080fd5b833561362981613404565b95602085013595506040909401359392505050565b6001600160a01b0391909116815260200190565b60008060008060006060868803121561366a57600080fd5b85356001600160401b038082111561368157600080fd5b61368d89838a01613300565b909750955060208801359150808211156136a657600080fd5b506136b388828901613300565b96999598509660400135949350505050565b6001600160a01b039390931683526020830191909152604082015260600190565b6000806000604084860312156136fb57600080fd5b83356001600160401b0381111561371157600080fd5b61371d86828701613300565b909790965060209590950135949350505050565b600080600080600060a0868803121561374957600080fd5b853561375481613404565b9450602086013561376481613404565b9350604086013561377481613404565b9250606086013561378481613404565b949793965091946080013592915050565b600080600080600060a086880312156137ad57600080fd5b85356137b881613404565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161382d5761382d613805565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561387d57600080fd5b8151801515811461348c57600080fd5b6001600160a01b03929092168252602082015260400190565b6000602082840312156138b857600080fd5b5051919050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b8082018082111561105957611059613805565b8181038181111561105957611059613805565b60208082528181018390526000908460408401835b8681101561396a57823561394f81613404565b6001600160a01b03168252918301919083019060010161393c565b509695505050505050565b808202811582820484141761105957611059613805565b6000826139a957634e487b7160e01b600052601260045260246000fd5b500490565b80516139b981613404565b919050565b600060e082840312156139d057600080fd5b60405160e081016001600160401b0381118282101715613a0057634e487b7160e01b600052604160045260246000fd5b604052613a0c836139ae565b8152613a1a602084016139ae565b6020820152613a2b604084016139ae565b6040820152613a3c606084016139ae565b60608201526080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b600081518084526020808501945080840160005b838110156133e65781516001600160a01b031687529582019590820190600101613a7d565b604081526000613ab56040830186613a69565b82810360208401528381526001600160fb1b03841115613ad457600080fd5b8360051b808660208401370160200195945050505050565b6020815260006110566020830184613a69565b606081526000613b126060830186613a69565b8281036020840152613b2481866133b6565b90508281036040840152613b3881856133b6565b969550505050505056fe0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75aa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ada264697066735822122084a2646a7e3b284e947649e3c4cea51c75829bcabae922a4d19175bd5ef9292564736f6c63430008110033", "devdoc": { "errors": { "ErrAdminOfAnyActivePoolForbidden(address)": [ @@ -1424,6 +1466,9 @@ "execRecordRewards(address[],uint256[],uint256)": { "details": "Records the amount of rewards `_rewards` for the pools `_consensusAddrs`. Requirements: - The method caller must be validator contract. Emits the event `PoolsUpdated` once the contract recorded the rewards successfully. Emits the event `PoolsUpdateFailed` once the input array lengths are not equal. Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period. Note: This method should be called once at the period ending." }, + "getCommissionRateRange()": { + "details": "Returns the commission rate range that the candidate can set." + }, "getManySelfStakings(address[])": { "details": "Returns the self-staking amounts of the pools." }, @@ -1457,9 +1502,6 @@ "isAdminOfActivePool(address)": { "details": "Returns whether the `_poolAdminAddr` is currently active." }, - "maxCommissionRate()": { - "details": "Returns the max commission rate that the candidate can set." - }, "minValidatorStakingAmount()": { "details": "Returns the minimum threshold for being a validator candidate." }, @@ -1475,12 +1517,12 @@ "requestUpdateCommissionRate(address,uint256,uint256)": { "details": "Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}. - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdated`." }, + "setCommissionRateRange(uint256,uint256)": { + "details": "Sets the commission rate range that a candidate can set. Requirements: - The method caller is admin. Emits the `CommissionRateRangeUpdated` event." + }, "setCooldownSecsToUndelegate(uint256)": { "details": "Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated. Requirements: - The method caller is admin. Emits the event `CooldownSecsToUndelegateUpdated`." }, - "setMaxCommissionRate(uint256)": { - "details": "Sets the max commission rate that a candidate can set. Requirements: - The method caller is admin. Emits the `MaxCommissionRateUpdated` event." - }, "setMinValidatorStakingAmount(uint256)": { "details": "Sets the minimum threshold for being a validator candidate. Requirements: - The method caller is admin. Emits the `MinValidatorStakingAmountUpdated` event." }, @@ -1524,31 +1566,31 @@ "type": "t_uint256" }, { - "astId": 28050, + "astId": 29207, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_accumulatedRps", "offset": 0, "slot": "1", - "type": "t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10572_storage))" + "type": "t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10552_storage))" }, { - "astId": 28058, + "astId": 29215, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_userReward", "offset": 0, "slot": "2", - "type": "t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage))" + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11332_storage))" }, { - "astId": 28064, + "astId": 29221, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_stakingPool", "offset": 0, "slot": "3", - "type": "t_mapping(t_address,t_struct(PoolFields)11352_storage)" + "type": "t_mapping(t_address,t_struct(PoolFields)11338_storage)" }, { - "astId": 28069, + "astId": 29226, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "______gap", "offset": 0, @@ -1556,23 +1598,23 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 6462, + "astId": 7051, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_validatorContract", "offset": 0, "slot": "54", - "type": "t_contract(IRoninValidatorSet)11984" + "type": "t_contract(IRoninValidatorSet)11973" }, { - "astId": 26357, + "astId": 27475, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_stakingPool", "offset": 0, "slot": "55", - "type": "t_mapping(t_address,t_struct(PoolDetail)10959_storage)" + "type": "t_mapping(t_address,t_struct(PoolDetail)10939_storage)" }, { - "astId": 26360, + "astId": 27478, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_cooldownSecsToUndelegate", "offset": 0, @@ -1580,7 +1622,7 @@ "type": "t_uint256" }, { - "astId": 26363, + "astId": 27481, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_waitingSecsToRevoke", "offset": 0, @@ -1588,7 +1630,7 @@ "type": "t_uint256" }, { - "astId": 26368, + "astId": 27486, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_adminOfActivePoolMapping", "offset": 0, @@ -1596,7 +1638,7 @@ "type": "t_mapping(t_address,t_address)" }, { - "astId": 26373, + "astId": 27491, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "______gap", "offset": 0, @@ -1604,7 +1646,7 @@ "type": "t_array(t_uint256)49_storage" }, { - "astId": 26806, + "astId": 27927, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_minValidatorStakingAmount", "offset": 0, @@ -1612,7 +1654,7 @@ "type": "t_uint256" }, { - "astId": 26809, + "astId": 27930, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_maxCommissionRate", "offset": 0, @@ -1620,15 +1662,23 @@ "type": "t_uint256" }, { - "astId": 26814, + "astId": 27933, "contract": "contracts/ronin/staking/Staking.sol:Staking", - "label": "______gap", + "label": "_minCommissionRate", "offset": 0, "slot": "110", - "type": "t_array(t_uint256)49_storage" + "type": "t_uint256" }, { - "astId": 27537, + "astId": 27938, + "contract": "contracts/ronin/staking/Staking.sol:Staking", + "label": "______gap", + "offset": 0, + "slot": "111", + "type": "t_array(t_uint256)48_storage" + }, + { + "astId": 28680, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "______gap", "offset": 0, @@ -1658,6 +1708,12 @@ "label": "address", "numberOfBytes": "20" }, + "t_array(t_uint256)48_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[48]", + "numberOfBytes": "1536" + }, "t_array(t_uint256)49_storage": { "base": "t_uint256", "encoding": "inplace", @@ -1675,7 +1731,7 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(IRoninValidatorSet)11984": { + "t_contract(IRoninValidatorSet)11973": { "encoding": "inplace", "label": "contract IRoninValidatorSet", "numberOfBytes": "20" @@ -1687,40 +1743,40 @@ "numberOfBytes": "32", "value": "t_address" }, - "t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11346_storage))": { + "t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11332_storage))": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => mapping(address => struct IRewardPool.UserRewardFields))", "numberOfBytes": "32", - "value": "t_mapping(t_address,t_struct(UserRewardFields)11346_storage)" + "value": "t_mapping(t_address,t_struct(UserRewardFields)11332_storage)" }, - "t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10572_storage))": { + "t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10552_storage))": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => mapping(uint256 => struct PeriodWrapperConsumer.PeriodWrapper))", "numberOfBytes": "32", - "value": "t_mapping(t_uint256,t_struct(PeriodWrapper)10572_storage)" + "value": "t_mapping(t_uint256,t_struct(PeriodWrapper)10552_storage)" }, - "t_mapping(t_address,t_struct(PoolDetail)10959_storage)": { + "t_mapping(t_address,t_struct(PoolDetail)10939_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct IBaseStaking.PoolDetail)", "numberOfBytes": "32", - "value": "t_struct(PoolDetail)10959_storage" + "value": "t_struct(PoolDetail)10939_storage" }, - "t_mapping(t_address,t_struct(PoolFields)11352_storage)": { + "t_mapping(t_address,t_struct(PoolFields)11338_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct IRewardPool.PoolFields)", "numberOfBytes": "32", - "value": "t_struct(PoolFields)11352_storage" + "value": "t_struct(PoolFields)11338_storage" }, - "t_mapping(t_address,t_struct(UserRewardFields)11346_storage)": { + "t_mapping(t_address,t_struct(UserRewardFields)11332_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct IRewardPool.UserRewardFields)", "numberOfBytes": "32", - "value": "t_struct(UserRewardFields)11346_storage" + "value": "t_struct(UserRewardFields)11332_storage" }, "t_mapping(t_address,t_uint256)": { "encoding": "mapping", @@ -1729,19 +1785,19 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_mapping(t_uint256,t_struct(PeriodWrapper)10572_storage)": { + "t_mapping(t_uint256,t_struct(PeriodWrapper)10552_storage)": { "encoding": "mapping", "key": "t_uint256", "label": "mapping(uint256 => struct PeriodWrapperConsumer.PeriodWrapper)", "numberOfBytes": "32", - "value": "t_struct(PeriodWrapper)10572_storage" + "value": "t_struct(PeriodWrapper)10552_storage" }, - "t_struct(PeriodWrapper)10572_storage": { + "t_struct(PeriodWrapper)10552_storage": { "encoding": "inplace", "label": "struct PeriodWrapperConsumer.PeriodWrapper", "members": [ { - "astId": 10569, + "astId": 10549, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "inner", "offset": 0, @@ -1749,7 +1805,7 @@ "type": "t_uint256" }, { - "astId": 10571, + "astId": 10551, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "lastPeriod", "offset": 0, @@ -1759,12 +1815,12 @@ ], "numberOfBytes": "64" }, - "t_struct(PoolDetail)10959_storage": { + "t_struct(PoolDetail)10939_storage": { "encoding": "inplace", "label": "struct IBaseStaking.PoolDetail", "members": [ { - "astId": 10944, + "astId": 10924, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "addr", "offset": 0, @@ -1772,7 +1828,7 @@ "type": "t_address" }, { - "astId": 10946, + "astId": 10926, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "admin", "offset": 0, @@ -1780,7 +1836,7 @@ "type": "t_address" }, { - "astId": 10948, + "astId": 10928, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "stakingAmount", "offset": 0, @@ -1788,7 +1844,7 @@ "type": "t_uint256" }, { - "astId": 10950, + "astId": 10930, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "stakingTotal", "offset": 0, @@ -1796,7 +1852,7 @@ "type": "t_uint256" }, { - "astId": 10954, + "astId": 10934, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "delegatingAmount", "offset": 0, @@ -1804,7 +1860,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 10958, + "astId": 10938, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "lastDelegatingTimestamp", "offset": 0, @@ -1814,12 +1870,12 @@ ], "numberOfBytes": "192" }, - "t_struct(PoolFields)11352_storage": { + "t_struct(PoolFields)11338_storage": { "encoding": "inplace", "label": "struct IRewardPool.PoolFields", "members": [ { - "astId": 11348, + "astId": 11334, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "aRps", "offset": 0, @@ -1827,22 +1883,22 @@ "type": "t_uint256" }, { - "astId": 11351, + "astId": 11337, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "shares", "offset": 0, "slot": "1", - "type": "t_struct(PeriodWrapper)10572_storage" + "type": "t_struct(PeriodWrapper)10552_storage" } ], "numberOfBytes": "96" }, - "t_struct(UserRewardFields)11346_storage": { + "t_struct(UserRewardFields)11332_storage": { "encoding": "inplace", "label": "struct IRewardPool.UserRewardFields", "members": [ { - "astId": 11339, + "astId": 11325, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "debited", "offset": 0, @@ -1850,7 +1906,7 @@ "type": "t_uint256" }, { - "astId": 11341, + "astId": 11327, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "aRps", "offset": 0, @@ -1858,7 +1914,7 @@ "type": "t_uint256" }, { - "astId": 11343, + "astId": 11329, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "lowestAmount", "offset": 0, @@ -1866,7 +1922,7 @@ "type": "t_uint256" }, { - "astId": 11345, + "astId": 11331, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "lastPeriod", "offset": 0, diff --git a/deployments/ronin-testnet/StakingVestingLogic.json b/deployments/ronin-testnet/StakingVestingLogic.json index ada1ad701..05c90e98a 100644 --- a/deployments/ronin-testnet/StakingVestingLogic.json +++ b/deployments/ronin-testnet/StakingVestingLogic.json @@ -1,5 +1,5 @@ { - "address": "0x86988a1479883172365344507BDB668fd826113e", + "address": "0x9AdadB81E6Ed774515971C6840E9815C06e4E7A7", "abi": [ { "inputs": [], @@ -314,41 +314,41 @@ "type": "function" } ], - "transactionHash": "0x6cb1679df841da6d096ace4f69f75ca66396d5ccdab9b73e20474fa95e86f328", + "transactionHash": "0xa763ef6ddd2b5fc09dcf947057dc358a26b71e873467b73600ee852aab82c5b5", "receipt": { "to": null, "from": "0x968D0Cd7343f711216817E617d3f92a23dC91c07", - "contractAddress": "0x86988a1479883172365344507BDB668fd826113e", + "contractAddress": "0x9AdadB81E6Ed774515971C6840E9815C06e4E7A7", "transactionIndex": 0, - "gasUsed": "546050", - "logsBloom": "0x00000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000200000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", - "blockHash": "0xb05a6127ab27736de1e9e9d0bb13eba387db1e3567083c1114897e27afb658e2", - "transactionHash": "0x6cb1679df841da6d096ace4f69f75ca66396d5ccdab9b73e20474fa95e86f328", + "gasUsed": "546074", + "logsBloom": "0x00000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000008000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x7825e09bb76db05ae493b68fdb41442773b99e6f9ae376cc21172d2809dfa138", + "transactionHash": "0xa763ef6ddd2b5fc09dcf947057dc358a26b71e873467b73600ee852aab82c5b5", "logs": [ { "transactionIndex": 0, - "blockNumber": 13050762, - "transactionHash": "0x6cb1679df841da6d096ace4f69f75ca66396d5ccdab9b73e20474fa95e86f328", - "address": "0x86988a1479883172365344507BDB668fd826113e", + "blockNumber": 16816869, + "transactionHash": "0xa763ef6ddd2b5fc09dcf947057dc358a26b71e873467b73600ee852aab82c5b5", + "address": "0x9AdadB81E6Ed774515971C6840E9815C06e4E7A7", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", "logIndex": 0, - "blockHash": "0xb05a6127ab27736de1e9e9d0bb13eba387db1e3567083c1114897e27afb658e2" + "blockHash": "0x7825e09bb76db05ae493b68fdb41442773b99e6f9ae376cc21172d2809dfa138" } ], - "blockNumber": 13050762, - "cumulativeGasUsed": "546050", + "blockNumber": 16816869, + "cumulativeGasUsed": "546074", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 3, - "solcInputHash": "d00a46919a8595a1f6b347cca5808c82", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"BlockProducerBonusPerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"blockProducerAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bridgeOperatorAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"BonusTransferFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"blockProducerAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bridgeOperatorAmount\",\"type\":\"uint256\"}],\"name\":\"BonusTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorBonusPerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"blockProducerBlockBonus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"bridgeOperatorBlockBonus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__blockProducerBonusPerBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__bridgeOperatorBonusPerBlock\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastBlockSendingBonus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"receiveRON\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_forBlockProducer\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"_forBridgeOperator\",\"type\":\"bool\"}],\"name\":\"requestBonus\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_blockProducerBonus\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_bridgeOperatorBonus\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"setBlockProducerBonusPerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"setBridgeOperatorBonusPerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrInsufficientBalance()\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrRecipientRevert()\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"blockProducerBlockBonus(uint256)\":{\"details\":\"Returns the bonus amount for the block producer at `_block`.\"},\"bridgeOperatorBlockBonus(uint256)\":{\"details\":\"Returns the bonus amount for the bridge validator at `_block`.\"},\"initialize(address,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"receiveRON()\":{\"details\":\"Receives RON from any address.\"},\"requestBonus(bool,bool)\":{\"details\":\"Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined. Requirements: - The method caller must be validator contract. - The method must be called only once per block. Emits the event `BonusTransferred` or `BonusTransferFailed`. Notes: - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method will not be reverted, and the underlying nodes does not hang.\",\"params\":{\"_forBlockProducer\":\"Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\",\"_forBridgeOperator\":\"Indicates whether requesting the bonus for the bridge operator.\"},\"returns\":{\"_blockProducerBonus\":\"The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\",\"_bridgeOperatorBonus\":\"The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\",\"_success\":\"Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\"}},\"setBlockProducerBonusPerBlock(uint256)\":{\"details\":\"Sets the bonus amount per block for block producer. Emits the event `BlockProducerBonusPerBlockUpdated`. Requirements: - The method caller is admin.\"},\"setBridgeOperatorBonusPerBlock(uint256)\":{\"details\":\"Sets the bonus amount per block for bridge operator. Emits the event `BridgeOperatorBonusPerBlockUpdated`. Requirements: - The method caller is admin.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"}},\"stateVariables\":{\"_blockProducerBonusPerBlock\":{\"details\":\"The block bonus for the block producer whenever a new block is mined.\"},\"_bridgeOperatorBonusPerBlock\":{\"details\":\"The block bonus for the bridge operator whenever a new block is mined.\"},\"lastBlockSendingBonus\":{\"details\":\"The last block number that the staking vesting sent.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/StakingVesting.sol\":\"StakingVesting\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/RONTransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract RONTransferHelper {\\n /// @dev Error of recipient not accepting RON when transfer RON.\\n error ErrRecipientRevert();\\n /// @dev Error of sender has insufficient balance.\\n error ErrInsufficientBalance();\\n\\n /**\\n * @dev See `_sendRON`.\\n * Reverts if the recipient does not receive RON.\\n */\\n function _transferRON(address payable _recipient, uint256 _amount) internal {\\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\\n }\\n\\n /**\\n * @dev Send `_amount` RON to the address `_recipient`.\\n * Returns whether the recipient receives RON or not.\\n * Reverts once the contract balance is insufficient.\\n *\\n * Note: consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\\n return _unsafeSendRON(_recipient, _amount);\\n }\\n\\n /**\\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\\n * the call does not revert.\\n *\\n * Note:\\n * - Does not assert whether the balance of sender is sufficient.\\n * - Does not assert whether the recipient accepts RON.\\n * - Consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount }(\\\"\\\");\\n }\\n\\n /**\\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\\n */\\n function _unsafeSendRON(\\n address payable _recipient,\\n uint256 _amount,\\n uint256 _gas\\n ) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbf47d40b2431cf190fa737b803e4cb6fb55aee3f8804470da57a9e340f7914f8\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/interfaces/IStakingVesting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IStakingVesting {\\n /// @dev Emitted when the block bonus for block producer is transferred.\\n event BonusTransferred(\\n uint256 indexed blockNumber,\\n address indexed recipient,\\n uint256 blockProducerAmount,\\n uint256 bridgeOperatorAmount\\n );\\n /// @dev Emitted when the transfer of block bonus for block producer is failed.\\n event BonusTransferFailed(\\n uint256 indexed blockNumber,\\n address indexed recipient,\\n uint256 blockProducerAmount,\\n uint256 bridgeOperatorAmount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the block bonus for block producer is updated\\n event BlockProducerBonusPerBlockUpdated(uint256);\\n /// @dev Emitted when the block bonus for bridge operator is updated\\n event BridgeOperatorBonusPerBlockUpdated(uint256);\\n\\n /**\\n * @dev Returns the bonus amount for the block producer at `_block`.\\n */\\n function blockProducerBlockBonus(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns the bonus amount for the bridge validator at `_block`.\\n */\\n function bridgeOperatorBlockBonus(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Receives RON from any address.\\n */\\n function receiveRON() external payable;\\n\\n /**\\n * @dev Returns the last block number that the staking vesting is sent.\\n */\\n function lastBlockSendingBonus() external view returns (uint256);\\n\\n /**\\n * @dev Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n * - The method must be called only once per block.\\n *\\n * Emits the event `BonusTransferred` or `BonusTransferFailed`.\\n *\\n * Notes:\\n * - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method\\n * will not be reverted, and the underlying nodes does not hang.\\n *\\n * @param _forBlockProducer Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\\n * @param _forBridgeOperator Indicates whether requesting the bonus for the bridge operator.\\n *\\n * @return _success Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\\n * @return _blockProducerBonus The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\\n * @return _bridgeOperatorBonus The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\\n *\\n */\\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\\n external\\n returns (\\n bool _success,\\n uint256 _blockProducerBonus,\\n uint256 _bridgeOperatorBonus\\n );\\n\\n /**\\n * @dev Sets the bonus amount per block for block producer.\\n *\\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n */\\n function setBlockProducerBonusPerBlock(uint256 _amount) external;\\n\\n /**\\n * @dev Sets the bonus amount per block for bridge operator.\\n *\\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n */\\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0x6705fdccf03c4acd34ceb1034c2ab556c901781d6d5597e63f257eafe75cf1ae\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function grantValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function requestRevokeCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0x3d6347795c481a997d2597cc11f6feeadcdbc47a4134d7fa8e82c6a5c149f705\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0xe4060b7e3b04a0043bd334011fe4ba67c990b0484dad52d7f14b35040989b6ab\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0xdeb929875d06c5dfb8562029ccc2922e1c5238f2dc67c8c61acad614f5fe1e28\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n // Error thrown when receives RON from neither staking vesting contract nor staking contract\\\"\\n error UnauthorizedReceiveRON();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xdad1fcf4cc7bbca1c756b5ca81328d0f5b603043e6e254172781808b431d2922\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address[] calldata _blockProducers) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producers are deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address[] calldata _blockProducers, uint256 _period)\\n external\\n view\\n returns (bool[] memory);\\n}\\n\",\"keccak256\":\"0x310f321625fac8b7dbabfdad36e82b960b0b1f7bf0e5b70b763e45438b8a8d30\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error InvalidMaxPrioitizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator or not.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the consensus address is operatoring the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0xccee56f5f513fd1faf5663db10044155bae27b07686ca66d9d5b967cbc3b6e16\",\"license\":\"MIT\"},\"contracts/ronin/StakingVesting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../interfaces/IStakingVesting.sol\\\";\\nimport \\\"../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../extensions/RONTransferHelper.sol\\\";\\n\\ncontract StakingVesting is IStakingVesting, HasValidatorContract, RONTransferHelper, Initializable {\\n /// @dev The block bonus for the block producer whenever a new block is mined.\\n uint256 internal _blockProducerBonusPerBlock;\\n /// @dev The block bonus for the bridge operator whenever a new block is mined.\\n uint256 internal _bridgeOperatorBonusPerBlock;\\n /// @dev The last block number that the staking vesting sent.\\n uint256 public lastBlockSendingBonus;\\n\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 __blockProducerBonusPerBlock,\\n uint256 __bridgeOperatorBonusPerBlock\\n ) external payable initializer {\\n _setValidatorContract(__validatorContract);\\n _setBlockProducerBonusPerBlock(__blockProducerBonusPerBlock);\\n _setBridgeOperatorBonusPerBlock(__bridgeOperatorBonusPerBlock);\\n }\\n\\n /**\\n * @inheritdoc IStakingVesting\\n */\\n function receiveRON() external payable {}\\n\\n /**\\n * @inheritdoc IStakingVesting\\n */\\n function blockProducerBlockBonus(\\n uint256 /* _block */\\n ) public view override returns (uint256) {\\n return _blockProducerBonusPerBlock;\\n }\\n\\n /**\\n * @inheritdoc IStakingVesting\\n */\\n function bridgeOperatorBlockBonus(\\n uint256 /* _block */\\n ) public view override returns (uint256) {\\n return _bridgeOperatorBonusPerBlock;\\n }\\n\\n /**\\n * @inheritdoc IStakingVesting\\n */\\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\\n external\\n override\\n onlyValidatorContract\\n returns (\\n bool _success,\\n uint256 _blockProducerBonus,\\n uint256 _bridgeOperatorBonus\\n )\\n {\\n require(block.number > lastBlockSendingBonus, \\\"StakingVesting: bonus for already sent\\\");\\n lastBlockSendingBonus = block.number;\\n\\n _blockProducerBonus = _forBlockProducer ? blockProducerBlockBonus(block.number) : 0;\\n _bridgeOperatorBonus = _forBridgeOperator ? bridgeOperatorBlockBonus(block.number) : 0;\\n\\n uint256 _totalAmount = _blockProducerBonus + _bridgeOperatorBonus;\\n\\n if (_totalAmount > 0) {\\n address payable _validatorContractAddr = payable(validatorContract());\\n\\n _success = _unsafeSendRON(_validatorContractAddr, _totalAmount);\\n\\n if (!_success) {\\n emit BonusTransferFailed(\\n block.number,\\n _validatorContractAddr,\\n _blockProducerBonus,\\n _bridgeOperatorBonus,\\n address(this).balance\\n );\\n return (_success, 0, 0);\\n }\\n\\n emit BonusTransferred(block.number, _validatorContractAddr, _blockProducerBonus, _bridgeOperatorBonus);\\n }\\n }\\n\\n /**\\n * @inheritdoc IStakingVesting\\n */\\n function setBlockProducerBonusPerBlock(uint256 _amount) external override onlyAdmin {\\n _setBlockProducerBonusPerBlock(_amount);\\n }\\n\\n /**\\n * @inheritdoc IStakingVesting\\n */\\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external override onlyAdmin {\\n _setBridgeOperatorBonusPerBlock(_amount);\\n }\\n\\n /**\\n * @dev Sets the bonus amount per block for block producer.\\n *\\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\\n *\\n */\\n function _setBlockProducerBonusPerBlock(uint256 _amount) internal {\\n _blockProducerBonusPerBlock = _amount;\\n emit BlockProducerBonusPerBlockUpdated(_amount);\\n }\\n\\n /**\\n * @dev Sets the bonus amount per block for bridge operator.\\n *\\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\\n *\\n */\\n function _setBridgeOperatorBonusPerBlock(uint256 _amount) internal {\\n _bridgeOperatorBonusPerBlock = _amount;\\n emit BridgeOperatorBonusPerBlockUpdated(_amount);\\n }\\n}\\n\",\"keccak256\":\"0x4276fc004a6e0f6ab87b302aba515b8286b5512ca0e1c3a0360173e7cebeec63\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100eb565b600054600160a81b900460ff161561008c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff600160a01b909104811610156100e9576000805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61086d806100fa6000396000f3fe6080604052600436106100915760003560e01c806399439089116100595780639943908914610131578063cdf64a7614610159578063d8209d0714610179578063f13ba6441461019b578063fa8674a1146101bb57600080fd5b80630634f5b9146100965780630d9160e7146100d857806359f778df146100fc57806367e9941c146100fe5780637a1ac61e1461011e575b600080fd5b3480156100a257600080fd5b506100b66100b1366004610716565b6101dd565b6040805193151584526020840192909252908201526060015b60405180910390f35b3480156100e457600080fd5b506100ee60035481565b6040519081526020016100cf565b005b34801561010a57600080fd5b506100fc610119366004610749565b610385565b6100fc61012c366004610779565b6103c9565b34801561013d57600080fd5b506000546040516001600160a01b0390911681526020016100cf565b34801561016557600080fd5b506100fc6101743660046107ac565b61050b565b34801561018557600080fd5b506100ee610194366004610749565b5060015490565b3480156101a757600080fd5b506100fc6101b6366004610749565b610577565b3480156101c757600080fd5b506100ee6101d6366004610749565b5060025490565b60008080336101f46000546001600160a01b031690565b6001600160a01b03161461021b57604051630e6444a160e31b815260040160405180910390fd5b60035443116102805760405162461bcd60e51b815260206004820152602660248201527f5374616b696e6756657374696e673a20626f6e757320666f7220616c726561646044820152651e481cd95b9d60d21b60648201526084015b60405180910390fd5b4360035584610290576000610294565b6001545b9150836102a25760006102a6565b6002545b905060006102b482846107ce565b9050801561037c576000546001600160a01b03166102d281836105b8565b945084610334576040805185815260208101859052478183015290516001600160a01b0383169143917f137e697384eeada9cf7614b88e4ac940aeff18d0fef7e86bce1abdc812b95e099181900360600190a3506000925082915061037e9050565b60408051858152602081018590526001600160a01b0383169143917f60200441f885b45b3b7f1fdc45a47bb0d0a0884a6a17722f8dd7232830de9bd2910160405180910390a3505b505b9250925092565b61038d610614565b6001600160a01b0316336001600160a01b0316146103bd5760405162461bcd60e51b8152600401610277906107f5565b6103c681610642565b50565b600054600160a81b900460ff16158080156103f157506000546001600160a01b90910460ff16105b806104125750303b1580156104125750600054600160a01b900460ff166001145b6104755760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610277565b6000805460ff60a01b1916600160a01b17905580156104a2576000805460ff60a81b1916600160a81b1790555b6104ab8461067e565b6104b4836106cc565b6104bd82610642565b8015610505576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b610513610614565b6001600160a01b0316336001600160a01b0316146105435760405162461bcd60e51b8152600401610277906107f5565b806001600160a01b03163b60000361056e57604051637bcd509160e01b815260040160405180910390fd5b6103c68161067e565b61057f610614565b6001600160a01b0316336001600160a01b0316146105af5760405162461bcd60e51b8152600401610277906107f5565b6103c6816106cc565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610605576040519150601f19603f3d011682016040523d82523d6000602084013e61060a565b606091505b5090949350505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b60028190556040518181527f57a23b4b11f619fb9dea21a5a8115bb90103c1043eb3318d773558829d25f12c906020015b60405180910390a150565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990602001610673565b60018190556040518181527f861f03c645467325a586235bb3155834f1dddf12413d0a802f416eb6d4035e6d90602001610673565b8035801515811461071157600080fd5b919050565b6000806040838503121561072957600080fd5b61073283610701565b915061074060208401610701565b90509250929050565b60006020828403121561075b57600080fd5b5035919050565b80356001600160a01b038116811461071157600080fd5b60008060006060848603121561078e57600080fd5b61079784610762565b95602085013595506040909401359392505050565b6000602082840312156107be57600080fd5b6107c782610762565b9392505050565b808201808211156107ef57634e487b7160e01b600052601160045260246000fd5b92915050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b60608201526080019056fea26469706673582212202d2b74a9a574be042867ede7c7bbc93e725ae0a5197974a54156c06575b46e9664736f6c63430008110033", - "deployedBytecode": "0x6080604052600436106100915760003560e01c806399439089116100595780639943908914610131578063cdf64a7614610159578063d8209d0714610179578063f13ba6441461019b578063fa8674a1146101bb57600080fd5b80630634f5b9146100965780630d9160e7146100d857806359f778df146100fc57806367e9941c146100fe5780637a1ac61e1461011e575b600080fd5b3480156100a257600080fd5b506100b66100b1366004610716565b6101dd565b6040805193151584526020840192909252908201526060015b60405180910390f35b3480156100e457600080fd5b506100ee60035481565b6040519081526020016100cf565b005b34801561010a57600080fd5b506100fc610119366004610749565b610385565b6100fc61012c366004610779565b6103c9565b34801561013d57600080fd5b506000546040516001600160a01b0390911681526020016100cf565b34801561016557600080fd5b506100fc6101743660046107ac565b61050b565b34801561018557600080fd5b506100ee610194366004610749565b5060015490565b3480156101a757600080fd5b506100fc6101b6366004610749565b610577565b3480156101c757600080fd5b506100ee6101d6366004610749565b5060025490565b60008080336101f46000546001600160a01b031690565b6001600160a01b03161461021b57604051630e6444a160e31b815260040160405180910390fd5b60035443116102805760405162461bcd60e51b815260206004820152602660248201527f5374616b696e6756657374696e673a20626f6e757320666f7220616c726561646044820152651e481cd95b9d60d21b60648201526084015b60405180910390fd5b4360035584610290576000610294565b6001545b9150836102a25760006102a6565b6002545b905060006102b482846107ce565b9050801561037c576000546001600160a01b03166102d281836105b8565b945084610334576040805185815260208101859052478183015290516001600160a01b0383169143917f137e697384eeada9cf7614b88e4ac940aeff18d0fef7e86bce1abdc812b95e099181900360600190a3506000925082915061037e9050565b60408051858152602081018590526001600160a01b0383169143917f60200441f885b45b3b7f1fdc45a47bb0d0a0884a6a17722f8dd7232830de9bd2910160405180910390a3505b505b9250925092565b61038d610614565b6001600160a01b0316336001600160a01b0316146103bd5760405162461bcd60e51b8152600401610277906107f5565b6103c681610642565b50565b600054600160a81b900460ff16158080156103f157506000546001600160a01b90910460ff16105b806104125750303b1580156104125750600054600160a01b900460ff166001145b6104755760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610277565b6000805460ff60a01b1916600160a01b17905580156104a2576000805460ff60a81b1916600160a81b1790555b6104ab8461067e565b6104b4836106cc565b6104bd82610642565b8015610505576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b610513610614565b6001600160a01b0316336001600160a01b0316146105435760405162461bcd60e51b8152600401610277906107f5565b806001600160a01b03163b60000361056e57604051637bcd509160e01b815260040160405180910390fd5b6103c68161067e565b61057f610614565b6001600160a01b0316336001600160a01b0316146105af5760405162461bcd60e51b8152600401610277906107f5565b6103c6816106cc565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114610605576040519150601f19603f3d011682016040523d82523d6000602084013e61060a565b606091505b5090949350505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b60028190556040518181527f57a23b4b11f619fb9dea21a5a8115bb90103c1043eb3318d773558829d25f12c906020015b60405180910390a150565b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990602001610673565b60018190556040518181527f861f03c645467325a586235bb3155834f1dddf12413d0a802f416eb6d4035e6d90602001610673565b8035801515811461071157600080fd5b919050565b6000806040838503121561072957600080fd5b61073283610701565b915061074060208401610701565b90509250929050565b60006020828403121561075b57600080fd5b5035919050565b80356001600160a01b038116811461071157600080fd5b60008060006060848603121561078e57600080fd5b61079784610762565b95602085013595506040909401359392505050565b6000602082840312156107be57600080fd5b6107c782610762565b9392505050565b808201808211156107ef57634e487b7160e01b600052601160045260246000fd5b92915050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b60608201526080019056fea26469706673582212202d2b74a9a574be042867ede7c7bbc93e725ae0a5197974a54156c06575b46e9664736f6c63430008110033", + "numDeployments": 4, + "solcInputHash": "85b953b22882c536a643bf4b61b3153b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"BlockProducerBonusPerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"blockProducerAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bridgeOperatorAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"BonusTransferFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"blockNumber\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"blockProducerAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bridgeOperatorAmount\",\"type\":\"uint256\"}],\"name\":\"BonusTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorBonusPerBlockUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"blockProducerBlockBonus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"bridgeOperatorBlockBonus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__blockProducerBonusPerBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__bridgeOperatorBonusPerBlock\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"lastBlockSendingBonus\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"receiveRON\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bool\",\"name\":\"_forBlockProducer\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"_forBridgeOperator\",\"type\":\"bool\"}],\"name\":\"requestBonus\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_success\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_blockProducerBonus\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_bridgeOperatorBonus\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"setBlockProducerBonusPerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"setBridgeOperatorBonusPerBlock\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrInsufficientBalance()\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrRecipientRevert()\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"blockProducerBlockBonus(uint256)\":{\"details\":\"Returns the bonus amount for the block producer at `_block`.\"},\"bridgeOperatorBlockBonus(uint256)\":{\"details\":\"Returns the bonus amount for the bridge validator at `_block`.\"},\"initialize(address,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"receiveRON()\":{\"details\":\"Receives RON from any address.\"},\"requestBonus(bool,bool)\":{\"details\":\"Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined. Requirements: - The method caller must be validator contract. - The method must be called only once per block. Emits the event `BonusTransferred` or `BonusTransferFailed`. Notes: - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method will not be reverted, and the underlying nodes does not hang.\",\"params\":{\"_forBlockProducer\":\"Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\",\"_forBridgeOperator\":\"Indicates whether requesting the bonus for the bridge operator.\"},\"returns\":{\"_blockProducerBonus\":\"The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\",\"_bridgeOperatorBonus\":\"The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\",\"_success\":\"Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\"}},\"setBlockProducerBonusPerBlock(uint256)\":{\"details\":\"Sets the bonus amount per block for block producer. Emits the event `BlockProducerBonusPerBlockUpdated`. Requirements: - The method caller is admin.\"},\"setBridgeOperatorBonusPerBlock(uint256)\":{\"details\":\"Sets the bonus amount per block for bridge operator. Emits the event `BridgeOperatorBonusPerBlockUpdated`. Requirements: - The method caller is admin.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"}},\"stateVariables\":{\"_blockProducerBonusPerBlock\":{\"details\":\"The block bonus for the block producer whenever a new block is mined.\"},\"_bridgeOperatorBonusPerBlock\":{\"details\":\"The block bonus for the bridge operator whenever a new block is mined.\"},\"lastBlockSendingBonus\":{\"details\":\"The last block number that the staking vesting sent.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/StakingVesting.sol\":\"StakingVesting\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/RONTransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract RONTransferHelper {\\n /// @dev Error of recipient not accepting RON when transfer RON.\\n error ErrRecipientRevert();\\n /// @dev Error of sender has insufficient balance.\\n error ErrInsufficientBalance();\\n\\n /**\\n * @dev See `_sendRON`.\\n * Reverts if the recipient does not receive RON.\\n */\\n function _transferRON(address payable _recipient, uint256 _amount) internal {\\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\\n }\\n\\n /**\\n * @dev Send `_amount` RON to the address `_recipient`.\\n * Returns whether the recipient receives RON or not.\\n * Reverts once the contract balance is insufficient.\\n *\\n * Note: consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\\n return _unsafeSendRON(_recipient, _amount);\\n }\\n\\n /**\\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\\n * the call does not revert.\\n *\\n * Note:\\n * - Does not assert whether the balance of sender is sufficient.\\n * - Does not assert whether the recipient accepts RON.\\n * - Consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount }(\\\"\\\");\\n }\\n\\n /**\\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\\n */\\n function _unsafeSendRON(\\n address payable _recipient,\\n uint256 _amount,\\n uint256 _gas\\n ) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbf47d40b2431cf190fa737b803e4cb6fb55aee3f8804470da57a9e340f7914f8\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/interfaces/IStakingVesting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IStakingVesting {\\n /// @dev Emitted when the block bonus for block producer is transferred.\\n event BonusTransferred(\\n uint256 indexed blockNumber,\\n address indexed recipient,\\n uint256 blockProducerAmount,\\n uint256 bridgeOperatorAmount\\n );\\n /// @dev Emitted when the transfer of block bonus for block producer is failed.\\n event BonusTransferFailed(\\n uint256 indexed blockNumber,\\n address indexed recipient,\\n uint256 blockProducerAmount,\\n uint256 bridgeOperatorAmount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the block bonus for block producer is updated\\n event BlockProducerBonusPerBlockUpdated(uint256);\\n /// @dev Emitted when the block bonus for bridge operator is updated\\n event BridgeOperatorBonusPerBlockUpdated(uint256);\\n\\n /**\\n * @dev Returns the bonus amount for the block producer at `_block`.\\n */\\n function blockProducerBlockBonus(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns the bonus amount for the bridge validator at `_block`.\\n */\\n function bridgeOperatorBlockBonus(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Receives RON from any address.\\n */\\n function receiveRON() external payable;\\n\\n /**\\n * @dev Returns the last block number that the staking vesting is sent.\\n */\\n function lastBlockSendingBonus() external view returns (uint256);\\n\\n /**\\n * @dev Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n * - The method must be called only once per block.\\n *\\n * Emits the event `BonusTransferred` or `BonusTransferFailed`.\\n *\\n * Notes:\\n * - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method\\n * will not be reverted, and the underlying nodes does not hang.\\n *\\n * @param _forBlockProducer Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\\n * @param _forBridgeOperator Indicates whether requesting the bonus for the bridge operator.\\n *\\n * @return _success Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\\n * @return _blockProducerBonus The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\\n * @return _bridgeOperatorBonus The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\\n *\\n */\\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\\n external\\n returns (\\n bool _success,\\n uint256 _blockProducerBonus,\\n uint256 _bridgeOperatorBonus\\n );\\n\\n /**\\n * @dev Sets the bonus amount per block for block producer.\\n *\\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n */\\n function setBlockProducerBonusPerBlock(uint256 _amount) external;\\n\\n /**\\n * @dev Sets the bonus amount per block for bridge operator.\\n *\\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n */\\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0x6705fdccf03c4acd34ceb1034c2ab556c901781d6d5597e63f257eafe75cf1ae\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/ronin/StakingVesting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../interfaces/IStakingVesting.sol\\\";\\nimport \\\"../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../extensions/RONTransferHelper.sol\\\";\\n\\ncontract StakingVesting is IStakingVesting, HasValidatorContract, RONTransferHelper, Initializable {\\n /// @dev The block bonus for the block producer whenever a new block is mined.\\n uint256 internal _blockProducerBonusPerBlock;\\n /// @dev The block bonus for the bridge operator whenever a new block is mined.\\n uint256 internal _bridgeOperatorBonusPerBlock;\\n /// @dev The last block number that the staking vesting sent.\\n uint256 public lastBlockSendingBonus;\\n\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 __blockProducerBonusPerBlock,\\n uint256 __bridgeOperatorBonusPerBlock\\n ) external payable initializer {\\n _setValidatorContract(__validatorContract);\\n _setBlockProducerBonusPerBlock(__blockProducerBonusPerBlock);\\n _setBridgeOperatorBonusPerBlock(__bridgeOperatorBonusPerBlock);\\n }\\n\\n /**\\n * @inheritdoc IStakingVesting\\n */\\n function receiveRON() external payable {}\\n\\n /**\\n * @inheritdoc IStakingVesting\\n */\\n function blockProducerBlockBonus(\\n uint256 /* _block */\\n ) public view override returns (uint256) {\\n return _blockProducerBonusPerBlock;\\n }\\n\\n /**\\n * @inheritdoc IStakingVesting\\n */\\n function bridgeOperatorBlockBonus(\\n uint256 /* _block */\\n ) public view override returns (uint256) {\\n return _bridgeOperatorBonusPerBlock;\\n }\\n\\n /**\\n * @inheritdoc IStakingVesting\\n */\\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\\n external\\n override\\n onlyValidatorContract\\n returns (\\n bool _success,\\n uint256 _blockProducerBonus,\\n uint256 _bridgeOperatorBonus\\n )\\n {\\n require(block.number > lastBlockSendingBonus, \\\"StakingVesting: bonus for already sent\\\");\\n lastBlockSendingBonus = block.number;\\n\\n _blockProducerBonus = _forBlockProducer ? blockProducerBlockBonus(block.number) : 0;\\n _bridgeOperatorBonus = _forBridgeOperator ? bridgeOperatorBlockBonus(block.number) : 0;\\n\\n uint256 _totalAmount = _blockProducerBonus + _bridgeOperatorBonus;\\n\\n if (_totalAmount > 0) {\\n address payable _validatorContractAddr = payable(validatorContract());\\n\\n _success = _unsafeSendRON(_validatorContractAddr, _totalAmount);\\n\\n if (!_success) {\\n emit BonusTransferFailed(\\n block.number,\\n _validatorContractAddr,\\n _blockProducerBonus,\\n _bridgeOperatorBonus,\\n address(this).balance\\n );\\n return (_success, 0, 0);\\n }\\n\\n emit BonusTransferred(block.number, _validatorContractAddr, _blockProducerBonus, _bridgeOperatorBonus);\\n }\\n }\\n\\n /**\\n * @inheritdoc IStakingVesting\\n */\\n function setBlockProducerBonusPerBlock(uint256 _amount) external override onlyAdmin {\\n _setBlockProducerBonusPerBlock(_amount);\\n }\\n\\n /**\\n * @inheritdoc IStakingVesting\\n */\\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external override onlyAdmin {\\n _setBridgeOperatorBonusPerBlock(_amount);\\n }\\n\\n /**\\n * @dev Sets the bonus amount per block for block producer.\\n *\\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\\n *\\n */\\n function _setBlockProducerBonusPerBlock(uint256 _amount) internal {\\n _blockProducerBonusPerBlock = _amount;\\n emit BlockProducerBonusPerBlockUpdated(_amount);\\n }\\n\\n /**\\n * @dev Sets the bonus amount per block for bridge operator.\\n *\\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\\n *\\n */\\n function _setBridgeOperatorBonusPerBlock(uint256 _amount) internal {\\n _bridgeOperatorBonusPerBlock = _amount;\\n emit BridgeOperatorBonusPerBlockUpdated(_amount);\\n }\\n}\\n\",\"keccak256\":\"0x4276fc004a6e0f6ab87b302aba515b8286b5512ca0e1c3a0360173e7cebeec63\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100eb565b600054600160a81b900460ff161561008c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff600160a01b909104811610156100e9576000805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61086d806100fa6000396000f3fe6080604052600436106100815760003560e01c80630634f5b9146100865780630d9160e7146100c857806359f778df146100ec57806367e9941c146100ee5780637a1ac61e1461010e5780639943908914610121578063cdf64a7614610143578063d8209d0714610163578063f13ba64414610185578063fa8674a1146101a5575b600080fd5b34801561009257600080fd5b506100a66100a1366004610702565b6101c7565b6040805193151584526020840192909252908201526060015b60405180910390f35b3480156100d457600080fd5b506100de60035481565b6040519081526020016100bf565b005b3480156100fa57600080fd5b506100ec610109366004610735565b610365565b6100ec61011c366004610765565b6103a9565b34801561012d57600080fd5b506101366104eb565b6040516100bf9190610798565b34801561014f57600080fd5b506100ec61015e3660046107ac565b6104fa565b34801561016f57600080fd5b506100de61017e366004610735565b5060015490565b34801561019157600080fd5b506100ec6101a0366004610735565b610566565b3480156101b157600080fd5b506100de6101c0366004610735565b5060025490565b60008080336101d46104eb565b6001600160a01b0316146101fb57604051630e6444a160e31b815260040160405180910390fd5b60035443116102605760405162461bcd60e51b815260206004820152602660248201527f5374616b696e6756657374696e673a20626f6e757320666f7220616c726561646044820152651e481cd95b9d60d21b60648201526084015b60405180910390fd5b4360035584610270576000610274565b6001545b915083610282576000610286565b6002545b9050600061029482846107ce565b9050801561035c5760006102a66104eb565b90506102b281836105a7565b945084610314576040805185815260208101859052478183015290516001600160a01b0383169143917f137e697384eeada9cf7614b88e4ac940aeff18d0fef7e86bce1abdc812b95e099181900360600190a3506000925082915061035e9050565b60408051858152602081018590526001600160a01b0383169143917f60200441f885b45b3b7f1fdc45a47bb0d0a0884a6a17722f8dd7232830de9bd2910160405180910390a3505b505b9250925092565b61036d610603565b6001600160a01b0316336001600160a01b03161461039d5760405162461bcd60e51b8152600401610257906107f5565b6103a681610631565b50565b600054600160a81b900460ff16158080156103d157506000546001600160a01b90910460ff16105b806103f25750303b1580156103f25750600054600160a01b900460ff166001145b6104555760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610257565b6000805460ff60a01b1916600160a01b1790558015610482576000805460ff60a81b1916600160a81b1790555b61048b8461066d565b610494836106b8565b61049d82610631565b80156104e5576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b6000546001600160a01b031690565b610502610603565b6001600160a01b0316336001600160a01b0316146105325760405162461bcd60e51b8152600401610257906107f5565b806001600160a01b03163b60000361055d57604051637bcd509160e01b815260040160405180910390fd5b6103a68161066d565b61056e610603565b6001600160a01b0316336001600160a01b03161461059e5760405162461bcd60e51b8152600401610257906107f5565b6103a6816106b8565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146105f4576040519150601f19603f3d011682016040523d82523d6000602084013e6105f9565b606091505b5090949350505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b60028190556040518181527f57a23b4b11f619fb9dea21a5a8115bb90103c1043eb3318d773558829d25f12c906020015b60405180910390a150565b600080546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990610662908390610798565b60018190556040518181527f861f03c645467325a586235bb3155834f1dddf12413d0a802f416eb6d4035e6d90602001610662565b803580151581146106fd57600080fd5b919050565b6000806040838503121561071557600080fd5b61071e836106ed565b915061072c602084016106ed565b90509250929050565b60006020828403121561074757600080fd5b5035919050565b80356001600160a01b03811681146106fd57600080fd5b60008060006060848603121561077a57600080fd5b6107838461074e565b95602085013595506040909401359392505050565b6001600160a01b0391909116815260200190565b6000602082840312156107be57600080fd5b6107c78261074e565b9392505050565b808201808211156107ef57634e487b7160e01b600052601160045260246000fd5b92915050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b60608201526080019056fea2646970667358221220b345fe7b21a326c505620c829a22364ed6c5c78193d7823706c9e440c45c338f64736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100815760003560e01c80630634f5b9146100865780630d9160e7146100c857806359f778df146100ec57806367e9941c146100ee5780637a1ac61e1461010e5780639943908914610121578063cdf64a7614610143578063d8209d0714610163578063f13ba64414610185578063fa8674a1146101a5575b600080fd5b34801561009257600080fd5b506100a66100a1366004610702565b6101c7565b6040805193151584526020840192909252908201526060015b60405180910390f35b3480156100d457600080fd5b506100de60035481565b6040519081526020016100bf565b005b3480156100fa57600080fd5b506100ec610109366004610735565b610365565b6100ec61011c366004610765565b6103a9565b34801561012d57600080fd5b506101366104eb565b6040516100bf9190610798565b34801561014f57600080fd5b506100ec61015e3660046107ac565b6104fa565b34801561016f57600080fd5b506100de61017e366004610735565b5060015490565b34801561019157600080fd5b506100ec6101a0366004610735565b610566565b3480156101b157600080fd5b506100de6101c0366004610735565b5060025490565b60008080336101d46104eb565b6001600160a01b0316146101fb57604051630e6444a160e31b815260040160405180910390fd5b60035443116102605760405162461bcd60e51b815260206004820152602660248201527f5374616b696e6756657374696e673a20626f6e757320666f7220616c726561646044820152651e481cd95b9d60d21b60648201526084015b60405180910390fd5b4360035584610270576000610274565b6001545b915083610282576000610286565b6002545b9050600061029482846107ce565b9050801561035c5760006102a66104eb565b90506102b281836105a7565b945084610314576040805185815260208101859052478183015290516001600160a01b0383169143917f137e697384eeada9cf7614b88e4ac940aeff18d0fef7e86bce1abdc812b95e099181900360600190a3506000925082915061035e9050565b60408051858152602081018590526001600160a01b0383169143917f60200441f885b45b3b7f1fdc45a47bb0d0a0884a6a17722f8dd7232830de9bd2910160405180910390a3505b505b9250925092565b61036d610603565b6001600160a01b0316336001600160a01b03161461039d5760405162461bcd60e51b8152600401610257906107f5565b6103a681610631565b50565b600054600160a81b900460ff16158080156103d157506000546001600160a01b90910460ff16105b806103f25750303b1580156103f25750600054600160a01b900460ff166001145b6104555760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610257565b6000805460ff60a01b1916600160a01b1790558015610482576000805460ff60a81b1916600160a81b1790555b61048b8461066d565b610494836106b8565b61049d82610631565b80156104e5576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b6000546001600160a01b031690565b610502610603565b6001600160a01b0316336001600160a01b0316146105325760405162461bcd60e51b8152600401610257906107f5565b806001600160a01b03163b60000361055d57604051637bcd509160e01b815260040160405180910390fd5b6103a68161066d565b61056e610603565b6001600160a01b0316336001600160a01b03161461059e5760405162461bcd60e51b8152600401610257906107f5565b6103a6816106b8565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146105f4576040519150601f19603f3d011682016040523d82523d6000602084013e6105f9565b606091505b5090949350505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b60028190556040518181527f57a23b4b11f619fb9dea21a5a8115bb90103c1043eb3318d773558829d25f12c906020015b60405180910390a150565b600080546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b683616990610662908390610798565b60018190556040518181527f861f03c645467325a586235bb3155834f1dddf12413d0a802f416eb6d4035e6d90602001610662565b803580151581146106fd57600080fd5b919050565b6000806040838503121561071557600080fd5b61071e836106ed565b915061072c602084016106ed565b90509250929050565b60006020828403121561074757600080fd5b5035919050565b80356001600160a01b03811681146106fd57600080fd5b60008060006060848603121561077a57600080fd5b6107838461074e565b95602085013595506040909401359392505050565b6001600160a01b0391909116815260200190565b6000602082840312156107be57600080fd5b6107c78261074e565b9392505050565b808201808211156107ef57634e487b7160e01b600052601160045260246000fd5b92915050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b60608201526080019056fea2646970667358221220b345fe7b21a326c505620c829a22364ed6c5c78193d7823706c9e440c45c338f64736f6c63430008110033", "devdoc": { "errors": { "ErrCallerMustBeValidatorContract()": [ @@ -432,12 +432,12 @@ "storageLayout": { "storage": [ { - "astId": 6458, + "astId": 7051, "contract": "contracts/ronin/StakingVesting.sol:StakingVesting", "label": "_validatorContract", "offset": 0, "slot": "0", - "type": "t_contract(IRoninValidatorSet)12209" + "type": "t_contract(IRoninValidatorSet)11973" }, { "astId": 1373, @@ -456,7 +456,7 @@ "type": "t_bool" }, { - "astId": 24228, + "astId": 22753, "contract": "contracts/ronin/StakingVesting.sol:StakingVesting", "label": "_blockProducerBonusPerBlock", "offset": 0, @@ -464,7 +464,7 @@ "type": "t_uint256" }, { - "astId": 24231, + "astId": 22756, "contract": "contracts/ronin/StakingVesting.sol:StakingVesting", "label": "_bridgeOperatorBonusPerBlock", "offset": 0, @@ -472,7 +472,7 @@ "type": "t_uint256" }, { - "astId": 24234, + "astId": 22759, "contract": "contracts/ronin/StakingVesting.sol:StakingVesting", "label": "lastBlockSendingBonus", "offset": 0, @@ -486,7 +486,7 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(IRoninValidatorSet)12209": { + "t_contract(IRoninValidatorSet)11973": { "encoding": "inplace", "label": "contract IRoninValidatorSet", "numberOfBytes": "20" diff --git a/deployments/ronin-testnet/solcInputs/2a8db5de0d3bfe0cb40ba15ae8460f16.json b/deployments/ronin-testnet/solcInputs/2a8db5de0d3bfe0cb40ba15ae8460f16.json new file mode 100644 index 000000000..7f59df0b6 --- /dev/null +++ b/deployments/ronin-testnet/solcInputs/2a8db5de0d3bfe0cb40ba15ae8460f16.json @@ -0,0 +1,525 @@ +{ + "language": "Solidity", + "sources": { + "contracts/extensions/bridge-operator-governance/BOsGovernanceProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../libraries/BridgeOperatorsBallot.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\n\nabstract contract BOsGovernanceProposal is SignatureConsumer, IRoninGovernanceAdmin {\n using IsolatedGovernance for IsolatedGovernance.Vote;\n\n /// @dev The last the brige operator set info.\n BridgeOperatorsBallot.BridgeOperatorSet internal _lastSyncedBridgeOperatorSetInfo;\n /// @dev Mapping from period index => epoch index => bridge operators vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) internal _bridgeOperatorVote;\n /// @dev Mapping from bridge voter address => last block that the address voted\n mapping(address => uint256) internal _lastVotedBlock;\n /// @dev Mapping from period index => epoch index => voter => bridge voter signatures\n mapping(uint256 => mapping(uint256 => mapping(address => Signature))) internal _bridgeVoterSig;\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256) {\n return _lastVotedBlock[_bridgeVoter];\n }\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function lastSyncedBridgeOperatorSetInfo() external view returns (BridgeOperatorsBallot.BridgeOperatorSet memory) {\n return _lastSyncedBridgeOperatorSetInfo;\n }\n\n /**\n * @dev Votes for a set of bridge operators by signatures.\n *\n * Requirements:\n * - The period of voting is larger than the last synced period.\n * - The arrays are not empty.\n * - The signature signers are in order.\n *\n */\n function _castBOVotesBySignatures(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures,\n uint256 _minimumVoteWeight,\n bytes32 _domainSeperator\n ) internal {\n require(\n _ballot.period >= _lastSyncedBridgeOperatorSetInfo.period &&\n _ballot.epoch >= _lastSyncedBridgeOperatorSetInfo.epoch,\n \"BOsGovernanceProposal: query for outdated bridge operator set\"\n );\n BridgeOperatorsBallot.verifyBallot(_ballot);\n require(_signatures.length > 0, \"BOsGovernanceProposal: invalid array length\");\n\n address _signer;\n address _lastSigner;\n bytes32 _hash = BridgeOperatorsBallot.hash(_ballot);\n bytes32 _digest = ECDSA.toTypedDataHash(_domainSeperator, _hash);\n IsolatedGovernance.Vote storage _v = _bridgeOperatorVote[_ballot.period][_ballot.epoch];\n mapping(address => Signature) storage _sigMap = _bridgeVoterSig[_ballot.period][_ballot.epoch];\n bool _hasValidVotes;\n\n for (uint256 _i; _i < _signatures.length; _i++) {\n // Avoids stack too deeps\n {\n Signature calldata _sig = _signatures[_i];\n _signer = ECDSA.recover(_digest, _sig.v, _sig.r, _sig.s);\n require(_lastSigner < _signer, \"BOsGovernanceProposal: invalid signer order\");\n _lastSigner = _signer;\n }\n\n if (_isBridgeVoter(_signer)) {\n _hasValidVotes = true;\n _lastVotedBlock[_signer] = block.number;\n _sigMap[_signer] = _signatures[_i];\n _v.castVote(_signer, _hash);\n }\n }\n\n require(_hasValidVotes, \"BOsGovernanceProposal: invalid signatures\");\n address[] memory _filteredVoters = _v.filterByHash(_hash);\n _v.syncVoteStatus(_minimumVoteWeight, _sumBridgeVoterWeights(_filteredVoters), 0, 0, _hash);\n }\n\n /**\n * @dev Returns whether the address is the bridge voter.\n */\n function _isBridgeVoter(address) internal view virtual returns (bool);\n\n /**\n * @dev Returns the weight of many bridge voters.\n */\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual returns (uint256);\n}\n" + }, + "contracts/interfaces/consumers/SignatureConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface SignatureConsumer {\n struct Signature {\n uint8 v;\n bytes32 r;\n bytes32 s;\n }\n}\n" + }, + "contracts/libraries/BridgeOperatorsBallot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary BridgeOperatorsBallot {\n struct BridgeOperatorSet {\n uint256 period;\n uint256 epoch;\n address[] operators;\n }\n\n // keccak256(\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\");\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\n\n /**\n * @dev Verifies whether the ballot is valid or not.\n *\n * Requirements:\n * - The ballot is not for an empty operator set.\n * - The operator address list is in order.\n *\n */\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\n require(_ballot.operators.length > 0, \"BridgeOperatorsBallot: invalid array length\");\n address _addr = _ballot.operators[0];\n for (uint _i = 1; _i < _ballot.operators.length; _i++) {\n require(_addr < _ballot.operators[_i], \"BridgeOperatorsBallot: invalid order of bridge operators\");\n _addr = _ballot.operators[_i];\n }\n }\n\n /**\n * @dev Returns hash of the ballot.\n */\n function hash(BridgeOperatorSet calldata _ballot) internal pure returns (bytes32) {\n bytes32 _operatorsHash;\n address[] memory _operators = _ballot.operators;\n\n assembly {\n _operatorsHash := keccak256(add(_operators, 32), mul(mload(_operators), 32))\n }\n\n return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\n }\n}\n" + }, + "contracts/interfaces/IRoninGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/BridgeOperatorsBallot.sol\";\n\ninterface IRoninGovernanceAdmin {\n /// @dev Emitted when the bridge operators are approved.\n event BridgeOperatorsApproved(uint256 _period, uint256 _epoch, address[] _operators);\n /// @dev Emitted when an emergency exit poll is created.\n event EmergencyExitPollCreated(\n bytes32 _voteHash,\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n );\n /// @dev Emitted when an emergency exit poll is approved.\n event EmergencyExitPollApproved(bytes32 _voteHash);\n /// @dev Emitted when an emergency exit poll is expired.\n event EmergencyExitPollExpired(bytes32 _voteHash);\n\n /**\n * @dev Returns the last voted block of the bridge voter.\n */\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256);\n\n /**\n * @dev Returns the synced bridge operator set info.\n */\n function lastSyncedBridgeOperatorSetInfo()\n external\n view\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory _bridgeOperatorSetInfo);\n\n /**\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n */\n function createEmergencyExitPoll(\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) external;\n}\n" + }, + "contracts/libraries/IsolatedGovernance.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../interfaces/consumers/VoteStatusConsumer.sol\";\n\nlibrary IsolatedGovernance {\n struct Vote {\n VoteStatusConsumer.VoteStatus status;\n bytes32 finalHash;\n /// @dev Mapping from voter => receipt hash\n mapping(address => bytes32) voteHashOf;\n /// @dev The timestamp that voting is expired (no expiration=0)\n uint256 expiredAt;\n /// @dev The timestamp that voting is created\n uint256 createdAt;\n /// @dev The list of voters\n address[] voters;\n }\n\n /**\n * @dev Casts vote for the receipt with the receipt hash `_hash`.\n *\n * Requirements:\n * - The voter has not voted for the round.\n *\n */\n function castVote(\n Vote storage _v,\n address _voter,\n bytes32 _hash\n ) internal {\n if (_v.expiredAt > 0 && _v.expiredAt <= block.timestamp) {\n _v.status = VoteStatusConsumer.VoteStatus.Expired;\n }\n\n if (voted(_v, _voter)) {\n revert(\n string(abi.encodePacked(\"IsolatedGovernance: \", Strings.toHexString(uint160(_voter), 20), \" already voted\"))\n );\n }\n\n _v.voteHashOf[_voter] = _hash;\n _v.voters.push(_voter);\n }\n\n /**\n * @dev Updates vote with the requirement of minimum vote weight.\n */\n function syncVoteStatus(\n Vote storage _v,\n uint256 _minimumVoteWeight,\n uint256 _votedWeightForHash,\n uint256 _minimumTrustedVoteWeight,\n uint256 _trustedVotedWeightForHash,\n bytes32 _hash\n ) internal returns (VoteStatusConsumer.VoteStatus _status) {\n if (\n _votedWeightForHash >= _minimumVoteWeight &&\n _trustedVotedWeightForHash >= _minimumTrustedVoteWeight &&\n _v.status == VoteStatusConsumer.VoteStatus.Pending\n ) {\n _v.status = VoteStatusConsumer.VoteStatus.Approved;\n _v.finalHash = _hash;\n }\n\n return _v.status;\n }\n\n /**\n * @dev Returns the list of vote's addresses that voted for the hash `_hash`.\n */\n function filterByHash(Vote storage _v, bytes32 _hash) internal view returns (address[] memory _voters) {\n uint256 _count;\n _voters = new address[](_v.voters.length);\n\n for (uint _i; _i < _voters.length; _i++) {\n address _voter = _v.voters[_i];\n if (_v.voteHashOf[_voter] == _hash) {\n _voters[_count++] = _voter;\n }\n }\n\n assembly {\n mstore(_voters, _count)\n }\n }\n\n /**\n * @dev Returns whether the voter casted for the proposal.\n */\n function voted(Vote storage _v, address _voter) internal view returns (bool) {\n return _v.voteHashOf[_voter] != bytes32(0);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/interfaces/consumers/VoteStatusConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface VoteStatusConsumer {\n enum VoteStatus {\n Pending,\n Approved,\n Executed,\n Rejected,\n Expired\n }\n}\n" + }, + "contracts/ronin/RoninGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../extensions/bridge-operator-governance/BOsGovernanceProposal.sol\";\nimport \"../extensions/sequential-governance/GovernanceProposal.sol\";\nimport \"../extensions/collections/HasValidatorContract.sol\";\nimport \"../extensions/GovernanceAdmin.sol\";\nimport \"../libraries/EmergencyExitBallot.sol\";\nimport \"../interfaces/IRoninGovernanceAdmin.sol\";\n\ncontract RoninGovernanceAdmin is\n IRoninGovernanceAdmin,\n GovernanceAdmin,\n GovernanceProposal,\n BOsGovernanceProposal,\n HasValidatorContract\n{\n using Proposal for Proposal.ProposalDetail;\n using IsolatedGovernance for IsolatedGovernance.Vote;\n\n /// @dev Mapping from request hash => emergency poll\n mapping(bytes32 => IsolatedGovernance.Vote) internal _emergencyExitPoll;\n\n modifier onlyGovernor() {\n require(_getWeight(msg.sender) > 0, \"RoninGovernanceAdmin: sender is not governor\");\n _;\n }\n\n constructor(\n uint256 _roninChainId,\n address _roninTrustedOrganizationContract,\n address _bridgeContract,\n address _validatorContract,\n uint256 _proposalExpiryDuration\n ) GovernanceAdmin(_roninChainId, _roninTrustedOrganizationContract, _bridgeContract, _proposalExpiryDuration) {\n _setValidatorContract(_validatorContract);\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function setValidatorContract(address _addr) external override onlySelfCall {\n require(_addr.code.length > 0, \"RoninGovernanceAdmin: set to non-contract\");\n _setValidatorContract(_addr);\n }\n\n /**\n * @dev Returns the voted signatures for the proposals.\n *\n * Note: The signatures can be empty in case the proposal is voted on the current network.\n *\n */\n function getProposalSignatures(uint256 _chainId, uint256 _round)\n external\n view\n returns (\n address[] memory _voters,\n Ballot.VoteType[] memory _supports,\n Signature[] memory _signatures\n )\n {\n ProposalVote storage _vote = vote[_chainId][_round];\n\n uint256 _forLength = _vote.forVoteds.length;\n uint256 _againstLength = _vote.againstVoteds.length;\n uint256 _voterLength = _forLength + _againstLength;\n\n _supports = new Ballot.VoteType[](_voterLength);\n _signatures = new Signature[](_voterLength);\n _voters = new address[](_voterLength);\n for (uint256 _i; _i < _forLength; _i++) {\n _supports[_i] = Ballot.VoteType.For;\n _signatures[_i] = vote[_chainId][_round].sig[_vote.forVoteds[_i]];\n _voters[_i] = _vote.forVoteds[_i];\n }\n for (uint256 _i; _i < _againstLength; _i++) {\n _supports[_i + _forLength] = Ballot.VoteType.Against;\n _signatures[_i + _forLength] = vote[_chainId][_round].sig[_vote.againstVoteds[_i]];\n _voters[_i + _forLength] = _vote.againstVoteds[_i];\n }\n }\n\n /**\n * @dev Returns the voted signatures for bridge operators at a specific period.\n */\n function getBridgeOperatorVotingSignatures(uint256 _period, uint256 _epoch)\n external\n view\n returns (address[] memory _voters, Signature[] memory _signatures)\n {\n mapping(address => Signature) storage _sigMap = _bridgeVoterSig[_period][_epoch];\n _voters = _bridgeOperatorVote[_period][_epoch].voters;\n _signatures = new Signature[](_voters.length);\n for (uint _i; _i < _voters.length; _i++) {\n _signatures[_i] = _sigMap[_voters[_i]];\n }\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for the proposal.\n */\n function proposalVoted(\n uint256 _chainId,\n uint256 _round,\n address _voter\n ) external view returns (bool) {\n return _voted(vote[_chainId][_round], _voter);\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for bridge operators at a specific period.\n */\n function bridgeOperatorsVoted(\n uint256 _period,\n uint256 _epoch,\n address _voter\n ) external view returns (bool) {\n return _bridgeOperatorVote[_period][_epoch].voted(_voter);\n }\n\n /**\n * @dev Returns whether the voter casted vote for emergency exit poll.\n */\n function emergencyPollVoted(bytes32 _voteHash, address _voter) external view returns (bool) {\n return _emergencyExitPoll[_voteHash].voted(_voter);\n }\n\n /**\n * @dev See `CoreGovernance-_proposeProposal`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function propose(\n uint256 _chainId,\n uint256 _expiryTimestamp,\n address[] calldata _targets,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts\n ) external onlyGovernor {\n _proposeProposal(_chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts, msg.sender);\n }\n\n /**\n * @dev See `GovernanceProposal-_proposeProposalStructAndCastVotes`.\n *\n * Requirements:\n * - The method caller is governor.\n * - The proposal is for the current network.\n *\n */\n function proposeProposalStructAndCastVotes(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyGovernor {\n _proposeProposalStructAndCastVotes(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender);\n }\n\n /**\n * @dev Proposes and casts vote for a proposal on the current network.\n *\n * Requirements:\n * - The method caller is governor.\n * - The proposal is for the current network.\n *\n */\n function proposeProposalForCurrentNetwork(\n uint256 _expiryTimestamp,\n address[] calldata _targets,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts,\n Ballot.VoteType _support\n ) external onlyGovernor {\n address _voter = msg.sender;\n Proposal.ProposalDetail memory _proposal = _proposeProposal(\n block.chainid,\n _expiryTimestamp,\n _targets,\n _values,\n _calldatas,\n _gasAmounts,\n _voter\n );\n _castProposalVoteForCurrentNetwork(_voter, _proposal, _support);\n }\n\n /**\n * @dev Casts vote for a proposal on the current network.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function castProposalVoteForCurrentNetwork(Proposal.ProposalDetail calldata _proposal, Ballot.VoteType _support)\n external\n onlyGovernor\n {\n _castProposalVoteForCurrentNetwork(msg.sender, _proposal, _support);\n }\n\n /**\n * @dev See `GovernanceProposal-_castProposalBySignatures`.\n */\n function castProposalBySignatures(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external {\n _castProposalBySignatures(_proposal, _supports, _signatures, DOMAIN_SEPARATOR);\n }\n\n /**\n * @dev See `CoreGovernance-_proposeGlobal`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function proposeGlobal(\n uint256 _expiryTimestamp,\n GlobalProposal.TargetOption[] calldata _targetOptions,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts\n ) external onlyGovernor {\n _proposeGlobal(\n _expiryTimestamp,\n _targetOptions,\n _values,\n _calldatas,\n _gasAmounts,\n roninTrustedOrganizationContract(),\n bridgeContract(),\n msg.sender\n );\n }\n\n /**\n * @dev See `GovernanceProposal-_proposeGlobalProposalStructAndCastVotes`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function proposeGlobalProposalStructAndCastVotes(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyGovernor {\n _proposeGlobalProposalStructAndCastVotes(\n _globalProposal,\n _supports,\n _signatures,\n DOMAIN_SEPARATOR,\n roninTrustedOrganizationContract(),\n bridgeContract(),\n msg.sender\n );\n }\n\n /**\n * @dev See `GovernanceProposal-_castGlobalProposalBySignatures`.\n */\n function castGlobalProposalBySignatures(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external {\n _castGlobalProposalBySignatures(\n _globalProposal,\n _supports,\n _signatures,\n DOMAIN_SEPARATOR,\n roninTrustedOrganizationContract(),\n bridgeContract()\n );\n }\n\n /**\n * @dev Deletes the expired proposal by its chainId and nonce, without creating a new proposal.\n *\n * Requirements:\n * - The proposal is already created.\n *\n */\n function deleteExpired(uint256 _chainId, uint256 _round) external {\n ProposalVote storage _vote = vote[_chainId][_round];\n require(_vote.hash != bytes32(0), \"RoninGovernanceAdmin: query for empty voting\");\n _tryDeleteExpiredVotingRound(_vote);\n }\n\n /**\n * @dev See `BOsGovernanceProposal-_castVotesBySignatures`.\n */\n function voteBridgeOperatorsBySignatures(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures\n ) external {\n _castBOVotesBySignatures(_ballot, _signatures, _getMinimumVoteWeight(), DOMAIN_SEPARATOR);\n IsolatedGovernance.Vote storage _v = _bridgeOperatorVote[_ballot.period][_ballot.epoch];\n if (_v.status == VoteStatus.Approved) {\n _lastSyncedBridgeOperatorSetInfo = _ballot;\n emit BridgeOperatorsApproved(_ballot.period, _ballot.epoch, _ballot.operators);\n _v.status = VoteStatus.Executed;\n }\n }\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function createEmergencyExitPoll(\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) external onlyValidatorContract {\n bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\n IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash];\n _v.createdAt = block.timestamp;\n _v.expiredAt = _expiredAt;\n emit EmergencyExitPollCreated(_hash, _consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\n }\n\n /**\n * @dev Votes for an emergency exit. Executes to unlock fund for the emergency exit's requester.\n *\n * Requirements:\n * - The voter is governor.\n * - The voting is existent.\n * - The voting is not expired yet.\n *\n */\n function voteEmergencyExit(\n bytes32 _voteHash,\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) external onlyGovernor {\n address _voter = msg.sender;\n bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\n require(_voteHash == _hash, \"RoninGovernanceAdmin: invalid vote hash\");\n\n IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash];\n require(_v.createdAt > 0, \"RoninGovernanceAdmin: query for non-existent vote\");\n require(_v.status != VoteStatus.Expired, \"RoninGovernanceAdmin: query for expired vote\");\n\n _v.castVote(_voter, _hash);\n address[] memory _voters = _v.filterByHash(_hash);\n VoteStatus _stt = _v.syncVoteStatus(_getMinimumVoteWeight(), _sumGovernorWeights(_voters), 0, 0, _hash);\n if (_stt == VoteStatus.Approved) {\n _execReleaseLockedFundForEmergencyExitRequest(_consensusAddr, _recipientAfterUnlockedFund);\n emit EmergencyExitPollApproved(_hash);\n _v.status = VoteStatus.Executed;\n } else if (_stt == VoteStatus.Expired) {\n emit EmergencyExitPollExpired(_hash);\n }\n }\n\n /**\n * @inheritdoc GovernanceProposal\n */\n function _getWeight(address _governor) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.getGovernorWeight.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governor)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Returns the total weight of a list address of governors.\n */\n function _sumGovernorWeights(address[] memory _governors) internal view virtual returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumGovernorWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governors)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Returns the bridge voter weight.\n */\n function _getBridgeVoterWeight(address _governor) internal view virtual returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.getBridgeVoterWeight.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governor)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @inheritdoc BOsGovernanceProposal\n */\n function _isBridgeVoter(address _addr) internal view virtual override returns (bool) {\n return _getBridgeVoterWeight(_addr) > 0;\n }\n\n /**\n * @inheritdoc BOsGovernanceProposal\n */\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumBridgeVoterWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _bridgeVoters)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Trigger function from validator contract to unlock fund for emeregency exit request.\n */\n function _execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address _recipientAfterUnlockedFund)\n internal\n virtual\n {\n bytes4 _selector = _validatorContract.execReleaseLockedFundForEmergencyExitRequest.selector;\n (bool _success, ) = validatorContract().call(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _consensusAddr, _recipientAfterUnlockedFund)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n }\n\n /**\n * @dev See `CoreGovernance-_getChainType`.\n */\n function _getChainType() internal pure override returns (ChainType) {\n return ChainType.RoninChain;\n }\n\n /**\n * @dev See `castProposalVoteForCurrentNetwork`.\n */\n function _castProposalVoteForCurrentNetwork(\n address _voter,\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType _support\n ) internal {\n require(_proposal.chainId == block.chainid, \"RoninGovernanceAdmin: invalid chain id\");\n require(\n vote[_proposal.chainId][_proposal.nonce].hash == _proposal.hash(),\n \"RoninGovernanceAdmin: cast vote for invalid proposal\"\n );\n\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\n Signature memory _emptySignature;\n _castVote(\n _proposal,\n _support,\n _minimumForVoteWeight,\n _minimumAgainstVoteWeight,\n _voter,\n _emptySignature,\n _getWeight(_voter)\n );\n }\n}\n" + }, + "contracts/extensions/sequential-governance/GovernanceProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./CoreGovernance.sol\";\n\nabstract contract GovernanceProposal is CoreGovernance {\n using Proposal for Proposal.ProposalDetail;\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\n\n /**\n * @dev Casts votes by signatures.\n *\n * Note: This method does not verify the proposal hash with the vote hash. Please consider checking it before.\n *\n */\n function _castVotesBySignatures(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _forDigest,\n bytes32 _againstDigest\n ) internal {\n require(_supports.length > 0 && _supports.length == _signatures.length, \"GovernanceProposal: invalid array length\");\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\n\n address _lastSigner;\n address _signer;\n Signature calldata _sig;\n bool _hasValidVotes;\n for (uint256 _i; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n\n if (_supports[_i] == Ballot.VoteType.For) {\n _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s);\n } else if (_supports[_i] == Ballot.VoteType.Against) {\n _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s);\n } else {\n revert(\"GovernanceProposal: query for unsupported vote type\");\n }\n\n require(_lastSigner < _signer, \"GovernanceProposal: invalid order\");\n _lastSigner = _signer;\n\n uint256 _weight = _getWeight(_signer);\n if (_weight > 0) {\n _hasValidVotes = true;\n if (\n _castVote(_proposal, _supports[_i], _minimumForVoteWeight, _minimumAgainstVoteWeight, _signer, _sig, _weight)\n ) {\n return;\n }\n }\n }\n\n require(_hasValidVotes, \"GovernanceProposal: invalid signatures\");\n }\n\n /**\n * @dev Proposes a proposal struct and casts votes by signature.\n */\n function _proposeProposalStructAndCastVotes(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _creator\n ) internal {\n _proposeProposalStruct(_proposal, _creator);\n bytes32 _proposalHash = _proposal.hash();\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes a proposal struct and casts votes by signature.\n */\n function _castProposalBySignatures(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator\n ) internal {\n bytes32 _proposalHash = _proposal.hash();\n require(\n vote[_proposal.chainId][_proposal.nonce].hash == _proposalHash,\n \"GovernanceAdmin: cast vote for invalid proposal\"\n );\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes and votes by signature.\n */\n function _proposeGlobalProposalStructAndCastVotes(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal returns (Proposal.ProposalDetail memory _proposal) {\n _proposal = _proposeGlobalStruct(_globalProposal, _roninTrustedOrganizationContract, _gatewayContract, _creator);\n bytes32 _globalProposalHash = _globalProposal.hash();\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes a global proposal struct and casts votes by signature.\n */\n function _castGlobalProposalBySignatures(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _roninTrustedOrganizationContract,\n address _gatewayContract\n ) internal {\n Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail(\n _roninTrustedOrganizationContract,\n _gatewayContract\n );\n bytes32 _globalProposalHash = _globalProposal.hash();\n require(vote[0][_proposal.nonce].hash == _proposal.hash(), \"GovernanceAdmin: cast vote for invalid proposal\");\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Returns the weight of a governor.\n */\n function _getWeight(address _governor) internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/collections/HasValidatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasValidatorContract.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\n\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\n IRoninValidatorSet internal _validatorContract;\n\n modifier onlyValidatorContract() {\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\n _;\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function validatorContract() public view override returns (address) {\n return address(_validatorContract);\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setValidatorContract(_addr);\n }\n\n /**\n * @dev Sets the validator contract.\n *\n * Emits the event `ValidatorContractUpdated`.\n *\n */\n function _setValidatorContract(address _addr) internal {\n _validatorContract = IRoninValidatorSet(_addr);\n emit ValidatorContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/GovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../extensions/sequential-governance/CoreGovernance.sol\";\nimport \"../extensions/collections/HasRoninTrustedOrganizationContract.sol\";\nimport \"../extensions/collections/HasBridgeContract.sol\";\nimport \"../interfaces/IRoninTrustedOrganization.sol\";\n\nabstract contract GovernanceAdmin is CoreGovernance, HasRoninTrustedOrganizationContract, HasBridgeContract {\n uint256 public roninChainId;\n /// @dev Domain separator\n bytes32 public DOMAIN_SEPARATOR;\n\n error ErrProxyCallFailed(bytes4 methodSignature);\n\n modifier onlySelfCall() {\n require(msg.sender == address(this), \"GovernanceAdmin: only allowed self-call\");\n _;\n }\n\n constructor(\n uint256 _roninChainId,\n address _roninTrustedOrganizationContract,\n address _bridgeContract,\n uint256 _proposalExpiryDuration\n ) CoreGovernance(_proposalExpiryDuration) {\n roninChainId = _roninChainId;\n DOMAIN_SEPARATOR = keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,bytes32 salt)\"),\n keccak256(\"GovernanceAdmin\"), // name hash\n keccak256(\"2\"), // version hash\n keccak256(abi.encode(\"RONIN_GOVERNANCE_ADMIN\", _roninChainId)) // salt\n )\n );\n _setRoninTrustedOrganizationContract(_roninTrustedOrganizationContract);\n _setBridgeContract(_bridgeContract);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function setRoninTrustedOrganizationContract(address _addr) external override onlySelfCall {\n require(_addr.code.length > 0, \"GovernanceAdmin: set to non-contract\");\n _setRoninTrustedOrganizationContract(_addr);\n }\n\n /**\n * @inheritdoc IHasBridgeContract\n */\n function setBridgeContract(address _addr) external override onlySelfCall {\n require(_addr.code.length > 0, \"GovernanceAdmin: set to non-contract\");\n _setBridgeContract(_addr);\n }\n\n /**\n * @dev Sets the expiry duration for a new proposal.\n *\n * Requirements:\n * - Only allowing self-call to this method, since this contract does not have admin.\n *\n */\n function setProposalExpiryDuration(uint256 _expiryDuration) external onlySelfCall {\n _setProposalExpiryDuration(_expiryDuration);\n }\n\n /**\n * @dev Returns the current implementation of `_proxy`.\n *\n * Requirements:\n * - This contract must be the admin of `_proxy`.\n *\n */\n function getProxyImplementation(address _proxy) external view returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n bytes4 _selector = 0x5c60da1b;\n (bool _success, bytes memory _returndata) = _proxy.staticcall(abi.encodeWithSelector(_selector));\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (address));\n }\n\n /**\n * @dev Returns the proposal expiry duration.\n */\n function getProposalExpiryDuration() external view returns (uint256) {\n return super._getProposalExpiryDuration();\n }\n\n /**\n * @dev Returns the current admin of `_proxy`.\n *\n * Requirements:\n * - This contract must be the admin of `_proxy`.\n *\n */\n function getProxyAdmin(address _proxy) external view returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n bytes4 _selector = 0xf851a440;\n (bool _success, bytes memory _returndata) = _proxy.staticcall(abi.encodeWithSelector(_selector));\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `_proxy` to `newAdmin`.\n *\n * Requirements:\n * - This contract must be the current admin of `_proxy`.\n *\n */\n function changeProxyAdmin(address _proxy, address _newAdmin) external onlySelfCall {\n // bytes4(keccak256(\"changeAdmin(address)\"))\n bytes4 _selector = 0x8f283970;\n (bool _success, ) = _proxy.call(abi.encodeWithSelector(_selector, _newAdmin));\n if (!_success) revert ErrProxyCallFailed(_selector);\n }\n\n /**\n * @dev Override `CoreGovernance-_getMinimumVoteWeight`.\n */\n function _getMinimumVoteWeight() internal view virtual override returns (uint256) {\n bytes4 _selector = IQuorum.minimumVoteWeight.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Override `CoreGovernance-_getTotalWeights`.\n */\n function _getTotalWeights() internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.totalWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n}\n" + }, + "contracts/libraries/EmergencyExitBallot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary EmergencyExitBallot {\n // keccak256(\"EmergencyExitBallot(address consensusAddress,address recipientAfterUnlockedFund,uint256 requestedAt,uint256 expiredAt)\");\n bytes32 public constant EMERGENCY_EXIT_BALLOT_TYPEHASH =\n 0x697acba4deaf1a718d8c2d93e42860488cb7812696f28ca10eed17bac41e7027;\n\n /**\n * @dev Returns hash of the ballot.\n */\n function hash(\n address _consensusAddress,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n EMERGENCY_EXIT_BALLOT_TYPEHASH,\n _consensusAddress,\n _recipientAfterUnlockedFund,\n _requestedAt,\n _expiredAt\n )\n );\n }\n}\n" + }, + "contracts/extensions/sequential-governance/CoreGovernance.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../../libraries/Proposal.sol\";\nimport \"../../libraries/GlobalProposal.sol\";\nimport \"../../libraries/Ballot.sol\";\nimport \"../../interfaces/consumers/ChainTypeConsumer.sol\";\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\n\nabstract contract CoreGovernance is SignatureConsumer, VoteStatusConsumer, ChainTypeConsumer {\n using Proposal for Proposal.ProposalDetail;\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\n\n struct ProposalVote {\n VoteStatus status;\n bytes32 hash;\n uint256 againstVoteWeight; // Total weight of against votes\n uint256 forVoteWeight; // Total weight of for votes\n address[] forVoteds; // Array of addresses voting for\n address[] againstVoteds; // Array of addresses voting against\n uint256 expiryTimestamp;\n mapping(address => Signature) sig;\n mapping(address => bool) voted;\n }\n\n /// @dev Emitted when a proposal is created\n event ProposalCreated(\n uint256 indexed chainId,\n uint256 indexed round,\n bytes32 indexed proposalHash,\n Proposal.ProposalDetail proposal,\n address creator\n );\n /// @dev Emitted when a proposal is created\n event GlobalProposalCreated(\n uint256 indexed round,\n bytes32 indexed proposalHash,\n Proposal.ProposalDetail proposal,\n bytes32 globalProposalHash,\n GlobalProposal.GlobalProposalDetail globalProposal,\n address creator\n );\n /// @dev Emitted when the proposal is voted\n event ProposalVoted(bytes32 indexed proposalHash, address indexed voter, Ballot.VoteType support, uint256 weight);\n /// @dev Emitted when the proposal is approved\n event ProposalApproved(bytes32 indexed proposalHash);\n /// @dev Emitted when the vote is reject\n event ProposalRejected(bytes32 indexed proposalHash);\n /// @dev Emitted when the vote is expired\n event ProposalExpired(bytes32 indexed proposalHash);\n /// @dev Emitted when the proposal is executed\n event ProposalExecuted(bytes32 indexed proposalHash, bool[] successCalls, bytes[] returnDatas);\n\n /// @dev Mapping from chain id => vote round\n /// @notice chain id = 0 for global proposal\n mapping(uint256 => uint256) public round;\n /// @dev Mapping from chain id => vote round => proposal vote\n mapping(uint256 => mapping(uint256 => ProposalVote)) public vote;\n\n uint256 private _proposalExpiryDuration;\n\n constructor(uint256 _expiryDuration) {\n _setProposalExpiryDuration(_expiryDuration);\n }\n\n /**\n * @dev Creates new voting round by calculating the `_round` number of chain `_chainId`.\n * Increases the `_round` number if the previous one is not expired. Delete the previous proposal\n * if it is expired and not increase the `_round`.\n */\n function _createVotingRound(uint256 _chainId) internal returns (uint256 _round) {\n _round = round[_chainId];\n // Skip checking for the first ever round\n if (_round == 0) {\n _round = round[_chainId] = 1;\n } else {\n ProposalVote storage _latestProposalVote = vote[_chainId][_round];\n bool _isExpired = _tryDeleteExpiredVotingRound(_latestProposalVote);\n // Skip increasing round number if the latest round is expired, allow the vote to be overridden\n if (!_isExpired) {\n require(_latestProposalVote.status != VoteStatus.Pending, \"CoreGovernance: current proposal is not completed\");\n _round = ++round[_chainId];\n }\n }\n }\n\n /**\n * @dev Saves new round voting for the proposal `_proposalHash` of chain `_chainId`.\n */\n function _saveVotingRound(\n ProposalVote storage _vote,\n bytes32 _proposalHash,\n uint256 _expiryTimestamp\n ) internal {\n _vote.hash = _proposalHash;\n _vote.expiryTimestamp = _expiryTimestamp;\n }\n\n /**\n * @dev Proposes for a new proposal.\n *\n * Requirements:\n * - The chain id is not equal to 0.\n *\n * Emits the `ProposalCreated` event.\n *\n */\n function _proposeProposal(\n uint256 _chainId,\n uint256 _expiryTimestamp,\n address[] memory _targets,\n uint256[] memory _values,\n bytes[] memory _calldatas,\n uint256[] memory _gasAmounts,\n address _creator\n ) internal virtual returns (Proposal.ProposalDetail memory _proposal) {\n require(_chainId != 0, \"CoreGovernance: invalid chain id\");\n uint256 _round = _createVotingRound(_chainId);\n\n _proposal = Proposal.ProposalDetail(_round, _chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts);\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n _saveVotingRound(vote[_chainId][_round], _proposalHash, _expiryTimestamp);\n emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator);\n }\n\n /**\n * @dev Proposes proposal struct.\n *\n * Requirements:\n * - The chain id is not equal to 0.\n * - The proposal nonce is equal to the new round.\n *\n * Emits the `ProposalCreated` event.\n *\n */\n function _proposeProposalStruct(Proposal.ProposalDetail memory _proposal, address _creator)\n internal\n virtual\n returns (uint256 _round)\n {\n uint256 _chainId = _proposal.chainId;\n require(_chainId != 0, \"CoreGovernance: invalid chain id\");\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n _round = _createVotingRound(_chainId);\n _saveVotingRound(vote[_chainId][_round], _proposalHash, _proposal.expiryTimestamp);\n require(_round == _proposal.nonce, \"CoreGovernance: invalid proposal nonce\");\n emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator);\n }\n\n /**\n * @dev Proposes for a global proposal.\n *\n * Emits the `GlobalProposalCreated` event.\n *\n */\n function _proposeGlobal(\n uint256 _expiryTimestamp,\n GlobalProposal.TargetOption[] calldata _targetOptions,\n uint256[] memory _values,\n bytes[] memory _calldatas,\n uint256[] memory _gasAmounts,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal virtual {\n uint256 _round = _createVotingRound(0);\n GlobalProposal.GlobalProposalDetail memory _globalProposal = GlobalProposal.GlobalProposalDetail(\n _round,\n _expiryTimestamp,\n _targetOptions,\n _values,\n _calldatas,\n _gasAmounts\n );\n Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail(\n _roninTrustedOrganizationContract,\n _gatewayContract\n );\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n _saveVotingRound(vote[0][_round], _proposalHash, _expiryTimestamp);\n emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator);\n }\n\n /**\n * @dev Proposes global proposal struct.\n *\n * Requirements:\n * - The proposal nonce is equal to the new round.\n *\n * Emits the `GlobalProposalCreated` event.\n *\n */\n function _proposeGlobalStruct(\n GlobalProposal.GlobalProposalDetail memory _globalProposal,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal virtual returns (Proposal.ProposalDetail memory _proposal) {\n _proposal = _globalProposal.into_proposal_detail(_roninTrustedOrganizationContract, _gatewayContract);\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n uint256 _round = _createVotingRound(0);\n _saveVotingRound(vote[0][_round], _proposalHash, _globalProposal.expiryTimestamp);\n require(_round == _proposal.nonce, \"CoreGovernance: invalid proposal nonce\");\n emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator);\n }\n\n /**\n * @dev Casts vote for the proposal with data and returns whether the voting is done.\n *\n * Requirements:\n * - The proposal nonce is equal to the round.\n * - The vote is not finalized.\n * - The voter has not voted for the round.\n *\n * Emits the `ProposalVoted` event. Emits the `ProposalApproved`, `ProposalExecuted` or `ProposalRejected` once the\n * proposal is approved, executed or rejected.\n *\n */\n function _castVote(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType _support,\n uint256 _minimumForVoteWeight,\n uint256 _minimumAgainstVoteWeight,\n address _voter,\n Signature memory _signature,\n uint256 _voterWeight\n ) internal virtual returns (bool _done) {\n uint256 _chainId = _proposal.chainId;\n uint256 _round = _proposal.nonce;\n ProposalVote storage _vote = vote[_chainId][_round];\n\n if (_tryDeleteExpiredVotingRound(_vote)) {\n return true;\n }\n\n require(round[_proposal.chainId] == _round, \"CoreGovernance: query for invalid proposal nonce\");\n require(_vote.status == VoteStatus.Pending, \"CoreGovernance: the vote is finalized\");\n if (_voted(_vote, _voter)) {\n revert(string(abi.encodePacked(\"CoreGovernance: \", Strings.toHexString(uint160(_voter), 20), \" already voted\")));\n }\n\n _vote.voted[_voter] = true;\n // Stores the signature if it is not empty\n if (_signature.r > 0 || _signature.s > 0 || _signature.v > 0) {\n _vote.sig[_voter] = _signature;\n }\n emit ProposalVoted(_vote.hash, _voter, _support, _voterWeight);\n\n uint256 _forVoteWeight;\n uint256 _againstVoteWeight;\n if (_support == Ballot.VoteType.For) {\n _vote.forVoteds.push(_voter);\n _forVoteWeight = _vote.forVoteWeight += _voterWeight;\n } else if (_support == Ballot.VoteType.Against) {\n _vote.againstVoteds.push(_voter);\n _againstVoteWeight = _vote.againstVoteWeight += _voterWeight;\n } else {\n revert(\"CoreGovernance: unsupported vote type\");\n }\n\n if (_forVoteWeight >= _minimumForVoteWeight) {\n _done = true;\n _vote.status = VoteStatus.Approved;\n emit ProposalApproved(_vote.hash);\n _tryExecute(_vote, _proposal);\n } else if (_againstVoteWeight >= _minimumAgainstVoteWeight) {\n _done = true;\n _vote.status = VoteStatus.Rejected;\n emit ProposalRejected(_vote.hash);\n }\n }\n\n /**\n * @dev When the contract is on Ronin chain, checks whether the proposal is expired and delete it if is expired.\n *\n * Emits the event `ProposalExpired` if the vote is expired.\n *\n * Note: This function assumes the vote `_proposalVote` is already created, consider verifying the vote's existence\n * before or it will emit an unexpected event of `ProposalExpired`.\n */\n function _tryDeleteExpiredVotingRound(ProposalVote storage _proposalVote) internal returns (bool _isExpired) {\n _isExpired =\n _getChainType() == ChainType.RoninChain &&\n _proposalVote.status == VoteStatus.Pending &&\n _proposalVote.expiryTimestamp <= block.timestamp;\n\n if (_isExpired) {\n emit ProposalExpired(_proposalVote.hash);\n\n for (uint256 _i; _i < _proposalVote.forVoteds.length; _i++) {\n delete _proposalVote.voted[_proposalVote.forVoteds[_i]];\n delete _proposalVote.sig[_proposalVote.forVoteds[_i]];\n }\n for (uint256 _i; _i < _proposalVote.againstVoteds.length; _i++) {\n delete _proposalVote.voted[_proposalVote.againstVoteds[_i]];\n delete _proposalVote.sig[_proposalVote.againstVoteds[_i]];\n }\n delete _proposalVote.status;\n delete _proposalVote.hash;\n delete _proposalVote.againstVoteWeight;\n delete _proposalVote.forVoteWeight;\n delete _proposalVote.forVoteds;\n delete _proposalVote.againstVoteds;\n delete _proposalVote.expiryTimestamp;\n }\n }\n\n /**\n * @dev Executes the proposal and update the vote status once the proposal is executable.\n */\n function _tryExecute(ProposalVote storage _vote, Proposal.ProposalDetail memory _proposal) internal {\n if (_proposal.executable()) {\n _vote.status = VoteStatus.Executed;\n (bool[] memory _successCalls, bytes[] memory _returnDatas) = _proposal.execute();\n emit ProposalExecuted(_vote.hash, _successCalls, _returnDatas);\n }\n }\n\n /**\n * @dev Sets the expiry duration for a new proposal.\n */\n function _setProposalExpiryDuration(uint256 _expiryDuration) internal {\n _proposalExpiryDuration = _expiryDuration;\n }\n\n /**\n * @dev Returns whether the voter casted for the proposal.\n */\n function _voted(ProposalVote storage _vote, address _voter) internal view returns (bool) {\n return _vote.voted[_voter];\n }\n\n /**\n * @dev Returns the expiry duration for a new proposal.\n */\n function _getProposalExpiryDuration() internal view returns (uint256) {\n return _proposalExpiryDuration;\n }\n\n /**\n * @dev Returns total weight from validators.\n */\n function _getTotalWeights() internal view virtual returns (uint256);\n\n /**\n * @dev Returns minimum vote to pass a proposal.\n */\n function _getMinimumVoteWeight() internal view virtual returns (uint256);\n\n /**\n * @dev Returns current context is running on whether Ronin chain or on mainchain.\n */\n function _getChainType() internal view virtual returns (ChainType);\n}\n" + }, + "contracts/libraries/Proposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary Proposal {\n struct ProposalDetail {\n // Nonce to make sure proposals are executed in order\n uint256 nonce;\n // Value 0: all chain should run this proposal\n // Other values: only specifc chain has to execute\n uint256 chainId;\n uint256 expiryTimestamp;\n address[] targets;\n uint256[] values;\n bytes[] calldatas;\n uint256[] gasAmounts;\n }\n\n // keccak256(\"ProposalDetail(uint256 nonce,uint256 chainId,uint256 expiryTimestamp,address[] targets,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\");\n bytes32 public constant TYPE_HASH = 0xd051578048e6ff0bbc9fca3b65a42088dbde10f36ca841de566711087ad9b08a;\n\n /**\n * @dev Validates the proposal.\n */\n function validate(ProposalDetail memory _proposal, uint256 _maxExpiryDuration) internal view {\n require(\n _proposal.targets.length > 0 &&\n _proposal.targets.length == _proposal.values.length &&\n _proposal.targets.length == _proposal.calldatas.length &&\n _proposal.targets.length == _proposal.gasAmounts.length,\n \"Proposal: invalid array length\"\n );\n require(_proposal.expiryTimestamp <= block.timestamp + _maxExpiryDuration, \"Proposal: invalid expiry timestamp\");\n }\n\n /**\n * @dev Returns struct hash of the proposal.\n */\n function hash(ProposalDetail memory _proposal) internal pure returns (bytes32) {\n bytes32 _targetsHash;\n bytes32 _valuesHash;\n bytes32 _calldatasHash;\n bytes32 _gasAmountsHash;\n\n uint256[] memory _values = _proposal.values;\n address[] memory _targets = _proposal.targets;\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _calldataHashList.length; _i++) {\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\n }\n\n assembly {\n _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32))\n _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32))\n _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32))\n _gasAmountsHash := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32))\n }\n\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _proposal.nonce,\n _proposal.chainId,\n _proposal.expiryTimestamp,\n _targetsHash,\n _valuesHash,\n _calldatasHash,\n _gasAmountsHash\n )\n );\n }\n\n /**\n * @dev Returns whether the proposal is executable for the current chain.\n *\n * @notice Does not check whether the call result is successful or not. Please use `execute` instead.\n *\n */\n function executable(ProposalDetail memory _proposal) internal view returns (bool _result) {\n return _proposal.chainId == 0 || _proposal.chainId == block.chainid;\n }\n\n /**\n * @dev Executes the proposal.\n */\n function execute(ProposalDetail memory _proposal)\n internal\n returns (bool[] memory _successCalls, bytes[] memory _returnDatas)\n {\n require(executable(_proposal), \"Proposal: query for invalid chainId\");\n _successCalls = new bool[](_proposal.targets.length);\n _returnDatas = new bytes[](_proposal.targets.length);\n for (uint256 _i = 0; _i < _proposal.targets.length; ++_i) {\n require(gasleft() > _proposal.gasAmounts[_i], \"Proposal: insufficient gas\");\n\n (_successCalls[_i], _returnDatas[_i]) = _proposal.targets[_i].call{\n value: _proposal.values[_i],\n gas: _proposal.gasAmounts[_i]\n }(_proposal.calldatas[_i]);\n }\n }\n}\n" + }, + "contracts/libraries/GlobalProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Proposal.sol\";\n\nlibrary GlobalProposal {\n enum TargetOption {\n RoninTrustedOrganizationContract,\n GatewayContract\n }\n\n struct GlobalProposalDetail {\n // Nonce to make sure proposals are executed in order\n uint256 nonce;\n uint256 expiryTimestamp;\n TargetOption[] targetOptions;\n uint256[] values;\n bytes[] calldatas;\n uint256[] gasAmounts;\n }\n\n // keccak256(\"GlobalProposalDetail(uint256 nonce,uint256 expiryTimestamp,uint8[] targetOptions,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\");\n bytes32 public constant TYPE_HASH = 0x1463f426c05aff2c1a7a0957a71c9898bc8b47142540538e79ee25ee91141350;\n\n /**\n * @dev Returns struct hash of the proposal.\n */\n function hash(GlobalProposalDetail memory _proposal) internal pure returns (bytes32) {\n bytes32 _targetsHash;\n bytes32 _valuesHash;\n bytes32 _calldatasHash;\n bytes32 _gasAmountsHash;\n\n uint256[] memory _values = _proposal.values;\n TargetOption[] memory _targets = _proposal.targetOptions;\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _calldataHashList.length; _i++) {\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\n }\n\n assembly {\n _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32))\n _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32))\n _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32))\n _gasAmountsHash := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32))\n }\n\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _proposal.nonce,\n _proposal.expiryTimestamp,\n _targetsHash,\n _valuesHash,\n _calldatasHash,\n _gasAmountsHash\n )\n );\n }\n\n /**\n * @dev Converts into the normal proposal.\n */\n function into_proposal_detail(\n GlobalProposalDetail memory _proposal,\n address _roninTrustedOrganizationContract,\n address _gatewayContract\n ) internal pure returns (Proposal.ProposalDetail memory _detail) {\n _detail.nonce = _proposal.nonce;\n _detail.expiryTimestamp = _proposal.expiryTimestamp;\n _detail.chainId = 0;\n _detail.targets = new address[](_proposal.targetOptions.length);\n _detail.values = _proposal.values;\n _detail.calldatas = _proposal.calldatas;\n _detail.gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _proposal.targetOptions.length; _i++) {\n if (_proposal.targetOptions[_i] == TargetOption.GatewayContract) {\n _detail.targets[_i] = _gatewayContract;\n } else if (_proposal.targetOptions[_i] == TargetOption.RoninTrustedOrganizationContract) {\n _detail.targets[_i] = _roninTrustedOrganizationContract;\n } else {\n revert(\"GlobalProposal: unsupported target\");\n }\n }\n }\n}\n" + }, + "contracts/libraries/Ballot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary Ballot {\n using ECDSA for bytes32;\n\n enum VoteType {\n For,\n Against\n }\n\n // keccak256(\"Ballot(bytes32 proposalHash,uint8 support)\");\n bytes32 public constant BALLOT_TYPEHASH = 0xd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c2;\n\n function hash(bytes32 _proposalHash, VoteType _support) internal pure returns (bytes32) {\n return keccak256(abi.encode(BALLOT_TYPEHASH, _proposalHash, _support));\n }\n}\n" + }, + "contracts/interfaces/consumers/ChainTypeConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface ChainTypeConsumer {\n enum ChainType {\n RoninChain,\n Mainchain\n }\n}\n" + }, + "contracts/extensions/collections/HasProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/StorageSlot.sol\";\n\nabstract contract HasProxyAdmin {\n // bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n modifier onlyAdmin() {\n require(msg.sender == _getAdmin(), \"HasProxyAdmin: unauthorized sender\");\n _;\n }\n\n /**\n * @dev Returns proxy admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n}\n" + }, + "contracts/interfaces/collections/IHasValidatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasValidatorContract is IHasContract {\n /// @dev Emitted when the validator contract is updated.\n event ValidatorContractUpdated(address);\n\n /// @dev Error of method caller must be validator contract.\n error ErrCallerMustBeValidatorContract();\n\n /**\n * @dev Returns the validator contract.\n */\n function validatorContract() external view returns (address);\n\n /**\n * @dev Sets the validator contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `ValidatorContractUpdated`.\n *\n */\n function setValidatorContract(address) external;\n}\n" + }, + "contracts/interfaces/validator/IRoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ICandidateManager.sol\";\nimport \"./info-fragments/ICommonInfo.sol\";\nimport \"./ICoinbaseExecution.sol\";\nimport \"./ISlashingExecution.sol\";\nimport \"./IEmergencyExit.sol\";\n\ninterface IRoninValidatorSet is\n ICandidateManager,\n ICommonInfo,\n ISlashingExecution,\n ICoinbaseExecution,\n IEmergencyExit\n{}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "contracts/interfaces/collections/IHasContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IHasContract {\n /// @dev Error of set to non-contract.\n error ErrZeroCodeContract();\n}\n" + }, + "contracts/interfaces/validator/ICandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ICandidateManager {\n struct ValidatorCandidate {\n // Admin of the candidate\n address admin;\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n address consensusAddr;\n // Address that receives mining reward of the validator\n address payable treasuryAddr;\n // Address of the bridge operator corresponding to the candidate\n address bridgeOperatorAddr;\n // The percentage of reward that validators can be received, the rest goes to the delegators.\n // Values in range [0; 100_00] stands for 0-100%\n uint256 commissionRate;\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\n uint256 revokingTimestamp;\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\n uint256 topupDeadline;\n }\n\n struct CommissionSchedule {\n // The timestamp that the commission schedule gets affected (no schedule=0).\n uint256 effectiveTimestamp;\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\n uint256 commissionRate;\n }\n\n /// @dev Emitted when the maximum number of validator candidates is updated.\n event MaxValidatorCandidateUpdated(uint256 threshold);\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\n /// @dev Emitted when the validator candidate is granted.\n event CandidateGranted(\n address indexed consensusAddr,\n address indexed treasuryAddr,\n address indexed admin,\n address bridgeOperator\n );\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\n /// @dev Emitted when the topup deadline of a candidate is updated.\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\n /// @dev Emitted when the validator candidate is revoked.\n event CandidatesRevoked(address[] consensusAddrs);\n\n /// @dev Emitted when a schedule for updating commission rate is set.\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\n /// @dev Emitted when the commission rate of a validator is updated.\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\n\n /// @dev Error of exceeding maximum number of candidates.\n error ErrExceedsMaxNumberOfCandidate();\n /// @dev Error of querying for already existent candidate.\n error ErrExistentCandidate();\n /// @dev Error of querying for non-existent candidate.\n error ErrNonExistentCandidate();\n /// @dev Error of candidate admin already exists.\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\n /// @dev Error of treasury already exists.\n error ErrExistentTreasury(address _treasuryAddr);\n /// @dev Error of bridge operator already exists.\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\n /// @dev Error of invalid commission rate.\n error ErrInvalidCommissionRate();\n /// @dev Error of invalid effective days onwards.\n error ErrInvalidEffectiveDaysOnwards();\n /// @dev Error of invalid min effective days onwards.\n error ErrInvalidMinEffectiveDaysOnwards();\n /// @dev Error of already requested revoking candidate before.\n error ErrAlreadyRequestedRevokingCandidate();\n /// @dev Error of commission change schedule exists.\n error ErrAlreadyRequestedUpdatingCommissionRate();\n /// @dev Error of trusted org cannot renounce.\n error ErrTrustedOrgCannotRenounce();\n\n /**\n * @dev Returns the maximum number of validator candidate.\n */\n function maxValidatorCandidate() external view returns (uint256);\n\n /**\n * @dev Returns the minimum number of days to the effective date of commission rate change.\n */\n function minEffectiveDaysOnwards() external view returns (uint256);\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function setMaxValidatorCandidate(uint256) external;\n\n /**\n * @dev Sets the minimum number of days to the effective date of commision rate change.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\n\n /**\n * @dev Grants a validator candidate.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateGranted`.\n *\n */\n function execApplyValidatorCandidate(\n address _admin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external;\n\n /**\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateRevokingTimestampUpdated`.\n *\n */\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\n\n /**\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\n *\n * Requirements:\n * - The method caller is the staking contract.\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\n * - The `_rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdateScheduled`.\n *\n */\n function execRequestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveTimestamp,\n uint256 _rate\n ) external;\n\n /**\n * @dev Returns whether the address is a validator (candidate).\n */\n function isValidatorCandidate(address _addr) external view returns (bool);\n\n /**\n * @dev Returns the validator candidate.\n */\n function getValidatorCandidates() external view returns (address[] memory);\n\n /**\n * @dev Returns all candidate info.\n */\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\n\n /**\n * @dev Returns the info of a candidate.\n */\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\n\n /**\n * @dev Returns whether the address is the candidate admin.\n */\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\n\n /**\n * @dev Returns the schedule of changing commission rate of a candidate address.\n */\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ICommonInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IJailingInfo.sol\";\nimport \"./ITimingInfo.sol\";\nimport \"./IValidatorInfo.sol\";\n\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\n struct EmergencyExitInfo {\n uint256 lockedAmount;\n // The timestamp that this locked amount will be recycled to staking vesting contract\n uint256 recyclingAt;\n }\n\n /// @dev Emitted when the deprecated reward is withdrawn.\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\n /// @dev Emitted when the deprecated reward withdrawal is failed\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\n\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\n error ErrUnauthorizedReceiveRON();\n /// @dev Error thrown when queries for a non existent info.\n error NonExistentRecyclingInfo();\n\n /**\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\n */\n function totalDeprecatedReward() external view returns (uint256);\n\n /**\n * @dev Returns the emergency exit request.\n */\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\n}\n" + }, + "contracts/interfaces/validator/ICoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashingExecution.sol\";\n\ninterface ICoinbaseExecution is ISlashingExecution {\n enum BlockRewardDeprecatedType {\n UNKNOWN,\n UNAVAILABILITY,\n AFTER_BAILOUT\n }\n\n /// @dev Emitted when the validator set is updated\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated.\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\n\n /// @dev Emitted when the reward of the block producer is deprecated.\n event BlockRewardDeprecated(\n address indexed coinbaseAddr,\n uint256 rewardAmount,\n BlockRewardDeprecatedType deprecatedType\n );\n /// @dev Emitted when the block reward is submitted.\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\n\n /// @dev Emitted when the block producer reward is distributed.\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\n /// @dev Emitted when the contract fails when distributing the block producer reward.\n event MiningRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the bridge operator reward is distributed.\n event BridgeOperatorRewardDistributed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipientAddr,\n uint256 amount\n );\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\n event BridgeOperatorRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\n event StakingRewardDistributionFailed(\n uint256 totalAmount,\n address[] consensusAddrs,\n uint256[] amounts,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the epoch is wrapped up.\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\n /// @dev Emitted when the bridge tracking contract's response is incorrect\n event BridgeTrackingIncorrectlyResponded();\n\n /// @dev Error of method caller must be coinbase\n error ErrCallerMustBeCoinbase();\n /// @dev Error of only allowed at the end of epoch\n error ErrAtEndOfEpochOnly();\n /// @dev Error of query for already wrapped up epoch\n error ErrAlreadyWrappedEpoch();\n\n /**\n * @dev Submits reward of the current block.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\n * Emits the event `BlockRewardSubmitted` for the valid call.\n *\n */\n function submitBlockReward() external payable;\n\n /**\n * @dev Wraps up the current epoch.\n *\n * Requirements:\n * - The method must be called when the current epoch is ending.\n * - The epoch is not wrapped yet.\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\n * Emits the event `WrappedUpEpoch`.\n *\n */\n function wrapUpEpoch() external payable;\n}\n" + }, + "contracts/interfaces/validator/ISlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ISlashingExecution {\n /// @dev Emitted when the validator is punished.\n event ValidatorPunished(\n address indexed consensusAddr,\n uint256 indexed period,\n uint256 jailedUntil,\n uint256 deductedStakingAmount,\n bool blockProducerRewardDeprecated,\n bool bridgeOperatorRewardDeprecated\n );\n /// @dev Emitted when the validator get out of jail by bailout.\n event ValidatorUnjailed(address indexed validator, uint256 period);\n\n /// @dev Error of cannot bailout due to high tier slash.\n error ErrCannotBailout(address validator);\n\n /**\n * @dev Finalize the slash request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorPunished`.\n *\n */\n function execSlash(\n address _validatorAddr,\n uint256 _newJailedUntil,\n uint256 _slashAmount,\n bool _cannotBailout\n ) external;\n\n /**\n * @dev Finalize the bailout request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorUnjailed`.\n *\n */\n function execBailOut(address _validatorAddr, uint256 _period) external;\n}\n" + }, + "contracts/interfaces/validator/IEmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IEmergencyExit {\n /// @dev Emitted when the fund is locked from an emergency exit request\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\n event EmergencyExitLockedFundReleased(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount\n );\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\n event EmergencyExitLockedFundReleasingFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the emergency exit locked amount is updated.\n event EmergencyExitLockedAmountUpdated(uint256 amount);\n /// @dev Emitted when the emergency expiry duration is updated.\n event EmergencyExpiryDurationUpdated(uint256 amount);\n\n /// @dev Error of already requested emergency exit before.\n error ErrAlreadyRequestedEmergencyExit();\n\n /**\n * @dev Returns the amount of RON to lock from a consensus address.\n */\n function emergencyExitLockedAmount() external returns (uint256);\n\n /**\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\n */\n function emergencyExpiryDuration() external returns (uint256);\n\n /**\n * @dev Sets the amount of RON to lock from a consensus address.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedAmountUpdated`.\n *\n */\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\n\n /**\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExpiryDurationUpdated`.\n *\n */\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\n\n /**\n * @dev Unlocks fund for emergency exit request.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\n *\n */\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\n\n /**\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n */\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IJailingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IJailingInfo {\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\n */\n function checkJailed(address) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeft(address _addr)\n external\n view\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n );\n\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\n */\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\n external\n view\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n );\n\n /**\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\n */\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\n */\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\n */\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\n\n /**\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\n */\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\n\n /**\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\n */\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\n external\n view\n returns (bool _result);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ITimingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ITimingInfo {\n /**\n * @dev Returns the block that validator set was updated.\n */\n function getLastUpdatedBlock() external view returns (uint256);\n\n /**\n * @dev Returns the number of blocks in a epoch.\n */\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\n\n /**\n * @dev Returns the epoch index from the block number.\n */\n function epochOf(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Returns whether the epoch ending is at the block number `_block`.\n */\n function epochEndingAt(uint256 _block) external view returns (bool);\n\n /**\n * @dev Tries to get the period index from the epoch number.\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\n\n /**\n * @dev Returns whether the period ending at the current block number.\n */\n function isPeriodEnding() external view returns (bool);\n\n /**\n * @dev Returns the period index from the current block.\n */\n function currentPeriod() external view returns (uint256);\n\n /**\n * @dev Returns the block number that the current period starts at.\n */\n function currentPeriodStartAtBlock() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IValidatorInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\n\ninterface IValidatorInfo {\n /// @dev Emitted when the number of max validator is updated.\n event MaxValidatorNumberUpdated(uint256);\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\n event MaxPrioritizedValidatorNumberUpdated(uint256);\n\n /// @dev Error of number of prioritized greater than number of max validators.\n error ErrInvalidMaxPrioritizedValidatorNumber();\n\n /**\n * @dev Returns the maximum number of validators in the epoch.\n */\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\n\n /**\n * @dev Returns the number of reserved slots for prioritized validators.\n */\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\n\n /**\n * @dev Returns the current validator list.\n */\n function getValidators()\n external\n view\n returns (\n address[] memory _validatorList,\n address[] memory _bridgeOperators,\n EnumFlags.ValidatorFlag[] memory _flags\n );\n\n /**\n * @dev Returns whether the address is either a bridge operator or a block producer.\n */\n function isValidator(address _addr) external view returns (bool);\n\n /**\n * @dev Returns the current block producer list.\n */\n function getBlockProducers() external view returns (address[] memory);\n\n /**\n * @dev Returns whether the address is block producer or not.\n */\n function isBlockProducer(address _addr) external view returns (bool);\n\n /**\n * @dev Returns total numbers of the block producers.\n */\n function totalBlockProducers() external view returns (uint256);\n\n /**\n * @dev Returns the current bridge operator list.\n */\n function getBridgeOperators() external view returns (address[] memory);\n\n /**\n * @dev Returns the bridge operator list corresponding to validator address list.\n */\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\n\n /**\n * @dev Returns whether the address is bridge operator.\n */\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\n\n /**\n * @dev Returns whether the consensus address is operating the bridge or not.\n */\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns total numbers of the bridge operators.\n */\n function totalBridgeOperators() external view returns (uint256);\n\n /**\n * @dev Updates the max validator number\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxValidatorNumberUpdated`\n *\n */\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\n\n /**\n * @dev Updates the number of reserved slots for prioritized validators\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\n *\n */\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\n}\n" + }, + "contracts/libraries/EnumFlags.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This library implements checking flag of an enumerated value.\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\n */\nlibrary EnumFlags {\n enum ValidatorFlag {\n None, // bit(00)\n BlockProducer, // bit(01)\n BridgeOperator, // bit(10)\n Both // bit(11)\n }\n\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\n return uint8(_value) == 0;\n }\n\n /**\n * @dev Checks if `_value` has `_flag`.\n */\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\n return (uint8(_value) & uint8(_flag)) != 0;\n }\n\n /**\n * @dev Calculate new value of `_value` after adding `_flag`.\n */\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) | uint8(_flag));\n }\n\n /**\n * @dev Calculate new value of `_value` after remove `_flag`.\n */\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\n }\n}\n" + }, + "contracts/extensions/collections/HasRoninTrustedOrganizationContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\n\ncontract HasRoninTrustedOrganizationContract is IHasRoninTrustedOrganizationContract, HasProxyAdmin {\n IRoninTrustedOrganization internal _roninTrustedOrganizationContract;\n\n modifier onlyRoninTrustedOrganizationContract() {\n if (roninTrustedOrganizationContract() != msg.sender) revert ErrCallerMustBeRoninTrustedOrgContract();\n _;\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function roninTrustedOrganizationContract() public view override returns (address) {\n return address(_roninTrustedOrganizationContract);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function setRoninTrustedOrganizationContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setRoninTrustedOrganizationContract(_addr);\n }\n\n /**\n * @dev Sets the ronin trusted organization contract.\n *\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\n *\n */\n function _setRoninTrustedOrganizationContract(address _addr) internal {\n _roninTrustedOrganizationContract = IRoninTrustedOrganization(_addr);\n emit RoninTrustedOrganizationContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/collections/HasBridgeContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasBridgeContract.sol\";\nimport \"../../interfaces/IBridge.sol\";\n\ncontract HasBridgeContract is IHasBridgeContract, HasProxyAdmin {\n IBridge internal _bridgeContract;\n\n modifier onlyBridgeContract() {\n if (bridgeContract() != msg.sender) revert ErrCallerMustBeBridgeContract();\n _;\n }\n\n /**\n * @inheritdoc IHasBridgeContract\n */\n function bridgeContract() public view override returns (address) {\n return address(_bridgeContract);\n }\n\n /**\n * @inheritdoc IHasBridgeContract\n */\n function setBridgeContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length <= 0) revert ErrZeroCodeContract();\n _setBridgeContract(_addr);\n }\n\n /**\n * @dev Sets the bridge contract.\n *\n * Emits the event `BridgeContractUpdated`.\n *\n */\n function _setBridgeContract(address _addr) internal {\n _bridgeContract = IBridge(_addr);\n emit BridgeContractUpdated(_addr);\n }\n}\n" + }, + "contracts/interfaces/IRoninTrustedOrganization.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IQuorum.sol\";\n\ninterface IRoninTrustedOrganization is IQuorum {\n struct TrustedOrganization {\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n address consensusAddr;\n // Address to voting proposal\n address governor;\n // Address to voting bridge operators\n address bridgeVoter;\n // Its Weight\n uint256 weight;\n // The block that the organization was added\n uint256 addedBlock;\n }\n\n /// @dev Emitted when the trusted organization is added.\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is updated.\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is removed.\n event TrustedOrganizationsRemoved(address[] orgs);\n\n /**\n * @dev Adds a list of addresses into the trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n * - The field `addedBlock` should be blank.\n *\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\n *\n */\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\n\n /**\n * @dev Updates weights for a list of existent trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n *\n * Emits the `TrustedOrganizationUpdated` event.\n *\n */\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\n\n /**\n * @dev Removes a list of addresses from the trusted organization.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\n *\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\n */\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\n\n /**\n * @dev Returns total weights.\n */\n function totalWeights() external view returns (uint256);\n\n /**\n * @dev Returns the weight of a consensus.\n */\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a governor.\n */\n function getGovernorWeight(address _governor) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a bridge voter.\n */\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\n\n /**\n * @dev Returns the weights of a list of consensus addresses.\n */\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of governor addresses.\n */\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of bridge voter addresses.\n */\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns total weights of the consensus list.\n */\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\n\n /**\n * @dev Returns total weights of the governor list.\n */\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\n\n /**\n * @dev Returns total weights of the bridge voter list.\n */\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\n\n /**\n * @dev Returns the trusted organization at `_index`.\n */\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\n\n /**\n * @dev Returns the number of trusted organizations.\n */\n function countTrustedOrganizations() external view returns (uint256);\n\n /**\n * @dev Returns all of the trusted organizations.\n */\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\n\n /**\n * @dev Returns the trusted organization by consensus address.\n *\n * Reverts once the consensus address is non-existent.\n */\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\n}\n" + }, + "contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\n /// @dev Emitted when the ronin trusted organization contract is updated.\n event RoninTrustedOrganizationContractUpdated(address);\n\n /// @dev Error of method caller must be Ronin trusted org contract.\n error ErrCallerMustBeRoninTrustedOrgContract();\n\n /**\n * @dev Returns the ronin trusted organization contract.\n */\n function roninTrustedOrganizationContract() external view returns (address);\n\n /**\n * @dev Sets the ronin trusted organization contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\n *\n */\n function setRoninTrustedOrganizationContract(address) external;\n}\n" + }, + "contracts/interfaces/IQuorum.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IQuorum {\n /// @dev Emitted when the threshold is updated\n event ThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n\n /**\n * @dev Returns the threshold.\n */\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\n\n /**\n * @dev Checks whether the `_voteWeight` passes the threshold.\n */\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\n\n /**\n * @dev Returns the minimum vote weight to pass the threshold.\n */\n function minimumVoteWeight() external view returns (uint256);\n\n /**\n * @dev Sets the threshold.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n returns (uint256 _previousNum, uint256 _previousDenom);\n}\n" + }, + "contracts/interfaces/collections/IHasBridgeContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasBridgeContract is IHasContract {\n /// @dev Emitted when the bridge contract is updated.\n event BridgeContractUpdated(address);\n\n /// @dev Error of method caller must be bridge contract.\n error ErrCallerMustBeBridgeContract();\n\n /**\n * @dev Returns the bridge contract.\n */\n function bridgeContract() external view returns (address);\n\n /**\n * @dev Sets the bridge contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `BridgeContractUpdated`.\n *\n */\n function setBridgeContract(address) external;\n}\n" + }, + "contracts/interfaces/IBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBridge {\n /**\n * @dev Replaces the old bridge operator list by the new one.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emitted the event `BridgeOperatorsReplaced`.\n *\n */\n function replaceBridgeOperators(address[] calldata) external;\n\n /**\n * @dev Returns the bridge operator list.\n */\n function getBridgeOperators() external view returns (address[] memory);\n}\n" + }, + "contracts/ronin/validator/EmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\nimport \"../../interfaces/validator/IEmergencyExit.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\nimport \"./CandidateManager.sol\";\n\nabstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateManager, CommonStorage {\n /**\n * @inheritdoc IEmergencyExit\n */\n function emergencyExitLockedAmount() external view returns (uint256) {\n return _emergencyExitLockedAmount;\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function emergencyExpiryDuration() external view returns (uint256) {\n return _emergencyExpiryDuration;\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external onlyStakingContract {\n EmergencyExitInfo storage _info = _exitInfo[_consensusAddr];\n if (_info.recyclingAt != 0) revert ErrAlreadyRequestedEmergencyExit();\n\n uint256 _revokingTimestamp = block.timestamp + _secLeftToRevoke;\n _setRevokingTimestamp(_candidateInfo[_consensusAddr], _revokingTimestamp);\n _emergencyExitJailedTimestamp[_consensusAddr] = _revokingTimestamp;\n _bridgeRewardDeprecatedAtPeriod[_consensusAddr][currentPeriod()] = true;\n\n uint256 _deductedAmount = _stakingContract.execDeductStakingAmount(_consensusAddr, _emergencyExitLockedAmount);\n if (_deductedAmount > 0) {\n uint256 _recyclingAt = block.timestamp + _emergencyExpiryDuration;\n _lockedConsensusList.push(_consensusAddr);\n _info.lockedAmount = _deductedAmount;\n _info.recyclingAt = _recyclingAt;\n IRoninGovernanceAdmin(_getAdmin()).createEmergencyExitPoll(\n _consensusAddr,\n _candidateInfo[_consensusAddr].treasuryAddr,\n block.timestamp,\n _recyclingAt\n );\n }\n emit EmergencyExitRequested(_consensusAddr, _deductedAmount);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external onlyAdmin {\n _setEmergencyExitLockedAmount(_emergencyExitLockedAmount);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external onlyAdmin {\n _setEmergencyExpiryDuration(_emergencyExpiryDuration);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient)\n external\n onlyAdmin\n {\n if (_exitInfo[_consensusAddr].recyclingAt == 0) {\n return;\n }\n\n uint256 _length = _lockedConsensusList.length;\n uint256 _index = _length;\n\n for (uint _i; _i < _length; _i++) {\n if (_lockedConsensusList[_i] == _consensusAddr) {\n _index = _i;\n break;\n }\n }\n\n // The locked amount might be recycled\n if (_index == _length) {\n return;\n }\n\n uint256 _amount = _exitInfo[_consensusAddr].lockedAmount;\n if (_amount > 0) {\n delete _exitInfo[_consensusAddr];\n if (_length > 1) {\n _lockedConsensusList[_index] = _lockedConsensusList[_length - 1];\n }\n _lockedConsensusList.pop();\n\n _lockedFundReleased[_consensusAddr] = true;\n if (_unsafeSendRON(_recipient, _amount, DEFAULT_ADDITION_GAS)) {\n emit EmergencyExitLockedFundReleased(_consensusAddr, _recipient, _amount);\n return;\n }\n\n emit EmergencyExitLockedFundReleasingFailed(_consensusAddr, _recipient, _amount, address(this).balance);\n }\n }\n\n /**\n * @dev Tries to recycle the locked funds from emergency exit requests.\n */\n function _tryRecycleLockedFundsFromEmergencyExits() internal {\n uint256 _length = _lockedConsensusList.length;\n\n uint256 _i;\n address _addr;\n EmergencyExitInfo storage _info;\n\n while (_i < _length) {\n _addr = _lockedConsensusList[_i];\n _info = _exitInfo[_addr];\n\n if (_info.recyclingAt <= block.timestamp) {\n _totalDeprecatedReward += _info.lockedAmount;\n\n delete _exitInfo[_addr];\n if (--_length > 0) {\n _lockedConsensusList[_i] = _lockedConsensusList[_length];\n }\n _lockedConsensusList.pop();\n continue;\n }\n\n _i++;\n }\n }\n\n /**\n * @dev Override `CandidateManager-_emergencyExitLockedFundReleased`.\n */\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {\n return _lockedFundReleased[_consensusAddr];\n }\n\n /**\n * @dev Override `CandidateManager-_removeCandidate`.\n */\n function _removeCandidate(address _consensusAddr) internal override {\n delete _lockedFundReleased[_consensusAddr];\n super._removeCandidate(_consensusAddr);\n }\n\n /**\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\n */\n function _bridgeOperatorOf(address _consensusAddr)\n internal\n view\n virtual\n override(CandidateManager, ValidatorInfoStorage)\n returns (address)\n {\n return CandidateManager._bridgeOperatorOf(_consensusAddr);\n }\n\n /**\n * @dev See `setEmergencyExitLockedAmount.\n */\n function _setEmergencyExitLockedAmount(uint256 _amount) internal {\n _emergencyExitLockedAmount = _amount;\n emit EmergencyExitLockedAmountUpdated(_amount);\n }\n\n /**\n * @dev See `setEmergencyExpiryDuration`.\n */\n function _setEmergencyExpiryDuration(uint256 _duration) internal {\n _emergencyExpiryDuration = _duration;\n emit EmergencyExpiryDurationUpdated(_duration);\n }\n}\n" + }, + "contracts/extensions/RONTransferHelper.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nabstract contract RONTransferHelper {\n /// @dev Error of recipient not accepting RON when transfer RON.\n error ErrRecipientRevert();\n /// @dev Error of sender has insufficient balance.\n error ErrInsufficientBalance();\n\n /**\n * @dev See `_sendRON`.\n * Reverts if the recipient does not receive RON.\n */\n function _transferRON(address payable _recipient, uint256 _amount) internal {\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\n }\n\n /**\n * @dev Send `_amount` RON to the address `_recipient`.\n * Returns whether the recipient receives RON or not.\n * Reverts once the contract balance is insufficient.\n *\n * Note: consider using `ReentrancyGuard` before calling this function.\n *\n */\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\n return _unsafeSendRON(_recipient, _amount);\n }\n\n /**\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\n * the call does not revert.\n *\n * Note:\n * - Does not assert whether the balance of sender is sufficient.\n * - Does not assert whether the recipient accepts RON.\n * - Consider using `ReentrancyGuard` before calling this function.\n *\n */\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\n (_success, ) = _recipient.call{ value: _amount }(\"\");\n }\n\n /**\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\n */\n function _unsafeSendRON(\n address payable _recipient,\n uint256 _amount,\n uint256 _gas\n ) internal returns (bool _success) {\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\"\");\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/CommonStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../interfaces/validator/info-fragments/ICommonInfo.sol\";\nimport \"./JailingStorage.sol\";\nimport \"./TimingStorage.sol\";\nimport \"./ValidatorInfoStorage.sol\";\n\nabstract contract CommonStorage is ICommonInfo, TimingStorage, JailingStorage, ValidatorInfoStorage {\n /// @dev Mapping from consensus address => pending reward from producing block\n mapping(address => uint256) internal _miningReward;\n /// @dev Mapping from consensus address => pending reward from delegating\n mapping(address => uint256) internal _delegatingReward;\n\n /// @dev The total reward for bridge operators\n uint256 internal _totalBridgeReward;\n /// @dev Mapping from consensus address => pending reward for being bridge operator\n mapping(address => uint256) internal _bridgeOperatingReward;\n\n /// @dev The deprecated reward that has not been withdrawn by admin\n uint256 internal _totalDeprecatedReward;\n\n /// @dev The amount of RON to lock from a consensus address.\n uint256 internal _emergencyExitLockedAmount;\n /// @dev The duration that an emergency request is expired and the fund will be recycled.\n uint256 internal _emergencyExpiryDuration;\n /// @dev The address list of consensus addresses that being locked fund.\n address[] internal _lockedConsensusList;\n /// @dev Mapping from consensus => request exist info\n mapping(address => EmergencyExitInfo) internal _exitInfo;\n /// @dev Mapping from consensus => flag indicating whether the locked fund is released\n mapping(address => bool) internal _lockedFundReleased;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[44] private ______gap;\n\n /**\n * @inheritdoc ICommonInfo\n */\n function getEmergencyExitInfo(address _consensusAddr)\n external\n view\n override\n returns (EmergencyExitInfo memory _info)\n {\n _info = _exitInfo[_consensusAddr];\n if (_info.recyclingAt == 0) revert NonExistentRecyclingInfo();\n }\n\n /**\n * @inheritdoc ICommonInfo\n */\n function totalDeprecatedReward() external view override returns (uint256) {\n return _totalDeprecatedReward;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochOf(uint256 _block)\n public\n view\n virtual\n override(ITimingInfo, JailingStorage, TimingStorage)\n returns (uint256)\n {\n return TimingStorage.epochOf(_block);\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriod() public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) {\n return TimingStorage.currentPeriod();\n }\n}\n" + }, + "contracts/ronin/validator/CandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasStakingContract.sol\";\nimport \"../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../interfaces/validator/ICandidateManager.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\n\nabstract contract CandidateManager is ICandidateManager, PercentageConsumer, GlobalConfigConsumer, HasStakingContract {\n /// @dev Maximum number of validator candidate\n uint256 private _maxValidatorCandidate;\n\n /// @dev The validator candidate array\n address[] internal _candidates;\n /// @dev Mapping from candidate consensus address => bitwise negation of validator index in `_candidates`\n mapping(address => uint256) internal _candidateIndex;\n /// @dev Mapping from candidate consensus address => their info\n mapping(address => ValidatorCandidate) internal _candidateInfo;\n\n /**\n * @dev The minimum offset in day from current date to the effective date of a new commission schedule.\n * Value of 1 means the change gets affected at the beginning of the following day.\n **/\n uint256 internal _minEffectiveDaysOnwards;\n /// @dev Mapping from candidate consensus address => schedule commission change.\n mapping(address => CommissionSchedule) internal _candidateCommissionChangeSchedule;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc ICandidateManager\n */\n function maxValidatorCandidate() public view override returns (uint256) {\n return _maxValidatorCandidate;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function minEffectiveDaysOnwards() external view override returns (uint256) {\n return _minEffectiveDaysOnwards;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function setMaxValidatorCandidate(uint256 _number) external override onlyAdmin {\n _setMaxValidatorCandidate(_number);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external override onlyAdmin {\n _setMinEffectiveDaysOnwards(_numOfDays);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function execApplyValidatorCandidate(\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external override onlyStakingContract {\n uint256 _length = _candidates.length;\n if (_length >= maxValidatorCandidate()) revert ErrExceedsMaxNumberOfCandidate();\n if (isValidatorCandidate(_consensusAddr)) revert ErrExistentCandidate();\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\n\n for (uint _i; _i < _candidates.length; _i++) {\n ValidatorCandidate storage existentInfo = _candidateInfo[_candidates[_i]];\n if (_candidateAdmin == existentInfo.admin) revert ErrExistentCandidateAdmin(_candidateAdmin);\n if (_treasuryAddr == existentInfo.treasuryAddr) revert ErrExistentTreasury(_treasuryAddr);\n if (_bridgeOperatorAddr == existentInfo.bridgeOperatorAddr) revert ErrExistentBridgeOperator(_bridgeOperatorAddr);\n }\n\n _candidateIndex[_consensusAddr] = ~_length;\n _candidates.push(_consensusAddr);\n\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\n _info.admin = _candidateAdmin;\n _info.consensusAddr = _consensusAddr;\n _info.treasuryAddr = _treasuryAddr;\n _info.bridgeOperatorAddr = _bridgeOperatorAddr;\n _info.commissionRate = _commissionRate;\n emit CandidateGranted(_consensusAddr, _treasuryAddr, _candidateAdmin, _bridgeOperatorAddr);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function execRequestRenounceCandidate(address _consensusAddr, uint256 _secsLeft)\n external\n override\n onlyStakingContract\n {\n if (_isTrustedOrg(_consensusAddr)) revert ErrTrustedOrgCannotRenounce();\n\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\n if (_info.revokingTimestamp != 0) revert ErrAlreadyRequestedRevokingCandidate();\n _setRevokingTimestamp(_info, block.timestamp + _secsLeft);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function execRequestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveDaysOnwards,\n uint256 _commissionRate\n ) external override onlyStakingContract {\n if (_candidateCommissionChangeSchedule[_consensusAddr].effectiveTimestamp != 0) {\n revert ErrAlreadyRequestedUpdatingCommissionRate();\n }\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\n if (_effectiveDaysOnwards < _minEffectiveDaysOnwards) revert ErrInvalidEffectiveDaysOnwards();\n\n CommissionSchedule storage _schedule = _candidateCommissionChangeSchedule[_consensusAddr];\n uint256 _effectiveTimestamp = ((block.timestamp / PERIOD_DURATION) + _effectiveDaysOnwards) * PERIOD_DURATION;\n _schedule.effectiveTimestamp = _effectiveTimestamp;\n _schedule.commissionRate = _commissionRate;\n\n emit CommissionRateUpdateScheduled(_consensusAddr, _effectiveTimestamp, _commissionRate);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function isValidatorCandidate(address _addr) public view override returns (bool) {\n return _candidateIndex[_addr] != 0;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCandidateInfos() external view override returns (ValidatorCandidate[] memory _list) {\n _list = new ValidatorCandidate[](_candidates.length);\n for (uint _i; _i < _list.length; _i++) {\n _list[_i] = _candidateInfo[_candidates[_i]];\n }\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCandidateInfo(address _candidate) external view override returns (ValidatorCandidate memory) {\n if (!isValidatorCandidate(_candidate)) revert ErrNonExistentCandidate();\n return _candidateInfo[_candidate];\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getValidatorCandidates() public view override returns (address[] memory) {\n return _candidates;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCommissionChangeSchedule(address _candidate) external view override returns (CommissionSchedule memory) {\n return _candidateCommissionChangeSchedule[_candidate];\n }\n\n /**\n * @dev Removes unsastisfied candidates, the ones who have insufficient minimum candidate staking amount,\n * or the ones who requested to renounce their candidate role.\n *\n * Emits the event `CandidatesRevoked` when a candidate is revoked.\n *\n */\n function _syncCandidateSet(uint256 _nextPeriod) internal returns (address[] memory _unsatisfiedCandidates) {\n IStaking _staking = _stakingContract;\n uint256 _waitingSecsToRevoke = _staking.waitingSecsToRevoke();\n uint256 _minStakingAmount = _staking.minValidatorStakingAmount();\n uint256[] memory _selfStakings = _staking.getManySelfStakings(_candidates);\n\n uint256 _length = _candidates.length;\n uint256 _unsatisfiedCount;\n _unsatisfiedCandidates = new address[](_length);\n\n {\n uint256 _i;\n address _addr;\n ValidatorCandidate storage _info;\n while (_i < _length) {\n _addr = _candidates[_i];\n _info = _candidateInfo[_addr];\n\n // Checks for under-balance status of candidates\n bool _hasTopupDeadline = _info.topupDeadline != 0;\n if (_selfStakings[_i] < _minStakingAmount) {\n // Updates deadline on the first time unsatisfied the staking amount condition\n if (!_hasTopupDeadline) {\n uint256 _topupDeadline = block.timestamp + _waitingSecsToRevoke;\n _info.topupDeadline = _topupDeadline;\n emit CandidateTopupDeadlineUpdated(_addr, _topupDeadline);\n }\n } else if (_hasTopupDeadline) {\n // Removes the deadline if the staking amount condition is satisfied\n delete _info.topupDeadline;\n emit CandidateTopupDeadlineUpdated(_addr, 0);\n }\n\n // Removes unsastisfied candidates\n bool _revokingActivated = (_info.revokingTimestamp != 0 && _info.revokingTimestamp <= block.timestamp) ||\n _emergencyExitLockedFundReleased(_addr);\n bool _topupDeadlineMissed = _info.topupDeadline != 0 && _info.topupDeadline <= block.timestamp;\n if (_revokingActivated || _topupDeadlineMissed) {\n _selfStakings[_i] = _selfStakings[--_length];\n _unsatisfiedCandidates[_unsatisfiedCount++] = _addr;\n _removeCandidate(_addr);\n continue;\n }\n\n // Checks for schedule of commission change and updates commission rate\n uint256 _scheduleTimestamp = _candidateCommissionChangeSchedule[_addr].effectiveTimestamp;\n if (_scheduleTimestamp != 0 && _scheduleTimestamp <= block.timestamp) {\n uint256 _commisionRate = _candidateCommissionChangeSchedule[_addr].commissionRate;\n delete _candidateCommissionChangeSchedule[_addr];\n _info.commissionRate = _commisionRate;\n emit CommissionRateUpdated(_addr, _commisionRate);\n }\n\n _i++;\n }\n }\n\n assembly {\n mstore(_unsatisfiedCandidates, _unsatisfiedCount)\n }\n\n if (_unsatisfiedCount > 0) {\n emit CandidatesRevoked(_unsatisfiedCandidates);\n _staking.execDeprecatePools(_unsatisfiedCandidates, _nextPeriod);\n }\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function isCandidateAdmin(address _candidate, address _admin) external view override returns (bool) {\n return _candidateInfo[_candidate].admin == _admin;\n }\n\n /**\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\n */\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address) {\n return _candidateInfo[_consensusAddr].bridgeOperatorAddr;\n }\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function _setMaxValidatorCandidate(uint256 _threshold) internal {\n _maxValidatorCandidate = _threshold;\n emit MaxValidatorCandidateUpdated(_threshold);\n }\n\n /**\n * @dev Sets the minimum number of days onwards to the effective date of commission rate change.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function _setMinEffectiveDaysOnwards(uint256 _numOfDays) internal {\n if (_numOfDays < 1) revert ErrInvalidMinEffectiveDaysOnwards();\n _minEffectiveDaysOnwards = _numOfDays;\n emit MinEffectiveDaysOnwardsUpdated(_numOfDays);\n }\n\n /**\n * @dev Removes the candidate.\n */\n function _removeCandidate(address _addr) internal virtual {\n uint256 _idx = _candidateIndex[_addr];\n if (_idx == 0) {\n return;\n }\n\n delete _candidateInfo[_addr];\n delete _candidateIndex[_addr];\n delete _candidateCommissionChangeSchedule[_addr];\n\n address _lastCandidate = _candidates[_candidates.length - 1];\n if (_lastCandidate != _addr) {\n _candidateIndex[_lastCandidate] = _idx;\n _candidates[~_idx] = _lastCandidate;\n }\n\n _candidates.pop();\n }\n\n /**\n * @dev Sets timestamp to revoke a candidate.\n */\n function _setRevokingTimestamp(ValidatorCandidate storage _candidate, uint256 _timestamp) internal {\n if (!isValidatorCandidate(_candidate.consensusAddr)) revert ErrNonExistentCandidate();\n _candidate.revokingTimestamp = _timestamp;\n emit CandidateRevokingTimestampUpdated(_candidate.consensusAddr, _timestamp);\n }\n\n /**\n * @dev Returns a flag indicating whether the fund is unlocked.\n */\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual returns (bool);\n\n /**\n * @dev Returns whether the consensus address is a trusted org or not.\n */\n function _isTrustedOrg(address _consensusAddr) internal virtual returns (bool);\n}\n" + }, + "contracts/ronin/validator/storage-fragments/JailingStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../interfaces/validator/info-fragments/IJailingInfo.sol\";\nimport \"./TimingStorage.sol\";\n\nabstract contract JailingStorage is IJailingInfo {\n /// @dev Mapping from consensus address => period number => block producer has no pending reward.\n mapping(address => mapping(uint256 => bool)) internal _miningRewardDeprecatedAtPeriod;\n /// @dev Mapping from consensus address => period number => whether the block producer get cut off reward, due to bailout.\n mapping(address => mapping(uint256 => bool)) internal _miningRewardBailoutCutOffAtPeriod;\n /// @dev Mapping from consensus address => period number => block operator has no pending reward.\n mapping(address => mapping(uint256 => bool)) internal _bridgeRewardDeprecatedAtPeriod;\n\n /// @dev Mapping from consensus address => the last block that the block producer is jailed.\n mapping(address => uint256) internal _blockProducerJailedBlock;\n /// @dev Mapping from consensus address => the last timestamp that the bridge operator is jailed.\n mapping(address => uint256) internal _emergencyExitJailedTimestamp;\n /// @dev Mapping from consensus address => the last block that the block producer cannot bailout.\n mapping(address => uint256) internal _cannotBailoutUntilBlock;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkJailed(address _addr) external view override returns (bool) {\n return checkJailedAtBlock(_addr, block.number);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function getJailedTimeLeft(address _addr)\n external\n view\n override\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n )\n {\n return getJailedTimeLeftAtBlock(_addr, block.number);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkJailedAtBlock(address _addr, uint256 _blockNum) public view override returns (bool) {\n return _jailedAtBlock(_addr, _blockNum);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\n public\n view\n override\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n )\n {\n uint256 _jailedBlock = _blockProducerJailedBlock[_addr];\n if (_jailedBlock < _blockNum) {\n return (false, 0, 0);\n }\n\n isJailed_ = true;\n blockLeft_ = _jailedBlock - _blockNum + 1;\n epochLeft_ = epochOf(_jailedBlock) - epochOf(_blockNum) + 1;\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkManyJailed(address[] calldata _addrList) external view override returns (bool[] memory _result) {\n _result = new bool[](_addrList.length);\n for (uint256 _i; _i < _addrList.length; _i++) {\n _result[_i] = _jailed(_addrList[_i]);\n }\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkMiningRewardDeprecated(address _blockProducer) external view override returns (bool _result) {\n uint256 _period = currentPeriod();\n return _miningRewardDeprecated(_blockProducer, _period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period)\n external\n view\n override\n returns (bool _result)\n {\n return _miningRewardDeprecated(_blockProducer, _period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n *\n * @dev Because the information of deprecating bridge reward of a period is only determined at the end of that period, this\n * method will return the deprecating info of the latest period. A method for querying that info of current period is no need.\n */\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr)\n external\n view\n override\n returns (bool _result)\n {\n uint256 _period = currentPeriod() - 1;\n return _bridgeRewardDeprecated(_consensusAddr, _period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\n external\n view\n override\n returns (bool _result)\n {\n return _bridgeRewardDeprecated(_consensusAddr, _period);\n }\n\n /**\n * @dev See `ITimingInfo-epochOf`\n */\n function epochOf(uint256 _block) public view virtual returns (uint256);\n\n /**\n * @dev See `ITimingInfo-currentPeriod`\n */\n function currentPeriod() public view virtual returns (uint256);\n\n /**\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) during the current period.\n */\n function _jailed(address _validatorAddr) internal view returns (bool) {\n return _jailedAtBlock(_validatorAddr, block.number);\n }\n\n /**\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) at a specific block.\n */\n function _jailedAtBlock(address _validatorAddr, uint256 _blockNum) internal view returns (bool) {\n return _blockNum <= _blockProducerJailedBlock[_validatorAddr];\n }\n\n /**\n * @dev Returns whether the block producer has no pending reward in that period.\n */\n function _miningRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\n return _miningRewardDeprecatedAtPeriod[_validatorAddr][_period];\n }\n\n /**\n * @dev Returns whether the bridge operator has no pending reward in the period.\n */\n function _bridgeRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\n return _bridgeRewardDeprecatedAtPeriod[_validatorAddr][_period];\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/TimingStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../../interfaces/validator/info-fragments/ITimingInfo.sol\";\n\nabstract contract TimingStorage is ITimingInfo, GlobalConfigConsumer {\n /// @dev The number of blocks in a epoch\n uint256 internal _numberOfBlocksInEpoch;\n /// @dev The last updated block\n uint256 internal _lastUpdatedBlock;\n /// @dev The last updated period\n uint256 internal _lastUpdatedPeriod;\n /// @dev The starting block of the last updated period\n uint256 internal _currentPeriodStartAtBlock;\n\n /// @dev Mapping from epoch index => period index\n mapping(uint256 => uint256) internal _periodOf;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n /**\n * @inheritdoc ITimingInfo\n */\n function getLastUpdatedBlock() external view override returns (uint256) {\n return _lastUpdatedBlock;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochOf(uint256 _block) public view virtual override returns (uint256) {\n return _block / _numberOfBlocksInEpoch + 1;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber) {\n return (_epoch <= epochOf(block.number) || _periodOf[_epoch] > 0, _periodOf[_epoch]);\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function isPeriodEnding() external view override returns (bool) {\n return _isPeriodEnding(_computePeriod(block.timestamp));\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochEndingAt(uint256 _block) public view virtual override returns (bool) {\n return _block % _numberOfBlocksInEpoch == _numberOfBlocksInEpoch - 1;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriod() public view virtual override returns (uint256) {\n return _lastUpdatedPeriod;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriodStartAtBlock() public view override returns (uint256) {\n return _currentPeriodStartAtBlock;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function numberOfBlocksInEpoch() public view virtual override returns (uint256 _numberOfBlocks) {\n return _numberOfBlocksInEpoch;\n }\n\n /**\n * @dev See `ITimingInfo-isPeriodEnding`\n */\n function _isPeriodEnding(uint256 _newPeriod) internal view virtual returns (bool) {\n return _newPeriod > _lastUpdatedPeriod;\n }\n\n /**\n * @dev Returns the calculated period.\n */\n function _computePeriod(uint256 _timestamp) internal pure returns (uint256) {\n return _timestamp / PERIOD_DURATION;\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/ValidatorInfoStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\nimport \"../../../extensions/collections/HasRoninTrustedOrganizationContract.sol\";\nimport \"../../../interfaces/validator/info-fragments/IValidatorInfo.sol\";\n\nabstract contract ValidatorInfoStorage is IValidatorInfo, HasRoninTrustedOrganizationContract {\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n /// @dev The maximum number of validator.\n uint256 internal _maxValidatorNumber;\n\n /// @dev The total of validators\n uint256 public validatorCount;\n /// @dev Mapping from validator index => validator address\n mapping(uint256 => address) internal _validators;\n /// @dev Mapping from address => flag indicating the validator ability: producing block, operating bridge\n mapping(address => EnumFlags.ValidatorFlag) internal _validatorMap;\n /// @dev The number of slot that is reserved for prioritized validators\n uint256 internal _maxPrioritizedValidatorNumber;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getValidators()\n public\n view\n override\n returns (\n address[] memory _validatorList,\n address[] memory _bridgeOperators,\n EnumFlags.ValidatorFlag[] memory _flags\n )\n {\n _validatorList = new address[](validatorCount);\n _bridgeOperators = new address[](validatorCount);\n _flags = new EnumFlags.ValidatorFlag[](validatorCount);\n for (uint _i; _i < _validatorList.length; _i++) {\n address _validator = _validators[_i];\n _validatorList[_i] = _validator;\n _bridgeOperators[_i] = _bridgeOperatorOf(_validator);\n _flags[_i] = _validatorMap[_validator];\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isValidator(address _addr) public view override returns (bool) {\n return !_validatorMap[_addr].isNone();\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getBlockProducers() public view override returns (address[] memory _result) {\n _result = new address[](validatorCount);\n uint256 _count = 0;\n for (uint _i; _i < _result.length; _i++) {\n if (isBlockProducer(_validators[_i])) {\n _result[_count++] = _validators[_i];\n }\n }\n\n assembly {\n mstore(_result, _count)\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isBlockProducer(address _addr) public view override returns (bool) {\n return _validatorMap[_addr].hasFlag(EnumFlags.ValidatorFlag.BlockProducer);\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function totalBlockProducers() external view returns (uint256 _total) {\n for (uint _i; _i < validatorCount; _i++) {\n if (isBlockProducer(_validators[_i])) {\n _total++;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getBridgeOperators() public view override returns (address[] memory _result) {\n _result = new address[](validatorCount);\n uint256 _count = 0;\n for (uint _i; _i < _result.length; _i++) {\n if (isOperatingBridge(_validators[_i])) {\n _result[_count++] = _bridgeOperatorOf(_validators[_i]);\n }\n }\n\n assembly {\n mstore(_result, _count)\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getBridgeOperatorsOf(address[] memory _validatorAddrs)\n public\n view\n override\n returns (address[] memory _result)\n {\n _result = new address[](_validatorAddrs.length);\n for (uint _i; _i < _result.length; _i++) {\n _result[_i] = _bridgeOperatorOf(_validatorAddrs[_i]);\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isBridgeOperator(address _bridgeOperatorAddr) external view override returns (bool _isOperator) {\n for (uint _i; _i < validatorCount; _i++) {\n if (_bridgeOperatorOf(_validators[_i]) == _bridgeOperatorAddr && isOperatingBridge(_validators[_i])) {\n _isOperator = true;\n break;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isOperatingBridge(address _consensusAddr) public view override returns (bool) {\n return _validatorMap[_consensusAddr].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator);\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {\n return _maxValidatorNumber;\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function maxPrioritizedValidatorNumber() external view override returns (uint256 _maximumPrioritizedValidatorNumber) {\n return _maxPrioritizedValidatorNumber;\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function totalBridgeOperators() public view returns (uint256 _total) {\n for (uint _i; _i < validatorCount; _i++) {\n if (isOperatingBridge(_validators[_i])) {\n _total++;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function setMaxValidatorNumber(uint256 _max) external override onlyAdmin {\n _setMaxValidatorNumber(_max);\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function setMaxPrioritizedValidatorNumber(uint256 _number) external override onlyAdmin {\n _setMaxPrioritizedValidatorNumber(_number);\n }\n\n /**\n * @dev Returns the bridge operator of a consensus address.\n */\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address);\n\n /**\n * @dev See `IValidatorInfo-setMaxValidatorNumber`\n */\n function _setMaxValidatorNumber(uint256 _number) internal {\n _maxValidatorNumber = _number;\n emit MaxValidatorNumberUpdated(_number);\n }\n\n /**\n * @dev See `IValidatorInfo-setMaxPrioritizedValidatorNumber`\n */\n function _setMaxPrioritizedValidatorNumber(uint256 _number) internal {\n if (_number > _maxValidatorNumber) revert ErrInvalidMaxPrioritizedValidatorNumber();\n _maxPrioritizedValidatorNumber = _number;\n emit MaxPrioritizedValidatorNumberUpdated(_number);\n }\n}\n" + }, + "contracts/extensions/consumers/GlobalConfigConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nabstract contract GlobalConfigConsumer {\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\n /// @dev The length of a period in second.\n uint256 public constant PERIOD_DURATION = 1 days;\n}\n" + }, + "contracts/extensions/collections/HasStakingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasStakingContract.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\n\ncontract HasStakingContract is IHasStakingContract, HasProxyAdmin {\n IStaking internal _stakingContract;\n\n modifier onlyStakingContract() {\n if (stakingContract() != msg.sender) revert ErrCallerMustBeStakingContract();\n _;\n }\n\n /**\n * @inheritdoc IHasStakingContract\n */\n function stakingContract() public view override returns (address) {\n return address(_stakingContract);\n }\n\n /**\n * @inheritdoc IHasStakingContract\n */\n function setStakingContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setStakingContract(_addr);\n }\n\n /**\n * @dev Sets the staking contract.\n *\n * Emits the event `StakingContractUpdated`.\n *\n */\n function _setStakingContract(address _addr) internal {\n _stakingContract = IStaking(_addr);\n emit StakingContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/consumers/PercentageConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract PercentageConsumer {\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\n}\n" + }, + "contracts/interfaces/staking/IStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseStaking.sol\";\nimport \"./ICandidateStaking.sol\";\nimport \"./IDelegatorStaking.sol\";\n\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\n /**\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\n *\n * Note: This method should be called once at the period ending.\n *\n */\n function execRecordRewards(\n address[] calldata _consensusAddrs,\n uint256[] calldata _rewards,\n uint256 _period\n ) external payable;\n\n /**\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `Unstaked`.\n *\n */\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\n external\n returns (uint256 _actualDeductingAmount);\n}\n" + }, + "contracts/interfaces/collections/IHasStakingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasStakingContract is IHasContract {\n /// @dev Emitted when the staking contract is updated.\n event StakingContractUpdated(address);\n\n /// @dev Error of method caller must be staking contract.\n error ErrCallerMustBeStakingContract();\n\n /**\n * @dev Returns the staking contract.\n */\n function stakingContract() external view returns (address);\n\n /**\n * @dev Sets the staking contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `StakingContractUpdated`.\n *\n */\n function setStakingContract(address) external;\n}\n" + }, + "contracts/interfaces/staking/IBaseStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IBaseStaking {\n struct PoolDetail {\n // Address of the pool i.e. consensus address of the validator\n address addr;\n // Pool admin address\n address admin;\n // Self-staking amount\n uint256 stakingAmount;\n // Total number of RON staking for the pool\n uint256 stakingTotal;\n // Mapping from delegator => delegating amount\n mapping(address => uint256) delegatingAmount;\n // Mapping from delegator => the last timestamp that delegator staked\n mapping(address => uint256) lastDelegatingTimestamp;\n }\n\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\n event WaitingSecsToRevokeUpdated(uint256 secs);\n\n /// @dev Error of cannot transfer RON.\n error ErrCannotTransferRON();\n /// @dev Error of receiving zero message value.\n error ErrZeroValue();\n /// @dev Error of pool admin is not allowed to call.\n error ErrPoolAdminForbidden();\n /// @dev Error of no one is allowed to call but the pool's admin.\n error ErrOnlyPoolAdminAllowed();\n /// @dev Error of admin of any active pool cannot delegate.\n error ErrAdminOfAnyActivePoolForbidden(address admin);\n /// @dev Error of querying inactive pool.\n error ErrInactivePool(address poolAddr);\n /// @dev Error of length of input arrays are not of the same.\n error ErrInvalidArrays();\n\n /**\n * @dev Returns whether the `_poolAdminAddr` is currently active.\n */\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\n\n /**\n * @dev Returns the consensus address corresponding to the pool admin.\n */\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\n\n /**\n * @dev Returns the staking pool detail.\n */\n function getPoolDetail(address)\n external\n view\n returns (\n address _admin,\n uint256 _stakingAmount,\n uint256 _stakingTotal\n );\n\n /**\n * @dev Returns the self-staking amounts of the pools.\n */\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\n\n /**\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n */\n function cooldownSecsToUndelegate() external view returns (uint256);\n\n /**\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\n */\n function waitingSecsToRevoke() external view returns (uint256);\n\n /**\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CooldownSecsToUndelegateUpdated`.\n *\n */\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\n\n /**\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `WaitingSecsToRevokeUpdated`.\n *\n */\n function setWaitingSecsToRevoke(uint256 _secs) external;\n}\n" + }, + "contracts/interfaces/staking/ICandidateStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface ICandidateStaking is IRewardPool {\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\n event MinValidatorStakingAmountUpdated(uint256 threshold);\n /// @dev Emitted when the commission rate range is updated.\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\n\n /// @dev Emitted when the pool admin staked for themself.\n event Staked(address indexed consensuAddr, uint256 amount);\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\n event Unstaked(address indexed consensuAddr, uint256 amount);\n\n /// @dev Emitted when the validator pool is approved.\n event PoolApproved(address indexed validator, address indexed admin);\n /// @dev Emitted when the validator pool is deprecated.\n event PoolsDeprecated(address[] validator);\n /// @dev Emitted when the staking amount transfer failed.\n event StakingAmountTransferFailed(\n address indexed validator,\n address indexed admin,\n uint256 amount,\n uint256 contractBalance\n );\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\n event StakingAmountDeductFailed(\n address indexed validator,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Error of cannot transfer RON to specified target.\n error ErrCannotInitTransferRON(address addr, string extraInfo);\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\n error ErrThreeInteractionAddrsNotEqual();\n /// @dev Error of three operation addresses must be distinct in applying for validator candidate.\n error ErrThreeOperationAddrsNotDistinct();\n /// @dev Error of unstaking zero amount.\n error ErrUnstakeZeroAmount();\n /// @dev Error of invalid staking amount left after deducted.\n error ErrStakingAmountLeft();\n /// @dev Error of insufficient staking amount for unstaking.\n error ErrInsufficientStakingAmount();\n /// @dev Error of unstaking too early.\n error ErrUnstakeTooEarly();\n /// @dev Error of setting commission rate exceeds max allowed.\n error ErrInvalidCommissionRate();\n\n /**\n * @dev Returns the minimum threshold for being a validator candidate.\n */\n function minValidatorStakingAmount() external view returns (uint256);\n\n /**\n * @dev Returns the commission rate range that the candidate can set.\n */\n function getCommissionRateRange() external view returns (uint256 _minRange, uint256 _maxRange);\n\n /**\n * @dev Sets the minimum threshold for being a validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinValidatorStakingAmountUpdated` event.\n *\n */\n function setMinValidatorStakingAmount(uint256) external;\n\n /**\n * @dev Sets the commission rate range that a candidate can set.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `CommissionRateRangeUpdated` event.\n *\n */\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external;\n\n /**\n * @dev Proposes a candidate to become a validator.\n *\n * Requirements:\n * - The method caller is able to receive RON.\n * - The treasury is able to receive RON.\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\n *\n * Emits the event `PoolApproved`.\n *\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\n * to its candidate, e.g. scheduling maintenance.\n *\n */\n function applyValidatorCandidate(\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external payable;\n\n /**\n * @dev Deprecates the pool.\n * - Deduct self-staking amount of the pool admin to zero.\n * - Transfer the deducted amount to the pool admin.\n * - Deactivate the pool admin address in the mapping of active pool admins\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\n *\n */\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\n\n /**\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `msg.value` is larger than 0.\n *\n * Emits the event `Staked`.\n *\n */\n function stake(address _consensusAddr) external payable;\n\n /**\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n * Emits the event `Unstaked`.\n *\n */\n function unstake(address _consensusAddr, uint256 _amount) external;\n\n /**\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\n * - The `_rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdated`.\n *\n */\n function requestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveDaysOnwards,\n uint256 _commissionRate\n ) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestRenounce(address _consensusAddr) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestEmergencyExit(address _consensusAddr) external;\n}\n" + }, + "contracts/interfaces/staking/IDelegatorStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface IDelegatorStaking is IRewardPool {\n /// @dev Emitted when the delegator staked for a validator candidate.\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\n /// @dev Emitted when the delegator unstaked from a validator candidate.\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\n\n /// @dev Error of undelegating zero amount.\n error ErrUndelegateZeroAmount();\n /// @dev Error of undelegating insufficient amount.\n error ErrInsufficientDelegatingAmount();\n /// @dev Error of undelegating too early.\n error ErrUndelegateTooEarly();\n\n /**\n * @dev Stakes for a validator candidate `_consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is not the pool admin.\n *\n * Emits the `Delegated` event.\n *\n */\n function delegate(address _consensusAddr) external payable;\n\n /**\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the `Undelegated` event.\n *\n */\n function undelegate(address _consensusAddr, uint256 _amount) external;\n\n /**\n * @dev Bulk unstakes from a list of candidates.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the events `Undelegated`.\n *\n */\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\n\n /**\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `Undelegated` event and the `Delegated` event.\n *\n */\n function redelegate(\n address _consensusAddrSrc,\n address _consensusAddrDst,\n uint256 _amount\n ) external;\n\n /**\n * @dev Returns the claimable reward of the user `_user`.\n */\n function getRewards(address _user, address[] calldata _poolAddrList)\n external\n view\n returns (uint256[] memory _rewards);\n\n /**\n * @dev Claims the reward of method caller.\n *\n * Emits the `RewardClaimed` event.\n *\n */\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\n\n /**\n * @dev Claims the rewards and delegates them to the consensus address.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `RewardClaimed` event and the `Delegated` event.\n *\n */\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\n external\n returns (uint256 _amount);\n}\n" + }, + "contracts/interfaces/staking/IRewardPool.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/consumers/PeriodWrapperConsumer.sol\";\n\ninterface IRewardPool is PeriodWrapperConsumer {\n struct UserRewardFields {\n // Recorded reward amount.\n uint256 debited;\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\n uint256 aRps;\n // Lowest staking amount in the period.\n uint256 lowestAmount;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n\n struct PoolFields {\n // Accumulated of the amount rewards per share (one unit staking).\n uint256 aRps;\n // The staking total to share reward of the current period.\n PeriodWrapper shares;\n }\n\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\n /// @dev Emitted when the user claimed their reward\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\n\n /// @dev Emitted when the pool shares are updated\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\n /// @dev Emitted when the pools are updated\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\n /// @dev Emitted when the contract fails when updating the pools\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\n /// @dev Emitted when the contract fails when updating the pools that already set\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\n\n /// @dev Error of invalid pool share.\n error ErrInvalidPoolShare();\n\n /**\n * @dev Returns the reward amount that user claimable.\n */\n function getReward(address _poolAddr, address _user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amount of an user.\n */\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amounts of the users.\n */\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Returns the total staking amount of all users for a pool.\n */\n function getStakingTotal(address _poolAddr) external view returns (uint256);\n\n /**\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\n */\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\n}\n" + }, + "contracts/interfaces/consumers/PeriodWrapperConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface PeriodWrapperConsumer {\n struct PeriodWrapper {\n // Inner value.\n uint256 inner;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n}\n" + }, + "contracts/mocks/validator/MockValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../ronin/validator/CandidateManager.sol\";\n\ncontract MockValidatorSet is IRoninValidatorSet, CandidateManager {\n address public stakingVestingContract;\n address public slashIndicatorContract;\n\n uint256 internal _lastUpdatedPeriod;\n uint256 internal _numberOfBlocksInEpoch;\n /// @dev Mapping from period number => slashed\n mapping(uint256 => bool) internal _periodSlashed;\n\n constructor(\n address __stakingContract,\n address _slashIndicatorContract,\n address _stakingVestingContract,\n uint256 __maxValidatorCandidate,\n uint256 __numberOfBlocksInEpoch,\n uint256 __minEffectiveDaysOnwards\n ) {\n _setStakingContract(__stakingContract);\n _setMaxValidatorCandidate(__maxValidatorCandidate);\n slashIndicatorContract = _slashIndicatorContract;\n stakingVestingContract = _stakingVestingContract;\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\n _minEffectiveDaysOnwards = __minEffectiveDaysOnwards;\n }\n\n function submitBlockReward() external payable override {}\n\n function wrapUpEpoch() external payable override {\n _syncCandidateSet(_lastUpdatedPeriod + 1);\n _lastUpdatedPeriod = currentPeriod();\n }\n\n function getLastUpdatedBlock() external view override returns (uint256) {}\n\n function checkManyJailed(address[] calldata) external view override returns (bool[] memory) {}\n\n function checkMiningRewardDeprecatedAtPeriod(address, uint256 _period) external view override returns (bool) {}\n\n function checkMiningRewardDeprecated(address) external view override returns (bool) {}\n\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr)\n external\n view\n override\n returns (bool _result)\n {}\n\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\n external\n view\n returns (bool _result)\n {}\n\n function epochOf(uint256 _block) external view override returns (uint256) {}\n\n function getValidators()\n external\n view\n override\n returns (\n address[] memory,\n address[] memory,\n EnumFlags.ValidatorFlag[] memory\n )\n {}\n\n function epochEndingAt(uint256 _block) external view override returns (bool) {}\n\n function execSlash(\n address _validatorAddr,\n uint256 _newJailedUntil,\n uint256 _slashAmount,\n bool _cannotBailout\n ) external override {}\n\n function execBailOut(address, uint256) external override {}\n\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external override {}\n\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external override {}\n\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {}\n\n function maxPrioritizedValidatorNumber()\n external\n view\n override\n returns (uint256 _maximumPrioritizedValidatorNumber)\n {}\n\n function isValidator(address) external pure override returns (bool) {\n return true;\n }\n\n function numberOfBlocksInEpoch() public view override returns (uint256) {\n return _numberOfBlocksInEpoch;\n }\n\n function getBridgeOperators() external view override returns (address[] memory) {}\n\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view override returns (address[] memory) {}\n\n function isBridgeOperator(address) external pure override returns (bool) {\n return true;\n }\n\n function totalBridgeOperators() external view override returns (uint256) {}\n\n function getBlockProducers() external view override returns (address[] memory) {}\n\n function isBlockProducer(address) external pure override returns (bool) {\n return true;\n }\n\n function totalBlockProducers() external view override returns (uint256) {}\n\n function tryGetPeriodOfEpoch(uint256) external view returns (bool, uint256) {}\n\n function isPeriodEnding() public view virtual returns (bool) {\n return currentPeriod() > _lastUpdatedPeriod;\n }\n\n function currentPeriod() public view override returns (uint256) {\n return block.timestamp / 86400;\n }\n\n function checkJailed(address) external view override returns (bool) {}\n\n function getJailedTimeLeft(address)\n external\n view\n override\n returns (\n bool,\n uint256,\n uint256\n )\n {}\n\n function currentPeriodStartAtBlock() external view override returns (uint256) {}\n\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view override returns (bool) {}\n\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\n external\n view\n override\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n )\n {}\n\n function totalDeprecatedReward() external view override returns (uint256) {}\n\n function _bridgeOperatorOf(address _consensusAddr) internal view override returns (address) {\n return super._bridgeOperatorOf(_consensusAddr);\n }\n\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient)\n external\n override\n {}\n\n function emergencyExitLockedAmount() external override returns (uint256) {}\n\n function emergencyExpiryDuration() external override returns (uint256) {}\n\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external override {}\n\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external override {}\n\n function getEmergencyExitInfo(address _consensusAddr) external view override returns (EmergencyExitInfo memory) {}\n\n function execEmergencyExit(address, uint256) external {}\n\n function isOperatingBridge(address) external view returns (bool) {}\n\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {}\n\n function _isTrustedOrg(address _consensusAddr) internal virtual override returns (bool) {}\n}\n" + }, + "contracts/ronin/staking/Staking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"./CandidateStaking.sol\";\nimport \"./DelegatorStaking.sol\";\n\ncontract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable {\n constructor() {\n _disableInitializers();\n }\n\n receive() external payable onlyValidatorContract {}\n\n fallback() external payable onlyValidatorContract {}\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 __minValidatorStakingAmount,\n uint256 __maxCommissionRate,\n uint256 __cooldownSecsToUndelegate,\n uint256 __waitingSecsToRevoke\n ) external initializer {\n _setValidatorContract(__validatorContract);\n _setMinValidatorStakingAmount(__minValidatorStakingAmount);\n _setCommissionRateRange(0, __maxCommissionRate);\n _setCooldownSecsToUndelegate(__cooldownSecsToUndelegate);\n _setWaitingSecsToRevoke(__waitingSecsToRevoke);\n }\n\n /**\n * @inheritdoc IStaking\n */\n function execRecordRewards(\n address[] calldata _consensusAddrs,\n uint256[] calldata _rewards,\n uint256 _period\n ) external payable override onlyValidatorContract {\n _recordRewards(_consensusAddrs, _rewards, _period);\n }\n\n /**\n * @inheritdoc IStaking\n */\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\n external\n override\n onlyValidatorContract\n returns (uint256 _actualDeductingAmount)\n {\n _actualDeductingAmount = _deductStakingAmount(_stakingPool[_consensusAddr], _amount);\n address payable _validatorContractAddr = payable(validatorContract());\n if (!_unsafeSendRON(_validatorContractAddr, _actualDeductingAmount)) {\n emit StakingAmountDeductFailed(\n _consensusAddr,\n _validatorContractAddr,\n _actualDeductingAmount,\n address(this).balance\n );\n }\n }\n\n /**\n * @inheritdoc RewardCalculation\n */\n function _currentPeriod() internal view virtual override returns (uint256) {\n return _validatorContract.currentPeriod();\n }\n\n /**\n * @inheritdoc CandidateStaking\n */\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount)\n internal\n override\n returns (uint256 _actualDeductingAmount)\n {\n _actualDeductingAmount = Math.min(_pool.stakingAmount, _amount);\n\n _pool.stakingAmount -= _actualDeductingAmount;\n _changeDelegatingAmount(\n _pool,\n _pool.admin,\n _pool.stakingAmount,\n Math.subNonNegative(_pool.stakingTotal, _actualDeductingAmount)\n );\n emit Unstaked(_pool.addr, _actualDeductingAmount);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "contracts/libraries/Math.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns whether the number `c` is in range of [a; b].\n */\n function inRange(\n uint256 c,\n uint256 a,\n uint256 b\n ) internal pure returns (bool) {\n return a <= c && c <= b;\n }\n\n /**\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\n */\n function twoRangeOverlap(\n uint256 x1,\n uint256 x2,\n uint256 y1,\n uint256 y2\n ) internal pure returns (bool) {\n return x1 <= y2 && y1 <= x2;\n }\n\n /**\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\n */\n function addWithUpperbound(\n uint256 a,\n uint256 b,\n uint256 upperbound\n ) internal pure returns (uint256) {\n return min(a + b, upperbound);\n }\n\n /**\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\n */\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a - b : 0;\n }\n\n /**\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\n */\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\n return zeroable != 0 ? a + zeroable : 0;\n }\n}\n" + }, + "contracts/ronin/staking/CandidateStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../libraries/AddressArrayUtils.sol\";\nimport \"../../interfaces/staking/ICandidateStaking.sol\";\nimport \"./BaseStaking.sol\";\n\nabstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConfigConsumer, PercentageConsumer {\n /// @dev The minimum threshold for being a validator candidate.\n uint256 internal _minValidatorStakingAmount;\n\n /// @dev The max commission rate that the validator can set (in range of [0;100_00] means [0-100%])\n uint256 internal _maxCommissionRate;\n /// @dev The min commission rate that the validator can set (in range of [0;100_00] means [0-100%])\n uint256 internal _minCommissionRate;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] ______gap;\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function minValidatorStakingAmount() public view override returns (uint256) {\n return _minValidatorStakingAmount;\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function getCommissionRateRange() external view override returns (uint256, uint256) {\n return (_minCommissionRate, _maxCommissionRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function setMinValidatorStakingAmount(uint256 _threshold) external override onlyAdmin {\n _setMinValidatorStakingAmount(_threshold);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external override onlyAdmin {\n _setCommissionRateRange(_minRate, _maxRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function applyValidatorCandidate(\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external payable override nonReentrant {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\n\n uint256 _amount = msg.value;\n address payable _poolAdmin = payable(msg.sender);\n _applyValidatorCandidate(\n _poolAdmin,\n _candidateAdmin,\n _consensusAddr,\n _treasuryAddr,\n _bridgeOperatorAddr,\n _commissionRate,\n _amount\n );\n\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\n _pool.admin = _poolAdmin;\n _pool.addr = _consensusAddr;\n _adminOfActivePoolMapping[_poolAdmin] = _consensusAddr;\n\n _stake(_stakingPool[_consensusAddr], _poolAdmin, _amount);\n emit PoolApproved(_consensusAddr, _poolAdmin);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveDaysOnwards,\n uint256 _commissionRate\n ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) {\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\n _validatorContract.execRequestUpdateCommissionRate(_consensusAddr, _effectiveDaysOnwards, _commissionRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function execDeprecatePools(address[] calldata _pools, uint256 _newPeriod) external override onlyValidatorContract {\n if (_pools.length == 0) {\n return;\n }\n\n for (uint _i = 0; _i < _pools.length; _i++) {\n PoolDetail storage _pool = _stakingPool[_pools[_i]];\n // Deactivate the pool admin in the active mapping.\n delete _adminOfActivePoolMapping[_pool.admin];\n\n // Deduct and transfer the self staking amount to the pool admin.\n uint256 _deductingAmount = _pool.stakingAmount;\n if (_deductingAmount > 0) {\n _deductStakingAmount(_pool, _deductingAmount);\n if (!_unsafeSendRON(payable(_pool.admin), _deductingAmount, DEFAULT_ADDITION_GAS)) {\n emit StakingAmountTransferFailed(_pool.addr, _pool.admin, _deductingAmount, address(this).balance);\n }\n }\n\n // Settle the unclaimed reward and transfer to the pool admin.\n uint256 _lastRewardAmount = _claimReward(_pools[_i], _pool.admin, _newPeriod);\n if (_lastRewardAmount > 0) {\n _unsafeSendRON(payable(_pool.admin), _lastRewardAmount, DEFAULT_ADDITION_GAS);\n }\n }\n\n emit PoolsDeprecated(_pools);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function stake(address _consensusAddr) external payable override noEmptyValue poolIsActive(_consensusAddr) {\n _stake(_stakingPool[_consensusAddr], msg.sender, msg.value);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function unstake(address _consensusAddr, uint256 _amount)\n external\n override\n nonReentrant\n poolIsActive(_consensusAddr)\n {\n if (_amount == 0) revert ErrUnstakeZeroAmount();\n address _requester = msg.sender;\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\n uint256 _remainAmount = _pool.stakingAmount - _amount;\n if (_remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft();\n\n _unstake(_pool, _requester, _amount);\n if (!_unsafeSendRON(payable(_requester), _amount, DEFAULT_ADDITION_GAS)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestRenounce(address _consensusAddr)\n external\n override\n poolIsActive(_consensusAddr)\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\n {\n _validatorContract.execRequestRenounceCandidate(_consensusAddr, _waitingSecsToRevoke);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestEmergencyExit(address _consensusAddr)\n external\n override\n poolIsActive(_consensusAddr)\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\n {\n _validatorContract.execEmergencyExit(_consensusAddr, _waitingSecsToRevoke);\n }\n\n /**\n * @dev See `ICandidateStaking-applyValidatorCandidate`\n */\n function _applyValidatorCandidate(\n address payable _poolAdmin,\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate,\n uint256 _amount\n ) internal {\n if (!_unsafeSendRON(_poolAdmin, 0)) revert ErrCannotInitTransferRON(_poolAdmin, \"pool admin\");\n if (!_unsafeSendRON(_treasuryAddr, 0)) revert ErrCannotInitTransferRON(_treasuryAddr, \"treasury\");\n if (_amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount();\n if (_poolAdmin != _candidateAdmin || _candidateAdmin != _treasuryAddr) revert ErrThreeInteractionAddrsNotEqual();\n\n address[] memory _diffAddrs = new address[](3);\n _diffAddrs[0] = _poolAdmin;\n _diffAddrs[1] = _consensusAddr;\n _diffAddrs[2] = _bridgeOperatorAddr;\n if (AddressArrayUtils.hasDuplicate(_diffAddrs)) revert ErrThreeOperationAddrsNotDistinct();\n\n _validatorContract.execApplyValidatorCandidate(\n _candidateAdmin,\n _consensusAddr,\n _treasuryAddr,\n _bridgeOperatorAddr,\n _commissionRate\n );\n }\n\n /**\n * @dev See `ICandidateStaking-stake`\n */\n function _stake(\n PoolDetail storage _pool,\n address _requester,\n uint256 _amount\n ) internal onlyPoolAdmin(_pool, _requester) {\n _pool.stakingAmount += _amount;\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal + _amount);\n _pool.lastDelegatingTimestamp[_requester] = block.timestamp;\n emit Staked(_pool.addr, _amount);\n }\n\n /**\n * @dev See `ICandidateStaking-unstake`\n */\n function _unstake(\n PoolDetail storage _pool,\n address _requester,\n uint256 _amount\n ) internal onlyPoolAdmin(_pool, _requester) {\n if (_amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount();\n if (_pool.lastDelegatingTimestamp[_requester] + _cooldownSecsToUndelegate > block.timestamp) {\n revert ErrUnstakeTooEarly();\n }\n\n _pool.stakingAmount -= _amount;\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal - _amount);\n emit Unstaked(_pool.addr, _amount);\n }\n\n /**\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\n *\n * Emits the event `Unstaked`.\n *\n * @return The actual deducted amount\n */\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount) internal virtual returns (uint256);\n\n /**\n * @dev Sets the minimum threshold for being a validator candidate.\n *\n * Emits the `MinValidatorStakingAmountUpdated` event.\n *\n */\n function _setMinValidatorStakingAmount(uint256 _threshold) internal {\n _minValidatorStakingAmount = _threshold;\n emit MinValidatorStakingAmountUpdated(_threshold);\n }\n\n /**\n * @dev Sets the max commission rate that a candidate can set.\n *\n * Emits the `MaxCommissionRateUpdated` event.\n *\n */\n function _setCommissionRateRange(uint256 _minRate, uint256 _maxRate) internal {\n if (_maxRate > _MAX_PERCENTAGE || _minRate > _maxRate) revert ErrInvalidCommissionRate();\n _maxCommissionRate = _maxRate;\n _minCommissionRate = _minRate;\n emit CommissionRateRangeUpdated(_minRate, _maxRate);\n }\n}\n" + }, + "contracts/ronin/staking/DelegatorStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/staking/IDelegatorStaking.sol\";\nimport \"./BaseStaking.sol\";\n\nabstract contract DelegatorStaking is BaseStaking, IDelegatorStaking {\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function delegate(address _consensusAddr) external payable noEmptyValue poolIsActive(_consensusAddr) {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n _delegate(_stakingPool[_consensusAddr], msg.sender, msg.value);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function undelegate(address _consensusAddr, uint256 _amount) external nonReentrant {\n address payable _delegator = payable(msg.sender);\n _undelegate(_stakingPool[_consensusAddr], _delegator, _amount);\n if (!_sendRON(_delegator, _amount)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external nonReentrant {\n if (_consensusAddrs.length == 0 || _consensusAddrs.length != _amounts.length) revert ErrInvalidArrays();\n\n address payable _delegator = payable(msg.sender);\n uint256 _total;\n\n for (uint _i = 0; _i < _consensusAddrs.length; _i++) {\n _total += _amounts[_i];\n _undelegate(_stakingPool[_consensusAddrs[_i]], _delegator, _amounts[_i]);\n }\n\n if (!_sendRON(_delegator, _total)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function redelegate(\n address _consensusAddrSrc,\n address _consensusAddrDst,\n uint256 _amount\n ) external nonReentrant poolIsActive(_consensusAddrDst) {\n address _delegator = msg.sender;\n _undelegate(_stakingPool[_consensusAddrSrc], _delegator, _amount);\n _delegate(_stakingPool[_consensusAddrDst], _delegator, _amount);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function claimRewards(address[] calldata _consensusAddrList)\n external\n override\n nonReentrant\n returns (uint256 _amount)\n {\n _amount = _claimRewards(msg.sender, _consensusAddrList);\n _transferRON(payable(msg.sender), _amount);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\n external\n override\n nonReentrant\n poolIsActive(_consensusAddrDst)\n returns (uint256 _amount)\n {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n return _delegateRewards(msg.sender, _consensusAddrList, _consensusAddrDst);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function getRewards(address _user, address[] calldata _poolAddrList)\n external\n view\n returns (uint256[] memory _rewards)\n {\n address _consensusAddr;\n uint256 _period = _validatorContract.currentPeriod();\n _rewards = new uint256[](_poolAddrList.length);\n\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\n _consensusAddr = _poolAddrList[_i];\n _rewards[_i] = _getReward(_consensusAddr, _user, _period, getStakingAmount(_consensusAddr, _user));\n }\n }\n\n /**\n * @dev Delegates from a validator address.\n *\n * Requirements:\n * - The delegator is not the pool admin.\n *\n * Emits the `Delegated` event.\n *\n * Note: This function does not verify the `msg.value` with the amount.\n *\n */\n function _delegate(\n PoolDetail storage _pool,\n address _delegator,\n uint256 _amount\n ) internal notPoolAdmin(_pool, _delegator) {\n _changeDelegatingAmount(\n _pool,\n _delegator,\n _pool.delegatingAmount[_delegator] + _amount,\n _pool.stakingTotal + _amount\n );\n _pool.lastDelegatingTimestamp[_delegator] = block.timestamp;\n emit Delegated(_delegator, _pool.addr, _amount);\n }\n\n /**\n * @dev Undelegates from a validator address.\n *\n * Requirements:\n * - The delegator is not the pool admin.\n * - The amount is larger than 0.\n * - The delegating amount is larger than or equal to the undelegating amount.\n *\n * Emits the `Undelegated` event.\n *\n * Note: Consider transferring back the amount of RON after calling this function.\n *\n */\n function _undelegate(\n PoolDetail storage _pool,\n address _delegator,\n uint256 _amount\n ) private notPoolAdmin(_pool, _delegator) {\n if (_amount == 0) revert ErrUndelegateZeroAmount();\n if (_pool.delegatingAmount[_delegator] < _amount) revert ErrInsufficientDelegatingAmount();\n\n if (\n _validatorContract.isValidatorCandidate(_pool.addr) &&\n _validatorContract.getCandidateInfo(_pool.addr).revokingTimestamp == 0 && // if candidate is not on renunciation\n _pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp // delegator is still in cooldown\n ) revert ErrUndelegateTooEarly();\n\n _changeDelegatingAmount(\n _pool,\n _delegator,\n _pool.delegatingAmount[_delegator] - _amount,\n _pool.stakingTotal - _amount\n );\n emit Undelegated(_delegator, _pool.addr, _amount);\n }\n\n /**\n * @dev Claims rewards from the pools `_poolAddrList`.\n * Note: This function does not transfer reward to user.\n */\n function _claimRewards(address _user, address[] memory _poolAddrList) internal returns (uint256 _amount) {\n uint256 _period = _currentPeriod();\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\n _amount += _claimReward(_poolAddrList[_i], _user, _period);\n }\n }\n\n /**\n * @dev Claims the rewards and delegates them to the consensus address.\n */\n function _delegateRewards(\n address _user,\n address[] calldata _poolAddrList,\n address _poolAddrDst\n ) internal returns (uint256 _amount) {\n _amount = _claimRewards(_user, _poolAddrList);\n _delegate(_stakingPool[_poolAddrDst], _user, _amount);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/libraries/AddressArrayUtils.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary AddressArrayUtils {\n /**\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\n * @param A Array to search\n * @return Returns true if duplicate, false otherwise\n */\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\n if (A.length == 0) {\n return false;\n }\n for (uint256 i = 0; i < A.length - 1; i++) {\n for (uint256 j = i + 1; j < A.length; j++) {\n if (A[i] == A[j]) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * @dev Returns whether two arrays of addresses are equal or not.\n */\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool) {\n bytes32 _thisHash;\n bytes32 _otherHash;\n\n assembly {\n _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\n _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\n }\n\n return _thisHash == _otherHash;\n }\n}\n" + }, + "contracts/ronin/staking/BaseStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\nimport \"../../interfaces/staking/IBaseStaking.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"./RewardCalculation.sol\";\n\nabstract contract BaseStaking is\n RONTransferHelper,\n ReentrancyGuard,\n RewardCalculation,\n HasValidatorContract,\n IBaseStaking\n{\n /// @dev Mapping from pool address => staking pool detail\n mapping(address => PoolDetail) internal _stakingPool;\n\n /// @dev The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n uint256 internal _cooldownSecsToUndelegate;\n /// @dev The number of seconds that a candidate must wait to be revoked and take the self-staking amount back.\n uint256 internal _waitingSecsToRevoke;\n\n /// @dev Mapping from admin address of an active pool => consensus address.\n mapping(address => address) internal _adminOfActivePoolMapping;\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n modifier noEmptyValue() {\n if (msg.value == 0) revert ErrZeroValue();\n _;\n }\n\n modifier notPoolAdmin(PoolDetail storage _pool, address _delegator) {\n if (_pool.admin == _delegator) revert ErrPoolAdminForbidden();\n _;\n }\n\n modifier onlyPoolAdmin(PoolDetail storage _pool, address _requester) {\n if (_pool.admin != _requester) revert ErrOnlyPoolAdminAllowed();\n _;\n }\n\n modifier poolIsActive(address _poolAddr) {\n if (!_validatorContract.isValidatorCandidate(_poolAddr)) revert ErrInactivePool(_poolAddr);\n _;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function isAdminOfActivePool(address _poolAdminAddr) public view override returns (bool) {\n return _adminOfActivePoolMapping[_poolAdminAddr] != address(0);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getPoolAddressOf(address _poolAdminAddr) external view override returns (address) {\n return _adminOfActivePoolMapping[_poolAdminAddr];\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getPoolDetail(address _poolAddr)\n external\n view\n returns (\n address _admin,\n uint256 _stakingAmount,\n uint256 _stakingTotal\n )\n {\n PoolDetail storage _pool = _stakingPool[_poolAddr];\n return (_pool.admin, _pool.stakingAmount, _pool.stakingTotal);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getManySelfStakings(address[] calldata _pools) external view returns (uint256[] memory _selfStakings) {\n _selfStakings = new uint256[](_pools.length);\n for (uint _i = 0; _i < _pools.length; _i++) {\n _selfStakings[_i] = _stakingPool[_pools[_i]].stakingAmount;\n }\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingTotal(address _poolAddr) public view override returns (uint256) {\n return _stakingPool[_poolAddr].stakingTotal;\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getManyStakingTotals(address[] calldata _poolList)\n public\n view\n override\n returns (uint256[] memory _stakingAmounts)\n {\n _stakingAmounts = new uint256[](_poolList.length);\n for (uint _i = 0; _i < _poolList.length; _i++) {\n _stakingAmounts[_i] = getStakingTotal(_poolList[_i]);\n }\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingAmount(address _poolAddr, address _user) public view override returns (uint256) {\n return _stakingPool[_poolAddr].delegatingAmount[_user];\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\n external\n view\n override\n returns (uint256[] memory _stakingAmounts)\n {\n if (_poolAddrs.length != _userList.length) revert ErrInvalidArrays();\n _stakingAmounts = new uint256[](_poolAddrs.length);\n for (uint _i = 0; _i < _stakingAmounts.length; _i++) {\n _stakingAmounts[_i] = _stakingPool[_poolAddrs[_i]].delegatingAmount[_userList[_i]];\n }\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function cooldownSecsToUndelegate() external view returns (uint256) {\n return _cooldownSecsToUndelegate;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function waitingSecsToRevoke() external view returns (uint256) {\n return _waitingSecsToRevoke;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external override onlyAdmin {\n _setCooldownSecsToUndelegate(_cooldownSecs);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function setWaitingSecsToRevoke(uint256 _secs) external override onlyAdmin {\n _setWaitingSecsToRevoke(_secs);\n }\n\n /**\n * @dev Sets the minium number of seconds to undelegate.\n *\n * Emits the event `CooldownSecsToUndelegateUpdated`.\n *\n */\n function _setCooldownSecsToUndelegate(uint256 _cooldownSecs) internal {\n _cooldownSecsToUndelegate = _cooldownSecs;\n emit CooldownSecsToUndelegateUpdated(_cooldownSecs);\n }\n\n /**\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\n *\n * Emits the event `WaitingSecsToRevokeUpdated`.\n *\n */\n function _setWaitingSecsToRevoke(uint256 _secs) internal {\n _waitingSecsToRevoke = _secs;\n emit WaitingSecsToRevokeUpdated(_secs);\n }\n\n /**\n * @dev Changes the delegate amount.\n */\n function _changeDelegatingAmount(\n PoolDetail storage _pool,\n address _delegator,\n uint256 _newDelegatingAmount,\n uint256 _newStakingTotal\n ) internal {\n _syncUserReward(_pool.addr, _delegator, _newDelegatingAmount);\n _pool.stakingTotal = _newStakingTotal;\n _pool.delegatingAmount[_delegator] = _newDelegatingAmount;\n }\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "contracts/ronin/staking/RewardCalculation.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/staking/IRewardPool.sol\";\nimport \"../../libraries/Math.sol\";\n\n/**\n * @title RewardCalculation contract\n * @dev This contract mainly contains the methods to calculate reward for staking contract.\n */\nabstract contract RewardCalculation is IRewardPool {\n /// @dev Mapping from pool address => period number => accumulated rewards per share (one unit staking)\n mapping(address => mapping(uint256 => PeriodWrapper)) private _accumulatedRps;\n /// @dev Mapping from the pool address => user address => the reward info of the user\n mapping(address => mapping(address => UserRewardFields)) private _userReward;\n /// @dev Mapping from the pool address => reward pool fields\n mapping(address => PoolFields) private _stakingPool;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IRewardPool\n */\n function getReward(address _poolAddr, address _user) external view returns (uint256) {\n return _getReward(_poolAddr, _user, _currentPeriod(), getStakingAmount(_poolAddr, _user));\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingAmount(address _poolAddr, address _user) public view virtual returns (uint256);\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingTotal(address _poolAddr) public view virtual returns (uint256);\n\n /**\n * @dev Returns the reward amount that user claimable.\n */\n function _getReward(\n address _poolAddr,\n address _user,\n uint256 _latestPeriod,\n uint256 _latestStakingAmount\n ) internal view returns (uint256) {\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\n\n if (_reward.lastPeriod == _latestPeriod) {\n return _reward.debited;\n }\n\n uint256 _aRps;\n uint256 _lastPeriodReward;\n PoolFields storage _pool = _stakingPool[_poolAddr];\n PeriodWrapper storage _wrappedArps = _accumulatedRps[_poolAddr][_reward.lastPeriod];\n\n if (_wrappedArps.lastPeriod > 0) {\n // Calculates the last period reward if the aRps at the period is set\n _aRps = _wrappedArps.inner;\n _lastPeriodReward = _reward.lowestAmount * (_aRps - _reward.aRps);\n } else {\n // Fallbacks to the previous aRps in case the aRps is not set\n _aRps = _reward.aRps;\n }\n\n uint256 _newPeriodsReward = _latestStakingAmount * (_pool.aRps - _aRps);\n return _reward.debited + (_lastPeriodReward + _newPeriodsReward) / 1e18;\n }\n\n /**\n * @dev Syncs the user reward.\n *\n * Emits the event `UserRewardUpdated` once the debit amount is updated.\n * Emits the event `PoolSharesUpdated` once the pool share is updated.\n *\n * Note: The method should be called whenever the user's staking amount changes.\n *\n */\n function _syncUserReward(\n address _poolAddr,\n address _user,\n uint256 _newStakingAmount\n ) internal {\n uint256 _period = _currentPeriod();\n PoolFields storage _pool = _stakingPool[_poolAddr];\n uint256 _lastShares = _pool.shares.inner;\n\n // Updates the pool shares if it is outdated\n if (_pool.shares.lastPeriod < _period) {\n _pool.shares = PeriodWrapper(getStakingTotal(_poolAddr), _period);\n }\n\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\n uint256 _debited = _getReward(_poolAddr, _user, _period, _currentStakingAmount);\n\n if (_reward.debited != _debited) {\n _reward.debited = _debited;\n emit UserRewardUpdated(_poolAddr, _user, _debited);\n }\n\n _syncMinStakingAmount(_pool, _reward, _period, _newStakingAmount, _currentStakingAmount);\n _reward.aRps = _pool.aRps;\n _reward.lastPeriod = _period;\n\n if (_pool.shares.inner != _lastShares) {\n emit PoolSharesUpdated(_period, _poolAddr, _pool.shares.inner);\n }\n }\n\n /**\n * @dev Syncs the minimum staking amount of an user in the current period.\n */\n function _syncMinStakingAmount(\n PoolFields storage _pool,\n UserRewardFields storage _reward,\n uint256 _latestPeriod,\n uint256 _newStakingAmount,\n uint256 _currentStakingAmount\n ) internal {\n if (_reward.lastPeriod < _latestPeriod) {\n _reward.lowestAmount = _currentStakingAmount;\n }\n\n uint256 _lowestAmount = Math.min(_reward.lowestAmount, _newStakingAmount);\n uint256 _diffAmount = _reward.lowestAmount - _lowestAmount;\n if (_diffAmount > 0) {\n _reward.lowestAmount = _lowestAmount;\n if (_pool.shares.inner < _diffAmount) revert ErrInvalidPoolShare();\n _pool.shares.inner -= _diffAmount;\n }\n }\n\n /**\n * @dev Claims the settled reward for a specific user.\n *\n * @param _lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or\n * `_currentPeriod + 1` in case of calculating the reward for revoked validators.\n *\n * Emits the `RewardClaimed` event and the `UserRewardUpdated` event.\n *\n * Note: This method should be called before transferring rewards for the user.\n *\n */\n function _claimReward(\n address _poolAddr,\n address _user,\n uint256 _lastPeriod\n ) internal returns (uint256 _amount) {\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\n _amount = _getReward(_poolAddr, _user, _lastPeriod, _currentStakingAmount);\n emit RewardClaimed(_poolAddr, _user, _amount);\n\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\n _reward.debited = 0;\n _syncMinStakingAmount(_stakingPool[_poolAddr], _reward, _lastPeriod, _currentStakingAmount, _currentStakingAmount);\n _reward.lastPeriod = _lastPeriod;\n _reward.aRps = _stakingPool[_poolAddr].aRps;\n emit UserRewardUpdated(_poolAddr, _user, 0);\n }\n\n /**\n * @dev Records the amount of rewards `_rewards` for the pools `_poolAddrs`.\n *\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\n * Emits the event `PoolUpdateConflicted` when the pool is already updated in the period.\n *\n * Note: This method should be called once at the period ending.\n *\n */\n function _recordRewards(\n address[] memory _poolAddrs,\n uint256[] calldata _rewards,\n uint256 _period\n ) internal {\n if (_poolAddrs.length != _rewards.length) {\n emit PoolsUpdateFailed(_period, _poolAddrs, _rewards);\n return;\n }\n\n uint256 _rps;\n uint256 _count;\n address _poolAddr;\n uint256 _stakingTotal;\n uint256[] memory _aRps = new uint256[](_poolAddrs.length);\n uint256[] memory _shares = new uint256[](_poolAddrs.length);\n address[] memory _conflicted = new address[](_poolAddrs.length);\n\n for (uint _i = 0; _i < _poolAddrs.length; _i++) {\n _poolAddr = _poolAddrs[_i];\n PoolFields storage _pool = _stakingPool[_poolAddr];\n _stakingTotal = getStakingTotal(_poolAddr);\n\n if (_accumulatedRps[_poolAddr][_period].lastPeriod == _period) {\n _conflicted[_count++] = _poolAddr;\n continue;\n }\n\n // Updates the pool shares if it is outdated\n if (_pool.shares.lastPeriod < _period) {\n _pool.shares = PeriodWrapper(_stakingTotal, _period);\n }\n\n // The rps is 0 if no one stakes for the pool\n _rps = _pool.shares.inner == 0 ? 0 : (_rewards[_i] * 1e18) / _pool.shares.inner;\n _aRps[_i - _count] = _pool.aRps += _rps;\n _accumulatedRps[_poolAddr][_period] = PeriodWrapper(_pool.aRps, _period);\n _pool.shares.inner = _stakingTotal;\n _shares[_i - _count] = _pool.shares.inner;\n _poolAddrs[_i - _count] = _poolAddr;\n }\n\n if (_count > 0) {\n assembly {\n mstore(_conflicted, _count)\n mstore(_poolAddrs, sub(mload(_poolAddrs), _count))\n }\n emit PoolsUpdateConflicted(_period, _conflicted);\n }\n\n if (_poolAddrs.length > 0) {\n emit PoolsUpdated(_period, _poolAddrs, _aRps, _shares);\n }\n }\n\n /**\n * @dev Returns the current period.\n */\n function _currentPeriod() internal view virtual returns (uint256);\n}\n" + }, + "contracts/ronin/Maintenance.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../interfaces/IMaintenance.sol\";\nimport \"../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../extensions/collections/HasValidatorContract.sol\";\nimport \"../libraries/Math.sol\";\n\ncontract Maintenance is IMaintenance, HasValidatorContract, Initializable {\n using Math for uint256;\n\n /// @dev Mapping from consensus address => maintenance schedule.\n mapping(address => Schedule) internal _schedule;\n\n /// @dev The min duration to maintenance in blocks.\n uint256 public minMaintenanceDurationInBlock;\n /// @dev The max duration to maintenance in blocks.\n uint256 public maxMaintenanceDurationInBlock;\n /// @dev The offset to the min block number that the schedule can start.\n uint256 public minOffsetToStartSchedule;\n /// @dev The offset to the max block number that the schedule can start.\n uint256 public maxOffsetToStartSchedule;\n /// @dev The max number of scheduled maintenances.\n uint256 public maxSchedules;\n /// @dev The cooldown time to request new schedule.\n uint256 public cooldownSecsToMaintain;\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) external initializer {\n _setValidatorContract(__validatorContract);\n _setMaintenanceConfig(\n _minMaintenanceDurationInBlock,\n _maxMaintenanceDurationInBlock,\n _minOffsetToStartSchedule,\n _maxOffsetToStartSchedule,\n _maxSchedules,\n _cooldownSecsToMaintain\n );\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function setMaintenanceConfig(\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) external onlyAdmin {\n _setMaintenanceConfig(\n _minMaintenanceDurationInBlock,\n _maxMaintenanceDurationInBlock,\n _minOffsetToStartSchedule,\n _maxOffsetToStartSchedule,\n _maxSchedules,\n _cooldownSecsToMaintain\n );\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function schedule(\n address _consensusAddr,\n uint256 _startedAtBlock,\n uint256 _endedAtBlock\n ) external override {\n IRoninValidatorSet _validator = _validatorContract;\n\n require(_validator.isBlockProducer(_consensusAddr), \"Maintenance: consensus address must be a block producer\");\n require(\n _validator.isCandidateAdmin(_consensusAddr, msg.sender),\n \"Maintenance: method caller must be a candidate admin\"\n );\n require(!checkScheduled(_consensusAddr), \"Maintenance: already scheduled\");\n require(checkCooldownEnds(_consensusAddr), \"Maintainance: cooldown time not end\");\n require(totalSchedules() < maxSchedules, \"Maintenance: exceeds total of schedules\");\n require(\n _startedAtBlock.inRange(block.number + minOffsetToStartSchedule, block.number + maxOffsetToStartSchedule),\n \"Maintenance: start block is out of offset\"\n );\n require(_startedAtBlock < _endedAtBlock, \"Maintenance: start block must be less than end block\");\n uint256 _maintenanceElapsed = _endedAtBlock - _startedAtBlock + 1;\n require(\n _maintenanceElapsed.inRange(minMaintenanceDurationInBlock, maxMaintenanceDurationInBlock),\n \"Maintenance: invalid maintenance duration\"\n );\n require(_validator.epochEndingAt(_startedAtBlock - 1), \"Maintenance: start block is not at the start of an epoch\");\n require(_validator.epochEndingAt(_endedAtBlock), \"Maintenance: end block is not at the end of an epoch\");\n\n Schedule storage _sSchedule = _schedule[_consensusAddr];\n _sSchedule.from = _startedAtBlock;\n _sSchedule.to = _endedAtBlock;\n _sSchedule.lastUpdatedBlock = block.number;\n _sSchedule.requestTimestamp = block.timestamp;\n emit MaintenanceScheduled(_consensusAddr, _sSchedule);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function cancelSchedule(address _consensusAddr) external override {\n require(\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\n \"Maintenance: method caller must be the candidate admin\"\n );\n require(checkScheduled(_consensusAddr), \"Maintenance: no schedule exists\");\n require(!checkMaintained(_consensusAddr, block.number), \"Maintenance: already on maintenance\");\n Schedule storage _sSchedule = _schedule[_consensusAddr];\n delete _sSchedule.from;\n delete _sSchedule.to;\n _sSchedule.lastUpdatedBlock = block.number;\n emit MaintenanceScheduleCancelled(_consensusAddr);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function getSchedule(address _consensusAddr) external view override returns (Schedule memory) {\n return _schedule[_consensusAddr];\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkManyMaintained(address[] calldata _addrList, uint256 _block)\n external\n view\n override\n returns (bool[] memory _resList)\n {\n _resList = new bool[](_addrList.length);\n for (uint _i = 0; _i < _addrList.length; _i++) {\n _resList[_i] = checkMaintained(_addrList[_i], _block);\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkManyMaintainedInBlockRange(\n address[] calldata _addrList,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view override returns (bool[] memory _resList) {\n _resList = new bool[](_addrList.length);\n for (uint _i = 0; _i < _addrList.length; _i++) {\n _resList[_i] = _maintainingInBlockRange(_addrList[_i], _fromBlock, _toBlock);\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function totalSchedules() public view override returns (uint256 _count) {\n (address[] memory _validators, , ) = _validatorContract.getValidators();\n for (uint _i = 0; _i < _validators.length; _i++) {\n if (checkScheduled(_validators[_i])) {\n _count++;\n }\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkMaintained(address _consensusAddr, uint256 _block) public view override returns (bool) {\n Schedule storage _s = _schedule[_consensusAddr];\n return _s.from <= _block && _block <= _s.to;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkMaintainedInBlockRange(\n address _consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) public view override returns (bool) {\n return _maintainingInBlockRange(_consensusAddr, _fromBlock, _toBlock);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkScheduled(address _consensusAddr) public view override returns (bool) {\n return block.number <= _schedule[_consensusAddr].to;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkCooldownEnds(address _consensusAddr) public view override returns (bool) {\n return block.timestamp > _schedule[_consensusAddr].requestTimestamp + cooldownSecsToMaintain;\n }\n\n /**\n * @dev Sets the min block period and max block period to maintenance.\n *\n * Requirements:\n * - The max period is larger than the min period.\n *\n * Emits the event `MaintenanceConfigUpdated`.\n *\n */\n function _setMaintenanceConfig(\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) internal {\n require(\n _minMaintenanceDurationInBlock < _maxMaintenanceDurationInBlock,\n \"Maintenance: invalid maintenance duration configs\"\n );\n require(\n _minOffsetToStartSchedule < _maxOffsetToStartSchedule,\n \"Maintenance: invalid offset to start schedule configs\"\n );\n minMaintenanceDurationInBlock = _minMaintenanceDurationInBlock;\n maxMaintenanceDurationInBlock = _maxMaintenanceDurationInBlock;\n minOffsetToStartSchedule = _minOffsetToStartSchedule;\n maxOffsetToStartSchedule = _maxOffsetToStartSchedule;\n maxSchedules = _maxSchedules;\n cooldownSecsToMaintain = _cooldownSecsToMaintain;\n emit MaintenanceConfigUpdated(\n _minMaintenanceDurationInBlock,\n _maxMaintenanceDurationInBlock,\n _minOffsetToStartSchedule,\n _maxOffsetToStartSchedule,\n _maxSchedules,\n _cooldownSecsToMaintain\n );\n }\n\n /**\n * @dev Check if the validator was maintaining in the current period.\n *\n * Note: This method should be called at the end of the period.\n */\n function _maintainingInBlockRange(\n address _consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) private view returns (bool) {\n Schedule storage _s = _schedule[_consensusAddr];\n return Math.twoRangeOverlap(_fromBlock, _toBlock, _s.from, _s.to);\n }\n}\n" + }, + "contracts/interfaces/IMaintenance.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IMaintenance {\n struct Schedule {\n uint256 from;\n uint256 to;\n uint256 lastUpdatedBlock;\n uint256 requestTimestamp;\n }\n\n /// @dev Emitted when a maintenance is scheduled.\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\n /// @dev Emitted when a schedule of maintenance is cancelled.\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\n /// @dev Emitted when the maintenance config is updated.\n event MaintenanceConfigUpdated(\n uint256 minMaintenanceDurationInBlock,\n uint256 maxMaintenanceDurationInBlock,\n uint256 minOffsetToStartSchedule,\n uint256 maxOffsetToStartSchedule,\n uint256 maxSchedules,\n uint256 cooldownSecsToMaintain\n );\n\n /**\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\n */\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\n */\n function checkMaintainedInBlockRange(\n address _consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool);\n\n /**\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\n */\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\n\n /**\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\n */\n function checkManyMaintainedInBlockRange(\n address[] calldata _addrList,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\n */\n function checkScheduled(address _consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `_consensusAddr`\n */\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\n */\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\n\n /**\n * @dev Returns the total of current schedules.\n */\n function totalSchedules() external view returns (uint256 _count);\n\n /**\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\n *\n * Requirements:\n * - The method caller is admin.\n * - The max duration is larger than the min duration.\n * - The max offset is larger than the min offset.\n *\n * Emits the event `MaintenanceConfigUpdated`.\n *\n */\n function setMaintenanceConfig(\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) external;\n\n /**\n * @dev Returns the min duration for maintenance in block.\n */\n function minMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev Returns the max duration for maintenance in block.\n */\n function maxMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev The offset to the min block number that the schedule can start\n */\n function minOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev The offset to the max block number that the schedule can start\n */\n function maxOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev Returns the max number of scheduled maintenances.\n */\n function maxSchedules() external view returns (uint256);\n\n /**\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\n *\n * Requirements:\n * - The candidate `_consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\n * - The total number of schedules is not larger than `maxSchedules()`.\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\n * - The end block is larger than the start block.\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\n * - The start block is at the start of an epoch.\n * - The end block is at the end of an epoch.\n *\n * Emits the event `MaintenanceScheduled`.\n *\n */\n function schedule(\n address _consensusAddr,\n uint256 _startedAtBlock,\n uint256 _endedAtBlock\n ) external;\n\n /**\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\n *\n * Requirements:\n * - The candidate `_consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\n *\n * Emits the event `MaintenanceScheduleCancelled`.\n */\n function cancelSchedule(address _consensusAddr) external;\n}\n" + }, + "contracts/ronin/StakingVesting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../interfaces/IStakingVesting.sol\";\nimport \"../extensions/collections/HasValidatorContract.sol\";\nimport \"../extensions/RONTransferHelper.sol\";\n\ncontract StakingVesting is IStakingVesting, HasValidatorContract, RONTransferHelper, Initializable {\n /// @dev The block bonus for the block producer whenever a new block is mined.\n uint256 internal _blockProducerBonusPerBlock;\n /// @dev The block bonus for the bridge operator whenever a new block is mined.\n uint256 internal _bridgeOperatorBonusPerBlock;\n /// @dev The last block number that the staking vesting sent.\n uint256 public lastBlockSendingBonus;\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 __blockProducerBonusPerBlock,\n uint256 __bridgeOperatorBonusPerBlock\n ) external payable initializer {\n _setValidatorContract(__validatorContract);\n _setBlockProducerBonusPerBlock(__blockProducerBonusPerBlock);\n _setBridgeOperatorBonusPerBlock(__bridgeOperatorBonusPerBlock);\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function receiveRON() external payable {}\n\n /**\n * @inheritdoc IStakingVesting\n */\n function blockProducerBlockBonus(\n uint256 /* _block */\n ) public view override returns (uint256) {\n return _blockProducerBonusPerBlock;\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function bridgeOperatorBlockBonus(\n uint256 /* _block */\n ) public view override returns (uint256) {\n return _bridgeOperatorBonusPerBlock;\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\n external\n override\n onlyValidatorContract\n returns (\n bool _success,\n uint256 _blockProducerBonus,\n uint256 _bridgeOperatorBonus\n )\n {\n require(block.number > lastBlockSendingBonus, \"StakingVesting: bonus for already sent\");\n lastBlockSendingBonus = block.number;\n\n _blockProducerBonus = _forBlockProducer ? blockProducerBlockBonus(block.number) : 0;\n _bridgeOperatorBonus = _forBridgeOperator ? bridgeOperatorBlockBonus(block.number) : 0;\n\n uint256 _totalAmount = _blockProducerBonus + _bridgeOperatorBonus;\n\n if (_totalAmount > 0) {\n address payable _validatorContractAddr = payable(validatorContract());\n\n _success = _unsafeSendRON(_validatorContractAddr, _totalAmount);\n\n if (!_success) {\n emit BonusTransferFailed(\n block.number,\n _validatorContractAddr,\n _blockProducerBonus,\n _bridgeOperatorBonus,\n address(this).balance\n );\n return (_success, 0, 0);\n }\n\n emit BonusTransferred(block.number, _validatorContractAddr, _blockProducerBonus, _bridgeOperatorBonus);\n }\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function setBlockProducerBonusPerBlock(uint256 _amount) external override onlyAdmin {\n _setBlockProducerBonusPerBlock(_amount);\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external override onlyAdmin {\n _setBridgeOperatorBonusPerBlock(_amount);\n }\n\n /**\n * @dev Sets the bonus amount per block for block producer.\n *\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\n *\n */\n function _setBlockProducerBonusPerBlock(uint256 _amount) internal {\n _blockProducerBonusPerBlock = _amount;\n emit BlockProducerBonusPerBlockUpdated(_amount);\n }\n\n /**\n * @dev Sets the bonus amount per block for bridge operator.\n *\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\n *\n */\n function _setBridgeOperatorBonusPerBlock(uint256 _amount) internal {\n _bridgeOperatorBonusPerBlock = _amount;\n emit BridgeOperatorBonusPerBlockUpdated(_amount);\n }\n}\n" + }, + "contracts/interfaces/IStakingVesting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IStakingVesting {\n /// @dev Emitted when the block bonus for block producer is transferred.\n event BonusTransferred(\n uint256 indexed blockNumber,\n address indexed recipient,\n uint256 blockProducerAmount,\n uint256 bridgeOperatorAmount\n );\n /// @dev Emitted when the transfer of block bonus for block producer is failed.\n event BonusTransferFailed(\n uint256 indexed blockNumber,\n address indexed recipient,\n uint256 blockProducerAmount,\n uint256 bridgeOperatorAmount,\n uint256 contractBalance\n );\n /// @dev Emitted when the block bonus for block producer is updated\n event BlockProducerBonusPerBlockUpdated(uint256);\n /// @dev Emitted when the block bonus for bridge operator is updated\n event BridgeOperatorBonusPerBlockUpdated(uint256);\n\n /**\n * @dev Returns the bonus amount for the block producer at `_block`.\n */\n function blockProducerBlockBonus(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Returns the bonus amount for the bridge validator at `_block`.\n */\n function bridgeOperatorBlockBonus(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Receives RON from any address.\n */\n function receiveRON() external payable;\n\n /**\n * @dev Returns the last block number that the staking vesting is sent.\n */\n function lastBlockSendingBonus() external view returns (uint256);\n\n /**\n * @dev Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined.\n *\n * Requirements:\n * - The method caller must be validator contract.\n * - The method must be called only once per block.\n *\n * Emits the event `BonusTransferred` or `BonusTransferFailed`.\n *\n * Notes:\n * - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method\n * will not be reverted, and the underlying nodes does not hang.\n *\n * @param _forBlockProducer Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\n * @param _forBridgeOperator Indicates whether requesting the bonus for the bridge operator.\n *\n * @return _success Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\n * @return _blockProducerBonus The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\n * @return _bridgeOperatorBonus The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\n *\n */\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\n external\n returns (\n bool _success,\n uint256 _blockProducerBonus,\n uint256 _bridgeOperatorBonus\n );\n\n /**\n * @dev Sets the bonus amount per block for block producer.\n *\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setBlockProducerBonusPerBlock(uint256 _amount) external;\n\n /**\n * @dev Sets the bonus amount per block for bridge operator.\n *\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external;\n}\n" + }, + "contracts/ronin/VaultForwarder.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../extensions/forwarder/Forwarder.sol\";\nimport \"../extensions/RONTransferHelper.sol\";\n\n/**\n * @title A vault contract that keeps RON, and behaves as an EOA account to interact with a target contract.\n * @dev There are three roles of interaction:\n * - Admin: top-up and withdraw RON to the vault, cannot forward call to the target.\n * - Moderator: forward all calls to the target, can top-up RON, cannot withdraw RON.\n * - Others: can top-up RON, cannot execute any other actions.\n */\ncontract VaultForwarder is Forwarder, RONTransferHelper {\n /// @dev Emitted when the admin withdraws all RON from the forwarder contract.\n event ForwarderRONWithdrawn(address indexed _recipient, uint256 _value);\n\n constructor(\n address[] memory _targets,\n address _admin,\n address _mod\n ) Forwarder(_targets, _admin, _mod) {}\n\n /**\n * @dev Withdraws all balance from the transfer to the admin.\n *\n * Requirements:\n * - Only the admin can call this method.\n */\n function withdrawAll() external onlyRole(DEFAULT_ADMIN_ROLE) {\n uint256 _value = address(this).balance;\n emit ForwarderRONWithdrawn(msg.sender, _value);\n _transferRON(payable(msg.sender), _value);\n }\n}\n" + }, + "contracts/extensions/forwarder/Forwarder.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\n\ncontract Forwarder is AccessControlEnumerable {\n /// @dev Only user with moderator role can invoke {functionCall} method to forward the call to the target.\n bytes32 public constant MODERATOR_ROLE = keccak256(\"MODERATOR_ROLE\");\n\n /**\n * @dev The target contracts must be registerred by the admin before called to. The admin can register the targets at\n * the contract construction or by assigning {TARGET_ROLE} to the target addresses.\n */\n bytes32 public constant TARGET_ROLE = keccak256(\"TARGET_ROLE\");\n\n /**\n * @dev Initializes the forwarder with an initial target address and a contract admin.\n */\n constructor(\n address[] memory _targets,\n address _admin,\n address _moderator\n ) payable {\n for (uint _i = 0; _i < _targets.length; _i++) {\n _setupRole(TARGET_ROLE, _targets[_i]);\n }\n _setupRole(DEFAULT_ADMIN_ROLE, _admin);\n _setupRole(MODERATOR_ROLE, _moderator);\n }\n\n modifier validTarget(address _target) {\n _checkRole(TARGET_ROLE, _target);\n _;\n }\n\n /**\n * @dev Receives RON transfer from all addresses.\n */\n fallback() external payable {}\n\n /**\n * @dev Receives RON transfer from all addresses.\n */\n receive() external payable {}\n\n /**\n * @dev Forwards the encoded call specified by `_data` to the target. The forwarder attachs `_val` value\n * from the forwarder contract and sends along with the call.\n *\n * Requirements:\n * - Only target with {TARGET_ROLE} can be called to.\n * - Only user with {MODERATOR_ROLE} can call this method.\n */\n function functionCall(\n address _target,\n bytes memory _data,\n uint256 _val\n ) external payable validTarget(_target) onlyRole(MODERATOR_ROLE) {\n require(_val <= address(this).balance, \"Forwarder: invalid forwarding value\");\n _call(_target, _data, _val);\n }\n\n /**\n * @dev Forwards the current call to `target`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _call(\n address _target,\n bytes memory _data,\n uint256 _value\n ) internal {\n (bool _success, bytes memory _res) = _target.call{ value: _value }(_data);\n if (!_success) {\n uint _size = _res.length;\n require(_size >= 4, \"Forwarder: target reverts silently\");\n assembly {\n _res := add(_res, 0x20)\n revert(_res, _size)\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/AccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerable.sol\";\nimport \"./AccessControl.sol\";\nimport \"../utils/structs/EnumerableSet.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override {\n super._grantRole(role, account);\n _roleMembers[role].add(account);\n }\n\n /**\n * @dev Overload {_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override {\n super._revokeRole(role, account);\n _roleMembers[role].remove(account);\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(uint160(account), 20),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/ronin/gateway/PauseEnforcer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"../../interfaces/IPauseTarget.sol\";\n\ncontract PauseEnforcer is AccessControlEnumerable {\n bytes32 public constant SENTRY_ROLE = keccak256(\"SENTRY_ROLE\");\n\n /// @dev The contract that can be paused or unpaused by the SENTRY_ROLE.\n IPauseTarget public target;\n /// @dev Indicating whether or not the target contract is paused in emergency mode.\n bool public emergency;\n\n /// @dev Emitted when the emergency ppause is triggered by `account`.\n event EmergencyPaused(address account);\n /// @dev Emitted when the emergency unpause is triggered by `account`.\n event EmergencyUnpaused(address account);\n /// @dev Emitted when the target is changed.\n event TargetChanged(IPauseTarget target);\n\n modifier onEmergency() {\n require(emergency, \"PauseEnforcer: not on emergency pause\");\n _;\n }\n\n modifier targetPaused() {\n require(target.paused(), \"PauseEnforcer: target is on pause\");\n _;\n }\n\n modifier targetNotPaused() {\n require(!target.paused(), \"PauseEnforcer: target is not on pause\");\n _;\n }\n\n constructor(\n IPauseTarget _target,\n address _admin,\n address[] memory _sentries\n ) {\n _changeTarget(_target);\n _setupRole(DEFAULT_ADMIN_ROLE, _admin);\n for (uint _i; _i < _sentries.length; _i++) {\n _grantRole(SENTRY_ROLE, _sentries[_i]);\n }\n }\n\n /**\n * @dev Grants the SENTRY_ROLE to the specified address.\n */\n function grantSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _grantRole(SENTRY_ROLE, _sentry);\n }\n\n /**\n * @dev Revokes the SENTRY_ROLE from the specified address.\n */\n function revokeSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _revokeRole(SENTRY_ROLE, _sentry);\n }\n\n /**\n * @dev Triggers a pause on the target contract.\n *\n * Requirements:\n * - Only be called by accounts with the SENTRY_ROLE,\n * - The target contract is not already paused.\n */\n function triggerPause() external onlyRole(SENTRY_ROLE) targetNotPaused {\n emergency = true;\n target.pause();\n emit EmergencyPaused(msg.sender);\n }\n\n /**\n * @dev Triggers an unpause on the target contract.\n *\n * Requirements:\n * - Only be called by accounts with the SENTRY_ROLE,\n * - The target contract is already paused.\n * - The target contract is paused in emergency mode.\n */\n function triggerUnpause() external onlyRole(SENTRY_ROLE) onEmergency targetPaused {\n emergency = false;\n target.unpause();\n emit EmergencyUnpaused(msg.sender);\n }\n\n /**\n * @dev Setter for `target`.\n *\n * Requirements:\n * - Only admin can call this method.\n */\n function changeTarget(IPauseTarget _target) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _changeTarget(_target);\n }\n\n /**\n * @dev Internal helper for setting value to `target`.\n */\n function _changeTarget(IPauseTarget _target) internal {\n target = _target;\n emit TargetChanged(_target);\n }\n}\n" + }, + "contracts/interfaces/IPauseTarget.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IPauseTarget {\n function pause() external;\n\n function unpause() external;\n\n function paused() external returns (bool);\n}\n" + }, + "contracts/ronin/gateway/RoninGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../extensions/GatewayV2.sol\";\nimport \"../../extensions/MinimumWithdrawal.sol\";\nimport \"../../interfaces/IERC20Mintable.sol\";\nimport \"../../interfaces/IERC721Mintable.sol\";\nimport \"../../interfaces/IBridgeTracking.sol\";\nimport \"../../interfaces/IRoninGatewayV2.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/collections/IHasValidatorContract.sol\";\nimport \"../../interfaces/collections/IHasBridgeTrackingContract.sol\";\nimport \"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\n\ncontract RoninGatewayV2 is\n GatewayV2,\n Initializable,\n MinimumWithdrawal,\n AccessControlEnumerable,\n VoteStatusConsumer,\n IRoninGatewayV2,\n IHasValidatorContract,\n IHasBridgeTrackingContract,\n IHasRoninTrustedOrganizationContract\n{\n using Token for Token.Info;\n using Transfer for Transfer.Request;\n using Transfer for Transfer.Receipt;\n using IsolatedGovernance for IsolatedGovernance.Vote;\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n /// @dev Withdrawal unlocker role hash\n bytes32 public constant WITHDRAWAL_MIGRATOR = keccak256(\"WITHDRAWAL_MIGRATOR\");\n\n /// @dev Flag indicating whether the withdrawal migrate progress is done\n bool public withdrawalMigrated;\n /// @dev Total withdrawal\n uint256 public withdrawalCount;\n /// @dev Mapping from chain id => deposit id => deposit vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) public depositVote;\n /// @dev Mapping from withdrawal id => mainchain withdrew vote\n mapping(uint256 => IsolatedGovernance.Vote) public mainchainWithdrewVote;\n /// @dev Mapping from withdrawal id => withdrawal receipt\n mapping(uint256 => Transfer.Receipt) public withdrawal;\n /// @dev Mapping from withdrawal id => validator address => signatures\n mapping(uint256 => mapping(address => bytes)) internal _withdrawalSig;\n /// @dev Mapping from token address => chain id => mainchain token address\n mapping(address => mapping(uint256 => MappedToken)) internal _mainchainToken;\n\n /// @dev The ronin validator contract\n IRoninValidatorSet internal _validatorContract;\n /// @dev The bridge tracking contract\n IBridgeTracking internal _bridgeTrackingContract;\n\n /// @dev Mapping from withdrawal id => vote for recording withdrawal stats\n mapping(uint256 => IsolatedGovernance.Vote) public withdrawalStatVote;\n\n /// @dev The trusted organization contract\n IRoninTrustedOrganization internal _trustedOrgContract;\n\n uint256 internal _trustedNum;\n uint256 internal _trustedDenom;\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n modifier onlyBridgeOperator() {\n require(_validatorContract.isBridgeOperator(msg.sender), \"RoninGatewayV2: unauthorized sender\");\n _;\n }\n\n /**\n * @dev Initializes contract storage.\n */\n function initialize(\n address _roleSetter,\n uint256 _numerator,\n uint256 _denominator,\n uint256 _trustedNumerator,\n uint256 _trustedDenominator,\n address[] calldata _withdrawalMigrators,\n // _packedAddresses[0]: roninTokens\n // _packedAddresses[1]: mainchainTokens\n address[][2] calldata _packedAddresses,\n // _packedNumbers[0]: chainIds\n // _packedNumbers[1]: minimumThresholds\n uint256[][2] calldata _packedNumbers,\n Token.Standard[] calldata _standards\n ) external virtual initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n _setThreshold(_numerator, _denominator);\n _setTrustedThreshold(_trustedNumerator, _trustedDenominator);\n if (_packedAddresses[0].length > 0) {\n _mapTokens(_packedAddresses[0], _packedAddresses[1], _packedNumbers[0], _standards);\n _setMinimumThresholds(_packedAddresses[0], _packedNumbers[1]);\n }\n\n for (uint256 _i; _i < _withdrawalMigrators.length; _i++) {\n _grantRole(WITHDRAWAL_MIGRATOR, _withdrawalMigrators[_i]);\n }\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function validatorContract() external view returns (address) {\n return address(_validatorContract);\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function setValidatorContract(address _addr) external override onlyAdmin {\n require(_addr.code.length > 0, \"RoninGatewayV2: set to non-contract\");\n _setValidatorContract(_addr);\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function bridgeTrackingContract() external view override returns (address) {\n return address(_bridgeTrackingContract);\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function setBridgeTrackingContract(address _addr) external override onlyAdmin {\n require(_addr.code.length > 0, \"RoninGatewayV2: set to non-contract\");\n _setBridgeTrackingContract(_addr);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function roninTrustedOrganizationContract() external view override returns (address) {\n return address(_trustedOrgContract);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function setRoninTrustedOrganizationContract(address _addr) external override onlyAdmin {\n require(_addr.code.length > 0, \"RoninGatewayV2: set to non-contract\");\n _setRoninTrustedOrganizationContract(_addr);\n }\n\n /**\n * @dev Migrates withdrawals.\n *\n * Requirements:\n * - The method caller is the migrator.\n * - The arrays have the same length and its length larger than 0.\n *\n */\n function migrateWithdrawals(Transfer.Request[] calldata _requests, address[] calldata _requesters)\n external\n onlyRole(WITHDRAWAL_MIGRATOR)\n {\n require(!withdrawalMigrated, \"RoninGatewayV2: withdrawals migrated\");\n require(_requesters.length == _requests.length && _requests.length > 0, \"RoninGatewayV2: invalid array lengths\");\n for (uint256 _i; _i < _requests.length; _i++) {\n MappedToken memory _token = getMainchainToken(_requests[_i].tokenAddr, 1);\n require(_requests[_i].info.erc == _token.erc, \"RoninGatewayV2: invalid token standard\");\n _storeAsReceipt(_requests[_i], 1, _requesters[_i], _token.tokenAddr);\n }\n }\n\n /**\n * @dev Mark the migration as done.\n */\n function markWithdrawalMigrated() external {\n require(\n hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(WITHDRAWAL_MIGRATOR, msg.sender),\n \"RoninGatewayV2: unauthorized sender\"\n );\n require(!withdrawalMigrated, \"RoninGatewayV2: withdrawals migrated\");\n withdrawalMigrated = true;\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function getWithdrawalSignatures(uint256 _withdrawalId, address[] calldata _validators)\n external\n view\n returns (bytes[] memory _signatures)\n {\n _signatures = new bytes[](_validators.length);\n for (uint256 _i = 0; _i < _validators.length; _i++) {\n _signatures[_i] = _withdrawalSig[_withdrawalId][_validators[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function depositFor(Transfer.Receipt calldata _receipt) external whenNotPaused onlyBridgeOperator {\n address _sender = msg.sender;\n _depositFor(_receipt, _sender, minimumVoteWeight(), minimumTrustedVoteWeight());\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds)\n external\n onlyBridgeOperator\n returns (bool[] memory _executedReceipts)\n {\n address _governor = msg.sender;\n uint256 _minVoteWeight = minimumVoteWeight();\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\n\n uint256 _withdrawalId;\n _executedReceipts = new bool[](_withdrawalIds.length);\n for (uint256 _i; _i < _withdrawalIds.length; _i++) {\n _withdrawalId = _withdrawalIds[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId, _governor);\n if (mainchainWithdrew(_withdrawalId)) {\n _executedReceipts[_i] = true;\n } else {\n IsolatedGovernance.Vote storage _vote = mainchainWithdrewVote[_withdrawalId];\n Transfer.Receipt memory _withdrawal = withdrawal[_withdrawalId];\n bytes32 _hash = _withdrawal.hash();\n VoteStatus _status = _castIsolatedVote(_vote, _governor, _minVoteWeight, _minTrustedVoteWeight, _hash);\n if (_status == VoteStatus.Approved) {\n _vote.status = VoteStatus.Executed;\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId);\n emit MainchainWithdrew(_hash, _withdrawal);\n }\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts)\n external\n whenNotPaused\n onlyBridgeOperator\n returns (bool[] memory _executedReceipts)\n {\n address _sender = msg.sender;\n\n Transfer.Receipt memory _receipt;\n _executedReceipts = new bool[](_receipts.length);\n uint256 _minVoteWeight = minimumVoteWeight();\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\n for (uint256 _i; _i < _receipts.length; _i++) {\n _receipt = _receipts[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\n if (depositVote[_receipt.mainchain.chainId][_receipt.id].status == VoteStatus.Executed) {\n _executedReceipts[_i] = true;\n } else {\n _depositFor(_receipt, _sender, _minVoteWeight, _minTrustedVoteWeight);\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external whenNotPaused {\n _requestWithdrawalFor(_request, msg.sender, _chainId);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external whenNotPaused {\n require(_requests.length > 0, \"RoninGatewayV2: empty array\");\n for (uint256 _i; _i < _requests.length; _i++) {\n _requestWithdrawalFor(_requests[_i], msg.sender, _chainId);\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function requestWithdrawalSignatures(uint256 _withdrawalId) external whenNotPaused {\n require(!mainchainWithdrew(_withdrawalId), \"RoninGatewayV2: withdrew on mainchain already\");\n Transfer.Receipt memory _receipt = withdrawal[_withdrawalId];\n require(_receipt.ronin.chainId == block.chainid, \"RoninGatewayV2: query for invalid withdrawal\");\n emit WithdrawalSignaturesRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures)\n external\n whenNotPaused\n onlyBridgeOperator\n {\n address _validator = msg.sender;\n\n require(\n _withdrawals.length > 0 && _withdrawals.length == _signatures.length,\n \"RoninGatewayV2: invalid array length\"\n );\n\n uint256 _minVoteWeight = minimumVoteWeight();\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\n\n uint256 _id;\n for (uint256 _i; _i < _withdrawals.length; _i++) {\n _id = _withdrawals[_i];\n _withdrawalSig[_id][_validator] = _signatures[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Withdrawal, _id, _validator);\n\n IsolatedGovernance.Vote storage _proposal = withdrawalStatVote[_id];\n VoteStatus _status = _castIsolatedVote(\n _proposal,\n _validator,\n _minVoteWeight,\n _minTrustedVoteWeight,\n bytes32(_id)\n );\n if (_status == VoteStatus.Approved) {\n _proposal.status = VoteStatus.Executed;\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Withdrawal, _id);\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata _chainIds,\n Token.Standard[] calldata _standards\n ) external onlyAdmin {\n require(_roninTokens.length > 0, \"RoninGatewayV2: invalid array length\");\n _mapTokens(_roninTokens, _mainchainTokens, _chainIds, _standards);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function depositVoted(\n uint256 _chainId,\n uint256 _depositId,\n address _voter\n ) external view returns (bool) {\n return depositVote[_chainId][_depositId].voted(_voter);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool) {\n return mainchainWithdrewVote[_withdrawalId].voted(_voter);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function mainchainWithdrew(uint256 _withdrawalId) public view returns (bool) {\n return mainchainWithdrewVote[_withdrawalId].status == VoteStatus.Executed;\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function getMainchainToken(address _roninToken, uint256 _chainId) public view returns (MappedToken memory _token) {\n _token = _mainchainToken[_roninToken][_chainId];\n require(_token.tokenAddr != address(0), \"RoninGatewayV2: unsupported token\");\n }\n\n /**\n * @dev Maps Ronin tokens to mainchain networks.\n *\n * Requirement:\n * - The arrays have the same length.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function _mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata _chainIds,\n Token.Standard[] calldata _standards\n ) internal {\n require(\n _roninTokens.length == _mainchainTokens.length && _roninTokens.length == _chainIds.length,\n \"RoninGatewayV2: invalid array length\"\n );\n\n for (uint256 _i; _i < _roninTokens.length; _i++) {\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].tokenAddr = _mainchainTokens[_i];\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].erc = _standards[_i];\n }\n\n emit TokenMapped(_roninTokens, _mainchainTokens, _chainIds, _standards);\n }\n\n /**\n * @dev Deposits based on the receipt.\n *\n * Emits the `Deposited` once the assets are released.\n *\n */\n function _depositFor(\n Transfer.Receipt memory _receipt,\n address _validator,\n uint256 _minVoteWeight,\n uint256 _minTrustedVoteWeight\n ) internal {\n uint256 _id = _receipt.id;\n _receipt.info.validate();\n require(_receipt.kind == Transfer.Kind.Deposit, \"RoninGatewayV2: invalid receipt kind\");\n require(_receipt.ronin.chainId == block.chainid, \"RoninGatewayV2: invalid chain id\");\n MappedToken memory _token = getMainchainToken(_receipt.ronin.tokenAddr, _receipt.mainchain.chainId);\n require(\n _token.erc == _receipt.info.erc && _token.tokenAddr == _receipt.mainchain.tokenAddr,\n \"RoninGatewayV2: invalid receipt\"\n );\n\n IsolatedGovernance.Vote storage _proposal = depositVote[_receipt.mainchain.chainId][_id];\n bytes32 _receiptHash = _receipt.hash();\n VoteStatus _status = _castIsolatedVote(_proposal, _validator, _minVoteWeight, _minTrustedVoteWeight, _receiptHash);\n emit DepositVoted(_validator, _id, _receipt.mainchain.chainId, _receiptHash);\n if (_status == VoteStatus.Approved) {\n _proposal.status = VoteStatus.Executed;\n _receipt.info.handleAssetTransfer(payable(_receipt.ronin.addr), _receipt.ronin.tokenAddr, IWETH(address(0)));\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Deposit, _receipt.id);\n emit Deposited(_receiptHash, _receipt);\n }\n }\n\n /**\n * @dev Locks the assets and request withdrawal.\n *\n * Requirements:\n * - The token info is valid.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function _requestWithdrawalFor(\n Transfer.Request calldata _request,\n address _requester,\n uint256 _chainId\n ) internal {\n _request.info.validate();\n _checkWithdrawal(_request);\n MappedToken memory _token = getMainchainToken(_request.tokenAddr, _chainId);\n require(_request.info.erc == _token.erc, \"RoninGatewayV2: invalid token standard\");\n _request.info.transferFrom(_requester, address(this), _request.tokenAddr);\n _storeAsReceipt(_request, _chainId, _requester, _token.tokenAddr);\n }\n\n /**\n * @dev Stores the withdrawal request as a receipt.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function _storeAsReceipt(\n Transfer.Request calldata _request,\n uint256 _chainId,\n address _requester,\n address _mainchainTokenAddr\n ) internal returns (uint256 _withdrawalId) {\n _withdrawalId = withdrawalCount++;\n Transfer.Receipt memory _receipt = _request.into_withdrawal_receipt(\n _requester,\n _withdrawalId,\n _mainchainTokenAddr,\n _chainId\n );\n withdrawal[_withdrawalId] = _receipt;\n emit WithdrawalRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @dev Don't send me RON.\n */\n function _fallback() internal virtual {\n revert(\"RoninGatewayV2: invalid request\");\n }\n\n /**\n * @inheritdoc GatewayV2\n */\n function _getTotalWeight() internal view virtual override returns (uint256) {\n return _validatorContract.totalBridgeOperators();\n }\n\n /**\n * @dev Returns the total trusted weight.\n */\n function _getTotalTrustedWeight() internal view virtual returns (uint256) {\n return _trustedOrgContract.countTrustedOrganizations();\n }\n\n /**\n * @dev Sets the validator contract.\n *\n * Emits the event `ValidatorContractUpdated`.\n *\n */\n function _setValidatorContract(address _addr) internal {\n _validatorContract = IRoninValidatorSet(_addr);\n emit ValidatorContractUpdated(_addr);\n }\n\n /**\n * @dev Sets the bridge tracking contract.\n *\n * Emits the event `BridgeTrackingContractUpdated`.\n *\n */\n function _setBridgeTrackingContract(address _addr) internal {\n _bridgeTrackingContract = IBridgeTracking(_addr);\n emit BridgeTrackingContractUpdated(_addr);\n }\n\n /**\n * @dev Sets the ronin trusted organization contract.\n *\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\n *\n */\n function _setRoninTrustedOrganizationContract(address _addr) internal {\n _trustedOrgContract = IRoninTrustedOrganization(_addr);\n emit RoninTrustedOrganizationContractUpdated(_addr);\n }\n\n /**\n * @dev Casts and updates the vote result.\n *\n * Requirements:\n * - The vote is not finalized.\n * - The voter has not voted for the round.\n *\n */\n function _castIsolatedVote(\n IsolatedGovernance.Vote storage _v,\n address _voter,\n uint256 _minVoteWeight,\n uint256 _minTrustedVoteWeight,\n bytes32 _hash\n ) internal virtual returns (VoteStatus _status) {\n _v.castVote(_voter, _hash);\n (uint256 _totalWeight, uint256 _trustedWeight) = _getVoteWeight(_v, _hash);\n return _v.syncVoteStatus(_minVoteWeight, _totalWeight, _minTrustedVoteWeight, _trustedWeight, _hash);\n }\n\n /**\n * @dev Returns the vote weight for a specified hash.\n */\n function _getVoteWeight(IsolatedGovernance.Vote storage _v, bytes32 _hash)\n internal\n view\n returns (uint256 _totalWeight, uint256 _trustedWeight)\n {\n (\n address[] memory _consensusList,\n address[] memory _bridgeOperators,\n EnumFlags.ValidatorFlag[] memory _flags\n ) = _validatorContract.getValidators();\n uint256[] memory _trustedWeights = _trustedOrgContract.getConsensusWeights(_consensusList);\n\n for (uint _i; _i < _bridgeOperators.length; _i++) {\n if (_flags[_i].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator) && _v.voteHashOf[_bridgeOperators[_i]] == _hash) {\n _totalWeight++;\n if (_trustedWeights[_i] > 0) {\n _trustedWeight++;\n }\n }\n }\n }\n\n function setTrustedThreshold(uint256 _trustedNumerator, uint256 _trustedDenominator)\n external\n virtual\n onlyAdmin\n returns (uint256, uint256)\n {\n return _setTrustedThreshold(_trustedNumerator, _trustedDenominator);\n }\n\n /**\n * @dev Returns the minimum trusted vote weight to pass the threshold.\n */\n function minimumTrustedVoteWeight() public view virtual returns (uint256) {\n return _minimumTrustedVoteWeight(_getTotalTrustedWeight());\n }\n\n /**\n * @dev Returns the threshold about trusted org.\n */\n function getTrustedThreshold() external view virtual returns (uint256 trustedNum_, uint256 trustedDenom_) {\n return (_trustedNum, _trustedDenom);\n }\n\n /**\n * @dev Sets trusted threshold and returns the old one.\n *\n * Emits the `TrustedThresholdUpdated` event.\n *\n */\n function _setTrustedThreshold(uint256 _trustedNumerator, uint256 _trustedDenominator)\n internal\n virtual\n returns (uint256 _previousTrustedNum, uint256 _previousTrustedDenom)\n {\n require(_trustedNumerator <= _trustedDenominator, \"GatewayV2: invalid trusted threshold\");\n _previousTrustedNum = _num;\n _previousTrustedDenom = _denom;\n _trustedNum = _trustedNumerator;\n _trustedDenom = _trustedDenominator;\n emit TrustedThresholdUpdated(\n nonce++,\n _trustedNumerator,\n _trustedDenominator,\n _previousTrustedNum,\n _previousTrustedDenom\n );\n }\n\n /**\n * @dev Returns minimum trusted vote weight.\n */\n function _minimumTrustedVoteWeight(uint256 _totalTrustedWeight) internal view virtual returns (uint256) {\n return (_trustedNum * _totalTrustedWeight + _trustedDenom - 1) / _trustedDenom;\n }\n}\n" + }, + "contracts/extensions/GatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/security/Pausable.sol\";\nimport \"../interfaces/IQuorum.sol\";\nimport \"./collections/HasProxyAdmin.sol\";\n\nabstract contract GatewayV2 is HasProxyAdmin, Pausable, IQuorum {\n uint256 internal _num;\n uint256 internal _denom;\n\n address private ______deprecated;\n uint256 public nonce;\n\n address public emergencyPauser;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n /**\n * @dev Grant emergency pauser role for `_addr`.\n */\n function setEmergencyPauser(address _addr) external onlyAdmin {\n emergencyPauser = _addr;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\n return (_num, _denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _denom >= _num * _getTotalWeight();\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n virtual\n onlyAdmin\n returns (uint256, uint256)\n {\n return _setThreshold(_numerator, _denominator);\n }\n\n /**\n * @dev Triggers paused state.\n */\n function pause() external {\n require(msg.sender == _getAdmin() || msg.sender == emergencyPauser, \"GatewayV2: not authorized pauser\");\n _pause();\n }\n\n /**\n * @dev Triggers unpaused state.\n */\n function unpause() external {\n require(msg.sender == _getAdmin() || msg.sender == emergencyPauser, \"GatewayV2: not authorized pauser\");\n _unpause();\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function minimumVoteWeight() public view virtual returns (uint256) {\n return _minimumVoteWeight(_getTotalWeight());\n }\n\n /**\n * @dev Sets threshold and returns the old one.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function _setThreshold(uint256 _numerator, uint256 _denominator)\n internal\n virtual\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n require(_numerator <= _denominator, \"GatewayV2: invalid threshold\");\n _previousNum = _num;\n _previousDenom = _denom;\n _num = _numerator;\n _denom = _denominator;\n emit ThresholdUpdated(nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n\n /**\n * @dev Returns minimum vote weight.\n */\n function _minimumVoteWeight(uint256 _totalWeight) internal view virtual returns (uint256) {\n return (_num * _totalWeight + _denom - 1) / _denom;\n }\n\n /**\n * @dev Returns the total weight.\n */\n function _getTotalWeight() internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/MinimumWithdrawal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./collections/HasProxyAdmin.sol\";\nimport \"../libraries/Transfer.sol\";\n\nabstract contract MinimumWithdrawal is HasProxyAdmin {\n /// @dev Emitted when the minimum thresholds are updated\n event MinimumThresholdsUpdated(address[] tokens, uint256[] threshold);\n\n /// @dev Mapping from token address => minimum thresholds\n mapping(address => uint256) public minimumThreshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @dev Sets the minimum thresholds to withdraw.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `MinimumThresholdsUpdated` event.\n *\n */\n function setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) external virtual onlyAdmin {\n require(_tokens.length > 0, \"MinimumWithdrawal: invalid array length\");\n _setMinimumThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets minimum thresholds.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `MinimumThresholdsUpdated` event.\n *\n */\n function _setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n require(_tokens.length == _thresholds.length, \"MinimumWithdrawal: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n minimumThreshold[_tokens[_i]] = _thresholds[_i];\n }\n emit MinimumThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Checks whether the request is larger than or equal to the minimum threshold.\n */\n function _checkWithdrawal(Transfer.Request calldata _request) internal view {\n require(\n _request.info.erc != Token.Standard.ERC20 || _request.info.quantity >= minimumThreshold[_request.tokenAddr],\n \"MinimumWithdrawal: query for too small quantity\"\n );\n }\n}\n" + }, + "contracts/interfaces/IERC20Mintable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\ninterface IERC20Mintable {\n function mint(address _to, uint256 _value) external returns (bool _success);\n}\n" + }, + "contracts/interfaces/IERC721Mintable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC721Mintable {\n function mint(address _to, uint256 _tokenId) external returns (bool);\n}\n" + }, + "contracts/interfaces/IBridgeTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBridgeTracking {\n struct Request {\n VoteKind kind;\n uint256 id;\n }\n\n enum VoteKind {\n Deposit,\n Withdrawal,\n MainchainWithdrawal\n }\n\n /**\n * @dev Returns the total number of votes at the specific period `_period`.\n */\n function totalVotes(uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the total number of ballots at the specific period `_period`.\n */\n function totalBallots(uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\n */\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\n */\n function totalBallotsOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\n\n /**\n * @dev Handles the request once it is approved.\n *\n * Requirements:\n * - The method caller is the bridge contract.\n *\n */\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\n\n /**\n * @dev Records vote for a receipt and a operator.\n *\n * Requirements:\n * - The method caller is the bridge contract.\n *\n */\n function recordVote(\n VoteKind _kind,\n uint256 _requestId,\n address _operator\n ) external;\n}\n" + }, + "contracts/interfaces/IRoninGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/Transfer.sol\";\nimport \"./consumers/MappedTokenConsumer.sol\";\n\ninterface IRoninGatewayV2 is MappedTokenConsumer {\n /// @dev Emitted when the assets are depositted\n event Deposited(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal is requested\n event WithdrawalRequested(bytes32 receiptHash, Transfer.Receipt);\n /// @dev Emitted when the assets are withdrawn on mainchain\n event MainchainWithdrew(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal signatures is requested\n event WithdrawalSignaturesRequested(bytes32 receiptHash, Transfer.Receipt);\n /// @dev Emitted when the tokens are mapped\n event TokenMapped(address[] roninTokens, address[] mainchainTokens, uint256[] chainIds, Token.Standard[] standards);\n /// @dev Emitted when the threshold is updated\n event TrustedThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n /// @dev Emitted when a deposit is voted\n event DepositVoted(address indexed bridgeOperator, uint256 indexed id, uint256 indexed chainId, bytes32 receiptHash);\n\n /**\n * @dev Returns withdrawal count.\n */\n function withdrawalCount() external view returns (uint256);\n\n /**\n * @dev Returns withdrawal signatures.\n */\n function getWithdrawalSignatures(uint256 _withdrawalId, address[] calldata _validators)\n external\n view\n returns (bytes[] memory);\n\n /**\n * @dev Deposits based on the receipt.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Deposited` once the assets are released.\n *\n * @notice The assets will be transferred whenever the valid call passes the quorum threshold.\n *\n */\n function depositFor(Transfer.Receipt calldata _receipt) external;\n\n /**\n * @dev Marks the withdrawals are done on mainchain and returns the boolean array indicating whether the withdrawal\n * vote is already done before.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `MainchainWithdrew` once the valid call passes the quorum threshold.\n *\n * @notice Not reverting to avoid unnecessary failed transactions because the validators can send transactions at the\n * same time.\n *\n */\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds) external returns (bool[] memory);\n\n /**\n * @dev Tries bulk deposits based on the receipts and returns the boolean array indicating whether the deposit vote\n * is already done before. Reverts if the deposit is invalid or is voted by the validator again.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Deposited` once the assets are released.\n *\n * @notice The assets will be transferred whenever the valid call for the receipt passes the quorum threshold. Not\n * reverting to avoid unnecessary failed transactions because the validators can send transactions at the same time.\n *\n */\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts) external returns (bool[] memory);\n\n /**\n * @dev Locks the assets and request withdrawal.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external;\n\n /**\n * @dev Bulk requests withdrawals.\n *\n * Emits the `WithdrawalRequested` events.\n *\n */\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external;\n\n /**\n * @dev Requests withdrawal signatures for a specific withdrawal.\n *\n * Emits the `WithdrawalSignaturesRequested` event.\n *\n */\n function requestWithdrawalSignatures(uint256 _withdrawalId) external;\n\n /**\n * @dev Submits withdrawal signatures.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n */\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures) external;\n\n /**\n * @dev Maps Ronin tokens to mainchain networks.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata chainIds,\n Token.Standard[] calldata _standards\n ) external;\n\n /**\n * @dev Returns whether the deposit is casted by the voter.\n */\n function depositVoted(\n uint256 _chainId,\n uint256 _depositId,\n address _voter\n ) external view returns (bool);\n\n /**\n * @dev Returns whether the mainchain withdrew is casted by the voter.\n */\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool);\n\n /**\n * @dev Returns whether the withdrawal is done on mainchain.\n */\n function mainchainWithdrew(uint256 _withdrawalId) external view returns (bool);\n\n /**\n * @dev Returns mainchain token address.\n * Reverts for unsupported token.\n */\n function getMainchainToken(address _roninToken, uint256 _chainId) external view returns (MappedToken memory _token);\n}\n" + }, + "contracts/interfaces/collections/IHasBridgeTrackingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasBridgeTrackingContract is IHasContract {\n /// @dev Emitted when the bridge tracking contract is updated.\n event BridgeTrackingContractUpdated(address);\n\n /// @dev Error of method caller must be bridge tracking contract.\n error ErrCallerMustBeBridgeTrackingContract();\n\n /**\n * @dev Returns the bridge tracking contract.\n */\n function bridgeTrackingContract() external view returns (address);\n\n /**\n * @dev Sets the bridge tracking contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `BridgeTrackingContractUpdated`.\n *\n */\n function setBridgeTrackingContract(address) external;\n}\n" + }, + "@openzeppelin/contracts/security/Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" + }, + "contracts/libraries/Transfer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"./Token.sol\";\n\nlibrary Transfer {\n using ECDSA for bytes32;\n\n enum Kind {\n Deposit,\n Withdrawal\n }\n\n struct Request {\n // For deposit request: Recipient address on Ronin network\n // For withdrawal request: Recipient address on mainchain network\n address recipientAddr;\n // Token address to deposit/withdraw\n // Value 0: native token\n address tokenAddr;\n Token.Info info;\n }\n\n /**\n * @dev Converts the transfer request into the deposit receipt.\n */\n function into_deposit_receipt(\n Request memory _request,\n address _requester,\n uint256 _id,\n address _roninTokenAddr,\n uint256 _roninChainId\n ) internal view returns (Receipt memory _receipt) {\n _receipt.id = _id;\n _receipt.kind = Kind.Deposit;\n _receipt.mainchain.addr = _requester;\n _receipt.mainchain.tokenAddr = _request.tokenAddr;\n _receipt.mainchain.chainId = block.chainid;\n _receipt.ronin.addr = _request.recipientAddr;\n _receipt.ronin.tokenAddr = _roninTokenAddr;\n _receipt.ronin.chainId = _roninChainId;\n _receipt.info = _request.info;\n }\n\n /**\n * @dev Converts the transfer request into the withdrawal receipt.\n */\n function into_withdrawal_receipt(\n Request memory _request,\n address _requester,\n uint256 _id,\n address _mainchainTokenAddr,\n uint256 _mainchainId\n ) internal view returns (Receipt memory _receipt) {\n _receipt.id = _id;\n _receipt.kind = Kind.Withdrawal;\n _receipt.ronin.addr = _requester;\n _receipt.ronin.tokenAddr = _request.tokenAddr;\n _receipt.ronin.chainId = block.chainid;\n _receipt.mainchain.addr = _request.recipientAddr;\n _receipt.mainchain.tokenAddr = _mainchainTokenAddr;\n _receipt.mainchain.chainId = _mainchainId;\n _receipt.info = _request.info;\n }\n\n struct Receipt {\n uint256 id;\n Kind kind;\n Token.Owner mainchain;\n Token.Owner ronin;\n Token.Info info;\n }\n\n // keccak256(\"Receipt(uint256 id,uint8 kind,TokenOwner mainchain,TokenOwner ronin,TokenInfo info)TokenInfo(uint8 erc,uint256 id,uint256 quantity)TokenOwner(address addr,address tokenAddr,uint256 chainId)\");\n bytes32 public constant TYPE_HASH = 0xb9d1fe7c9deeec5dc90a2f47ff1684239519f2545b2228d3d91fb27df3189eea;\n\n /**\n * @dev Returns token info struct hash.\n */\n function hash(Receipt memory _receipt) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _receipt.id,\n _receipt.kind,\n Token.hash(_receipt.mainchain),\n Token.hash(_receipt.ronin),\n Token.hash(_receipt.info)\n )\n );\n }\n\n /**\n * @dev Returns the receipt digest.\n */\n function receiptDigest(bytes32 _domainSeparator, bytes32 _receiptHash) internal pure returns (bytes32) {\n return _domainSeparator.toTypedDataHash(_receiptHash);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "contracts/libraries/Token.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../interfaces/IWETH.sol\";\n\nlibrary Token {\n enum Standard {\n ERC20,\n ERC721\n }\n struct Info {\n Standard erc;\n // For ERC20: the id must be 0 and the quantity is larger than 0.\n // For ERC721: the quantity must be 0.\n uint256 id;\n uint256 quantity;\n }\n\n // keccak256(\"TokenInfo(uint8 erc,uint256 id,uint256 quantity)\");\n bytes32 public constant INFO_TYPE_HASH = 0x1e2b74b2a792d5c0f0b6e59b037fa9d43d84fbb759337f0112fcc15ca414fc8d;\n\n /**\n * @dev Returns token info struct hash.\n */\n function hash(Info memory _info) internal pure returns (bytes32) {\n return keccak256(abi.encode(INFO_TYPE_HASH, _info.erc, _info.id, _info.quantity));\n }\n\n /**\n * @dev Validates the token info.\n */\n function validate(Info memory _info) internal pure {\n require(\n (_info.erc == Standard.ERC20 && _info.quantity > 0 && _info.id == 0) ||\n (_info.erc == Standard.ERC721 && _info.quantity == 0),\n \"Token: invalid info\"\n );\n }\n\n /**\n * @dev Transfer asset from.\n *\n * Requirements:\n * - The `_from` address must approve for the contract using this library.\n *\n */\n function transferFrom(\n Info memory _info,\n address _from,\n address _to,\n address _token\n ) internal {\n bool _success;\n bytes memory _data;\n if (_info.erc == Standard.ERC20) {\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, _from, _to, _info.quantity));\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\n } else if (_info.erc == Standard.ERC721) {\n // bytes4(keccak256(\"transferFrom(address,address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x23b872dd, _from, _to, _info.id));\n } else {\n revert(\"Token: unsupported token standard\");\n }\n\n if (!_success) {\n revert(\n string(\n abi.encodePacked(\n \"Token: could not transfer \",\n toString(_info),\n \" from \",\n Strings.toHexString(uint160(_from), 20),\n \" to \",\n Strings.toHexString(uint160(_to), 20),\n \" token \",\n Strings.toHexString(uint160(_token), 20)\n )\n )\n );\n }\n }\n\n /**\n * @dev Transfers ERC721 token and returns the result.\n */\n function tryTransferERC721(\n address _token,\n address _to,\n uint256 _id\n ) internal returns (bool _success) {\n (_success, ) = _token.call(abi.encodeWithSelector(IERC721.transferFrom.selector, address(this), _to, _id));\n }\n\n /**\n * @dev Transfers ERC20 token and returns the result.\n */\n function tryTransferERC20(\n address _token,\n address _to,\n uint256 _quantity\n ) internal returns (bool _success) {\n bytes memory _data;\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transfer.selector, _to, _quantity));\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\n }\n\n /**\n * @dev Transfer assets from current address to `_to` address.\n */\n function transfer(\n Info memory _info,\n address _to,\n address _token\n ) internal {\n bool _success;\n if (_info.erc == Standard.ERC20) {\n _success = tryTransferERC20(_token, _to, _info.quantity);\n } else if (_info.erc == Standard.ERC721) {\n _success = tryTransferERC721(_token, _to, _info.id);\n } else {\n revert(\"Token: unsupported token standard\");\n }\n\n if (!_success) {\n revert(\n string(\n abi.encodePacked(\n \"Token: could not transfer \",\n toString(_info),\n \" to \",\n Strings.toHexString(uint160(_to), 20),\n \" token \",\n Strings.toHexString(uint160(_token), 20)\n )\n )\n );\n }\n }\n\n /**\n * @dev Tries minting and transfering assets.\n *\n * @notice Prioritizes transfer native token if the token is wrapped.\n *\n */\n function handleAssetTransfer(\n Info memory _info,\n address payable _to,\n address _token,\n IWETH _wrappedNativeToken\n ) internal {\n bool _success;\n if (_token == address(_wrappedNativeToken)) {\n // Try sending the native token before transferring the wrapped token\n if (!_to.send(_info.quantity)) {\n _wrappedNativeToken.deposit{ value: _info.quantity }();\n transfer(_info, _to, _token);\n }\n } else if (_info.erc == Token.Standard.ERC20) {\n uint256 _balance = IERC20(_token).balanceOf(address(this));\n\n if (_balance < _info.quantity) {\n // bytes4(keccak256(\"mint(address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, address(this), _info.quantity - _balance));\n require(_success, \"Token: ERC20 minting failed\");\n }\n\n transfer(_info, _to, _token);\n } else if (_info.erc == Token.Standard.ERC721) {\n if (!tryTransferERC721(_token, _to, _info.id)) {\n // bytes4(keccak256(\"mint(address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, _to, _info.id));\n require(_success, \"Token: ERC721 minting failed\");\n }\n } else {\n revert(\"Token: unsupported token standard\");\n }\n }\n\n /**\n * @dev Returns readable string.\n */\n function toString(Info memory _info) internal pure returns (string memory) {\n return\n string(\n abi.encodePacked(\n \"TokenInfo(\",\n Strings.toHexString(uint160(_info.erc), 1),\n \",\",\n Strings.toHexString(_info.id),\n \",\",\n Strings.toHexString(_info.quantity),\n \")\"\n )\n );\n }\n\n struct Owner {\n address addr;\n address tokenAddr;\n uint256 chainId;\n }\n\n // keccak256(\"TokenOwner(address addr,address tokenAddr,uint256 chainId)\");\n bytes32 public constant OWNER_TYPE_HASH = 0x353bdd8d69b9e3185b3972e08b03845c0c14a21a390215302776a7a34b0e8764;\n\n /**\n * @dev Returns ownership struct hash.\n */\n function hash(Owner memory _owner) internal pure returns (bytes32) {\n return keccak256(abi.encode(OWNER_TYPE_HASH, _owner.addr, _owner.tokenAddr, _owner.chainId));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IWETH.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IWETH {\n function deposit() external payable;\n\n function withdraw(uint256 _wad) external;\n\n function balanceOf(address) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/consumers/MappedTokenConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../libraries/Token.sol\";\n\ninterface MappedTokenConsumer {\n struct MappedToken {\n Token.Standard erc;\n address tokenAddr;\n }\n}\n" + }, + "contracts/extensions/bridge-operator-governance/BOsGovernanceRelay.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\nimport \"../../libraries/BridgeOperatorsBallot.sol\";\nimport \"../../libraries/AddressArrayUtils.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\n\nabstract contract BOsGovernanceRelay is SignatureConsumer, VoteStatusConsumer {\n /// @dev The last the brige operator set info.\n BridgeOperatorsBallot.BridgeOperatorSet internal _lastSyncedBridgeOperatorSetInfo;\n /// @dev Mapping from period index => epoch index => bridge operators vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) internal _vote;\n\n /**\n * @dev Returns the synced bridge operator set info.\n */\n function lastSyncedBridgeOperatorSetInfo() external view returns (BridgeOperatorsBallot.BridgeOperatorSet memory) {\n return _lastSyncedBridgeOperatorSetInfo;\n }\n\n /**\n * @dev Relays votes by signatures.\n *\n * Requirements:\n * - The period of voting is larger than the last synced period.\n * - The arrays are not empty.\n * - The signature signers are in order.\n *\n * @notice Does not store the voter signature into storage.\n *\n */\n function _relayVotesBySignatures(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures,\n uint256 _minimumVoteWeight,\n bytes32 _domainSeperator\n ) internal {\n require(\n (_ballot.period >= _lastSyncedBridgeOperatorSetInfo.period &&\n _ballot.epoch > _lastSyncedBridgeOperatorSetInfo.epoch),\n \"BOsGovernanceRelay: query for outdated bridge operator set\"\n );\n BridgeOperatorsBallot.verifyBallot(_ballot);\n require(\n !AddressArrayUtils.isEqual(_ballot.operators, _lastSyncedBridgeOperatorSetInfo.operators),\n \"BOsGovernanceRelay: bridge operator set is already voted\"\n );\n require(_signatures.length > 0, \"BOsGovernanceRelay: invalid array length\");\n\n Signature calldata _sig;\n address[] memory _signers = new address[](_signatures.length);\n address _lastSigner;\n bytes32 _hash = BridgeOperatorsBallot.hash(_ballot);\n bytes32 _digest = ECDSA.toTypedDataHash(_domainSeperator, _hash);\n\n for (uint256 _i = 0; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n _signers[_i] = ECDSA.recover(_digest, _sig.v, _sig.r, _sig.s);\n require(_lastSigner < _signers[_i], \"BOsGovernanceRelay: invalid order\");\n _lastSigner = _signers[_i];\n }\n\n IsolatedGovernance.Vote storage _v = _vote[_ballot.period][_ballot.epoch];\n uint256 _totalVoteWeight = _sumBridgeVoterWeights(_signers);\n if (_totalVoteWeight >= _minimumVoteWeight) {\n require(_totalVoteWeight > 0, \"BOsGovernanceRelay: invalid vote weight\");\n _v.status = VoteStatus.Approved;\n _lastSyncedBridgeOperatorSetInfo = _ballot;\n return;\n }\n\n revert(\"BOsGovernanceRelay: relay failed\");\n }\n\n /**\n * @dev Returns the weight of the governor list.\n */\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual returns (uint256);\n}\n" + }, + "contracts/mainchain/MainchainGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"../extensions/bridge-operator-governance/BOsGovernanceRelay.sol\";\nimport \"../extensions/sequential-governance/GovernanceRelay.sol\";\nimport \"../extensions/TransparentUpgradeableProxyV2.sol\";\nimport \"../extensions/GovernanceAdmin.sol\";\nimport \"../interfaces/IBridge.sol\";\n\ncontract MainchainGovernanceAdmin is AccessControlEnumerable, GovernanceRelay, GovernanceAdmin, BOsGovernanceRelay {\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n uint256 private constant DEFAULT_EXPIRY_DURATION = 1 << 255;\n\n constructor(\n uint256 _roninChainId,\n address _roleSetter,\n address _roninTrustedOrganizationContract,\n address _bridgeContract,\n address[] memory _relayers\n ) GovernanceAdmin(_roninChainId, _roninTrustedOrganizationContract, _bridgeContract, DEFAULT_EXPIRY_DURATION) {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n for (uint256 _i; _i < _relayers.length; _i++) {\n _grantRole(RELAYER_ROLE, _relayers[_i]);\n }\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for the proposal.\n */\n function proposalRelayed(uint256 _chainId, uint256 _round) external view returns (bool) {\n return vote[_chainId][_round].status != VoteStatus.Pending;\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for bridge operators at a specific period.\n */\n function bridgeOperatorsRelayed(uint256 _period, uint256 _epoch) external view returns (bool) {\n return _vote[_period][_epoch].status != VoteStatus.Pending;\n }\n\n /**\n * @dev See `GovernanceRelay-_relayProposal`.\n *\n * Requirements:\n * - The method caller is relayer.\n *\n */\n function relayProposal(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyRole(RELAYER_ROLE) {\n _relayProposal(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender);\n }\n\n /**\n * @dev See `GovernanceRelay-_relayGlobalProposal`.\n *\n * Requirements:\n * - The method caller is relayer.\n *\n */\n function relayGlobalProposal(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyRole(RELAYER_ROLE) {\n _relayGlobalProposal(\n _globalProposal,\n _supports,\n _signatures,\n DOMAIN_SEPARATOR,\n roninTrustedOrganizationContract(),\n bridgeContract(),\n msg.sender\n );\n }\n\n /**\n * @dev See `BOsGovernanceRelay-_relayVotesBySignatures`.\n *\n * Requirements:\n * - The method caller is relayer.\n *\n */\n function relayBridgeOperators(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures\n ) external onlyRole(RELAYER_ROLE) {\n _relayVotesBySignatures(_ballot, _signatures, _getMinimumVoteWeight(), DOMAIN_SEPARATOR);\n TransparentUpgradeableProxyV2(payable(bridgeContract())).functionDelegateCall(\n abi.encodeWithSelector(_bridgeContract.replaceBridgeOperators.selector, _ballot.operators)\n );\n }\n\n /**\n * @inheritdoc GovernanceRelay\n */\n function _sumWeights(address[] memory _governors) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumGovernorWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governors)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @inheritdoc BOsGovernanceRelay\n */\n function _sumBridgeVoterWeights(address[] memory _governors) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumBridgeVoterWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governors)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev See {CoreGovernance-_getChainType}\n */\n function _getChainType() internal pure override returns (ChainType) {\n return ChainType.Mainchain;\n }\n}\n" + }, + "contracts/extensions/sequential-governance/GovernanceRelay.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./CoreGovernance.sol\";\n\nabstract contract GovernanceRelay is CoreGovernance {\n using Proposal for Proposal.ProposalDetail;\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\n\n /**\n * @dev Relays votes by signatures.\n *\n * @notice Does not store the voter signature into storage.\n *\n */\n function _relayVotesBySignatures(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _forDigest,\n bytes32 _againstDigest\n ) internal {\n require(_supports.length > 0 && _supports.length == _signatures.length, \"GovernanceRelay: invalid array length\");\n uint256 _forVoteCount;\n uint256 _againstVoteCount;\n address[] memory _forVoteSigners = new address[](_signatures.length);\n address[] memory _againstVoteSigners = new address[](_signatures.length);\n\n {\n address _signer;\n address _lastSigner;\n Ballot.VoteType _support;\n Signature calldata _sig;\n\n for (uint256 _i; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n _support = _supports[_i];\n\n if (_support == Ballot.VoteType.For) {\n _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s);\n _forVoteSigners[_forVoteCount++] = _signer;\n } else if (_support == Ballot.VoteType.Against) {\n _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s);\n _againstVoteSigners[_againstVoteCount++] = _signer;\n } else {\n revert(\"GovernanceRelay: query for unsupported vote type\");\n }\n\n require(_lastSigner < _signer, \"GovernanceRelay: invalid order\");\n _lastSigner = _signer;\n }\n }\n\n assembly {\n mstore(_forVoteSigners, _forVoteCount)\n mstore(_againstVoteSigners, _againstVoteCount)\n }\n\n ProposalVote storage _vote = vote[_proposal.chainId][_proposal.nonce];\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _totalForVoteWeight = _sumWeights(_forVoteSigners);\n if (_totalForVoteWeight >= _minimumForVoteWeight) {\n require(_totalForVoteWeight > 0, \"GovernanceRelay: invalid vote weight\");\n _vote.status = VoteStatus.Approved;\n emit ProposalApproved(_vote.hash);\n _tryExecute(_vote, _proposal);\n return;\n }\n\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\n uint256 _totalAgainstVoteWeight = _sumWeights(_againstVoteSigners);\n if (_totalAgainstVoteWeight >= _minimumAgainstVoteWeight) {\n require(_totalAgainstVoteWeight > 0, \"GovernanceRelay: invalid vote weight\");\n _vote.status = VoteStatus.Rejected;\n emit ProposalRejected(_vote.hash);\n return;\n }\n\n revert(\"GovernanceRelay: relay failed\");\n }\n\n /**\n * @dev Relays voted proposal.\n *\n * Requirements:\n * - The relay proposal is finalized.\n *\n */\n function _relayProposal(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _creator\n ) internal {\n _proposeProposalStruct(_proposal, _creator);\n bytes32 _proposalHash = _proposal.hash();\n _relayVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Relays voted global proposal.\n *\n * Requirements:\n * - The relay proposal is finalized.\n *\n */\n function _relayGlobalProposal(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal {\n Proposal.ProposalDetail memory _proposal = _proposeGlobalStruct(\n _globalProposal,\n _roninTrustedOrganizationContract,\n _gatewayContract,\n _creator\n );\n bytes32 _globalProposalHash = _globalProposal.hash();\n _relayVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Returns the weight of the governor list.\n */\n function _sumWeights(address[] memory _governors) internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/TransparentUpgradeableProxyV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\n\n /**\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\n *\n * Requirements:\n * - Only the admin can call this function.\n *\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\n * reviewing the encoded data `_data` and the method which is called before using this.\n *\n */\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\n address _addr = _implementation();\n assembly {\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\n returndatacopy(0, 0, returndatasize())\n switch _result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "contracts/mocks/MockBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol\";\nimport \"../interfaces/IBridge.sol\";\n\ncontract MockBridge is IBridge {\n /// @dev Mapping from validator address => last block that the bridge operator is added\n mapping(address => uint256) public bridgeOperatorAddedBlock;\n /// @dev Bridge operators array\n address[] public bridgeOperators;\n\n function replaceBridgeOperators(address[] calldata _list) external {\n address _addr;\n for (uint256 _i = 0; _i < _list.length; _i++) {\n _addr = _list[_i];\n if (bridgeOperatorAddedBlock[_addr] == 0) {\n bridgeOperators.push(_addr);\n }\n bridgeOperatorAddedBlock[_addr] = block.number;\n }\n\n {\n uint256 _i;\n while (_i < bridgeOperators.length) {\n _addr = bridgeOperators[_i];\n if (bridgeOperatorAddedBlock[_addr] < block.number) {\n delete bridgeOperatorAddedBlock[_addr];\n bridgeOperators[_i] = bridgeOperators[bridgeOperators.length - 1];\n bridgeOperators.pop();\n continue;\n }\n _i++;\n }\n }\n }\n\n function getBridgeOperators() external view override returns (address[] memory) {\n return bridgeOperators;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetMinterPauser.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../extensions/ERC20Burnable.sol\";\nimport \"../extensions/ERC20Pausable.sol\";\nimport \"../../../access/AccessControlEnumerable.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev {ERC20} token, including:\n *\n * - ability for holders to burn (destroy) their tokens\n * - a minter role that allows for token minting (creation)\n * - a pauser role that allows to stop all token transfers\n *\n * This contract uses {AccessControl} to lock permissioned functions using the\n * different roles - head to its documentation for details.\n *\n * The account that deploys the contract will be granted the minter and pauser\n * roles, as well as the default admin role, which will let it grant both minter\n * and pauser roles to other accounts.\n *\n * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._\n */\ncontract ERC20PresetMinterPauser is Context, AccessControlEnumerable, ERC20Burnable, ERC20Pausable {\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant PAUSER_ROLE = keccak256(\"PAUSER_ROLE\");\n\n /**\n * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the\n * account that deploys the contract.\n *\n * See {ERC20-constructor}.\n */\n constructor(string memory name, string memory symbol) ERC20(name, symbol) {\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n\n _setupRole(MINTER_ROLE, _msgSender());\n _setupRole(PAUSER_ROLE, _msgSender());\n }\n\n /**\n * @dev Creates `amount` new tokens for `to`.\n *\n * See {ERC20-_mint}.\n *\n * Requirements:\n *\n * - the caller must have the `MINTER_ROLE`.\n */\n function mint(address to, uint256 amount) public virtual {\n require(hasRole(MINTER_ROLE, _msgSender()), \"ERC20PresetMinterPauser: must have minter role to mint\");\n _mint(to, amount);\n }\n\n /**\n * @dev Pauses all token transfers.\n *\n * See {ERC20Pausable} and {Pausable-_pause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function pause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC20PresetMinterPauser: must have pauser role to pause\");\n _pause();\n }\n\n /**\n * @dev Unpauses all token transfers.\n *\n * See {ERC20Pausable} and {Pausable-_unpause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function unpause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC20PresetMinterPauser: must have pauser role to unpause\");\n _unpause();\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override(ERC20, ERC20Pausable) {\n super._beforeTokenTransfer(from, to, amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\n * tokens and those that they have an allowance for, in a way that can be\n * recognized off-chain (via event analysis).\n */\nabstract contract ERC20Burnable is Context, ERC20 {\n /**\n * @dev Destroys `amount` tokens from the caller.\n *\n * See {ERC20-_burn}.\n */\n function burn(uint256 amount) public virtual {\n _burn(_msgSender(), amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\n * allowance.\n *\n * See {ERC20-_burn} and {ERC20-allowance}.\n *\n * Requirements:\n *\n * - the caller must have allowance for ``accounts``'s tokens of at least\n * `amount`.\n */\n function burnFrom(address account, uint256 amount) public virtual {\n _spendAllowance(account, _msgSender(), amount);\n _burn(account, amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../security/Pausable.sol\";\n\n/**\n * @dev ERC20 token with pausable token transfers, minting and burning.\n *\n * Useful for scenarios such as preventing trades until the end of an evaluation\n * period, or having an emergency switch for freezing all token transfers in the\n * event of a large bug.\n */\nabstract contract ERC20Pausable is ERC20, Pausable {\n /**\n * @dev See {ERC20-_beforeTokenTransfer}.\n *\n * Requirements:\n *\n * - the contract must not be paused.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, amount);\n\n require(!paused(), \"ERC20Pausable: token transfer while paused\");\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"../../access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" + }, + "contracts/multi-chains/RoninTrustedOrganization.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../libraries/AddressArrayUtils.sol\";\nimport \"../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../extensions/collections/HasProxyAdmin.sol\";\n\ncontract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, Initializable {\n uint256 internal _num;\n uint256 internal _denom;\n uint256 internal _totalWeight;\n uint256 internal _nonce;\n\n /// @dev Mapping from consensus address => weight\n mapping(address => uint256) internal _consensusWeight;\n /// @dev Mapping from governor address => weight\n mapping(address => uint256) internal _governorWeight;\n /// @dev Mapping from bridge voter address => weight\n mapping(address => uint256) internal _bridgeVoterWeight;\n\n /// @dev Mapping from consensus address => added block\n mapping(address => uint256) internal _addedBlock;\n\n /// @dev Consensus array\n address[] internal _consensusList;\n /// @dev Governors array\n address[] internal _governorList;\n /// @dev Bridge voters array\n address[] internal _bridgeVoterList;\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n TrustedOrganization[] calldata _trustedOrgs,\n uint256 __num,\n uint256 __denom\n ) external initializer {\n if (_trustedOrgs.length > 0) {\n _addTrustedOrganizations(_trustedOrgs);\n }\n _setThreshold(__num, __denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\n return (_num, _denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _denom >= _num * _totalWeight;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function minimumVoteWeight() external view virtual returns (uint256) {\n return (_num * _totalWeight + _denom - 1) / _denom;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n override\n onlyAdmin\n returns (uint256, uint256)\n {\n return _setThreshold(_numerator, _denominator);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function addTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\n _addTrustedOrganizations(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\n require(_list.length > 0, \"RoninTrustedOrganization: invalid array length\");\n for (uint256 _i; _i < _list.length; _i++) {\n _updateTrustedOrganization(_list[_i]);\n }\n emit TrustedOrganizationsUpdated(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function removeTrustedOrganizations(address[] calldata _list) external override onlyAdmin {\n require(_list.length > 0, \"RoninTrustedOrganization: invalid array length\");\n for (uint _i = 0; _i < _list.length; _i++) {\n _removeTrustedOrganization(_list[_i]);\n }\n emit TrustedOrganizationsRemoved(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function totalWeights() external view virtual returns (uint256) {\n return _totalWeight;\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getConsensusWeight(address _consensusAddr) external view returns (uint256) {\n return _consensusWeight[_consensusAddr];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getGovernorWeight(address _governor) external view returns (uint256) {\n return _governorWeight[_governor];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getBridgeVoterWeight(address _addr) external view returns (uint256) {\n return _bridgeVoterWeight[_addr];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; _i++) {\n _res[_i] = _consensusWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; _i++) {\n _res[_i] = _governorWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; _i++) {\n _res[_i] = _bridgeVoterWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; _i++) {\n _res += _consensusWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; _i++) {\n _res += _governorWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; _i++) {\n _res += _bridgeVoterWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function countTrustedOrganizations() external view override returns (uint256) {\n return _consensusList.length;\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getAllTrustedOrganizations() external view override returns (TrustedOrganization[] memory _list) {\n _list = new TrustedOrganization[](_consensusList.length);\n address _addr;\n for (uint256 _i; _i < _list.length; _i++) {\n _addr = _consensusList[_i];\n _list[_i].consensusAddr = _addr;\n _list[_i].governor = _governorList[_i];\n _list[_i].bridgeVoter = _bridgeVoterList[_i];\n _list[_i].weight = _consensusWeight[_addr];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory) {\n for (uint _i = 0; _i < _consensusList.length; _i++) {\n if (_consensusList[_i] == _consensusAddr) {\n return getTrustedOrganizationAt(_i);\n }\n }\n revert(\"RoninTrustedOrganization: query for non-existent consensus address\");\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getTrustedOrganizationAt(uint256 _idx) public view override returns (TrustedOrganization memory) {\n address _addr = _consensusList[_idx];\n return\n TrustedOrganization(\n _addr,\n _governorList[_idx],\n _bridgeVoterList[_idx],\n _consensusWeight[_addr],\n _addedBlock[_addr]\n );\n }\n\n /**\n * @dev Adds a list of trusted organizations.\n */\n function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {\n for (uint256 _i; _i < _list.length; _i++) {\n _addTrustedOrganization(_list[_i]);\n }\n emit TrustedOrganizationsAdded(_list);\n }\n\n /**\n * @dev Adds a trusted organization.\n *\n * Requirements:\n * - The weight is larger than 0.\n * - The consensus address is not added.\n * - The govenor address is not added.\n * - The bridge voter address is not added.\n *\n */\n function _addTrustedOrganization(TrustedOrganization memory _v) internal virtual {\n require(_v.addedBlock == 0, \"RoninTrustedOrganization: invalid request\");\n _sanityCheckTrustedOrganizationData(_v);\n\n if (_consensusWeight[_v.consensusAddr] > 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: consensus address \",\n Strings.toHexString(uint160(_v.consensusAddr), 20),\n \" is added already\"\n )\n )\n );\n }\n\n if (_governorWeight[_v.governor] > 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: govenor address \",\n Strings.toHexString(uint160(_v.governor), 20),\n \" is added already\"\n )\n )\n );\n }\n\n if (_bridgeVoterWeight[_v.bridgeVoter] > 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: bridge voter address \",\n Strings.toHexString(uint160(_v.bridgeVoter), 20),\n \" is added already\"\n )\n )\n );\n }\n\n _consensusList.push(_v.consensusAddr);\n _consensusWeight[_v.consensusAddr] = _v.weight;\n\n _governorList.push(_v.governor);\n _governorWeight[_v.governor] = _v.weight;\n\n _bridgeVoterList.push(_v.bridgeVoter);\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\n\n _addedBlock[_v.consensusAddr] = block.number;\n\n _totalWeight += _v.weight;\n }\n\n /**\n * @dev Updates a trusted organization.\n *\n * Requirements:\n * - The weight is larger than 0.\n * - The consensus address is already added.\n *\n */\n function _updateTrustedOrganization(TrustedOrganization memory _v) internal virtual {\n _sanityCheckTrustedOrganizationData(_v);\n\n uint256 _weight = _consensusWeight[_v.consensusAddr];\n if (_weight == 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: consensus address \",\n Strings.toHexString(uint160(_v.consensusAddr), 20),\n \" is not added\"\n )\n )\n );\n }\n\n uint256 _count = _consensusList.length;\n for (uint256 _i = 0; _i < _count; _i++) {\n if (_consensusList[_i] == _v.consensusAddr) {\n _totalWeight -= _weight;\n _totalWeight += _v.weight;\n\n if (_governorList[_i] != _v.governor) {\n require(_governorWeight[_v.governor] == 0, \"RoninTrustedOrganization: query for duplicated governor\");\n delete _governorWeight[_governorList[_i]];\n _governorList[_i] = _v.governor;\n }\n\n if (_bridgeVoterList[_i] != _v.bridgeVoter) {\n require(\n _bridgeVoterWeight[_v.bridgeVoter] == 0,\n \"RoninTrustedOrganization: query for duplicated bridge voter\"\n );\n delete _bridgeVoterWeight[_bridgeVoterList[_i]];\n _bridgeVoterList[_i] = _v.bridgeVoter;\n }\n\n _consensusWeight[_v.consensusAddr] = _v.weight;\n _governorWeight[_v.governor] = _v.weight;\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\n return;\n }\n }\n }\n\n /**\n * @dev Removes a trusted organization.\n *\n * Requirements:\n * - The consensus address is added.\n *\n */\n function _removeTrustedOrganization(address _addr) internal virtual {\n uint256 _weight = _consensusWeight[_addr];\n if (_weight == 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: consensus address \",\n Strings.toHexString(uint160(_addr), 20),\n \" is not added\"\n )\n )\n );\n }\n\n uint256 _index;\n uint256 _count = _consensusList.length;\n for (uint256 _i = 0; _i < _count; _i++) {\n if (_consensusList[_i] == _addr) {\n _index = _i;\n break;\n }\n }\n\n _totalWeight -= _weight;\n\n delete _addedBlock[_addr];\n delete _consensusWeight[_addr];\n _consensusList[_index] = _consensusList[_count - 1];\n _consensusList.pop();\n\n delete _governorWeight[_governorList[_index]];\n _governorList[_index] = _governorList[_count - 1];\n _governorList.pop();\n\n delete _bridgeVoterWeight[_bridgeVoterList[_index]];\n _bridgeVoterList[_index] = _bridgeVoterList[_count - 1];\n _bridgeVoterList.pop();\n }\n\n /**\n * @dev Sets threshold and returns the old one.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function _setThreshold(uint256 _numerator, uint256 _denominator)\n internal\n virtual\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n require(_numerator <= _denominator, \"RoninTrustedOrganization: invalid threshold\");\n _previousNum = _num;\n _previousDenom = _denom;\n _num = _numerator;\n _denom = _denominator;\n emit ThresholdUpdated(_nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n\n /**\n * @dev Hook that checks trusted organization's data. Reverts if the requirements are not met.\n *\n * Requirements:\n * - The weight must be larger than 0.\n * - The consensus address, governor address, and bridge voter address are different.\n */\n function _sanityCheckTrustedOrganizationData(TrustedOrganization memory _v) private pure {\n require(_v.weight > 0, \"RoninTrustedOrganization: invalid weight\");\n\n address[] memory _addresses = new address[](3);\n _addresses[0] = _v.consensusAddr;\n _addresses[1] = _v.governor;\n _addresses[2] = _v.bridgeVoter;\n require(!AddressArrayUtils.hasDuplicate(_addresses), \"RoninTrustedOrganization: three addresses must be distinct\");\n }\n}\n" + }, + "contracts/ronin/gateway/BridgeTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../extensions/collections/HasBridgeContract.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\nimport \"../../interfaces/IBridgeTracking.sol\";\n\ncontract BridgeTracking is HasBridgeContract, HasValidatorContract, Initializable, IBridgeTracking {\n struct PeriodVotingMetric {\n /// @dev Total requests that are tracked in the period. This value is 0 until the {_bufferMetric.requests[]} gets added into a period metric.\n uint256 totalRequests;\n uint256 totalBallots;\n mapping(address => uint256) totalBallotsOf;\n address[] voters;\n }\n\n struct PeriodVotingMetricTimeWrapper {\n uint256 lastEpoch;\n Request[] requests;\n PeriodVotingMetric data;\n }\n\n struct ReceiptTrackingInfo {\n /// @dev The period that the receipt is approved. Value 0 means the receipt is not approved yet.\n uint256 approvedPeriod;\n /// @dev The address list of voters\n address[] voters;\n /// @dev Mapping from voter => flag indicating the voter casts vote for this receipt\n mapping(address => bool) voted;\n /// @dev The period that the receipt is tracked, i.e. the metric is transferred from buffer to the period. Value 0 means the receipt is currently in buffer or not tracked yet.\n uint256 trackedPeriod;\n }\n\n /// @dev The block that the contract allows incoming mutable calls.\n uint256 public startedAtBlock;\n\n /// @dev The temporary info of votes and ballots\n PeriodVotingMetricTimeWrapper internal _bufferMetric;\n /// @dev Mapping from period number => vote stats based on period\n mapping(uint256 => PeriodVotingMetric) internal _periodMetric;\n /// @dev Mapping from vote kind => receipt id => receipt stats\n mapping(VoteKind => mapping(uint256 => ReceiptTrackingInfo)) internal _receiptTrackingInfo;\n\n modifier skipOnUnstarted() {\n if (block.number < startedAtBlock) {\n return;\n }\n _;\n }\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address _bridgeContract,\n address _validatorContract,\n uint256 _startedAtBlock\n ) external initializer {\n _setBridgeContract(_bridgeContract);\n _setValidatorContract(_validatorContract);\n startedAtBlock = _startedAtBlock;\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalVotes(uint256 _period) external view override returns (uint256 _totalVotes) {\n _totalVotes = _periodMetric[_period].totalRequests;\n if (_isBufferCountedForPeriod(_period)) {\n _totalVotes += _bufferMetric.requests.length;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalBallots(uint256 _period) external view override returns (uint256 _totalBallots) {\n _totalBallots = _periodMetric[_period].totalBallots;\n if (_isBufferCountedForPeriod(_period)) {\n _totalBallots += _bufferMetric.data.totalBallots;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\n external\n view\n override\n returns (uint256[] memory _res)\n {\n _res = new uint256[](_bridgeOperators.length);\n bool _isBufferCounted = _isBufferCountedForPeriod(_period);\n for (uint _i = 0; _i < _bridgeOperators.length; _i++) {\n _res[_i] = _totalBallotsOf(_period, _bridgeOperators[_i], _isBufferCounted);\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalBallotsOf(uint256 _period, address _bridgeOperator) public view override returns (uint256) {\n return _totalBallotsOf(_period, _bridgeOperator, _isBufferCountedForPeriod(_period));\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external override onlyBridgeContract skipOnUnstarted {\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\n\n // Only records for the receipt which not approved\n if (_receiptInfo.approvedPeriod == 0) {\n _trySyncBuffer();\n uint256 _currentPeriod = _validatorContract.currentPeriod();\n _receiptInfo.approvedPeriod = _currentPeriod;\n\n Request storage _bufferRequest = _bufferMetric.requests.push();\n _bufferRequest.kind = _kind;\n _bufferRequest.id = _requestId;\n\n address[] storage _voters = _receiptInfo.voters;\n for (uint _i = 0; _i < _voters.length; _i++) {\n _increaseBallot(_kind, _requestId, _voters[_i], _currentPeriod);\n }\n\n delete _receiptInfo.voters;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function recordVote(\n VoteKind _kind,\n uint256 _requestId,\n address _operator\n ) external override onlyBridgeContract skipOnUnstarted {\n uint256 _period = _validatorContract.currentPeriod();\n _trySyncBuffer();\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\n\n // When the vote is not approved yet, the voters are saved in the receipt info, and not increase ballot metric.\n // The ballot metric will be increased later in the {handleVoteApproved} method.\n if (_receiptInfo.approvedPeriod == 0) {\n _receiptInfo.voters.push(_operator);\n return;\n }\n\n _increaseBallot(_kind, _requestId, _operator, _period);\n }\n\n /**\n * @dev Increases the ballot for the operator at a period.\n */\n function _increaseBallot(\n VoteKind _kind,\n uint256 _requestId,\n address _operator,\n uint256 _currentPeriod\n ) internal {\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\n if (_receiptInfo.voted[_operator]) {\n return;\n }\n\n _receiptInfo.voted[_operator] = true;\n\n uint256 _trackedPeriod = _receiptInfo.trackedPeriod;\n\n // Do not increase ballot for receipt that is neither in the buffer, nor in the most current tracked period.\n // If the receipt is not tracked in a period, increase metric in buffer.\n if (_trackedPeriod == 0) {\n if (_bufferMetric.data.totalBallotsOf[_operator] == 0) {\n _bufferMetric.data.voters.push(_operator);\n }\n _bufferMetric.data.totalBallots++;\n _bufferMetric.data.totalBallotsOf[_operator]++;\n }\n // If the receipt is tracked in the most current tracked period, increase metric in the period.\n else if (_trackedPeriod == _currentPeriod) {\n PeriodVotingMetric storage _metric = _periodMetric[_trackedPeriod];\n _metric.totalBallots++;\n _metric.totalBallotsOf[_operator]++;\n }\n }\n\n /**\n * @dev See `totalBallotsOf`.\n */\n function _totalBallotsOf(\n uint256 _period,\n address _bridgeOperator,\n bool _mustCountLastStats\n ) internal view returns (uint256 _totalBallots) {\n _totalBallots = _periodMetric[_period].totalBallotsOf[_bridgeOperator];\n if (_mustCountLastStats) {\n _totalBallots += _bufferMetric.data.totalBallotsOf[_bridgeOperator];\n }\n }\n\n /**\n * @dev Syncs period stats. Move all data from the buffer metric to the period metric.\n *\n * Requirements:\n * - The epoch after the buffer epoch is wrapped up.\n */\n function _trySyncBuffer() internal {\n uint256 _currentEpoch = _validatorContract.epochOf(block.number);\n if (_bufferMetric.lastEpoch < _currentEpoch) {\n (, uint256 _trackedPeriod) = _validatorContract.tryGetPeriodOfEpoch(_bufferMetric.lastEpoch + 1);\n _bufferMetric.lastEpoch = _currentEpoch;\n\n // Copy numbers of totals\n PeriodVotingMetric storage _metric = _periodMetric[_trackedPeriod];\n _metric.totalRequests += _bufferMetric.requests.length;\n _metric.totalBallots += _bufferMetric.data.totalBallots;\n\n // Copy voters info and voters' ballot\n for (uint _i = 0; _i < _bufferMetric.data.voters.length; _i++) {\n address _voter = _bufferMetric.data.voters[_i];\n _metric.totalBallotsOf[_voter] += _bufferMetric.data.totalBallotsOf[_voter];\n delete _bufferMetric.data.totalBallotsOf[_voter]; // need to manually delete each element, due to mapping\n }\n\n // Mark all receipts in the buffer as tracked. Keep total number of receipts and delete receipt details.\n for (uint _i = 0; _i < _bufferMetric.requests.length; _i++) {\n Request storage _bufferRequest = _bufferMetric.requests[_i];\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_bufferRequest.kind][_bufferRequest.id];\n _receiptInfo.trackedPeriod = _trackedPeriod;\n }\n\n delete _bufferMetric.requests;\n delete _bufferMetric.data;\n }\n }\n\n /**\n * @dev Returns whether the buffer stats must be counted or not.\n */\n function _isBufferCountedForPeriod(uint256 _queriedPeriod) internal view returns (bool) {\n uint256 _currentEpoch = _validatorContract.epochOf(block.number);\n (bool _filled, uint256 _periodOfNextTemporaryEpoch) = _validatorContract.tryGetPeriodOfEpoch(\n _bufferMetric.lastEpoch + 1\n );\n return _filled && _queriedPeriod == _periodOfNextTemporaryEpoch && _bufferMetric.lastEpoch < _currentEpoch;\n }\n}\n" + }, + "contracts/mocks/MockGatewayForTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../interfaces/IBridgeTracking.sol\";\nimport \"../extensions/collections/HasBridgeTrackingContract.sol\";\n\ncontract MockGatewayForTracking is HasBridgeTrackingContract {\n constructor(address _bridgeTrackingContract) {\n _setBridgeTrackingContract(_bridgeTrackingContract);\n }\n\n function sendBallot(\n IBridgeTracking.VoteKind _kind,\n uint256 _id,\n address[] memory _voters\n ) external {\n for (uint256 _i; _i < _voters.length; _i++) {\n _bridgeTrackingContract.recordVote(_kind, _id, _voters[_i]);\n }\n }\n\n function sendApprovedVote(IBridgeTracking.VoteKind _kind, uint256 _id) external {\n _bridgeTrackingContract.handleVoteApproved(_kind, _id);\n }\n}\n" + }, + "contracts/extensions/collections/HasBridgeTrackingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasBridgeTrackingContract.sol\";\nimport \"../../interfaces/IBridgeTracking.sol\";\n\ncontract HasBridgeTrackingContract is IHasBridgeTrackingContract, HasProxyAdmin {\n IBridgeTracking internal _bridgeTrackingContract;\n\n modifier onlyBridgeTrackingContract() {\n if (bridgeTrackingContract() != msg.sender) revert ErrCallerMustBeBridgeTrackingContract();\n _;\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function bridgeTrackingContract() public view override returns (address) {\n return address(_bridgeTrackingContract);\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function setBridgeTrackingContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setBridgeTrackingContract(_addr);\n }\n\n /**\n * @dev Sets the bridge tracking contract.\n *\n * Emits the event `BridgeTrackingContractUpdated`.\n *\n */\n function _setBridgeTrackingContract(address _addr) internal {\n _bridgeTrackingContract = IBridgeTracking(_addr);\n emit BridgeTrackingContractUpdated(_addr);\n }\n}\n" + }, + "contracts/ronin/validator/CoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasBridgeTrackingContract.sol\";\nimport \"../../extensions/collections/HasMaintenanceContract.sol\";\nimport \"../../extensions/collections/HasSlashIndicatorContract.sol\";\nimport \"../../extensions/collections/HasStakingVestingContract.sol\";\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../interfaces/validator/ICoinbaseExecution.sol\";\nimport \"../../libraries/EnumFlags.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"../../precompile-usages/PCUSortValidators.sol\";\nimport \"../../precompile-usages/PCUPickValidatorSet.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\nimport \"./CandidateManager.sol\";\nimport \"./EmergencyExit.sol\";\n\nabstract contract CoinbaseExecution is\n ICoinbaseExecution,\n RONTransferHelper,\n PCUSortValidators,\n PCUPickValidatorSet,\n HasStakingVestingContract,\n HasBridgeTrackingContract,\n HasMaintenanceContract,\n HasSlashIndicatorContract,\n EmergencyExit\n{\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n modifier onlyCoinbase() {\n if (msg.sender != block.coinbase) revert ErrCallerMustBeCoinbase();\n _;\n }\n\n modifier whenEpochEnding() {\n if (!epochEndingAt(block.number)) revert ErrAtEndOfEpochOnly();\n _;\n }\n\n modifier oncePerEpoch() {\n if (epochOf(_lastUpdatedBlock) >= epochOf(block.number)) revert ErrAlreadyWrappedEpoch();\n _lastUpdatedBlock = block.number;\n _;\n }\n\n /**\n * @inheritdoc ICoinbaseExecution\n */\n function submitBlockReward() external payable override onlyCoinbase {\n bool _requestForBlockProducer = isBlockProducer(msg.sender) &&\n !_jailed(msg.sender) &&\n !_miningRewardDeprecated(msg.sender, currentPeriod());\n\n (, uint256 _blockProducerBonus, uint256 _bridgeOperatorBonus) = _stakingVestingContract.requestBonus(\n _requestForBlockProducer,\n true // _requestForBridgeOperator\n );\n\n _totalBridgeReward += _bridgeOperatorBonus;\n\n // Deprecates reward for non-validator or slashed validator\n if (!_requestForBlockProducer) {\n _totalDeprecatedReward += msg.value;\n emit BlockRewardDeprecated(msg.sender, msg.value, BlockRewardDeprecatedType.UNAVAILABILITY);\n return;\n }\n\n emit BlockRewardSubmitted(msg.sender, msg.value, _blockProducerBonus);\n\n uint256 _period = currentPeriod();\n uint256 _reward = msg.value + _blockProducerBonus;\n uint256 _cutOffReward;\n if (_miningRewardBailoutCutOffAtPeriod[msg.sender][_period]) {\n (, , , uint256 _cutOffPercentage) = _slashIndicatorContract.getCreditScoreConfigs();\n _cutOffReward = (_reward * _cutOffPercentage) / _MAX_PERCENTAGE;\n _totalDeprecatedReward += _cutOffReward;\n emit BlockRewardDeprecated(msg.sender, _cutOffReward, BlockRewardDeprecatedType.AFTER_BAILOUT);\n }\n\n _reward -= _cutOffReward;\n (uint256 _minRate, uint256 _maxRate) = _stakingContract.getCommissionRateRange();\n uint256 _rate = Math.max(Math.min(_candidateInfo[msg.sender].commissionRate, _maxRate), _minRate);\n uint256 _miningAmount = (_rate * _reward) / _MAX_PERCENTAGE;\n _miningReward[msg.sender] += _miningAmount;\n\n uint256 _delegatingAmount = _reward - _miningAmount;\n _delegatingReward[msg.sender] += _delegatingAmount;\n }\n\n /**\n * @inheritdoc ICoinbaseExecution\n */\n function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {\n uint256 _newPeriod = _computePeriod(block.timestamp);\n bool _periodEnding = _isPeriodEnding(_newPeriod);\n\n (address[] memory _currentValidators, , ) = getValidators();\n address[] memory _revokedCandidates;\n uint256 _epoch = epochOf(block.number);\n uint256 _nextEpoch = _epoch + 1;\n uint256 _lastPeriod = currentPeriod();\n\n if (_periodEnding) {\n _syncBridgeOperatingReward(_lastPeriod, _currentValidators);\n (\n uint256 _totalDelegatingReward,\n uint256[] memory _delegatingRewards\n ) = _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(_lastPeriod, _currentValidators);\n _settleAndTransferDelegatingRewards(_lastPeriod, _currentValidators, _totalDelegatingReward, _delegatingRewards);\n _tryRecycleLockedFundsFromEmergencyExits();\n _recycleDeprecatedRewards();\n _slashIndicatorContract.updateCreditScores(_currentValidators, _lastPeriod);\n (_currentValidators, _revokedCandidates) = _syncValidatorSet(_newPeriod);\n if (_revokedCandidates.length > 0) {\n _slashIndicatorContract.execResetCreditScores(_revokedCandidates);\n }\n _currentPeriodStartAtBlock = block.number + 1;\n }\n _revampRoles(_newPeriod, _nextEpoch, _currentValidators);\n emit WrappedUpEpoch(_lastPeriod, _epoch, _periodEnding);\n _periodOf[_nextEpoch] = _newPeriod;\n _lastUpdatedPeriod = _newPeriod;\n }\n\n /**\n * @dev This loop over the all current validators to sync the bridge operating reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _syncBridgeOperatingReward(uint256 _lastPeriod, address[] memory _currentValidators) internal {\n uint256 _totalBridgeBallots = _bridgeTrackingContract.totalBallots(_lastPeriod);\n uint256 _totalBridgeVotes = _bridgeTrackingContract.totalVotes(_lastPeriod);\n uint256[] memory _bridgeBallots = _bridgeTrackingContract.getManyTotalBallots(\n _lastPeriod,\n getBridgeOperatorsOf(_currentValidators)\n );\n\n if (\n !_validateBridgeTrackingResponse(_totalBridgeBallots, _totalBridgeVotes, _bridgeBallots) || _totalBridgeVotes == 0\n ) {\n // Shares equally in case the bridge has nothing to vote or bridge tracking response is incorrect\n for (uint256 _i; _i < _currentValidators.length; _i++) {\n _bridgeOperatingReward[_currentValidators[_i]] = _totalBridgeReward / _currentValidators.length;\n }\n return;\n }\n\n (\n uint256 _missingVotesRatioTier1,\n uint256 _missingVotesRatioTier2,\n uint256 _jailDurationForMissingVotesRatioTier2,\n uint256 _skipBridgeOperatorSlashingThreshold\n ) = _slashIndicatorContract.getBridgeOperatorSlashingConfigs();\n\n // Slashes the bridge reward if the total of votes exceeds the slashing threshold.\n bool _shouldSlash = _totalBridgeVotes > _skipBridgeOperatorSlashingThreshold;\n for (uint256 _i; _i < _currentValidators.length; _i++) {\n // Shares the bridge operators reward proportionally.\n _bridgeOperatingReward[_currentValidators[_i]] = (_totalBridgeReward * _bridgeBallots[_i]) / _totalBridgeBallots;\n if (_shouldSlash) {\n _slashBridgeOperatorBasedOnPerformance(\n _lastPeriod,\n _currentValidators[_i],\n _MAX_PERCENTAGE - (_bridgeBallots[_i] * _MAX_PERCENTAGE) / _totalBridgeVotes,\n _jailDurationForMissingVotesRatioTier2,\n _missingVotesRatioTier1,\n _missingVotesRatioTier2\n );\n }\n }\n }\n\n /**\n * @dev Returns whether the responses from bridge tracking are correct.\n */\n function _validateBridgeTrackingResponse(\n uint256 _totalBridgeBallots,\n uint256 _totalBridgeVotes,\n uint256[] memory _bridgeBallots\n ) private returns (bool _valid) {\n _valid = true;\n uint256 _sumBallots;\n for (uint _i; _i < _bridgeBallots.length; _i++) {\n if (_bridgeBallots[_i] > _totalBridgeVotes) {\n _valid = false;\n break;\n }\n _sumBallots += _bridgeBallots[_i];\n }\n _valid = _valid && (_sumBallots <= _totalBridgeBallots);\n if (!_valid) {\n emit BridgeTrackingIncorrectlyResponded();\n }\n }\n\n /**\n * @dev Slashes the validator on the corresponding bridge operator performance. Updates the status of the deprecated reward. Not update the reward amount.\n *\n * Consider validating the bridge tracking response by using the method `_validateBridgeTrackingResponse` before calling this function.\n */\n function _slashBridgeOperatorBasedOnPerformance(\n uint256 _period,\n address _validator,\n uint256 _missedRatio,\n uint256 _jailDurationTier2,\n uint256 _ratioTier1,\n uint256 _ratioTier2\n ) internal {\n if (_missedRatio >= _ratioTier2) {\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\n _miningRewardDeprecatedAtPeriod[_validator][_period] = true;\n\n uint256 _newJailUntilBlock = Math.addIfNonZero(block.number, _jailDurationTier2);\n _blockProducerJailedBlock[_validator] = Math.max(_newJailUntilBlock, _blockProducerJailedBlock[_validator]);\n _cannotBailoutUntilBlock[_validator] = Math.max(_newJailUntilBlock, _cannotBailoutUntilBlock[_validator]);\n\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 2, _period);\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, true, true);\n } else if (_missedRatio >= _ratioTier1) {\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 1, _period);\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, false, true);\n }\n }\n\n /**\n * @dev This loops over all current validators to:\n * - Update delegating reward for and calculate total delegating rewards to be sent to the staking contract,\n * - Distribute the reward of block producers and bridge operators to their treasury addresses,\n * - Update the total deprecated reward if the two previous conditions do not sastify.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(\n uint256 _lastPeriod,\n address[] memory _currentValidators\n ) private returns (uint256 _totalDelegatingReward, uint256[] memory _delegatingRewards) {\n address _consensusAddr;\n address payable _treasury;\n _delegatingRewards = new uint256[](_currentValidators.length);\n for (uint _i; _i < _currentValidators.length; _i++) {\n _consensusAddr = _currentValidators[_i];\n _treasury = _candidateInfo[_consensusAddr].treasuryAddr;\n\n if (!_bridgeRewardDeprecated(_consensusAddr, _lastPeriod)) {\n _distributeBridgeOperatingReward(_consensusAddr, _candidateInfo[_consensusAddr].bridgeOperatorAddr, _treasury);\n } else {\n _totalDeprecatedReward += _bridgeOperatingReward[_consensusAddr];\n }\n\n if (!_jailed(_consensusAddr) && !_miningRewardDeprecated(_consensusAddr, _lastPeriod)) {\n _totalDelegatingReward += _delegatingReward[_consensusAddr];\n _delegatingRewards[_i] = _delegatingReward[_consensusAddr];\n _distributeMiningReward(_consensusAddr, _treasury);\n } else {\n _totalDeprecatedReward += _miningReward[_consensusAddr] + _delegatingReward[_consensusAddr];\n }\n\n delete _delegatingReward[_consensusAddr];\n delete _miningReward[_consensusAddr];\n delete _bridgeOperatingReward[_consensusAddr];\n }\n delete _totalBridgeReward;\n }\n\n /**\n * @dev Distributes bonus of staking vesting and mining fee for the block producer.\n *\n * Emits the `MiningRewardDistributed` once the reward is distributed successfully.\n * Emits the `MiningRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeMiningReward(address _consensusAddr, address payable _treasury) private {\n uint256 _amount = _miningReward[_consensusAddr];\n if (_amount > 0) {\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\n emit MiningRewardDistributed(_consensusAddr, _treasury, _amount);\n return;\n }\n\n emit MiningRewardDistributionFailed(_consensusAddr, _treasury, _amount, address(this).balance);\n }\n }\n\n /**\n * @dev Distribute bonus of staking vesting for the bridge operator.\n *\n * Emits the `BridgeOperatorRewardDistributed` once the reward is distributed successfully.\n * Emits the `BridgeOperatorRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeBridgeOperatingReward(\n address _consensusAddr,\n address _bridgeOperator,\n address payable _treasury\n ) private {\n uint256 _amount = _bridgeOperatingReward[_consensusAddr];\n if (_amount > 0) {\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\n emit BridgeOperatorRewardDistributed(_consensusAddr, _bridgeOperator, _treasury, _amount);\n return;\n }\n\n emit BridgeOperatorRewardDistributionFailed(\n _consensusAddr,\n _bridgeOperator,\n _treasury,\n _amount,\n address(this).balance\n );\n }\n }\n\n /**\n * @dev Helper function to settle rewards for delegators of `_currentValidators` at the end of each period,\n * then transfer the rewards from this contract to the staking contract, in order to finalize a period.\n *\n * Emits the `StakingRewardDistributed` once the reward is distributed successfully.\n * Emits the `StakingRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _settleAndTransferDelegatingRewards(\n uint256 _period,\n address[] memory _currentValidators,\n uint256 _totalDelegatingReward,\n uint256[] memory _delegatingRewards\n ) private {\n IStaking _staking = _stakingContract;\n if (_totalDelegatingReward > 0) {\n if (_unsafeSendRON(payable(address(_staking)), _totalDelegatingReward)) {\n _staking.execRecordRewards(_currentValidators, _delegatingRewards, _period);\n emit StakingRewardDistributed(_totalDelegatingReward, _currentValidators, _delegatingRewards);\n return;\n }\n\n emit StakingRewardDistributionFailed(\n _totalDelegatingReward,\n _currentValidators,\n _delegatingRewards,\n address(this).balance\n );\n }\n }\n\n /**\n * @dev Transfer the deprecated rewards e.g. the rewards that get deprecated when validator is slashed/maintained,\n * to the staking vesting contract\n *\n * Note: This method should be called once in the end of each period.\n */\n function _recycleDeprecatedRewards() private {\n uint256 _withdrawAmount = _totalDeprecatedReward;\n\n if (_withdrawAmount != 0) {\n address _withdrawTarget = stakingVestingContract();\n\n delete _totalDeprecatedReward;\n\n (bool _success, ) = _withdrawTarget.call{ value: _withdrawAmount }(\n abi.encodeWithSelector(IStakingVesting.receiveRON.selector)\n );\n\n if (_success) {\n emit DeprecatedRewardRecycled(_withdrawTarget, _withdrawAmount);\n } else {\n emit DeprecatedRewardRecycleFailed(_withdrawTarget, _withdrawAmount, address(this).balance);\n }\n }\n }\n\n /**\n * @dev Updates the validator set based on the validator candidates from the Staking contract.\n *\n * Emits the `ValidatorSetUpdated` event.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _syncValidatorSet(uint256 _newPeriod)\n private\n returns (address[] memory _newValidators, address[] memory _unsastifiedCandidates)\n {\n _unsastifiedCandidates = _syncCandidateSet(_newPeriod);\n uint256[] memory _weights = _stakingContract.getManyStakingTotals(_candidates);\n uint256[] memory _trustedWeights = _roninTrustedOrganizationContract.getConsensusWeights(_candidates);\n uint256 _newValidatorCount;\n (_newValidators, _newValidatorCount) = _pcPickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n _setNewValidatorSet(_newValidators, _newValidatorCount, _newPeriod);\n }\n\n /**\n * @dev Private helper function helps writing the new validator set into the contract storage.\n *\n * Emits the `ValidatorSetUpdated` event.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _setNewValidatorSet(\n address[] memory _newValidators,\n uint256 _newValidatorCount,\n uint256 _newPeriod\n ) private {\n // Remove exceeding validators in the current set\n for (uint256 _i = _newValidatorCount; _i < validatorCount; _i++) {\n delete _validatorMap[_validators[_i]];\n delete _validators[_i];\n }\n\n // Remove flag for all validator in the current set\n for (uint _i; _i < _newValidatorCount; _i++) {\n delete _validatorMap[_validators[_i]];\n }\n\n // Update new validator set and set flag correspondingly.\n for (uint256 _i; _i < _newValidatorCount; _i++) {\n address _newValidator = _newValidators[_i];\n _validatorMap[_newValidator] = EnumFlags.ValidatorFlag.Both;\n _validators[_i] = _newValidator;\n }\n\n validatorCount = _newValidatorCount;\n emit ValidatorSetUpdated(_newPeriod, _newValidators);\n }\n\n /**\n * @dev Activate/Deactivate the validators from producing blocks, based on their in jail status and maintenance status.\n *\n * Requirements:\n * - This method is called at the end of each epoch\n *\n * Emits the `BlockProducerSetUpdated` event.\n * Emits the `BridgeOperatorSetUpdated` event.\n *\n */\n function _revampRoles(\n uint256 _newPeriod,\n uint256 _nextEpoch,\n address[] memory _currentValidators\n ) private {\n bool[] memory _maintainedList = _maintenanceContract.checkManyMaintained(_currentValidators, block.number + 1);\n\n for (uint _i; _i < _currentValidators.length; _i++) {\n address _validator = _currentValidators[_i];\n bool _emergencyExitRequested = block.timestamp <= _emergencyExitJailedTimestamp[_validator];\n bool _isProducerBefore = isBlockProducer(_validator);\n bool _isProducerAfter = !(_jailedAtBlock(_validator, block.number + 1) ||\n _maintainedList[_i] ||\n _emergencyExitRequested);\n\n if (!_isProducerBefore && _isProducerAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BlockProducer);\n } else if (_isProducerBefore && !_isProducerAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BlockProducer);\n }\n\n bool _isBridgeOperatorBefore = isOperatingBridge(_validator);\n bool _isBridgeOperatorAfter = !_emergencyExitRequested;\n if (!_isBridgeOperatorBefore && _isBridgeOperatorAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BridgeOperator);\n } else if (_isBridgeOperatorBefore && !_isBridgeOperatorAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BridgeOperator);\n }\n }\n\n emit BlockProducerSetUpdated(_newPeriod, _nextEpoch, getBlockProducers());\n emit BridgeOperatorSetUpdated(_newPeriod, _nextEpoch, getBridgeOperators());\n }\n\n /**\n * @dev Override `CandidateManager-_isTrustedOrg`.\n */\n function _isTrustedOrg(address _consensusAddr) internal view override returns (bool) {\n return _roninTrustedOrganizationContract.getConsensusWeight(_consensusAddr) > 0;\n }\n}\n" + }, + "contracts/extensions/collections/HasMaintenanceContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasMaintenanceContract.sol\";\nimport \"../../interfaces/IMaintenance.sol\";\n\ncontract HasMaintenanceContract is IHasMaintenanceContract, HasProxyAdmin {\n IMaintenance internal _maintenanceContract;\n\n modifier onlyMaintenanceContract() {\n if (maintenanceContract() != msg.sender) revert ErrCallerMustBeMaintenanceContract();\n _;\n }\n\n /**\n * @inheritdoc IHasMaintenanceContract\n */\n function maintenanceContract() public view override returns (address) {\n return address(_maintenanceContract);\n }\n\n /**\n * @inheritdoc IHasMaintenanceContract\n */\n function setMaintenanceContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setMaintenanceContract(_addr);\n }\n\n /**\n * @dev Sets the scheduled maintenance contract.\n *\n * Emits the event `MaintenanceContractUpdated`.\n *\n */\n function _setMaintenanceContract(address _addr) internal {\n _maintenanceContract = IMaintenance(_addr);\n emit MaintenanceContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/collections/HasSlashIndicatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasSlashIndicatorContract.sol\";\nimport \"../../interfaces/slash-indicator/ISlashIndicator.sol\";\n\ncontract HasSlashIndicatorContract is IHasSlashIndicatorContract, HasProxyAdmin {\n ISlashIndicator internal _slashIndicatorContract;\n\n modifier onlySlashIndicatorContract() {\n if (slashIndicatorContract() != msg.sender) revert ErrCallerMustBeSlashIndicatorContract();\n _;\n }\n\n /**\n * @inheritdoc IHasSlashIndicatorContract\n */\n function slashIndicatorContract() public view override returns (address) {\n return address(_slashIndicatorContract);\n }\n\n /**\n * @inheritdoc IHasSlashIndicatorContract\n */\n function setSlashIndicatorContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setSlashIndicatorContract(_addr);\n }\n\n /**\n * @dev Sets the slash indicator contract.\n *\n * Emits the event `SlashIndicatorContractUpdated`.\n *\n */\n function _setSlashIndicatorContract(address _addr) internal {\n _slashIndicatorContract = ISlashIndicator(_addr);\n emit SlashIndicatorContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/collections/HasStakingVestingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasStakingVestingContract.sol\";\nimport \"../../interfaces/IStakingVesting.sol\";\n\ncontract HasStakingVestingContract is IHasStakingVestingContract, HasProxyAdmin {\n IStakingVesting internal _stakingVestingContract;\n\n modifier onlyStakingVestingContract() {\n if (stakingVestingContract() != msg.sender) revert ErrCallerMustBeStakingVestingContract();\n _;\n }\n\n /**\n * @inheritdoc IHasStakingVestingContract\n */\n function stakingVestingContract() public view override returns (address) {\n return address(_stakingVestingContract);\n }\n\n /**\n * @inheritdoc IHasStakingVestingContract\n */\n function setStakingVestingContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setStakingVestingContract(_addr);\n }\n\n /**\n * @dev Sets the staking vesting contract.\n *\n * Emits the event `StakingVestingContractUpdated`.\n *\n */\n function _setStakingVestingContract(address _addr) internal {\n _stakingVestingContract = IStakingVesting(_addr);\n emit StakingVestingContractUpdated(_addr);\n }\n}\n" + }, + "contracts/precompile-usages/PCUSortValidators.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUSortValidators is PrecompiledUsage {\n /// @dev Gets the address of the precompile of sorting validators\n function precompileSortValidatorsAddress() public view virtual returns (address) {\n return address(0x66);\n }\n\n /**\n * @dev Sorts candidates descending by their weights by calling precompile contract.\n *\n * Note: This function is marked as virtual for being wrapping in mock contract for testing purpose.\n */\n function _pcSortCandidates(address[] memory _candidates, uint256[] memory _weights)\n internal\n view\n virtual\n returns (address[] memory _result)\n {\n address _smc = precompileSortValidatorsAddress();\n bool _success = true;\n\n bytes memory _payload = abi.encodeWithSignature(\"sortValidators(address[],uint256[])\", _candidates, _weights);\n uint256 _payloadLength = _payload.length;\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n\n _result := add(_result, 0x20)\n }\n\n if (!_success) revert ErrCallPrecompiled();\n }\n}\n" + }, + "contracts/precompile-usages/PCUPickValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUPickValidatorSet is PrecompiledUsage {\n /// @dev Gets the address of the precompile of picking validator set\n function precompilePickValidatorSetAddress() public view virtual returns (address) {\n return address(0x68);\n }\n\n /**\n * @dev Sorts and arranges to return a new validator set.\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcPickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) internal view virtual returns (address[] memory _result, uint256 _newValidatorCount) {\n address _smc = precompilePickValidatorSetAddress();\n bytes memory _payload = abi.encodeWithSignature(\n \"pickValidatorSet(address[],uint256[],uint256[],uint256,uint256)\",\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n bool _success = true;\n\n uint256 _payloadLength = _payload.length;\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n\n _result := add(_result, 0x20)\n }\n\n if (!_success) revert ErrCallPrecompiled();\n\n _newValidatorCount = _result.length;\n }\n}\n" + }, + "contracts/interfaces/collections/IHasMaintenanceContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasMaintenanceContract is IHasContract {\n /// @dev Emitted when the maintenance contract is updated.\n event MaintenanceContractUpdated(address);\n\n /// @dev Error of method caller must be maintenance contract.\n error ErrCallerMustBeMaintenanceContract();\n\n /**\n * @dev Returns the maintenance contract.\n */\n function maintenanceContract() external view returns (address);\n\n /**\n * @dev Sets the maintenance contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `MaintenanceContractUpdated`.\n *\n */\n function setMaintenanceContract(address) external;\n}\n" + }, + "contracts/interfaces/collections/IHasSlashIndicatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasSlashIndicatorContract is IHasContract {\n /// @dev Emitted when the slash indicator contract is updated.\n event SlashIndicatorContractUpdated(address);\n\n /// @dev Error of method caller must be slash indicator contract.\n error ErrCallerMustBeSlashIndicatorContract();\n\n /**\n * @dev Returns the slash indicator contract.\n */\n function slashIndicatorContract() external view returns (address);\n\n /**\n * @dev Sets the slash indicator contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `SlashIndicatorContractUpdated`.\n *\n */\n function setSlashIndicatorContract(address) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashDoubleSign.sol\";\nimport \"./ISlashBridgeVoting.sol\";\nimport \"./ISlashBridgeOperator.sol\";\nimport \"./ISlashUnavailability.sol\";\nimport \"./ICreditScore.sol\";\n\ninterface ISlashIndicator is\n ISlashDoubleSign,\n ISlashBridgeVoting,\n ISlashBridgeOperator,\n ISlashUnavailability,\n ICreditScore\n{}\n" + }, + "contracts/interfaces/slash-indicator/ISlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashDoubleSign is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\n * for param details.\n */\n event DoubleSignSlashingConfigsUpdated(\n uint256 slashDoubleSignAmount,\n uint256 doubleSigningJailUntilBlock,\n uint256 doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Slashes for double signing.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\n */\n function slashDoubleSign(\n address _validatorAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) external;\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\n * double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n returns (\n uint256 _slashDoubleSignAmount,\n uint256 _doubleSigningJailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\n *\n * @param _slashAmount The amount of RON to slash double sign.\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashBridgeVoting is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash bridge voting is updated. See the method `getBridgeVotingSlashingConfigs` for param\n * details.\n */\n event BridgeVotingSlashingConfigsUpdated(uint256 bridgeVotingThreshold, uint256 bridgeVotingSlashAmount);\n\n /**\n * @dev Slashes for bridge voter governance.\n *\n * Emits the event `Slashed`.\n */\n function slashBridgeVoting(address _consensusAddr) external;\n\n /**\n * @dev Returns the configs related to bridge voting slashing.\n *\n * @return _bridgeVotingThreshold The threshold to slash when a trusted organization does not vote for bridge\n * operators.\n * @return _bridgeVotingSlashAmount The amount of RON to slash bridge voting.\n *\n */\n function getBridgeVotingSlashingConfigs()\n external\n view\n returns (uint256 _bridgeVotingThreshold, uint256 _bridgeVotingSlashAmount);\n\n /**\n * @dev Sets the configs to slash bridge voting.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeVotingSlashingConfigsUpdated`.\n *\n * @param _threshold The threshold to slash when a trusted organization does not vote for bridge operators.\n * @param _slashAmount The amount of RON to slash bridge voting.\n *\n */\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashBridgeOperator is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash bridge operator is updated. See the method\n * `getBridgeOperatorSlashingConfigs` for param details.\n */\n event BridgeOperatorSlashingConfigsUpdated(\n uint256 missingVotesRatioTier1,\n uint256 missingVotesRatioTier2,\n uint256 jailDurationForMissingVotesRatioTier2,\n uint256 skipBridgeOperatorSlashingThreshold\n );\n\n /**\n * @dev Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\n * @param _tier The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1`\n * and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2`\n *\n * Requirements:\n * - Only validator contract can invoke this method.\n * - Should be called only at the end of period.\n * - Should be called only when there is slash of bridge operator.\n *\n * Emits the event `Slashed`.\n */\n function execSlashBridgeOperator(\n address _consensusAddr,\n uint256 _tier,\n uint256 _period\n ) external;\n\n /**\n * @dev Returns the configs related to bridge operator slashing.\n *\n * @return _missingVotesRatioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio.\n * @return _missingVotesRatioTier2 The bridge reward and mining reward will be deprecated and the corresponding\n * block producer will be put in jail if (s)he misses more than this ratio.\n * @return _jailDurationForMissingVotesRatioTier2 The number of blocks to jail the corresponding block producer when\n * its bridge operator is slashed tier-2.\n * @return _skipBridgeOperatorSlashingThreshold The threshold to skip slashing the bridge operator in case the total\n * number of votes in the bridge is too small.\n *\n */\n function getBridgeOperatorSlashingConfigs()\n external\n view\n returns (\n uint256 _missingVotesRatioTier1,\n uint256 _missingVotesRatioTier2,\n uint256 _jailDurationForMissingVotesRatioTier2,\n uint256 _skipBridgeOperatorSlashingThreshold\n );\n\n /**\n * @dev Sets the configs to slash bridge operators.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\n *\n * @param _ratioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map\n * to 0%-100%.\n * @param _ratioTier2 The bridge reward and mining reward will be deprecated and the corresponding block producer will\n * be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\n * @param _jailDurationTier2 The number of blocks to jail the corresponding block producer when its bridge operator is\n * slashed tier-2.\n * @param _skipSlashingThreshold The threshold to skip slashing the bridge operator in case the total number of votes\n * in the bridge is too small.\n *\n */\n function setBridgeOperatorSlashingConfigs(\n uint256 _ratioTier1,\n uint256 _ratioTier2,\n uint256 _jailDurationTier2,\n uint256 _skipSlashingThreshold\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashUnavailability is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\n * for param details.\n */\n event UnavailabilitySlashingConfigsUpdated(\n uint256 unavailabilityTier1Threshold,\n uint256 unavailabilityTier2Threshold,\n uint256 slashAmountForUnavailabilityTier2Threshold,\n uint256 jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Returns the last block that a block producer is slashed for unavailability.\n */\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\n\n /**\n * @dev Slashes for unavailability by increasing the counter of block producer `_consensusAddr`.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` when the threshold is reached.\n *\n */\n function slashUnavailability(address _consensusAddr) external;\n\n /**\n * @dev Returns the current unavailability indicator of a block producer.\n */\n function currentUnavailabilityIndicator(address _validator) external view returns (uint256);\n\n /**\n * @dev Returns the unavailability indicator in the period `_period` of a block producer.\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return _unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\n * @return _unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n * @return _slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\n * producer when (s)he is slashed with tier-2 or tier-3.\n * @return _jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\n * slashed with tier-2 or tier-3.\n *\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n returns (\n uint256 _unavailabilityTier1Threshold,\n uint256 _unavailabilityTier2Threshold,\n uint256 _slashAmountForUnavailabilityTier2Threshold,\n uint256 _jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\n *\n * @param _tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\n * @param _tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold.\n * @param _slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\n * is slashed tier-2.\n * @param _jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\n *\n */\n function setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ICreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ICreditScore {\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\n event CreditScoreConfigsUpdated(\n uint256 gainCreditScore,\n uint256 maxCreditScore,\n uint256 bailOutCostMultiplier,\n uint256 cutOffPercentageAfterBailout\n );\n /// @dev Emitted the credit score of validators is updated.\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\n /// @dev Emitted when a validator bailed out of jail.\n event BailedOut(address indexed validator, uint256 period, uint256 usedCreditScore);\n\n /**\n * @dev Updates the credit score for the validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function updateCreditScores(address[] calldata _validators, uint256 _period) external;\n\n /**\n * @dev Resets the credit score for the revoked validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function execResetCreditScores(address[] calldata _validators) external;\n\n /**\n * @dev A slashed validator use this method to get out of jail.\n *\n * Requirements:\n * - The `_consensusAddr` must be a validator.\n * - Only validator's admin can call this method.\n *\n * Emits the event `BailedOut`.\n *\n */\n function bailOut(address _consensusAddr) external;\n\n /**\n * @dev Sets the configs to credit score.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CreditScoreConfigsUpdated`.\n *\n * @param _gainScore The score to gain per period.\n * @param _maxScore The max number of credit score that a validator can hold.\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external;\n\n /**\n * @dev Returns the configs related to credit score.\n *\n * @return _gainCreditScore The score to gain per period.\n * @return _maxCreditScore The max number of credit score that a validator can hold.\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function getCreditScoreConfigs()\n external\n view\n returns (\n uint256 _gainCreditScore,\n uint256 _maxCreditScore,\n uint256 _bailOutCostMultiplier,\n uint256 _cutOffPercentageAfterBailout\n );\n\n /**\n * @dev Returns the current credit score of the validator.\n */\n function getCreditScore(address _validator) external view returns (uint256);\n\n /**\n * @dev Returns the current credit score of a list of validators.\n */\n function getManyCreditScores(address[] calldata _validators) external view returns (uint256[] memory _resultList);\n\n /**\n * @dev Returns the whether the `_validator` has been bailed out at the `_period`.\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period) external view returns (bool);\n}\n" + }, + "contracts/interfaces/slash-indicator/IBaseSlash.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IBaseSlash {\n enum SlashType {\n UNKNOWN,\n UNAVAILABILITY_TIER_1,\n UNAVAILABILITY_TIER_2,\n DOUBLE_SIGNING,\n BRIDGE_VOTING,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\n UNAVAILABILITY_TIER_3\n }\n\n /// @dev Emitted when the validator is slashed.\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\n}\n" + }, + "contracts/interfaces/collections/IHasStakingVestingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasStakingVestingContract is IHasContract {\n /// @dev Emitted when the staking vesting contract is updated.\n event StakingVestingContractUpdated(address);\n\n /// @dev Error of method caller must be staking vesting contract.\n error ErrCallerMustBeStakingVestingContract();\n\n /**\n * @dev Returns the staking vesting contract.\n */\n function stakingVestingContract() external view returns (address);\n\n /**\n * @dev Sets the staking vesting contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `StakingVestingContractUpdated`.\n *\n */\n function setStakingVestingContract(address) external;\n}\n" + }, + "contracts/precompile-usages/PrecompiledUsage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PrecompiledUsage {\n /// @dev Error of call to precompile fails.\n error ErrCallPrecompiled();\n}\n" + }, + "contracts/ronin/validator/SlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasSlashIndicatorContract.sol\";\nimport \"../../extensions/collections/HasStakingContract.sol\";\nimport \"../../interfaces/validator/ISlashingExecution.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\n\nabstract contract SlashingExecution is\n ISlashingExecution,\n HasSlashIndicatorContract,\n HasStakingContract,\n CommonStorage\n{\n /**\n * @inheritdoc ISlashingExecution\n */\n function execSlash(\n address _validatorAddr,\n uint256 _newJailedUntil,\n uint256 _slashAmount,\n bool _cannotBailout\n ) external override onlySlashIndicatorContract {\n uint256 _period = currentPeriod();\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = true;\n\n _totalDeprecatedReward += _miningReward[_validatorAddr] + _delegatingReward[_validatorAddr];\n\n delete _miningReward[_validatorAddr];\n delete _delegatingReward[_validatorAddr];\n\n _blockProducerJailedBlock[_validatorAddr] = Math.max(_newJailedUntil, _blockProducerJailedBlock[_validatorAddr]);\n\n if (_slashAmount > 0) {\n uint256 _actualAmount = _stakingContract.execDeductStakingAmount(_validatorAddr, _slashAmount);\n _totalDeprecatedReward += _actualAmount;\n }\n\n if (_cannotBailout) {\n _cannotBailoutUntilBlock[_validatorAddr] = Math.max(_newJailedUntil, _cannotBailoutUntilBlock[_validatorAddr]);\n }\n\n emit ValidatorPunished(\n _validatorAddr,\n _period,\n _blockProducerJailedBlock[_validatorAddr],\n _slashAmount,\n true,\n false\n );\n }\n\n /**\n * @inheritdoc ISlashingExecution\n */\n function execBailOut(address _validatorAddr, uint256 _period) external override onlySlashIndicatorContract {\n if (block.number <= _cannotBailoutUntilBlock[_validatorAddr]) revert ErrCannotBailout(_validatorAddr);\n\n // Note: Removing rewards of validator in `bailOut` function is not needed, since the rewards have been\n // removed previously in the `slash` function.\n _miningRewardBailoutCutOffAtPeriod[_validatorAddr][_period] = true;\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = false;\n _blockProducerJailedBlock[_validatorAddr] = block.number - 1;\n\n emit ValidatorUnjailed(_validatorAddr, _period);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/slash-indicator/ISlashIndicator.sol\";\nimport \"./SlashDoubleSign.sol\";\nimport \"./SlashBridgeVoting.sol\";\nimport \"./SlashBridgeOperator.sol\";\nimport \"./SlashUnavailability.sol\";\nimport \"./CreditScore.sol\";\n\ncontract SlashIndicator is\n ISlashIndicator,\n SlashDoubleSign,\n SlashBridgeVoting,\n SlashBridgeOperator,\n SlashUnavailability,\n CreditScore,\n Initializable\n{\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n address __maintenanceContract,\n address __roninTrustedOrganizationContract,\n address __roninGovernanceAdminContract,\n // _bridgeOperatorSlashingConfigs[0]: _missingVotesRatioTier1\n // _bridgeOperatorSlashingConfigs[1]: _missingVotesRatioTier2\n // _bridgeOperatorSlashingConfigs[2]: _jailDurationForMissingVotesRatioTier2\n // _bridgeOperatorSlashingConfigs[3]: _skipBridgeOperatorSlashingThreshold\n uint256[4] calldata _bridgeOperatorSlashingConfigs,\n // _bridgeVotingSlashingConfigs[0]: _bridgeVotingThreshold\n // _bridgeVotingSlashingConfigs[1]: _bridgeVotingSlashAmount\n uint256[2] calldata _bridgeVotingSlashingConfigs,\n // _doubleSignSlashingConfigs[0]: _slashDoubleSignAmount\n // _doubleSignSlashingConfigs[1]: _doubleSigningJailUntilBlock\n // _doubleSignSlashingConfigs[2]: _doubleSigningOffsetLimitBlock\n uint256[3] calldata _doubleSignSlashingConfigs,\n // _unavailabilitySlashingConfigs[0]: _unavailabilityTier1Threshold\n // _unavailabilitySlashingConfigs[1]: _unavailabilityTier2Threshold\n // _unavailabilitySlashingConfigs[2]: _slashAmountForUnavailabilityTier2Threshold\n // _unavailabilitySlashingConfigs[3]: _jailDurationForUnavailabilityTier2Threshold\n uint256[4] calldata _unavailabilitySlashingConfigs,\n // _creditScoreConfigs[0]: _gainCreditScore\n // _creditScoreConfigs[1]: _maxCreditScore\n // _creditScoreConfigs[2]: _bailOutCostMultiplier\n // _creditScoreConfigs[3]: _cutOffPercentageAfterBailout\n uint256[4] calldata _creditScoreConfigs\n ) external initializer {\n _setValidatorContract(__validatorContract);\n _setMaintenanceContract(__maintenanceContract);\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\n _setRoninGovernanceAdminContract(__roninGovernanceAdminContract);\n _setBridgeOperatorSlashingConfigs(\n _bridgeOperatorSlashingConfigs[0],\n _bridgeOperatorSlashingConfigs[1],\n _bridgeOperatorSlashingConfigs[2],\n _bridgeOperatorSlashingConfigs[3]\n );\n _setBridgeVotingSlashingConfigs(_bridgeVotingSlashingConfigs[0], _bridgeVotingSlashingConfigs[1]);\n _setDoubleSignSlashingConfigs(\n _doubleSignSlashingConfigs[0],\n _doubleSignSlashingConfigs[1],\n _doubleSignSlashingConfigs[2]\n );\n _setUnavailabilitySlashingConfigs(\n _unavailabilitySlashingConfigs[0],\n _unavailabilitySlashingConfigs[1],\n _unavailabilitySlashingConfigs[2],\n _unavailabilitySlashingConfigs[3]\n );\n _setCreditScoreConfigs(\n _creditScoreConfigs[0],\n _creditScoreConfigs[1],\n _creditScoreConfigs[2],\n _creditScoreConfigs[3]\n );\n }\n\n /**\n * @dev Helper for CreditScore contract to reset the indicator of the validator after bailing out.\n */\n function _setUnavailabilityIndicator(\n address _validator,\n uint256 _period,\n uint256 _indicator\n ) internal override(CreditScore, SlashUnavailability) {\n SlashUnavailability._setUnavailabilityIndicator(_validator, _period, _indicator);\n }\n\n /**\n * @dev Helper for CreditScore contract to query indicator of the validator.\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period)\n public\n view\n override(CreditScore, ISlashUnavailability, SlashUnavailability)\n returns (uint256)\n {\n return SlashUnavailability.getUnavailabilityIndicator(_validator, _period);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period)\n public\n view\n override(CreditScore, ICreditScore, SlashUnavailability)\n returns (bool)\n {\n return CreditScore.checkBailedOutAtPeriod(_validator, _period);\n }\n\n /**\n * @dev Sanity check the address to be slashed\n */\n function _shouldSlash(address _addr) internal view override(SlashDoubleSign, SlashUnavailability) returns (bool) {\n return\n (msg.sender != _addr) &&\n _validatorContract.isBlockProducer(_addr) &&\n !_maintenanceContract.checkMaintained(_addr, block.number);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/slash-indicator/ISlashDoubleSign.sol\";\nimport \"../../precompile-usages/PCUValidateDoubleSign.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashDoubleSign is ISlashDoubleSign, HasValidatorContract, PCUValidateDoubleSign {\n /// @dev The amount of RON to slash double sign.\n uint256 internal _slashDoubleSignAmount;\n /// @dev The block number that the punished validator will be jailed until, due to double signing.\n uint256 internal _doubleSigningJailUntilBlock;\n /** @dev The offset from the submitted block to the current block, from which double signing will be invalidated.\n * This parameter is exposed for system transaction.\n **/\n uint256 internal _doubleSigningOffsetLimitBlock;\n /// @dev Recording of submitted proof to prevent relay attack.\n mapping(bytes32 => bool) _submittedEvidence;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function slashDoubleSign(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) external override onlyAdmin {\n bytes32 _header1Checksum = keccak256(_header1);\n bytes32 _header2Checksum = keccak256(_header2);\n\n require(\n !_submittedEvidence[_header1Checksum] && !_submittedEvidence[_header2Checksum],\n \"SlashDoubleSign: evidence already submitted\"\n );\n\n if (_pcValidateEvidence(_consensusAddr, _header1, _header2)) {\n uint256 _period = _validatorContract.currentPeriod();\n _submittedEvidence[_header1Checksum] = true;\n _submittedEvidence[_header2Checksum] = true;\n emit Slashed(_consensusAddr, SlashType.DOUBLE_SIGNING, _period);\n _validatorContract.execSlash(_consensusAddr, _doubleSigningJailUntilBlock, _slashDoubleSignAmount, true);\n }\n }\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n override\n returns (\n uint256 slashDoubleSignAmount_,\n uint256 doubleSigningJailUntilBlock_,\n uint256 doubleSigningOffsetLimitBlock_\n )\n {\n return (_slashDoubleSignAmount, _doubleSigningJailUntilBlock, _doubleSigningOffsetLimitBlock);\n }\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _offsetLimitBlock\n ) external override onlyAdmin {\n _setDoubleSignSlashingConfigs(_slashAmount, _jailUntilBlock, _offsetLimitBlock);\n }\n\n /**\n * @dev See `ISlashDoubleSign-setDoubleSignSlashingConfigs`.\n */\n function _setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _offsetLimitBlock\n ) internal {\n _slashDoubleSignAmount = _slashAmount;\n _doubleSigningJailUntilBlock = _jailUntilBlock;\n _doubleSigningOffsetLimitBlock = _offsetLimitBlock;\n emit DoubleSignSlashingConfigsUpdated(_slashAmount, _jailUntilBlock, _doubleSigningOffsetLimitBlock);\n }\n\n /**\n * @dev Returns whether the account `_addr` should be slashed or not.\n */\n function _shouldSlash(address _addr) internal view virtual returns (bool);\n}\n" + }, + "contracts/ronin/slash-indicator/SlashBridgeVoting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../libraries/Math.sol\";\nimport \"../../interfaces/slash-indicator/ISlashBridgeVoting.sol\";\nimport \"../../extensions/collections/HasRoninTrustedOrganizationContract.sol\";\nimport \"../../extensions/collections/HasRoninGovernanceAdminContract.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashBridgeVoting is\n ISlashBridgeVoting,\n HasValidatorContract,\n HasRoninTrustedOrganizationContract,\n HasRoninGovernanceAdminContract\n{\n /// @dev Mapping from validator address => period index => bridge voting slashed\n mapping(address => mapping(uint256 => bool)) internal _bridgeVotingSlashed;\n /// @dev The threshold to slash when a trusted organization does not vote for bridge operators.\n uint256 internal _bridgeVotingThreshold;\n /// @dev The amount of RON to slash bridge voting.\n uint256 internal _bridgeVotingSlashAmount;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ISlashBridgeVoting\n */\n function slashBridgeVoting(address _consensusAddr) external onlyAdmin {\n IRoninTrustedOrganization.TrustedOrganization memory _org = _roninTrustedOrganizationContract\n .getTrustedOrganization(_consensusAddr);\n uint256 _lastVotedBlock = Math.max(_roninGovernanceAdminContract.lastVotedBlock(_org.bridgeVoter), _org.addedBlock);\n uint256 _period = _validatorContract.currentPeriod();\n\n require(\n block.number - _lastVotedBlock > _bridgeVotingThreshold && !_bridgeVotingSlashed[_consensusAddr][_period],\n \"SlashBridgeVoting: invalid slash\"\n );\n\n _bridgeVotingSlashed[_consensusAddr][_period] = true;\n emit Slashed(_consensusAddr, SlashType.BRIDGE_VOTING, _period);\n _validatorContract.execSlash(_consensusAddr, 0, _bridgeVotingSlashAmount, false);\n }\n\n /**\n * @inheritdoc ISlashBridgeVoting\n */\n function getBridgeVotingSlashingConfigs()\n external\n view\n override\n returns (uint256 bridgeVotingThreshold_, uint256 bridgeVotingSlashAmount_)\n {\n return (_bridgeVotingThreshold, _bridgeVotingSlashAmount);\n }\n\n /**\n * @inheritdoc ISlashBridgeVoting\n */\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external override onlyAdmin {\n _setBridgeVotingSlashingConfigs(_threshold, _slashAmount);\n }\n\n /**\n * @dev See `ISlashBridgeVoting-setBridgeVotingSlashingConfigs`.\n */\n function _setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) internal {\n _bridgeVotingThreshold = _threshold;\n _bridgeVotingSlashAmount = _slashAmount;\n emit BridgeVotingSlashingConfigsUpdated(_threshold, _slashAmount);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashBridgeOperator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../extensions/collections/HasProxyAdmin.sol\";\nimport \"../../interfaces/slash-indicator/ISlashBridgeOperator.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashBridgeOperator is ISlashBridgeOperator, HasProxyAdmin, HasValidatorContract, PercentageConsumer {\n /**\n * @dev The bridge operators will be deprecated reward if (s)he missed more than the ratio.\n * Values 0-10,000 map to 0%-100%.\n */\n uint256 internal _missingVotesRatioTier1;\n /**\n * @dev The bridge operators will be deprecated all rewards including bridge reward and mining reward if (s)he missed\n * more than the ratio. Values 0-10,000 map to 0%-100%.\n */\n uint256 internal _missingVotesRatioTier2;\n /// @dev The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\n uint256 internal _jailDurationForMissingVotesRatioTier2;\n /// @dev The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\n uint256 internal _skipBridgeOperatorSlashingThreshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ISlashBridgeOperator\n */\n function getBridgeOperatorSlashingConfigs()\n external\n view\n override\n returns (\n uint256 missingVotesRatioTier1_,\n uint256 missingVotesRatioTier2_,\n uint256 jailDurationForMissingVotesRatioTier2_,\n uint256 skipBridgeOperatorSlashingThreshold_\n )\n {\n return (\n _missingVotesRatioTier1,\n _missingVotesRatioTier2,\n _jailDurationForMissingVotesRatioTier2,\n _skipBridgeOperatorSlashingThreshold\n );\n }\n\n /**\n * @inheritdoc ISlashBridgeOperator\n */\n function setBridgeOperatorSlashingConfigs(\n uint256 _ratioTier1,\n uint256 _ratioTier2,\n uint256 _jailDurationTier2,\n uint256 _skipSlashingThreshold\n ) external override onlyAdmin {\n _setBridgeOperatorSlashingConfigs(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\n }\n\n /**\n * @inheritdoc ISlashBridgeOperator\n */\n function execSlashBridgeOperator(\n address _consensusAddr,\n uint256 _tier,\n uint256 _period\n ) external onlyValidatorContract {\n if (_tier == 1) {\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1, _period);\n } else if (_tier == 2) {\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2, _period);\n }\n }\n\n /**\n * @dev See `ISlashBridgeOperator-setBridgeOperatorSlashingConfigs`.\n */\n function _setBridgeOperatorSlashingConfigs(\n uint256 _ratioTier1,\n uint256 _ratioTier2,\n uint256 _jailDurationTier2,\n uint256 _skipSlashingThreshold\n ) internal {\n require(\n _ratioTier1 <= _ratioTier2 && _ratioTier1 <= _MAX_PERCENTAGE && _ratioTier2 <= _MAX_PERCENTAGE,\n \"SlashIndicator: invalid ratios\"\n );\n _missingVotesRatioTier1 = _ratioTier1;\n _missingVotesRatioTier2 = _ratioTier2;\n _jailDurationForMissingVotesRatioTier2 = _jailDurationTier2;\n _skipBridgeOperatorSlashingThreshold = _skipSlashingThreshold;\n emit BridgeOperatorSlashingConfigsUpdated(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./CreditScore.sol\";\nimport \"../../interfaces/slash-indicator/ISlashUnavailability.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashUnavailability is ISlashUnavailability, HasValidatorContract {\n /// @dev The last block that a validator is slashed for unavailability.\n uint256 public lastUnavailabilitySlashedBlock;\n /// @dev Mapping from validator address => period index => unavailability indicator.\n mapping(address => mapping(uint256 => uint256)) internal _unavailabilityIndicator;\n\n /**\n * @dev The mining reward will be deprecated, if (s)he missed more than this threshold.\n * This threshold is applied for tier-1 and tier-3 of unavailability slash.\n */\n uint256 internal _unavailabilityTier1Threshold;\n /**\n * @dev The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n */\n uint256 internal _unavailabilityTier2Threshold;\n /**\n * @dev The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with\n * tier-2 or tier-3.\n **/\n uint256 internal _slashAmountForUnavailabilityTier2Threshold;\n /// @dev The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\n uint256 internal _jailDurationForUnavailabilityTier2Threshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n modifier oncePerBlock() {\n require(\n block.number > lastUnavailabilitySlashedBlock,\n \"SlashIndicator: cannot slash a validator twice or slash more than one validator in one block\"\n );\n lastUnavailabilitySlashedBlock = block.number;\n _;\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function slashUnavailability(address _validatorAddr) external override oncePerBlock {\n require(msg.sender == block.coinbase, \"SlashUnavailability: method caller must be coinbase\");\n if (!_shouldSlash(_validatorAddr)) {\n // Should return instead of throwing error since this is a part of system transaction.\n return;\n }\n\n uint256 _period = _validatorContract.currentPeriod();\n uint256 _count = ++_unavailabilityIndicator[_validatorAddr][_period];\n uint256 _newJailedUntilBlock = Math.addIfNonZero(block.number, _jailDurationForUnavailabilityTier2Threshold);\n\n if (_count == _unavailabilityTier2Threshold) {\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_2, _period);\n _validatorContract.execSlash(\n _validatorAddr,\n _newJailedUntilBlock,\n _slashAmountForUnavailabilityTier2Threshold,\n false\n );\n } else if (_count == _unavailabilityTier1Threshold) {\n bool _tier1SecondTime = checkBailedOutAtPeriod(_validatorAddr, _period);\n if (!_tier1SecondTime) {\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_1, _period);\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\n } else {\n /// Handles tier-3\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_3, _period);\n _validatorContract.execSlash(\n _validatorAddr,\n _newJailedUntilBlock,\n _slashAmountForUnavailabilityTier2Threshold,\n true\n );\n }\n }\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) external override onlyAdmin {\n _setUnavailabilitySlashingConfigs(\n _tier1Threshold,\n _tier2Threshold,\n _slashAmountForTier2Threshold,\n _jailDurationForTier2Threshold\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n override\n returns (\n uint256 unavailabilityTier1Threshold_,\n uint256 unavailabilityTier2Threshold_,\n uint256 slashAmountForUnavailabilityTier2Threshold_,\n uint256 jailDurationForUnavailabilityTier2Threshold_\n )\n {\n return (\n _unavailabilityTier1Threshold,\n _unavailabilityTier2Threshold,\n _slashAmountForUnavailabilityTier2Threshold,\n _jailDurationForUnavailabilityTier2Threshold\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function currentUnavailabilityIndicator(address _validator) external view override returns (uint256) {\n return getUnavailabilityIndicator(_validator, _validatorContract.currentPeriod());\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period)\n public\n view\n virtual\n override\n returns (uint256)\n {\n return _unavailabilityIndicator[_validator][_period];\n }\n\n /**\n * @dev Sets the unavailability indicator of the `_validator` at `_period`.\n */\n function _setUnavailabilityIndicator(\n address _validator,\n uint256 _period,\n uint256 _indicator\n ) internal virtual {\n _unavailabilityIndicator[_validator][_period] = _indicator;\n }\n\n /**\n * @dev See `ISlashUnavailability-setUnavailabilitySlashingConfigs`.\n */\n function _setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) internal {\n require(_unavailabilityTier1Threshold <= _unavailabilityTier2Threshold, \"SlashUnavailability: invalid threshold\");\n _unavailabilityTier1Threshold = _tier1Threshold;\n _unavailabilityTier2Threshold = _tier2Threshold;\n _slashAmountForUnavailabilityTier2Threshold = _slashAmountForTier2Threshold;\n _jailDurationForUnavailabilityTier2Threshold = _jailDurationForTier2Threshold;\n emit UnavailabilitySlashingConfigsUpdated(\n _tier1Threshold,\n _tier2Threshold,\n _slashAmountForTier2Threshold,\n _jailDurationForTier2Threshold\n );\n }\n\n /**\n * @dev Returns whether the account `_addr` should be slashed or not.\n */\n function _shouldSlash(address _addr) internal view virtual returns (bool);\n\n /**\n * @dev See `ICreditScore-checkBailedOutAtPeriod`\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual returns (bool);\n}\n" + }, + "contracts/ronin/slash-indicator/CreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/slash-indicator/ICreditScore.sol\";\nimport \"../../extensions/collections/HasMaintenanceContract.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../libraries/Math.sol\";\n\nabstract contract CreditScore is ICreditScore, HasValidatorContract, HasMaintenanceContract, PercentageConsumer {\n /// @dev Mapping from validator address => period index => whether bailed out before\n mapping(address => mapping(uint256 => bool)) internal _checkBailedOutAtPeriod;\n /// @dev Mapping from validator address => credit score\n mapping(address => uint256) internal _creditScore;\n\n /// @dev The max gained number of credit score per period.\n uint256 internal _gainCreditScore;\n /// @dev The max number of credit score that a validator can hold.\n uint256 internal _maxCreditScore;\n /// @dev The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n uint256 internal _bailOutCostMultiplier;\n /// @dev The percentage of reward to be cut off from the validator in the rest of the period after bailed out.\n uint256 internal _cutOffPercentageAfterBailout;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ICreditScore\n */\n function updateCreditScores(address[] calldata _validators, uint256 _period) external override onlyValidatorContract {\n uint256 _periodStartAtBlock = _validatorContract.currentPeriodStartAtBlock();\n\n bool[] memory _jaileds = _validatorContract.checkManyJailed(_validators);\n bool[] memory _maintaineds = _maintenanceContract.checkManyMaintainedInBlockRange(\n _validators,\n _periodStartAtBlock,\n block.number\n );\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\n\n for (uint _i = 0; _i < _validators.length; _i++) {\n address _validator = _validators[_i];\n\n uint256 _indicator = getUnavailabilityIndicator(_validator, _period);\n bool _isJailedInPeriod = _jaileds[_i];\n bool _isMaintainingInPeriod = _maintaineds[_i];\n\n uint256 _actualGain = (_isJailedInPeriod || _isMaintainingInPeriod)\n ? 0\n : Math.subNonNegative(_gainCreditScore, _indicator);\n\n _creditScore[_validator] = Math.addWithUpperbound(_creditScore[_validator], _actualGain, _maxCreditScore);\n _updatedCreditScores[_i] = _creditScore[_validator];\n }\n\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\n }\n\n function execResetCreditScores(address[] calldata _validators) external override onlyValidatorContract {\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\n for (uint _i = 0; _i < _validators.length; _i++) {\n address _validator = _validators[_i];\n delete _creditScore[_validator];\n delete _updatedCreditScores[_i];\n }\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function bailOut(address _consensusAddr) external override {\n require(\n _validatorContract.isValidatorCandidate(_consensusAddr),\n \"SlashIndicator: consensus address must be a validator candidate\"\n );\n require(\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\n \"SlashIndicator: method caller must be a candidate admin\"\n );\n\n (bool _isJailed, , uint256 _jailedEpochLeft) = _validatorContract.getJailedTimeLeft(_consensusAddr);\n require(_isJailed, \"SlashIndicator: caller must be jailed in the current period\");\n\n uint256 _period = _validatorContract.currentPeriod();\n require(!_checkBailedOutAtPeriod[_consensusAddr][_period], \"SlashIndicator: validator has bailed out previously\");\n\n uint256 _score = _creditScore[_consensusAddr];\n uint256 _cost = _jailedEpochLeft * _bailOutCostMultiplier;\n require(_score >= _cost, \"SlashIndicator: insufficient credit score to bail out\");\n\n _validatorContract.execBailOut(_consensusAddr, _period);\n\n _creditScore[_consensusAddr] -= _cost;\n _setUnavailabilityIndicator(_consensusAddr, _period, 0);\n _checkBailedOutAtPeriod[_consensusAddr][_period] = true;\n emit BailedOut(_consensusAddr, _period, _cost);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external override onlyAdmin {\n _setCreditScoreConfigs(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\n }\n\n /**\n * @dev See `ISlashUnavailability`\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period) public view virtual returns (uint256);\n\n /**\n * @inheritdoc ICreditScore\n */\n function getCreditScoreConfigs()\n external\n view\n override\n returns (\n uint256 gainCreditScore_,\n uint256 maxCreditScore_,\n uint256 bailOutCostMultiplier_,\n uint256 cutOffPercentageAfterBailout_\n )\n {\n return (_gainCreditScore, _maxCreditScore, _bailOutCostMultiplier, _cutOffPercentageAfterBailout);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function getCreditScore(address _validator) external view override returns (uint256) {\n return _creditScore[_validator];\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function getManyCreditScores(address[] calldata _validators)\n public\n view\n override\n returns (uint256[] memory _resultList)\n {\n _resultList = new uint256[](_validators.length);\n\n for (uint _i = 0; _i < _resultList.length; _i++) {\n _resultList[_i] = _creditScore[_validators[_i]];\n }\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual override returns (bool) {\n return _checkBailedOutAtPeriod[_validator][_period];\n }\n\n /**\n * @dev See `SlashUnavailability`.\n */\n function _setUnavailabilityIndicator(\n address _validator,\n uint256 _period,\n uint256 _indicator\n ) internal virtual;\n\n /**\n * @dev See `ICreditScore-setCreditScoreConfigs`.\n */\n function _setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) internal {\n require(_gainScore <= _maxScore, \"CreditScore: invalid credit score config\");\n require(_cutOffPercentage <= _MAX_PERCENTAGE, \"CreditScore: invalid cut off percentage config\");\n\n _gainCreditScore = _gainScore;\n _maxCreditScore = _maxScore;\n _bailOutCostMultiplier = _bailOutMultiplier;\n _cutOffPercentageAfterBailout = _cutOffPercentage;\n emit CreditScoreConfigsUpdated(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\n }\n}\n" + }, + "contracts/precompile-usages/PCUValidateDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUValidateDoubleSign is PrecompiledUsage {\n /// @dev Gets the address of the precompile of validating double sign evidence\n function precompileValidateDoubleSignAddress() public view virtual returns (address) {\n return address(0x67);\n }\n\n /**\n * @dev Validates the two submitted block header if they are produced by the same address\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcValidateEvidence(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) internal view virtual returns (bool _validEvidence) {\n address _smc = precompileValidateDoubleSignAddress();\n bool _success = true;\n\n bytes memory _payload = abi.encodeWithSignature(\n \"validatingDoubleSignProof(address,bytes,bytes)\",\n _consensusAddr,\n _header1,\n _header2\n );\n uint _payloadLength = _payload.length;\n uint[1] memory _output;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _output, 0x20)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n }\n\n if (!_success) revert ErrCallPrecompiled();\n return (_output[0] != 0);\n }\n}\n" + }, + "contracts/extensions/collections/HasRoninGovernanceAdminContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasRoninGovernanceAdminContract.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\n\ncontract HasRoninGovernanceAdminContract is IHasRoninGovernanceAdminContract, HasProxyAdmin {\n IRoninGovernanceAdmin internal _roninGovernanceAdminContract;\n\n modifier onlyRoninGovernanceAdminContract() {\n if (roninGovernanceAdminContract() != msg.sender) revert ErrCallerMustBeGovernanceAdminContract();\n _;\n }\n\n /**\n * @inheritdoc IHasRoninGovernanceAdminContract\n */\n function roninGovernanceAdminContract() public view override returns (address) {\n return address(_roninGovernanceAdminContract);\n }\n\n /**\n * @inheritdoc IHasRoninGovernanceAdminContract\n */\n function setRoninGovernanceAdminContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setRoninGovernanceAdminContract(_addr);\n }\n\n /**\n * @dev Sets the ronin governance admin contract.\n *\n * Emits the event `RoninGovernanceAdminContractUpdated`.\n *\n */\n function _setRoninGovernanceAdminContract(address _addr) internal {\n _roninGovernanceAdminContract = IRoninGovernanceAdmin(_addr);\n emit RoninGovernanceAdminContractUpdated(_addr);\n }\n}\n" + }, + "contracts/interfaces/collections/IHasRoninGovernanceAdminContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasRoninGovernanceAdminContract is IHasContract {\n /// @dev Emitted when the ronin governance admin contract is updated.\n event RoninGovernanceAdminContractUpdated(address);\n\n /// @dev Error of method caller must be goverance admin contract.\n error ErrCallerMustBeGovernanceAdminContract();\n\n /**\n * @dev Returns the ronin governance admin contract.\n */\n function roninGovernanceAdminContract() external view returns (address);\n\n /**\n * @dev Sets the ronin governance admin contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `RoninGovernanceAdminContractUpdated`.\n *\n */\n function setRoninGovernanceAdminContract(address) external;\n}\n" + }, + "contracts/mocks/validator/MockRoninValidatorSetExtended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./MockRoninValidatorSetOverridePrecompile.sol\";\nimport \"../../libraries/EnumFlags.sol\";\n\ncontract MockRoninValidatorSetExtended is MockRoninValidatorSetOverridePrecompile {\n bool private _initialized;\n uint256[] internal _epochs;\n\n constructor() {}\n\n function initEpoch() public {\n if (!_initialized) {\n _epochs.push(0);\n _initialized = true;\n }\n }\n\n function endEpoch() external {\n _epochs.push(block.number);\n }\n\n function epochOf(uint256 _block) public view override returns (uint256 _epoch) {\n for (uint256 _i = _epochs.length; _i > 0; _i--) {\n if (_block > _epochs[_i - 1]) {\n return _i;\n }\n }\n }\n\n function epochEndingAt(uint256 _block) public view override(ITimingInfo, TimingStorage) returns (bool) {\n for (uint _i = 0; _i < _epochs.length; _i++) {\n if (_block == _epochs[_i]) {\n return true;\n }\n }\n return false;\n }\n\n function getJailUntils(address[] calldata _addrs) public view returns (uint256[] memory jailUntils_) {\n jailUntils_ = new uint256[](_addrs.length);\n for (uint _i = 0; _i < _addrs.length; _i++) {\n jailUntils_[_i] = _blockProducerJailedBlock[_addrs[_i]];\n }\n }\n\n function addValidators(address[] calldata _addrs) public {\n for (uint _i = 0; _i < _addrs.length; _i++) {\n _validators[_i] = _addrs[_i];\n _validatorMap[_addrs[_i]] = EnumFlags.ValidatorFlag.Both;\n }\n }\n}\n" + }, + "contracts/mocks/validator/MockRoninValidatorSetOverridePrecompile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../MockPrecompile.sol\";\nimport \"../../ronin/validator/RoninValidatorSet.sol\";\n\ncontract MockRoninValidatorSetOverridePrecompile is RoninValidatorSet, MockPrecompile {\n constructor() {}\n\n function arrangeValidatorCandidates(\n address[] memory _candidates,\n uint256[] memory _trustedWeights,\n uint _newValidatorCount,\n uint _maxPrioritizedValidatorNumber\n ) external pure returns (address[] memory) {\n _arrangeValidatorCandidates(_candidates, _trustedWeights, _newValidatorCount, _maxPrioritizedValidatorNumber);\n return _candidates;\n }\n\n function _pcSortCandidates(address[] memory _candidates, uint256[] memory _weights)\n internal\n pure\n override\n returns (address[] memory _result)\n {\n return sortValidators(_candidates, _weights);\n }\n\n function _pcPickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) internal pure override returns (address[] memory _result, uint256 _newValidatorCount) {\n _result = pickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n\n _newValidatorCount = _result.length;\n }\n}\n" + }, + "contracts/mocks/MockPrecompile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./libraries/Sorting.sol\";\nimport \"../libraries/Math.sol\";\n\ncontract MockPrecompile {\n function sortValidators(address[] memory _validators, uint256[] memory _weights)\n public\n pure\n returns (address[] memory)\n {\n return Sorting.sort(_validators, _weights);\n }\n\n function validatingDoubleSignProof(\n address, /*consensusAddr*/\n bytes calldata, /*_header1*/\n bytes calldata /*_header2*/\n ) public pure returns (bool _validEvidence) {\n return true;\n }\n\n function pickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) public pure returns (address[] memory _result) {\n (_result, _trustedWeights) = Sorting.sortWithExternalKeys(_candidates, _weights, _trustedWeights);\n uint256 _newValidatorCount = Math.min(_maxValidatorNumber, _result.length);\n _arrangeValidatorCandidates(_result, _trustedWeights, _newValidatorCount, _maxPrioritizedValidatorNumber);\n }\n\n /**\n * @dev Arranges the sorted candidates to list of validators, by asserting prioritized and non-prioritized candidates\n *\n * @param _candidates A sorted list of candidates\n */\n function _arrangeValidatorCandidates(\n address[] memory _candidates,\n uint256[] memory _trustedWeights,\n uint _newValidatorCount,\n uint _maxPrioritizedValidatorNumber\n ) internal pure {\n address[] memory _waitingCandidates = new address[](_candidates.length);\n uint _waitingCounter;\n uint _prioritySlotCounter;\n\n for (uint _i = 0; _i < _candidates.length; _i++) {\n if (_trustedWeights[_i] > 0 && _prioritySlotCounter < _maxPrioritizedValidatorNumber) {\n _candidates[_prioritySlotCounter++] = _candidates[_i];\n continue;\n }\n _waitingCandidates[_waitingCounter++] = _candidates[_i];\n }\n\n _waitingCounter = 0;\n for (uint _i = _prioritySlotCounter; _i < _newValidatorCount; _i++) {\n _candidates[_i] = _waitingCandidates[_waitingCounter++];\n }\n\n assembly {\n mstore(_candidates, _newValidatorCount)\n }\n }\n}\n" + }, + "contracts/ronin/validator/RoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"./CoinbaseExecution.sol\";\nimport \"./SlashingExecution.sol\";\n\ncontract RoninValidatorSet is Initializable, CoinbaseExecution, SlashingExecution {\n constructor() {\n _disableInitializers();\n }\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __slashIndicatorContract,\n address __stakingContract,\n address __stakingVestingContract,\n address __maintenanceContract,\n address __roninTrustedOrganizationContract,\n address __bridgeTrackingContract,\n uint256 __maxValidatorNumber,\n uint256 __maxValidatorCandidate,\n uint256 __maxPrioritizedValidatorNumber,\n uint256 __minEffectiveDaysOnwards,\n uint256 __numberOfBlocksInEpoch,\n // __emergencyExitConfigs[0]: emergencyExitLockedAmount\n // __emergencyExitConfigs[1]: emergencyExpiryDuration\n uint256[2] calldata __emergencyExitConfigs\n ) external initializer {\n _setSlashIndicatorContract(__slashIndicatorContract);\n _setStakingContract(__stakingContract);\n _setStakingVestingContract(__stakingVestingContract);\n _setMaintenanceContract(__maintenanceContract);\n _setBridgeTrackingContract(__bridgeTrackingContract);\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\n _setMaxValidatorNumber(__maxValidatorNumber);\n _setMaxValidatorCandidate(__maxValidatorCandidate);\n _setMaxPrioritizedValidatorNumber(__maxPrioritizedValidatorNumber);\n _setMinEffectiveDaysOnwards(__minEffectiveDaysOnwards);\n _setEmergencyExitLockedAmount(__emergencyExitConfigs[0]);\n _setEmergencyExpiryDuration(__emergencyExitConfigs[1]);\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\n }\n\n /**\n * @dev Only receives RON from staking vesting contract (for topping up bonus), and from staking contract (for transferring\n * deducting amount on slashing).\n */\n function _fallback() internal view {\n if (msg.sender != stakingVestingContract() && msg.sender != stakingContract()) revert ErrUnauthorizedReceiveRON();\n }\n\n /**\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\n */\n function _bridgeOperatorOf(address _consensusAddr)\n internal\n view\n override(EmergencyExit, ValidatorInfoStorage)\n returns (address)\n {\n return super._bridgeOperatorOf(_consensusAddr);\n }\n}\n" + }, + "contracts/mocks/libraries/Sorting.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Sorting {\n struct Node {\n uint key;\n uint value;\n }\n\n struct Node3 {\n uint key;\n uint value;\n uint otherKey;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // VALUE SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sort(uint[] memory data) internal pure returns (uint[] memory) {\n return _quickSort(data, int(0), int(data.length - 1));\n }\n\n function _quickSort(\n uint[] memory arr,\n int left,\n int right\n ) private pure returns (uint[] memory) {\n int i = left;\n int j = right;\n if (i == j) return arr;\n uint pivot = arr[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (arr[uint(i)] > pivot) i++;\n while (pivot > arr[uint(j)]) j--;\n if (i <= j) {\n (arr[uint(i)], arr[uint(j)]) = (arr[uint(j)], arr[uint(i)]);\n i++;\n j--;\n }\n }\n if (left < j) arr = _quickSort(arr, left, j);\n if (i < right) arr = _quickSort(arr, i, right);\n\n return arr;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // NODE SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sort(address[] memory _keys, uint256[] memory _values) internal pure returns (address[] memory) {\n require(_values.length == _keys.length, \"Sorting: invalid array length\");\n if (_keys.length == 0) {\n return _keys;\n }\n\n Node[] memory _nodes = new Node[](_keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node(uint256(uint160(_keys[_i])), _values[_i]);\n }\n _quickSortNodes(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n _keys[_i] = address(uint160(_nodes[_i].key)); // Casting?\n }\n\n return _keys;\n }\n\n function sortNodes(Node[] memory nodes) internal pure returns (Node[] memory) {\n return _quickSortNodes(nodes, int(0), int(nodes.length - 1));\n }\n\n function _quickSortNodes(\n Node[] memory nodes,\n int left,\n int right\n ) private pure returns (Node[] memory) {\n int i = left;\n int j = right;\n if (i == j) return nodes;\n Node memory pivot = nodes[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (nodes[uint(i)].value > pivot.value) i++;\n while (pivot.value > nodes[uint(j)].value) j--;\n if (i <= j) {\n (nodes[uint(i)], nodes[uint(j)]) = __swapNodes(nodes[uint(i)], nodes[uint(j)]);\n i++;\n j--;\n }\n }\n if (left < j) nodes = _quickSortNodes(nodes, left, j);\n if (i < right) nodes = _quickSortNodes(nodes, i, right);\n\n return nodes;\n }\n\n function _bubbleSortNodes(Node[] memory nodes) private pure returns (Node[] memory) {\n uint length = nodes.length;\n for (uint i = 0; i < length - 1; i++) {\n for (uint j = i + 1; j < length; j++) {\n if (nodes[j].value > nodes[i].value) {\n (nodes[i], nodes[j]) = __swapNodes(nodes[i], nodes[j]);\n }\n }\n }\n return nodes;\n }\n\n function __swapNodes(Node memory x, Node memory y) private pure returns (Node memory, Node memory) {\n Node memory tmp = x;\n (x, y) = (y, tmp);\n return (x, y);\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // NODE3 SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sortWithExternalKeys(\n address[] memory _keys,\n uint256[] memory _values,\n uint256[] memory _otherKeys\n ) internal pure returns (address[] memory keys_, uint256[] memory otherKeys_) {\n require((_values.length == _keys.length) && (_otherKeys.length == _keys.length), \"Sorting: invalid array length\");\n if (_keys.length == 0) {\n return (_keys, _otherKeys);\n }\n\n Node3[] memory _nodes = new Node3[](_keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node3(uint256(uint160(_keys[_i])), _values[_i], _otherKeys[_i]);\n }\n _quickSortNode3s(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n _keys[_i] = address(uint160(_nodes[_i].key)); // Casting?\n }\n\n return (_keys, _otherKeys);\n }\n\n function sortNode3s(Node3[] memory nodes) internal pure returns (Node3[] memory) {\n return _quickSortNode3s(nodes, int(0), int(nodes.length - 1));\n }\n\n function _quickSortNode3s(\n Node3[] memory nodes,\n int left,\n int right\n ) private pure returns (Node3[] memory) {\n int i = left;\n int j = right;\n if (i == j) return nodes;\n Node3 memory pivot = nodes[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (nodes[uint(i)].value > pivot.value) i++;\n while (pivot.value > nodes[uint(j)].value) j--;\n if (i <= j) {\n (nodes[uint(i)], nodes[uint(j)]) = __swapNode3s(nodes[uint(i)], nodes[uint(j)]);\n i++;\n j--;\n }\n }\n if (left < j) nodes = _quickSortNode3s(nodes, left, j);\n if (i < right) nodes = _quickSortNode3s(nodes, i, right);\n\n return nodes;\n }\n\n function _bubbleSortNode3s(Node3[] memory nodes) private pure returns (Node3[] memory) {\n uint length = nodes.length;\n for (uint i = 0; i < length - 1; i++) {\n for (uint j = i + 1; j < length; j++) {\n if (nodes[j].value > nodes[i].value) {\n (nodes[i], nodes[j]) = __swapNode3s(nodes[i], nodes[j]);\n }\n }\n }\n return nodes;\n }\n\n function __swapNode3s(Node3 memory x, Node3 memory y) private pure returns (Node3 memory, Node3 memory) {\n Node3 memory tmp = x;\n (x, y) = (y, tmp);\n return (x, y);\n }\n}\n" + }, + "contracts/mainchain/MainchainGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../extensions/GatewayV2.sol\";\nimport \"../extensions/WithdrawalLimitation.sol\";\nimport \"../libraries/Transfer.sol\";\nimport \"../interfaces/IMainchainGatewayV2.sol\";\n\ncontract MainchainGatewayV2 is WithdrawalLimitation, Initializable, AccessControlEnumerable, IMainchainGatewayV2 {\n using Token for Token.Info;\n using Transfer for Transfer.Request;\n using Transfer for Transfer.Receipt;\n\n /// @dev Emitted when the bridge operators are replaced\n event BridgeOperatorsReplaced(address[] operators);\n\n /// @dev Withdrawal unlocker role hash\n bytes32 public constant WITHDRAWAL_UNLOCKER_ROLE = keccak256(\"WITHDRAWAL_UNLOCKER_ROLE\");\n\n /// @dev Wrapped native token address\n IWETH public wrappedNativeToken;\n /// @dev Ronin network id\n uint256 public roninChainId;\n /// @dev Total deposit\n uint256 public depositCount;\n /// @dev Domain seperator\n bytes32 internal _domainSeparator;\n /// @dev Mapping from mainchain token => token address on Ronin network\n mapping(address => MappedToken) internal _roninToken;\n /// @dev Mapping from withdrawal id => withdrawal hash\n mapping(uint256 => bytes32) public withdrawalHash;\n /// @dev Mapping from withdrawal id => locked\n mapping(uint256 => bool) public withdrawalLocked;\n\n /// @dev Mapping from validator address => last block that the bridge operator is added\n mapping(address => uint256) internal _bridgeOperatorAddedBlock;\n /// @dev Bridge operators array\n address[] internal _bridgeOperators;\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n /**\n * @dev Initializes contract storage.\n */\n function initialize(\n address _roleSetter,\n IWETH _wrappedToken,\n uint256 _roninChainId,\n uint256 _numerator,\n uint256 _highTierVWNumerator,\n uint256 _denominator,\n // _addresses[0]: mainchainTokens\n // _addresses[1]: roninTokens\n // _addresses[2]: withdrawalUnlockers\n address[][3] calldata _addresses,\n // _thresholds[0]: highTierThreshold\n // _thresholds[1]: lockedThreshold\n // _thresholds[2]: unlockFeePercentages\n // _thresholds[3]: dailyWithdrawalLimit\n uint256[][4] calldata _thresholds,\n Token.Standard[] calldata _standards\n ) external payable virtual initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n roninChainId = _roninChainId;\n\n _setWrappedNativeTokenContract(_wrappedToken);\n _updateDomainSeparator();\n _setThreshold(_numerator, _denominator);\n _setHighTierVoteWeightThreshold(_highTierVWNumerator, _denominator);\n _verifyThresholds();\n\n if (_addresses[0].length > 0) {\n // Map mainchain tokens to ronin tokens\n _mapTokens(_addresses[0], _addresses[1], _standards);\n // Sets thresholds based on the mainchain tokens\n _setHighTierThresholds(_addresses[0], _thresholds[0]);\n _setLockedThresholds(_addresses[0], _thresholds[1]);\n _setUnlockFeePercentages(_addresses[0], _thresholds[2]);\n _setDailyWithdrawalLimits(_addresses[0], _thresholds[3]);\n }\n\n // Grant role for withdrawal unlocker\n for (uint256 _i; _i < _addresses[2].length; _i++) {\n _grantRole(WITHDRAWAL_UNLOCKER_ROLE, _addresses[2][_i]);\n }\n }\n\n /**\n * @inheritdoc IBridge\n */\n function replaceBridgeOperators(address[] calldata _list) external onlyAdmin {\n address _addr;\n for (uint256 _i = 0; _i < _list.length; _i++) {\n _addr = _list[_i];\n if (_bridgeOperatorAddedBlock[_addr] == 0) {\n _bridgeOperators.push(_addr);\n }\n _bridgeOperatorAddedBlock[_addr] = block.number;\n }\n\n {\n uint256 _i;\n while (_i < _bridgeOperators.length) {\n _addr = _bridgeOperators[_i];\n if (_bridgeOperatorAddedBlock[_addr] < block.number) {\n delete _bridgeOperatorAddedBlock[_addr];\n _bridgeOperators[_i] = _bridgeOperators[_bridgeOperators.length - 1];\n _bridgeOperators.pop();\n continue;\n }\n _i++;\n }\n }\n\n emit BridgeOperatorsReplaced(_list);\n }\n\n /**\n * @inheritdoc IBridge\n */\n function getBridgeOperators() external view returns (address[] memory) {\n return _bridgeOperators;\n }\n\n /**\n * @dev Receives ether without doing anything. Use this function to topup native token.\n */\n function receiveEther() external payable {}\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {\n return _domainSeparator;\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function setWrappedNativeTokenContract(IWETH _wrappedToken) external virtual onlyAdmin {\n _setWrappedNativeTokenContract(_wrappedToken);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function requestDepositFor(Transfer.Request calldata _request) external payable virtual whenNotPaused {\n _requestDepositFor(_request, msg.sender);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function submitWithdrawal(Transfer.Receipt calldata _receipt, Signature[] calldata _signatures)\n external\n virtual\n whenNotPaused\n returns (bool _locked)\n {\n return _submitWithdrawal(_receipt, _signatures);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function unlockWithdrawal(Transfer.Receipt calldata _receipt) external onlyRole(WITHDRAWAL_UNLOCKER_ROLE) {\n bytes32 _receiptHash = _receipt.hash();\n require(withdrawalHash[_receipt.id] == _receipt.hash(), \"MainchainGatewayV2: invalid receipt\");\n require(withdrawalLocked[_receipt.id], \"MainchainGatewayV2: query for approved withdrawal\");\n delete withdrawalLocked[_receipt.id];\n emit WithdrawalUnlocked(_receiptHash, _receipt);\n\n address _token = _receipt.mainchain.tokenAddr;\n if (_receipt.info.erc == Token.Standard.ERC20) {\n Token.Info memory _feeInfo = _receipt.info;\n _feeInfo.quantity = _computeFeePercentage(_receipt.info.quantity, unlockFeePercentages[_token]);\n Token.Info memory _withdrawInfo = _receipt.info;\n _withdrawInfo.quantity = _receipt.info.quantity - _feeInfo.quantity;\n\n _feeInfo.handleAssetTransfer(payable(msg.sender), _token, wrappedNativeToken);\n _withdrawInfo.handleAssetTransfer(payable(_receipt.mainchain.addr), _token, wrappedNativeToken);\n } else {\n _receipt.info.handleAssetTransfer(payable(_receipt.mainchain.addr), _token, wrappedNativeToken);\n }\n\n emit Withdrew(_receiptHash, _receipt);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function mapTokens(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards\n ) external virtual onlyAdmin {\n require(_mainchainTokens.length > 0, \"MainchainGatewayV2: query for empty array\");\n _mapTokens(_mainchainTokens, _roninTokens, _standards);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function mapTokensAndThresholds(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards,\n // _thresholds[0]: highTierThreshold\n // _thresholds[1]: lockedThreshold\n // _thresholds[2]: unlockFeePercentages\n // _thresholds[3]: dailyWithdrawalLimit\n uint256[][4] calldata _thresholds\n ) external virtual onlyAdmin {\n require(_mainchainTokens.length > 0, \"MainchainGatewayV2: query for empty array\");\n _mapTokens(_mainchainTokens, _roninTokens, _standards);\n _setHighTierThresholds(_mainchainTokens, _thresholds[0]);\n _setLockedThresholds(_mainchainTokens, _thresholds[1]);\n _setUnlockFeePercentages(_mainchainTokens, _thresholds[2]);\n _setDailyWithdrawalLimits(_mainchainTokens, _thresholds[3]);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function getRoninToken(address _mainchainToken) public view returns (MappedToken memory _token) {\n _token = _roninToken[_mainchainToken];\n require(_token.tokenAddr != address(0), \"MainchainGatewayV2: unsupported token\");\n }\n\n /**\n * @dev Maps mainchain tokens to Ronin network.\n *\n * Requirement:\n * - The arrays have the same length.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function _mapTokens(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards\n ) internal virtual {\n require(\n _mainchainTokens.length == _roninTokens.length && _mainchainTokens.length == _standards.length,\n \"MainchainGatewayV2: invalid array length\"\n );\n\n for (uint256 _i; _i < _mainchainTokens.length; _i++) {\n _roninToken[_mainchainTokens[_i]].tokenAddr = _roninTokens[_i];\n _roninToken[_mainchainTokens[_i]].erc = _standards[_i];\n }\n\n emit TokenMapped(_mainchainTokens, _roninTokens, _standards);\n }\n\n /**\n * @dev Submits withdrawal receipt.\n *\n * Requirements:\n * - The receipt kind is withdrawal.\n * - The receipt is to withdraw on this chain.\n * - The receipt is not used to withdraw before.\n * - The withdrawal is not reached the limit threshold.\n * - The signer weight total is larger than or equal to the minimum threshold.\n * - The signature signers are in order.\n *\n * Emits the `Withdrew` once the assets are released.\n *\n */\n function _submitWithdrawal(Transfer.Receipt calldata _receipt, Signature[] memory _signatures)\n internal\n virtual\n returns (bool _locked)\n {\n uint256 _id = _receipt.id;\n uint256 _quantity = _receipt.info.quantity;\n address _tokenAddr = _receipt.mainchain.tokenAddr;\n\n _receipt.info.validate();\n require(_receipt.kind == Transfer.Kind.Withdrawal, \"MainchainGatewayV2: invalid receipt kind\");\n require(_receipt.mainchain.chainId == block.chainid, \"MainchainGatewayV2: invalid chain id\");\n MappedToken memory _token = getRoninToken(_receipt.mainchain.tokenAddr);\n require(\n _token.erc == _receipt.info.erc && _token.tokenAddr == _receipt.ronin.tokenAddr,\n \"MainchainGatewayV2: invalid receipt\"\n );\n require(withdrawalHash[_id] == bytes32(0), \"MainchainGatewayV2: query for processed withdrawal\");\n require(\n _receipt.info.erc == Token.Standard.ERC721 || !_reachedWithdrawalLimit(_tokenAddr, _quantity),\n \"MainchainGatewayV2: reached daily withdrawal limit\"\n );\n\n bytes32 _receiptHash = _receipt.hash();\n bytes32 _receiptDigest = Transfer.receiptDigest(_domainSeparator, _receiptHash);\n\n uint256 _minimumVoteWeight;\n (_minimumVoteWeight, _locked) = _computeMinVoteWeight(_receipt.info.erc, _tokenAddr, _quantity);\n\n {\n bool _passed;\n address _signer;\n address _lastSigner;\n Signature memory _sig;\n uint256 _weight;\n for (uint256 _i; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n _signer = ecrecover(_receiptDigest, _sig.v, _sig.r, _sig.s);\n require(_lastSigner < _signer, \"MainchainGatewayV2: invalid order\");\n _lastSigner = _signer;\n\n _weight += _getWeight(_signer);\n if (_weight >= _minimumVoteWeight) {\n _passed = true;\n break;\n }\n }\n require(_passed, \"MainchainGatewayV2: query for insufficient vote weight\");\n withdrawalHash[_id] = _receiptHash;\n }\n\n if (_locked) {\n withdrawalLocked[_id] = true;\n emit WithdrawalLocked(_receiptHash, _receipt);\n return _locked;\n }\n\n _recordWithdrawal(_tokenAddr, _quantity);\n _receipt.info.handleAssetTransfer(payable(_receipt.mainchain.addr), _tokenAddr, wrappedNativeToken);\n emit Withdrew(_receiptHash, _receipt);\n }\n\n /**\n * @dev Requests deposit made by `_requester` address.\n *\n * Requirements:\n * - The token info is valid.\n * - The `msg.value` is 0 while depositing ERC20 token.\n * - The `msg.value` is equal to deposit quantity while depositing native token.\n *\n * Emits the `DepositRequested` event.\n *\n */\n function _requestDepositFor(Transfer.Request memory _request, address _requester) internal virtual {\n MappedToken memory _token;\n address _weth = address(wrappedNativeToken);\n\n _request.info.validate();\n if (_request.tokenAddr == address(0)) {\n require(_request.info.quantity == msg.value, \"MainchainGatewayV2: invalid request\");\n _token = getRoninToken(_weth);\n require(_token.erc == _request.info.erc, \"MainchainGatewayV2: invalid token standard\");\n _request.tokenAddr = _weth;\n } else {\n require(msg.value == 0, \"MainchainGatewayV2: invalid request\");\n _token = getRoninToken(_request.tokenAddr);\n require(_token.erc == _request.info.erc, \"MainchainGatewayV2: invalid token standard\");\n _request.info.transferFrom(_requester, address(this), _request.tokenAddr);\n // Withdraw if token is WETH\n if (_weth == _request.tokenAddr) {\n IWETH(_weth).withdraw(_request.info.quantity);\n }\n }\n\n uint256 _depositId = depositCount++;\n Transfer.Receipt memory _receipt = _request.into_deposit_receipt(\n _requester,\n _depositId,\n _token.tokenAddr,\n roninChainId\n );\n\n emit DepositRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @dev Returns the minimum vote weight for the token.\n */\n function _computeMinVoteWeight(\n Token.Standard _erc,\n address _token,\n uint256 _quantity\n ) internal virtual returns (uint256 _weight, bool _locked) {\n uint256 _totalWeight = _getTotalWeight();\n _weight = _minimumVoteWeight(_totalWeight);\n if (_erc == Token.Standard.ERC20) {\n if (highTierThreshold[_token] <= _quantity) {\n _weight = _highTierVoteWeight(_totalWeight);\n }\n _locked = _lockedWithdrawalRequest(_token, _quantity);\n }\n }\n\n /**\n * @dev Update domain seperator.\n */\n function _updateDomainSeparator() internal {\n _domainSeparator = keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(\"MainchainGatewayV2\"),\n keccak256(\"2\"),\n block.chainid,\n address(this)\n )\n );\n }\n\n /**\n * @dev Sets the WETH contract.\n *\n * Emits the `WrappedNativeTokenContractUpdated` event.\n *\n */\n function _setWrappedNativeTokenContract(IWETH _wrapedToken) internal {\n wrappedNativeToken = _wrapedToken;\n emit WrappedNativeTokenContractUpdated(_wrapedToken);\n }\n\n /**\n * @dev Receives ETH from WETH or creates deposit request.\n */\n function _fallback() internal virtual whenNotPaused {\n if (msg.sender != address(wrappedNativeToken)) {\n Transfer.Request memory _request;\n _request.recipientAddr = msg.sender;\n _request.info.quantity = msg.value;\n _requestDepositFor(_request, _request.recipientAddr);\n }\n }\n\n /**\n * @inheritdoc GatewayV2\n */\n function _getTotalWeight() internal view override returns (uint256) {\n return _bridgeOperators.length;\n }\n\n /**\n * @dev Returns the weight of an address.\n */\n function _getWeight(address _addr) internal view returns (uint256) {\n return _bridgeOperatorAddedBlock[_addr] > 0 ? 1 : 0;\n }\n}\n" + }, + "contracts/extensions/WithdrawalLimitation.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./GatewayV2.sol\";\n\nabstract contract WithdrawalLimitation is GatewayV2 {\n /// @dev Emitted when the high-tier vote weight threshold is updated\n event HighTierVoteWeightThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n /// @dev Emitted when the thresholds for high-tier withdrawals that requires high-tier vote weights are updated\n event HighTierThresholdsUpdated(address[] tokens, uint256[] thresholds);\n /// @dev Emitted when the thresholds for locked withdrawals are updated\n event LockedThresholdsUpdated(address[] tokens, uint256[] thresholds);\n /// @dev Emitted when the fee percentages to unlock withdraw are updated\n event UnlockFeePercentagesUpdated(address[] tokens, uint256[] percentages);\n /// @dev Emitted when the daily limit thresholds are updated\n event DailyWithdrawalLimitsUpdated(address[] tokens, uint256[] limits);\n\n uint256 public constant _MAX_PERCENTAGE = 1_000_000;\n\n uint256 internal _highTierVWNum;\n uint256 internal _highTierVWDenom;\n\n /// @dev Mapping from mainchain token => the amount thresholds for high-tier withdrawals that requires high-tier vote weights\n mapping(address => uint256) public highTierThreshold;\n /// @dev Mapping from mainchain token => the amount thresholds to lock withdrawal\n mapping(address => uint256) public lockedThreshold;\n /// @dev Mapping from mainchain token => unlock fee percentages for unlocker\n /// @notice Values 0-1,000,000 map to 0%-100%\n mapping(address => uint256) public unlockFeePercentages;\n /// @dev Mapping from mainchain token => daily limit amount for withdrawal\n mapping(address => uint256) public dailyWithdrawalLimit;\n /// @dev Mapping from token address => today withdrawal amount\n mapping(address => uint256) public lastSyncedWithdrawal;\n /// @dev Mapping from token address => last date synced to record the `lastSyncedWithdrawal`\n mapping(address => uint256) public lastDateSynced;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @dev Override `GatewayV2-setThreshold`.\n *\n * Requirements:\n * - The high-tier vote weight threshold must equal to or larger than the normal threshold.\n *\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n virtual\n override\n onlyAdmin\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n (_previousNum, _previousDenom) = _setThreshold(_numerator, _denominator);\n _verifyThresholds();\n }\n\n /**\n * @dev Returns the high-tier vote weight threshold.\n */\n function getHighTierVoteWeightThreshold() external view virtual returns (uint256, uint256) {\n return (_highTierVWNum, _highTierVWDenom);\n }\n\n /**\n * @dev Checks whether the `_voteWeight` passes the high-tier vote weight threshold.\n */\n function checkHighTierVoteWeightThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _highTierVWDenom >= _highTierVWNum * _getTotalWeight();\n }\n\n /**\n * @dev Sets high-tier vote weight threshold and returns the old one.\n *\n * Requirements:\n * - The method caller is admin.\n * - The high-tier vote weight threshold must equal to or larger than the normal threshold.\n *\n * Emits the `HighTierVoteWeightThresholdUpdated` event.\n *\n */\n function setHighTierVoteWeightThreshold(uint256 _numerator, uint256 _denominator)\n external\n virtual\n onlyAdmin\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n (_previousNum, _previousDenom) = _setHighTierVoteWeightThreshold(_numerator, _denominator);\n _verifyThresholds();\n }\n\n /**\n * @dev Sets the thresholds for high-tier withdrawals that requires high-tier vote weights.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `HighTierThresholdsUpdated` event.\n *\n */\n function setHighTierThresholds(address[] calldata _tokens, uint256[] calldata _thresholds)\n external\n virtual\n onlyAdmin\n {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setHighTierThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets the amount thresholds to lock withdrawal.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `LockedThresholdsUpdated` event.\n *\n */\n function setLockedThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) external virtual onlyAdmin {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setLockedThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets fee percentages to unlock withdrawal.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `UnlockFeePercentagesUpdated` event.\n *\n */\n function setUnlockFeePercentages(address[] calldata _tokens, uint256[] calldata _percentages)\n external\n virtual\n onlyAdmin\n {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setUnlockFeePercentages(_tokens, _percentages);\n }\n\n /**\n * @dev Sets daily limit amounts for the withdrawals.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `DailyWithdrawalLimitsUpdated` event.\n *\n */\n function setDailyWithdrawalLimits(address[] calldata _tokens, uint256[] calldata _limits) external virtual onlyAdmin {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setDailyWithdrawalLimits(_tokens, _limits);\n }\n\n /**\n * @dev Checks whether the withdrawal reaches the limitation.\n */\n function reachedWithdrawalLimit(address _token, uint256 _quantity) external view virtual returns (bool) {\n return _reachedWithdrawalLimit(_token, _quantity);\n }\n\n /**\n * @dev Sets high-tier vote weight threshold and returns the old one.\n *\n * Emits the `HighTierVoteWeightThresholdUpdated` event.\n *\n */\n function _setHighTierVoteWeightThreshold(uint256 _numerator, uint256 _denominator)\n internal\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n require(_numerator <= _denominator, \"WithdrawalLimitation: invalid threshold\");\n _previousNum = _highTierVWNum;\n _previousDenom = _highTierVWDenom;\n _highTierVWNum = _numerator;\n _highTierVWDenom = _denominator;\n emit HighTierVoteWeightThresholdUpdated(nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n\n /**\n * @dev Sets the thresholds for high-tier withdrawals that requires high-tier vote weights.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `HighTierThresholdsUpdated` event.\n *\n */\n function _setHighTierThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n require(_tokens.length == _thresholds.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n highTierThreshold[_tokens[_i]] = _thresholds[_i];\n }\n emit HighTierThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets the amount thresholds to lock withdrawal.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `LockedThresholdsUpdated` event.\n *\n */\n function _setLockedThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n require(_tokens.length == _thresholds.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n lockedThreshold[_tokens[_i]] = _thresholds[_i];\n }\n emit LockedThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets fee percentages to unlock withdrawal.\n *\n * Requirements:\n * - The array lengths are equal.\n * - The percentage is equal to or less than 100_000.\n *\n * Emits the `UnlockFeePercentagesUpdated` event.\n *\n */\n function _setUnlockFeePercentages(address[] calldata _tokens, uint256[] calldata _percentages) internal virtual {\n require(_tokens.length == _percentages.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n require(_percentages[_i] <= _MAX_PERCENTAGE, \"WithdrawalLimitation: invalid percentage\");\n unlockFeePercentages[_tokens[_i]] = _percentages[_i];\n }\n emit UnlockFeePercentagesUpdated(_tokens, _percentages);\n }\n\n /**\n * @dev Sets daily limit amounts for the withdrawals.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `DailyWithdrawalLimitsUpdated` event.\n *\n */\n function _setDailyWithdrawalLimits(address[] calldata _tokens, uint256[] calldata _limits) internal virtual {\n require(_tokens.length == _limits.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n dailyWithdrawalLimit[_tokens[_i]] = _limits[_i];\n }\n emit DailyWithdrawalLimitsUpdated(_tokens, _limits);\n }\n\n /**\n * @dev Checks whether the withdrawal reaches the daily limitation.\n *\n * Requirements:\n * - The daily withdrawal threshold should not apply for locked withdrawals.\n *\n */\n function _reachedWithdrawalLimit(address _token, uint256 _quantity) internal view virtual returns (bool) {\n if (_lockedWithdrawalRequest(_token, _quantity)) {\n return false;\n }\n\n uint256 _currentDate = block.timestamp / 1 days;\n if (_currentDate > lastDateSynced[_token]) {\n return dailyWithdrawalLimit[_token] <= _quantity;\n } else {\n return dailyWithdrawalLimit[_token] <= lastSyncedWithdrawal[_token] + _quantity;\n }\n }\n\n /**\n * @dev Record withdrawal token.\n */\n function _recordWithdrawal(address _token, uint256 _quantity) internal virtual {\n uint256 _currentDate = block.timestamp / 1 days;\n if (_currentDate > lastDateSynced[_token]) {\n lastDateSynced[_token] = _currentDate;\n lastSyncedWithdrawal[_token] = _quantity;\n } else {\n lastSyncedWithdrawal[_token] += _quantity;\n }\n }\n\n /**\n * @dev Returns whether the withdrawal request is locked or not.\n */\n function _lockedWithdrawalRequest(address _token, uint256 _quantity) internal view virtual returns (bool) {\n return lockedThreshold[_token] <= _quantity;\n }\n\n /**\n * @dev Computes fee percentage.\n */\n function _computeFeePercentage(uint256 _amount, uint256 _percentage) internal view virtual returns (uint256) {\n return (_amount * _percentage) / _MAX_PERCENTAGE;\n }\n\n /**\n * @dev Returns high-tier vote weight.\n */\n function _highTierVoteWeight(uint256 _totalWeight) internal view virtual returns (uint256) {\n return (_highTierVWNum * _totalWeight + _highTierVWDenom - 1) / _highTierVWDenom;\n }\n\n /**\n * @dev Validates whether the high-tier vote weight threshold is larger than the normal threshold.\n */\n function _verifyThresholds() internal view {\n require(_num * _highTierVWDenom <= _highTierVWNum * _denom, \"WithdrawalLimitation: invalid thresholds\");\n }\n}\n" + }, + "contracts/interfaces/IMainchainGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./IBridge.sol\";\nimport \"./IWETH.sol\";\nimport \"./consumers/SignatureConsumer.sol\";\nimport \"./consumers/MappedTokenConsumer.sol\";\nimport \"../libraries/Transfer.sol\";\n\ninterface IMainchainGatewayV2 is SignatureConsumer, MappedTokenConsumer, IBridge {\n /// @dev Emitted when the deposit is requested\n event DepositRequested(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the assets are withdrawn\n event Withdrew(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the tokens are mapped\n event TokenMapped(address[] mainchainTokens, address[] roninTokens, Token.Standard[] standards);\n /// @dev Emitted when the wrapped native token contract is updated\n event WrappedNativeTokenContractUpdated(IWETH weth);\n /// @dev Emitted when the withdrawal is locked\n event WithdrawalLocked(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal is unlocked\n event WithdrawalUnlocked(bytes32 receiptHash, Transfer.Receipt receipt);\n\n /**\n * @dev Returns the domain seperator.\n */\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n /**\n * @dev Returns deposit count.\n */\n function depositCount() external view returns (uint256);\n\n /**\n * @dev Sets the wrapped native token contract.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `WrappedNativeTokenContractUpdated` event.\n *\n */\n function setWrappedNativeTokenContract(IWETH _wrappedToken) external;\n\n /**\n * @dev Returns whether the withdrawal is locked.\n */\n function withdrawalLocked(uint256 withdrawalId) external view returns (bool);\n\n /**\n * @dev Returns the withdrawal hash.\n */\n function withdrawalHash(uint256 withdrawalId) external view returns (bytes32);\n\n /**\n * @dev Locks the assets and request deposit.\n */\n function requestDepositFor(Transfer.Request calldata _request) external payable;\n\n /**\n * @dev Withdraws based on the receipt and the validator signatures.\n * Returns whether the withdrawal is locked.\n *\n * Emits the `Withdrew` once the assets are released.\n *\n */\n function submitWithdrawal(Transfer.Receipt memory _receipt, Signature[] memory _signatures)\n external\n returns (bool _locked);\n\n /**\n * @dev Approves a specific withdrawal.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Withdrew` once the assets are released.\n *\n */\n function unlockWithdrawal(Transfer.Receipt calldata _receipt) external;\n\n /**\n * @dev Maps mainchain tokens to Ronin network.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokens(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards\n ) external;\n\n /**\n * @dev Maps mainchain tokens to Ronin network and sets thresholds.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokensAndThresholds(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards,\n uint256[][4] calldata _thresholds\n ) external;\n\n /**\n * @dev Returns token address on Ronin network.\n * Note: Reverts for unsupported token.\n */\n function getRoninToken(address _mainchainToken) external view returns (MappedToken memory _token);\n}\n" + }, + "contracts/mocks/MockSlashIndicatorExtended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./MockPrecompile.sol\";\nimport \"../ronin/slash-indicator/SlashIndicator.sol\";\n\ncontract MockSlashIndicatorExtended is SlashIndicator, MockPrecompile {\n function slashFelony(address _validatorAddr) external {\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\n }\n\n function slashMisdemeanor(address _validatorAddr) external {\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\n }\n\n function _pcValidateEvidence(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) internal pure override returns (bool _validEvidence) {\n return validatingDoubleSignProof(_consensusAddr, _header1, _header2);\n }\n}\n" + }, + "contracts/mocks/sorting/MockSorting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\nimport \"../libraries/Sorting.sol\";\n\ncontract MockSorting {\n uint256[] public data;\n\n function addData(uint256[] memory _data) public {\n for (uint256 i; i < _data.length; i++) {\n data.push(_data[i]);\n }\n }\n\n function sort(uint256[] memory _data) public pure returns (uint256[] memory) {\n return Sorting.sort(_data);\n }\n\n function sortOnStorage() public returns (uint256[] memory, uint256) {\n uint256[] memory _tmpData = data;\n data = Sorting.sort(_tmpData);\n\n return (data, data.length);\n }\n\n function sortAddressesAndValues(address[] calldata _addrs, uint256[] calldata _values)\n public\n pure\n returns (address[] memory)\n {\n return Sorting.sort(_addrs, _values);\n }\n}\n" + }, + "contracts/mocks/MockStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../ronin/staking/RewardCalculation.sol\";\n\ncontract MockStaking is RewardCalculation, GlobalConfigConsumer {\n /// @dev Mapping from user => staking balance\n mapping(address => uint256) internal _stakingAmount;\n /// @dev Mapping from period number => slashed\n mapping(uint256 => bool) internal _periodSlashed;\n\n uint256 internal _stakingTotal;\n\n uint256 public lastUpdatedPeriod;\n uint256 public pendingReward;\n address public poolAddr;\n\n constructor(address _poolAddr) {\n poolAddr = _poolAddr;\n }\n\n function firstEverWrapup() external {\n delete pendingReward;\n lastUpdatedPeriod = block.timestamp / PERIOD_DURATION + 1;\n }\n\n function endPeriod() external {\n address[] memory _addrs = new address[](1);\n uint256[] memory _rewards = new uint256[](1);\n _addrs[0] = poolAddr;\n _rewards[0] = pendingReward;\n this.execRecordRewards(_addrs, _rewards);\n\n pendingReward = 0;\n lastUpdatedPeriod++;\n }\n\n function increasePeriod() external {\n lastUpdatedPeriod++;\n }\n\n function stake(address _user, uint256 _amount) external {\n uint256 _lastStakingAmount = _stakingAmount[_user];\n uint256 _newStakingAmount = _lastStakingAmount + _amount;\n _syncUserReward(poolAddr, _user, _newStakingAmount);\n _stakingAmount[_user] = _newStakingAmount;\n _stakingTotal += _amount;\n }\n\n function unstake(address _user, uint256 _amount) external {\n uint256 _lastStakingAmount = _stakingAmount[_user];\n uint256 _newStakingAmount = _lastStakingAmount - _amount;\n _syncUserReward(poolAddr, _user, _newStakingAmount);\n _stakingAmount[_user] = _newStakingAmount;\n _stakingTotal -= _amount;\n }\n\n function increaseReward(uint256 _amount) external {\n pendingReward += _amount;\n }\n\n function decreaseReward(uint256 _amount) external {\n pendingReward -= _amount;\n }\n\n function execRecordRewards(address[] calldata _addrList, uint256[] calldata _rewards) external {\n _recordRewards(_addrList, _rewards, _currentPeriod());\n }\n\n function getPeriod() public view returns (uint256) {\n return _currentPeriod();\n }\n\n function claimReward(address _user) external returns (uint256 _amount) {\n _amount = _claimReward(poolAddr, _user, getPeriod());\n }\n\n function getStakingAmount(address, address _user) public view override returns (uint256) {\n return _stakingAmount[_user];\n }\n\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\n external\n view\n override\n returns (uint256[] memory)\n {}\n\n function getStakingTotal(address _addr) public view virtual override returns (uint256) {\n return _addr == poolAddr ? _stakingTotal : 0;\n }\n\n function _currentPeriod() internal view override returns (uint256 _period) {\n return lastUpdatedPeriod;\n }\n\n function getManyStakingTotals(address[] calldata _poolAddr) external view override returns (uint256[] memory) {}\n}\n" + }, + "contracts/mocks/precompile-usages/MockPCUValidateDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../precompile-usages/PCUValidateDoubleSign.sol\";\n\ncontract MockPCUValidateDoubleSign is PCUValidateDoubleSign {\n address internal _precompileValidateDoubleSignAddress;\n\n constructor(address _precompile) {\n setPrecompileValidateDoubleSignAddress(_precompile);\n }\n\n function setPrecompileValidateDoubleSignAddress(address _addr) public {\n _precompileValidateDoubleSignAddress = _addr;\n }\n\n function precompileValidateDoubleSignAddress() public view override returns (address) {\n return _precompileValidateDoubleSignAddress;\n }\n\n function callPrecompile(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) public view returns (bool) {\n return _pcValidateEvidence(_consensusAddr, _header1, _header2);\n }\n}\n" + }, + "contracts/mocks/precompile-usages/MockPCUSortValidators.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../precompile-usages/PCUSortValidators.sol\";\n\ncontract MockPCUSortValidators is PCUSortValidators {\n address internal _precompileSortValidatorAddress;\n\n constructor(address _precompile) {\n setPrecompileSortValidatorAddress(_precompile);\n }\n\n function setPrecompileSortValidatorAddress(address _addr) public {\n _precompileSortValidatorAddress = _addr;\n }\n\n function precompileSortValidatorsAddress() public view override returns (address) {\n return _precompileSortValidatorAddress;\n }\n\n function callPrecompile(address[] calldata _validators, uint256[] calldata _weights)\n public\n view\n returns (address[] memory _result)\n {\n return _pcSortCandidates(_validators, _weights);\n }\n}\n" + }, + "contracts/mocks/precompile-usages/MockPCUPickValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../precompile-usages/PCUPickValidatorSet.sol\";\n\ncontract MockPCUPickValidatorSet is PCUPickValidatorSet {\n address internal _precompileSortValidatorAddress;\n\n constructor(address _precompile) {\n setPrecompileSortValidatorAddress(_precompile);\n }\n\n function setPrecompileSortValidatorAddress(address _addr) public {\n _precompileSortValidatorAddress = _addr;\n }\n\n function precompilePickValidatorSetAddress() public view override returns (address) {\n return _precompileSortValidatorAddress;\n }\n\n function callPrecompile(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) public view returns (address[] memory _result) {\n (_result, ) = _pcPickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n }\n}\n" + }, + "contracts/mocks/ronin/MockRoninGatewayV2Extended.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../ronin/gateway/RoninGatewayV2.sol\";\n\ncontract MockRoninGatewayV2Extended is RoninGatewayV2 {\n /*\n * @dev Returns the vote weight for a deposit based on its corressponding hash.\n */\n function getDepositVoteWeight(\n uint256 _chainId,\n uint256 _depositId,\n bytes32 _hash\n ) external view returns (uint256, uint256) {\n return _getVoteWeight(depositVote[_chainId][_depositId], _hash);\n }\n\n /**\n * @dev Returns the vote weight for a mainchain withdrew acknowledgement based on its corressponding hash.\n */\n function getMainchainWithdrewVoteWeight(uint256 _withdrawalId, bytes32 _hash)\n external\n view\n returns (uint256, uint256)\n {\n return _getVoteWeight(mainchainWithdrewVote[_withdrawalId], _hash);\n }\n\n /**\n * @dev Returns the vote weight for a withdraw stats based on its corressponding hash.\n */\n function getWithdrawalStatVoteWeight(uint256 _withdrawalId, bytes32 _hash) external view returns (uint256, uint256) {\n return _getVoteWeight(withdrawalStatVote[_withdrawalId], _hash);\n }\n}\n" + }, + "contracts/mocks/MockTransferFallback.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"../extensions/RONTransferHelper.sol\";\n\ncontract MockPaymentFallback {\n event SafeReceived(address indexed sender, uint256 value);\n\n /// @dev Fallback function accepts ether transactions.\n receive() external payable {\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n\ncontract MockPaymentFallbackExpensive {\n uint[] public array;\n event SafeReceived(address indexed sender, uint256 value);\n\n constructor() {\n array.push(0);\n }\n\n /// @dev Fallback function accepts ether transactions and set non-zero value to a zero value slot.\n receive() external payable {\n array.push(block.number);\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n\ncontract MockTransfer is RONTransferHelper {\n uint256 public track;\n\n constructor() payable {}\n\n function fooTransfer(\n address payable _recipient,\n uint256 _amount,\n uint256 _gas\n ) external {\n if (_unsafeSendRON(_recipient, _amount, _gas)) {\n track++;\n }\n }\n}\n" + }, + "contracts/mocks/forwarder/MockForwarderTarget.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/RONTransferHelper.sol\";\n\ncontract MockForwarderTarget is RONTransferHelper {\n address public owner;\n uint256 public data;\n\n event TargetWithdrawn(address indexed _origin, address indexed _caller, address indexed _recipient);\n\n error ErrIntentionally();\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"MockForwarderContract: only owner can call method\");\n _;\n }\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n constructor(address _owner, uint256 _data) payable {\n owner = _owner;\n data = _data;\n }\n\n function foo(uint256 _data) external onlyOwner {\n data = _data;\n }\n\n function fooPayable(uint256 _data) external payable onlyOwner {\n data = _data;\n }\n\n function fooSilentRevert() external view onlyOwner {\n revert();\n }\n\n function fooCustomErrorRevert() external view onlyOwner {\n revert ErrIntentionally();\n }\n\n function fooRevert() external view onlyOwner {\n revert(\"MockForwarderContract: revert intentionally\");\n }\n\n function getBalance() external view returns (uint256) {\n return address(this).balance;\n }\n\n function withdrawAll() external onlyOwner {\n emit TargetWithdrawn(tx.origin, msg.sender, msg.sender);\n _transferRON(payable(msg.sender), address(this).balance);\n }\n\n function _fallback() private pure {\n revert(\"MockForwardTarget: hello from fallback\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 0 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "storageLayout" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/ronin-testnet/solcInputs/85b953b22882c536a643bf4b61b3153b.json b/deployments/ronin-testnet/solcInputs/85b953b22882c536a643bf4b61b3153b.json new file mode 100644 index 000000000..923fd155d --- /dev/null +++ b/deployments/ronin-testnet/solcInputs/85b953b22882c536a643bf4b61b3153b.json @@ -0,0 +1,525 @@ +{ + "language": "Solidity", + "sources": { + "contracts/extensions/bridge-operator-governance/BOsGovernanceProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../libraries/BridgeOperatorsBallot.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\n\nabstract contract BOsGovernanceProposal is SignatureConsumer, IRoninGovernanceAdmin {\n using IsolatedGovernance for IsolatedGovernance.Vote;\n\n /// @dev The last the brige operator set info.\n BridgeOperatorsBallot.BridgeOperatorSet internal _lastSyncedBridgeOperatorSetInfo;\n /// @dev Mapping from period index => epoch index => bridge operators vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) internal _bridgeOperatorVote;\n /// @dev Mapping from bridge voter address => last block that the address voted\n mapping(address => uint256) internal _lastVotedBlock;\n /// @dev Mapping from period index => epoch index => voter => bridge voter signatures\n mapping(uint256 => mapping(uint256 => mapping(address => Signature))) internal _bridgeVoterSig;\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256) {\n return _lastVotedBlock[_bridgeVoter];\n }\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function lastSyncedBridgeOperatorSetInfo() external view returns (BridgeOperatorsBallot.BridgeOperatorSet memory) {\n return _lastSyncedBridgeOperatorSetInfo;\n }\n\n /**\n * @dev Votes for a set of bridge operators by signatures.\n *\n * Requirements:\n * - The period of voting is larger than the last synced period.\n * - The arrays are not empty.\n * - The signature signers are in order.\n *\n */\n function _castBOVotesBySignatures(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures,\n uint256 _minimumVoteWeight,\n bytes32 _domainSeperator\n ) internal {\n require(\n _ballot.period >= _lastSyncedBridgeOperatorSetInfo.period &&\n _ballot.epoch >= _lastSyncedBridgeOperatorSetInfo.epoch,\n \"BOsGovernanceProposal: query for outdated bridge operator set\"\n );\n BridgeOperatorsBallot.verifyBallot(_ballot);\n require(_signatures.length > 0, \"BOsGovernanceProposal: invalid array length\");\n\n address _signer;\n address _lastSigner;\n bytes32 _hash = BridgeOperatorsBallot.hash(_ballot);\n bytes32 _digest = ECDSA.toTypedDataHash(_domainSeperator, _hash);\n IsolatedGovernance.Vote storage _v = _bridgeOperatorVote[_ballot.period][_ballot.epoch];\n mapping(address => Signature) storage _sigMap = _bridgeVoterSig[_ballot.period][_ballot.epoch];\n bool _hasValidVotes;\n\n for (uint256 _i; _i < _signatures.length; _i++) {\n // Avoids stack too deeps\n {\n Signature calldata _sig = _signatures[_i];\n _signer = ECDSA.recover(_digest, _sig.v, _sig.r, _sig.s);\n require(_lastSigner < _signer, \"BOsGovernanceProposal: invalid signer order\");\n _lastSigner = _signer;\n }\n\n if (_isBridgeVoter(_signer)) {\n _hasValidVotes = true;\n _lastVotedBlock[_signer] = block.number;\n _sigMap[_signer] = _signatures[_i];\n _v.castVote(_signer, _hash);\n }\n }\n\n require(_hasValidVotes, \"BOsGovernanceProposal: invalid signatures\");\n address[] memory _filteredVoters = _v.filterByHash(_hash);\n _v.syncVoteStatus(_minimumVoteWeight, _sumBridgeVoterWeights(_filteredVoters), 0, 0, _hash);\n }\n\n /**\n * @dev Returns whether the address is the bridge voter.\n */\n function _isBridgeVoter(address) internal view virtual returns (bool);\n\n /**\n * @dev Returns the weight of many bridge voters.\n */\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual returns (uint256);\n}\n" + }, + "contracts/interfaces/consumers/SignatureConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface SignatureConsumer {\n struct Signature {\n uint8 v;\n bytes32 r;\n bytes32 s;\n }\n}\n" + }, + "contracts/libraries/BridgeOperatorsBallot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary BridgeOperatorsBallot {\n struct BridgeOperatorSet {\n uint256 period;\n uint256 epoch;\n address[] operators;\n }\n\n // keccak256(\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\");\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\n\n /**\n * @dev Verifies whether the ballot is valid or not.\n *\n * Requirements:\n * - The ballot is not for an empty operator set.\n * - The operator address list is in order.\n *\n */\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\n require(_ballot.operators.length > 0, \"BridgeOperatorsBallot: invalid array length\");\n address _addr = _ballot.operators[0];\n for (uint _i = 1; _i < _ballot.operators.length; _i++) {\n require(_addr < _ballot.operators[_i], \"BridgeOperatorsBallot: invalid order of bridge operators\");\n _addr = _ballot.operators[_i];\n }\n }\n\n /**\n * @dev Returns hash of the ballot.\n */\n function hash(BridgeOperatorSet calldata _ballot) internal pure returns (bytes32) {\n bytes32 _operatorsHash;\n address[] memory _operators = _ballot.operators;\n\n assembly {\n _operatorsHash := keccak256(add(_operators, 32), mul(mload(_operators), 32))\n }\n\n return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\n }\n}\n" + }, + "contracts/interfaces/IRoninGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/BridgeOperatorsBallot.sol\";\n\ninterface IRoninGovernanceAdmin {\n /// @dev Emitted when the bridge operators are approved.\n event BridgeOperatorsApproved(uint256 _period, uint256 _epoch, address[] _operators);\n /// @dev Emitted when an emergency exit poll is created.\n event EmergencyExitPollCreated(\n bytes32 _voteHash,\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n );\n /// @dev Emitted when an emergency exit poll is approved.\n event EmergencyExitPollApproved(bytes32 _voteHash);\n /// @dev Emitted when an emergency exit poll is expired.\n event EmergencyExitPollExpired(bytes32 _voteHash);\n\n /**\n * @dev Returns the last voted block of the bridge voter.\n */\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256);\n\n /**\n * @dev Returns the synced bridge operator set info.\n */\n function lastSyncedBridgeOperatorSetInfo()\n external\n view\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory _bridgeOperatorSetInfo);\n\n /**\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n */\n function createEmergencyExitPoll(\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) external;\n}\n" + }, + "contracts/libraries/IsolatedGovernance.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../interfaces/consumers/VoteStatusConsumer.sol\";\n\nlibrary IsolatedGovernance {\n struct Vote {\n VoteStatusConsumer.VoteStatus status;\n bytes32 finalHash;\n /// @dev Mapping from voter => receipt hash\n mapping(address => bytes32) voteHashOf;\n /// @dev The timestamp that voting is expired (no expiration=0)\n uint256 expiredAt;\n /// @dev The timestamp that voting is created\n uint256 createdAt;\n /// @dev The list of voters\n address[] voters;\n }\n\n /**\n * @dev Casts vote for the receipt with the receipt hash `_hash`.\n *\n * Requirements:\n * - The voter has not voted for the round.\n *\n */\n function castVote(\n Vote storage _v,\n address _voter,\n bytes32 _hash\n ) internal {\n if (_v.expiredAt > 0 && _v.expiredAt <= block.timestamp) {\n _v.status = VoteStatusConsumer.VoteStatus.Expired;\n }\n\n if (voted(_v, _voter)) {\n revert(\n string(abi.encodePacked(\"IsolatedGovernance: \", Strings.toHexString(uint160(_voter), 20), \" already voted\"))\n );\n }\n\n _v.voteHashOf[_voter] = _hash;\n _v.voters.push(_voter);\n }\n\n /**\n * @dev Updates vote with the requirement of minimum vote weight.\n */\n function syncVoteStatus(\n Vote storage _v,\n uint256 _minimumVoteWeight,\n uint256 _votedWeightForHash,\n uint256 _minimumTrustedVoteWeight,\n uint256 _trustedVotedWeightForHash,\n bytes32 _hash\n ) internal returns (VoteStatusConsumer.VoteStatus _status) {\n if (\n _votedWeightForHash >= _minimumVoteWeight &&\n _trustedVotedWeightForHash >= _minimumTrustedVoteWeight &&\n _v.status == VoteStatusConsumer.VoteStatus.Pending\n ) {\n _v.status = VoteStatusConsumer.VoteStatus.Approved;\n _v.finalHash = _hash;\n }\n\n return _v.status;\n }\n\n /**\n * @dev Returns the list of vote's addresses that voted for the hash `_hash`.\n */\n function filterByHash(Vote storage _v, bytes32 _hash) internal view returns (address[] memory _voters) {\n uint256 _count;\n _voters = new address[](_v.voters.length);\n\n for (uint _i; _i < _voters.length; _i++) {\n address _voter = _v.voters[_i];\n if (_v.voteHashOf[_voter] == _hash) {\n _voters[_count++] = _voter;\n }\n }\n\n assembly {\n mstore(_voters, _count)\n }\n }\n\n /**\n * @dev Returns whether the voter casted for the proposal.\n */\n function voted(Vote storage _v, address _voter) internal view returns (bool) {\n return _v.voteHashOf[_voter] != bytes32(0);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/interfaces/consumers/VoteStatusConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface VoteStatusConsumer {\n enum VoteStatus {\n Pending,\n Approved,\n Executed,\n Rejected,\n Expired\n }\n}\n" + }, + "contracts/ronin/RoninGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../extensions/bridge-operator-governance/BOsGovernanceProposal.sol\";\nimport \"../extensions/sequential-governance/GovernanceProposal.sol\";\nimport \"../extensions/collections/HasValidatorContract.sol\";\nimport \"../extensions/GovernanceAdmin.sol\";\nimport \"../libraries/EmergencyExitBallot.sol\";\nimport \"../interfaces/IRoninGovernanceAdmin.sol\";\n\ncontract RoninGovernanceAdmin is\n IRoninGovernanceAdmin,\n GovernanceAdmin,\n GovernanceProposal,\n BOsGovernanceProposal,\n HasValidatorContract\n{\n using Proposal for Proposal.ProposalDetail;\n using IsolatedGovernance for IsolatedGovernance.Vote;\n\n /// @dev Mapping from request hash => emergency poll\n mapping(bytes32 => IsolatedGovernance.Vote) internal _emergencyExitPoll;\n\n modifier onlyGovernor() {\n require(_getWeight(msg.sender) > 0, \"RoninGovernanceAdmin: sender is not governor\");\n _;\n }\n\n constructor(\n uint256 _roninChainId,\n address _roninTrustedOrganizationContract,\n address _bridgeContract,\n address _validatorContract,\n uint256 _proposalExpiryDuration\n ) GovernanceAdmin(_roninChainId, _roninTrustedOrganizationContract, _bridgeContract, _proposalExpiryDuration) {\n _setValidatorContract(_validatorContract);\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function setValidatorContract(address _addr) external override onlySelfCall {\n require(_addr.code.length > 0, \"RoninGovernanceAdmin: set to non-contract\");\n _setValidatorContract(_addr);\n }\n\n /**\n * @dev Returns the voted signatures for the proposals.\n *\n * Note: The signatures can be empty in case the proposal is voted on the current network.\n *\n */\n function getProposalSignatures(uint256 _chainId, uint256 _round)\n external\n view\n returns (\n address[] memory _voters,\n Ballot.VoteType[] memory _supports,\n Signature[] memory _signatures\n )\n {\n ProposalVote storage _vote = vote[_chainId][_round];\n\n uint256 _forLength = _vote.forVoteds.length;\n uint256 _againstLength = _vote.againstVoteds.length;\n uint256 _voterLength = _forLength + _againstLength;\n\n _supports = new Ballot.VoteType[](_voterLength);\n _signatures = new Signature[](_voterLength);\n _voters = new address[](_voterLength);\n for (uint256 _i; _i < _forLength; _i++) {\n _supports[_i] = Ballot.VoteType.For;\n _signatures[_i] = vote[_chainId][_round].sig[_vote.forVoteds[_i]];\n _voters[_i] = _vote.forVoteds[_i];\n }\n for (uint256 _i; _i < _againstLength; _i++) {\n _supports[_i + _forLength] = Ballot.VoteType.Against;\n _signatures[_i + _forLength] = vote[_chainId][_round].sig[_vote.againstVoteds[_i]];\n _voters[_i + _forLength] = _vote.againstVoteds[_i];\n }\n }\n\n /**\n * @dev Returns the voted signatures for bridge operators at a specific period.\n */\n function getBridgeOperatorVotingSignatures(uint256 _period, uint256 _epoch)\n external\n view\n returns (address[] memory _voters, Signature[] memory _signatures)\n {\n mapping(address => Signature) storage _sigMap = _bridgeVoterSig[_period][_epoch];\n _voters = _bridgeOperatorVote[_period][_epoch].voters;\n _signatures = new Signature[](_voters.length);\n for (uint _i; _i < _voters.length; _i++) {\n _signatures[_i] = _sigMap[_voters[_i]];\n }\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for the proposal.\n */\n function proposalVoted(\n uint256 _chainId,\n uint256 _round,\n address _voter\n ) external view returns (bool) {\n return _voted(vote[_chainId][_round], _voter);\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for bridge operators at a specific period.\n */\n function bridgeOperatorsVoted(\n uint256 _period,\n uint256 _epoch,\n address _voter\n ) external view returns (bool) {\n return _bridgeOperatorVote[_period][_epoch].voted(_voter);\n }\n\n /**\n * @dev Returns whether the voter casted vote for emergency exit poll.\n */\n function emergencyPollVoted(bytes32 _voteHash, address _voter) external view returns (bool) {\n return _emergencyExitPoll[_voteHash].voted(_voter);\n }\n\n /**\n * @dev See `CoreGovernance-_proposeProposal`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function propose(\n uint256 _chainId,\n uint256 _expiryTimestamp,\n address[] calldata _targets,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts\n ) external onlyGovernor {\n _proposeProposal(_chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts, msg.sender);\n }\n\n /**\n * @dev See `GovernanceProposal-_proposeProposalStructAndCastVotes`.\n *\n * Requirements:\n * - The method caller is governor.\n * - The proposal is for the current network.\n *\n */\n function proposeProposalStructAndCastVotes(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyGovernor {\n _proposeProposalStructAndCastVotes(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender);\n }\n\n /**\n * @dev Proposes and casts vote for a proposal on the current network.\n *\n * Requirements:\n * - The method caller is governor.\n * - The proposal is for the current network.\n *\n */\n function proposeProposalForCurrentNetwork(\n uint256 _expiryTimestamp,\n address[] calldata _targets,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts,\n Ballot.VoteType _support\n ) external onlyGovernor {\n address _voter = msg.sender;\n Proposal.ProposalDetail memory _proposal = _proposeProposal(\n block.chainid,\n _expiryTimestamp,\n _targets,\n _values,\n _calldatas,\n _gasAmounts,\n _voter\n );\n _castProposalVoteForCurrentNetwork(_voter, _proposal, _support);\n }\n\n /**\n * @dev Casts vote for a proposal on the current network.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function castProposalVoteForCurrentNetwork(Proposal.ProposalDetail calldata _proposal, Ballot.VoteType _support)\n external\n onlyGovernor\n {\n _castProposalVoteForCurrentNetwork(msg.sender, _proposal, _support);\n }\n\n /**\n * @dev See `GovernanceProposal-_castProposalBySignatures`.\n */\n function castProposalBySignatures(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external {\n _castProposalBySignatures(_proposal, _supports, _signatures, DOMAIN_SEPARATOR);\n }\n\n /**\n * @dev See `CoreGovernance-_proposeGlobal`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function proposeGlobal(\n uint256 _expiryTimestamp,\n GlobalProposal.TargetOption[] calldata _targetOptions,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts\n ) external onlyGovernor {\n _proposeGlobal(\n _expiryTimestamp,\n _targetOptions,\n _values,\n _calldatas,\n _gasAmounts,\n roninTrustedOrganizationContract(),\n bridgeContract(),\n msg.sender\n );\n }\n\n /**\n * @dev See `GovernanceProposal-_proposeGlobalProposalStructAndCastVotes`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function proposeGlobalProposalStructAndCastVotes(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyGovernor {\n _proposeGlobalProposalStructAndCastVotes(\n _globalProposal,\n _supports,\n _signatures,\n DOMAIN_SEPARATOR,\n roninTrustedOrganizationContract(),\n bridgeContract(),\n msg.sender\n );\n }\n\n /**\n * @dev See `GovernanceProposal-_castGlobalProposalBySignatures`.\n */\n function castGlobalProposalBySignatures(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external {\n _castGlobalProposalBySignatures(\n _globalProposal,\n _supports,\n _signatures,\n DOMAIN_SEPARATOR,\n roninTrustedOrganizationContract(),\n bridgeContract()\n );\n }\n\n /**\n * @dev Deletes the expired proposal by its chainId and nonce, without creating a new proposal.\n *\n * Requirements:\n * - The proposal is already created.\n *\n */\n function deleteExpired(uint256 _chainId, uint256 _round) external {\n ProposalVote storage _vote = vote[_chainId][_round];\n require(_vote.hash != bytes32(0), \"RoninGovernanceAdmin: query for empty voting\");\n _tryDeleteExpiredVotingRound(_vote);\n }\n\n /**\n * @dev See `BOsGovernanceProposal-_castVotesBySignatures`.\n */\n function voteBridgeOperatorsBySignatures(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures\n ) external {\n _castBOVotesBySignatures(_ballot, _signatures, _getMinimumVoteWeight(), DOMAIN_SEPARATOR);\n IsolatedGovernance.Vote storage _v = _bridgeOperatorVote[_ballot.period][_ballot.epoch];\n if (_v.status == VoteStatus.Approved) {\n _lastSyncedBridgeOperatorSetInfo = _ballot;\n emit BridgeOperatorsApproved(_ballot.period, _ballot.epoch, _ballot.operators);\n _v.status = VoteStatus.Executed;\n }\n }\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function createEmergencyExitPoll(\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) external onlyValidatorContract {\n bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\n IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash];\n _v.createdAt = block.timestamp;\n _v.expiredAt = _expiredAt;\n emit EmergencyExitPollCreated(_hash, _consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\n }\n\n /**\n * @dev Votes for an emergency exit. Executes to unlock fund for the emergency exit's requester.\n *\n * Requirements:\n * - The voter is governor.\n * - The voting is existent.\n * - The voting is not expired yet.\n *\n */\n function voteEmergencyExit(\n bytes32 _voteHash,\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) external onlyGovernor {\n address _voter = msg.sender;\n bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\n require(_voteHash == _hash, \"RoninGovernanceAdmin: invalid vote hash\");\n\n IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash];\n require(_v.createdAt > 0, \"RoninGovernanceAdmin: query for non-existent vote\");\n require(_v.status != VoteStatus.Expired, \"RoninGovernanceAdmin: query for expired vote\");\n\n _v.castVote(_voter, _hash);\n address[] memory _voters = _v.filterByHash(_hash);\n VoteStatus _stt = _v.syncVoteStatus(_getMinimumVoteWeight(), _sumGovernorWeights(_voters), 0, 0, _hash);\n if (_stt == VoteStatus.Approved) {\n _execReleaseLockedFundForEmergencyExitRequest(_consensusAddr, _recipientAfterUnlockedFund);\n emit EmergencyExitPollApproved(_hash);\n _v.status = VoteStatus.Executed;\n } else if (_stt == VoteStatus.Expired) {\n emit EmergencyExitPollExpired(_hash);\n }\n }\n\n /**\n * @inheritdoc GovernanceProposal\n */\n function _getWeight(address _governor) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.getGovernorWeight.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governor)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Returns the total weight of a list address of governors.\n */\n function _sumGovernorWeights(address[] memory _governors) internal view virtual returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumGovernorWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governors)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Returns the bridge voter weight.\n */\n function _getBridgeVoterWeight(address _governor) internal view virtual returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.getBridgeVoterWeight.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governor)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @inheritdoc BOsGovernanceProposal\n */\n function _isBridgeVoter(address _addr) internal view virtual override returns (bool) {\n return _getBridgeVoterWeight(_addr) > 0;\n }\n\n /**\n * @inheritdoc BOsGovernanceProposal\n */\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumBridgeVoterWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _bridgeVoters)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Trigger function from validator contract to unlock fund for emeregency exit request.\n */\n function _execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address _recipientAfterUnlockedFund)\n internal\n virtual\n {\n bytes4 _selector = _validatorContract.execReleaseLockedFundForEmergencyExitRequest.selector;\n (bool _success, ) = validatorContract().call(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _consensusAddr, _recipientAfterUnlockedFund)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n }\n\n /**\n * @dev See `CoreGovernance-_getChainType`.\n */\n function _getChainType() internal pure override returns (ChainType) {\n return ChainType.RoninChain;\n }\n\n /**\n * @dev See `castProposalVoteForCurrentNetwork`.\n */\n function _castProposalVoteForCurrentNetwork(\n address _voter,\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType _support\n ) internal {\n require(_proposal.chainId == block.chainid, \"RoninGovernanceAdmin: invalid chain id\");\n require(\n vote[_proposal.chainId][_proposal.nonce].hash == _proposal.hash(),\n \"RoninGovernanceAdmin: cast vote for invalid proposal\"\n );\n\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\n Signature memory _emptySignature;\n _castVote(\n _proposal,\n _support,\n _minimumForVoteWeight,\n _minimumAgainstVoteWeight,\n _voter,\n _emptySignature,\n _getWeight(_voter)\n );\n }\n}\n" + }, + "contracts/extensions/sequential-governance/GovernanceProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./CoreGovernance.sol\";\n\nabstract contract GovernanceProposal is CoreGovernance {\n using Proposal for Proposal.ProposalDetail;\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\n\n /**\n * @dev Casts votes by signatures.\n *\n * Note: This method does not verify the proposal hash with the vote hash. Please consider checking it before.\n *\n */\n function _castVotesBySignatures(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _forDigest,\n bytes32 _againstDigest\n ) internal {\n require(_supports.length > 0 && _supports.length == _signatures.length, \"GovernanceProposal: invalid array length\");\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\n\n address _lastSigner;\n address _signer;\n Signature calldata _sig;\n bool _hasValidVotes;\n for (uint256 _i; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n\n if (_supports[_i] == Ballot.VoteType.For) {\n _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s);\n } else if (_supports[_i] == Ballot.VoteType.Against) {\n _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s);\n } else {\n revert(\"GovernanceProposal: query for unsupported vote type\");\n }\n\n require(_lastSigner < _signer, \"GovernanceProposal: invalid order\");\n _lastSigner = _signer;\n\n uint256 _weight = _getWeight(_signer);\n if (_weight > 0) {\n _hasValidVotes = true;\n if (\n _castVote(_proposal, _supports[_i], _minimumForVoteWeight, _minimumAgainstVoteWeight, _signer, _sig, _weight)\n ) {\n return;\n }\n }\n }\n\n require(_hasValidVotes, \"GovernanceProposal: invalid signatures\");\n }\n\n /**\n * @dev Proposes a proposal struct and casts votes by signature.\n */\n function _proposeProposalStructAndCastVotes(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _creator\n ) internal {\n _proposeProposalStruct(_proposal, _creator);\n bytes32 _proposalHash = _proposal.hash();\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes a proposal struct and casts votes by signature.\n */\n function _castProposalBySignatures(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator\n ) internal {\n bytes32 _proposalHash = _proposal.hash();\n require(\n vote[_proposal.chainId][_proposal.nonce].hash == _proposalHash,\n \"GovernanceAdmin: cast vote for invalid proposal\"\n );\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes and votes by signature.\n */\n function _proposeGlobalProposalStructAndCastVotes(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal returns (Proposal.ProposalDetail memory _proposal) {\n _proposal = _proposeGlobalStruct(_globalProposal, _roninTrustedOrganizationContract, _gatewayContract, _creator);\n bytes32 _globalProposalHash = _globalProposal.hash();\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes a global proposal struct and casts votes by signature.\n */\n function _castGlobalProposalBySignatures(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _roninTrustedOrganizationContract,\n address _gatewayContract\n ) internal {\n Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail(\n _roninTrustedOrganizationContract,\n _gatewayContract\n );\n bytes32 _globalProposalHash = _globalProposal.hash();\n require(vote[0][_proposal.nonce].hash == _proposal.hash(), \"GovernanceAdmin: cast vote for invalid proposal\");\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Returns the weight of a governor.\n */\n function _getWeight(address _governor) internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/collections/HasValidatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasValidatorContract.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\n\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\n IRoninValidatorSet internal _validatorContract;\n\n modifier onlyValidatorContract() {\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\n _;\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function validatorContract() public view override returns (address) {\n return address(_validatorContract);\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setValidatorContract(_addr);\n }\n\n /**\n * @dev Sets the validator contract.\n *\n * Emits the event `ValidatorContractUpdated`.\n *\n */\n function _setValidatorContract(address _addr) internal {\n _validatorContract = IRoninValidatorSet(_addr);\n emit ValidatorContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/GovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../extensions/sequential-governance/CoreGovernance.sol\";\nimport \"../extensions/collections/HasRoninTrustedOrganizationContract.sol\";\nimport \"../extensions/collections/HasBridgeContract.sol\";\nimport \"../interfaces/IRoninTrustedOrganization.sol\";\n\nabstract contract GovernanceAdmin is CoreGovernance, HasRoninTrustedOrganizationContract, HasBridgeContract {\n uint256 public roninChainId;\n /// @dev Domain separator\n bytes32 public DOMAIN_SEPARATOR;\n\n error ErrProxyCallFailed(bytes4 methodSignature);\n\n modifier onlySelfCall() {\n require(msg.sender == address(this), \"GovernanceAdmin: only allowed self-call\");\n _;\n }\n\n constructor(\n uint256 _roninChainId,\n address _roninTrustedOrganizationContract,\n address _bridgeContract,\n uint256 _proposalExpiryDuration\n ) CoreGovernance(_proposalExpiryDuration) {\n roninChainId = _roninChainId;\n DOMAIN_SEPARATOR = keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,bytes32 salt)\"),\n keccak256(\"GovernanceAdmin\"), // name hash\n keccak256(\"2\"), // version hash\n keccak256(abi.encode(\"RONIN_GOVERNANCE_ADMIN\", _roninChainId)) // salt\n )\n );\n _setRoninTrustedOrganizationContract(_roninTrustedOrganizationContract);\n _setBridgeContract(_bridgeContract);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function setRoninTrustedOrganizationContract(address _addr) external override onlySelfCall {\n require(_addr.code.length > 0, \"GovernanceAdmin: set to non-contract\");\n _setRoninTrustedOrganizationContract(_addr);\n }\n\n /**\n * @inheritdoc IHasBridgeContract\n */\n function setBridgeContract(address _addr) external override onlySelfCall {\n require(_addr.code.length > 0, \"GovernanceAdmin: set to non-contract\");\n _setBridgeContract(_addr);\n }\n\n /**\n * @dev Sets the expiry duration for a new proposal.\n *\n * Requirements:\n * - Only allowing self-call to this method, since this contract does not have admin.\n *\n */\n function setProposalExpiryDuration(uint256 _expiryDuration) external onlySelfCall {\n _setProposalExpiryDuration(_expiryDuration);\n }\n\n /**\n * @dev Returns the current implementation of `_proxy`.\n *\n * Requirements:\n * - This contract must be the admin of `_proxy`.\n *\n */\n function getProxyImplementation(address _proxy) external view returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n bytes4 _selector = 0x5c60da1b;\n (bool _success, bytes memory _returndata) = _proxy.staticcall(abi.encodeWithSelector(_selector));\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (address));\n }\n\n /**\n * @dev Returns the proposal expiry duration.\n */\n function getProposalExpiryDuration() external view returns (uint256) {\n return super._getProposalExpiryDuration();\n }\n\n /**\n * @dev Returns the current admin of `_proxy`.\n *\n * Requirements:\n * - This contract must be the admin of `_proxy`.\n *\n */\n function getProxyAdmin(address _proxy) external view returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n bytes4 _selector = 0xf851a440;\n (bool _success, bytes memory _returndata) = _proxy.staticcall(abi.encodeWithSelector(_selector));\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `_proxy` to `newAdmin`.\n *\n * Requirements:\n * - This contract must be the current admin of `_proxy`.\n *\n */\n function changeProxyAdmin(address _proxy, address _newAdmin) external onlySelfCall {\n // bytes4(keccak256(\"changeAdmin(address)\"))\n bytes4 _selector = 0x8f283970;\n (bool _success, ) = _proxy.call(abi.encodeWithSelector(_selector, _newAdmin));\n if (!_success) revert ErrProxyCallFailed(_selector);\n }\n\n /**\n * @dev Override `CoreGovernance-_getMinimumVoteWeight`.\n */\n function _getMinimumVoteWeight() internal view virtual override returns (uint256) {\n bytes4 _selector = IQuorum.minimumVoteWeight.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Override `CoreGovernance-_getTotalWeights`.\n */\n function _getTotalWeights() internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.totalWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n}\n" + }, + "contracts/libraries/EmergencyExitBallot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary EmergencyExitBallot {\n // keccak256(\"EmergencyExitBallot(address consensusAddress,address recipientAfterUnlockedFund,uint256 requestedAt,uint256 expiredAt)\");\n bytes32 public constant EMERGENCY_EXIT_BALLOT_TYPEHASH =\n 0x697acba4deaf1a718d8c2d93e42860488cb7812696f28ca10eed17bac41e7027;\n\n /**\n * @dev Returns hash of the ballot.\n */\n function hash(\n address _consensusAddress,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n EMERGENCY_EXIT_BALLOT_TYPEHASH,\n _consensusAddress,\n _recipientAfterUnlockedFund,\n _requestedAt,\n _expiredAt\n )\n );\n }\n}\n" + }, + "contracts/extensions/sequential-governance/CoreGovernance.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../../libraries/Proposal.sol\";\nimport \"../../libraries/GlobalProposal.sol\";\nimport \"../../libraries/Ballot.sol\";\nimport \"../../interfaces/consumers/ChainTypeConsumer.sol\";\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\n\nabstract contract CoreGovernance is SignatureConsumer, VoteStatusConsumer, ChainTypeConsumer {\n using Proposal for Proposal.ProposalDetail;\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\n\n struct ProposalVote {\n VoteStatus status;\n bytes32 hash;\n uint256 againstVoteWeight; // Total weight of against votes\n uint256 forVoteWeight; // Total weight of for votes\n address[] forVoteds; // Array of addresses voting for\n address[] againstVoteds; // Array of addresses voting against\n uint256 expiryTimestamp;\n mapping(address => Signature) sig;\n mapping(address => bool) voted;\n }\n\n /// @dev Emitted when a proposal is created\n event ProposalCreated(\n uint256 indexed chainId,\n uint256 indexed round,\n bytes32 indexed proposalHash,\n Proposal.ProposalDetail proposal,\n address creator\n );\n /// @dev Emitted when a proposal is created\n event GlobalProposalCreated(\n uint256 indexed round,\n bytes32 indexed proposalHash,\n Proposal.ProposalDetail proposal,\n bytes32 globalProposalHash,\n GlobalProposal.GlobalProposalDetail globalProposal,\n address creator\n );\n /// @dev Emitted when the proposal is voted\n event ProposalVoted(bytes32 indexed proposalHash, address indexed voter, Ballot.VoteType support, uint256 weight);\n /// @dev Emitted when the proposal is approved\n event ProposalApproved(bytes32 indexed proposalHash);\n /// @dev Emitted when the vote is reject\n event ProposalRejected(bytes32 indexed proposalHash);\n /// @dev Emitted when the vote is expired\n event ProposalExpired(bytes32 indexed proposalHash);\n /// @dev Emitted when the proposal is executed\n event ProposalExecuted(bytes32 indexed proposalHash, bool[] successCalls, bytes[] returnDatas);\n\n /// @dev Mapping from chain id => vote round\n /// @notice chain id = 0 for global proposal\n mapping(uint256 => uint256) public round;\n /// @dev Mapping from chain id => vote round => proposal vote\n mapping(uint256 => mapping(uint256 => ProposalVote)) public vote;\n\n uint256 private _proposalExpiryDuration;\n\n constructor(uint256 _expiryDuration) {\n _setProposalExpiryDuration(_expiryDuration);\n }\n\n /**\n * @dev Creates new voting round by calculating the `_round` number of chain `_chainId`.\n * Increases the `_round` number if the previous one is not expired. Delete the previous proposal\n * if it is expired and not increase the `_round`.\n */\n function _createVotingRound(uint256 _chainId) internal returns (uint256 _round) {\n _round = round[_chainId];\n // Skip checking for the first ever round\n if (_round == 0) {\n _round = round[_chainId] = 1;\n } else {\n ProposalVote storage _latestProposalVote = vote[_chainId][_round];\n bool _isExpired = _tryDeleteExpiredVotingRound(_latestProposalVote);\n // Skip increasing round number if the latest round is expired, allow the vote to be overridden\n if (!_isExpired) {\n require(_latestProposalVote.status != VoteStatus.Pending, \"CoreGovernance: current proposal is not completed\");\n _round = ++round[_chainId];\n }\n }\n }\n\n /**\n * @dev Saves new round voting for the proposal `_proposalHash` of chain `_chainId`.\n */\n function _saveVotingRound(\n ProposalVote storage _vote,\n bytes32 _proposalHash,\n uint256 _expiryTimestamp\n ) internal {\n _vote.hash = _proposalHash;\n _vote.expiryTimestamp = _expiryTimestamp;\n }\n\n /**\n * @dev Proposes for a new proposal.\n *\n * Requirements:\n * - The chain id is not equal to 0.\n *\n * Emits the `ProposalCreated` event.\n *\n */\n function _proposeProposal(\n uint256 _chainId,\n uint256 _expiryTimestamp,\n address[] memory _targets,\n uint256[] memory _values,\n bytes[] memory _calldatas,\n uint256[] memory _gasAmounts,\n address _creator\n ) internal virtual returns (Proposal.ProposalDetail memory _proposal) {\n require(_chainId != 0, \"CoreGovernance: invalid chain id\");\n uint256 _round = _createVotingRound(_chainId);\n\n _proposal = Proposal.ProposalDetail(_round, _chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts);\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n _saveVotingRound(vote[_chainId][_round], _proposalHash, _expiryTimestamp);\n emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator);\n }\n\n /**\n * @dev Proposes proposal struct.\n *\n * Requirements:\n * - The chain id is not equal to 0.\n * - The proposal nonce is equal to the new round.\n *\n * Emits the `ProposalCreated` event.\n *\n */\n function _proposeProposalStruct(Proposal.ProposalDetail memory _proposal, address _creator)\n internal\n virtual\n returns (uint256 _round)\n {\n uint256 _chainId = _proposal.chainId;\n require(_chainId != 0, \"CoreGovernance: invalid chain id\");\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n _round = _createVotingRound(_chainId);\n _saveVotingRound(vote[_chainId][_round], _proposalHash, _proposal.expiryTimestamp);\n require(_round == _proposal.nonce, \"CoreGovernance: invalid proposal nonce\");\n emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator);\n }\n\n /**\n * @dev Proposes for a global proposal.\n *\n * Emits the `GlobalProposalCreated` event.\n *\n */\n function _proposeGlobal(\n uint256 _expiryTimestamp,\n GlobalProposal.TargetOption[] calldata _targetOptions,\n uint256[] memory _values,\n bytes[] memory _calldatas,\n uint256[] memory _gasAmounts,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal virtual {\n uint256 _round = _createVotingRound(0);\n GlobalProposal.GlobalProposalDetail memory _globalProposal = GlobalProposal.GlobalProposalDetail(\n _round,\n _expiryTimestamp,\n _targetOptions,\n _values,\n _calldatas,\n _gasAmounts\n );\n Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail(\n _roninTrustedOrganizationContract,\n _gatewayContract\n );\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n _saveVotingRound(vote[0][_round], _proposalHash, _expiryTimestamp);\n emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator);\n }\n\n /**\n * @dev Proposes global proposal struct.\n *\n * Requirements:\n * - The proposal nonce is equal to the new round.\n *\n * Emits the `GlobalProposalCreated` event.\n *\n */\n function _proposeGlobalStruct(\n GlobalProposal.GlobalProposalDetail memory _globalProposal,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal virtual returns (Proposal.ProposalDetail memory _proposal) {\n _proposal = _globalProposal.into_proposal_detail(_roninTrustedOrganizationContract, _gatewayContract);\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n uint256 _round = _createVotingRound(0);\n _saveVotingRound(vote[0][_round], _proposalHash, _globalProposal.expiryTimestamp);\n require(_round == _proposal.nonce, \"CoreGovernance: invalid proposal nonce\");\n emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator);\n }\n\n /**\n * @dev Casts vote for the proposal with data and returns whether the voting is done.\n *\n * Requirements:\n * - The proposal nonce is equal to the round.\n * - The vote is not finalized.\n * - The voter has not voted for the round.\n *\n * Emits the `ProposalVoted` event. Emits the `ProposalApproved`, `ProposalExecuted` or `ProposalRejected` once the\n * proposal is approved, executed or rejected.\n *\n */\n function _castVote(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType _support,\n uint256 _minimumForVoteWeight,\n uint256 _minimumAgainstVoteWeight,\n address _voter,\n Signature memory _signature,\n uint256 _voterWeight\n ) internal virtual returns (bool _done) {\n uint256 _chainId = _proposal.chainId;\n uint256 _round = _proposal.nonce;\n ProposalVote storage _vote = vote[_chainId][_round];\n\n if (_tryDeleteExpiredVotingRound(_vote)) {\n return true;\n }\n\n require(round[_proposal.chainId] == _round, \"CoreGovernance: query for invalid proposal nonce\");\n require(_vote.status == VoteStatus.Pending, \"CoreGovernance: the vote is finalized\");\n if (_voted(_vote, _voter)) {\n revert(string(abi.encodePacked(\"CoreGovernance: \", Strings.toHexString(uint160(_voter), 20), \" already voted\")));\n }\n\n _vote.voted[_voter] = true;\n // Stores the signature if it is not empty\n if (_signature.r > 0 || _signature.s > 0 || _signature.v > 0) {\n _vote.sig[_voter] = _signature;\n }\n emit ProposalVoted(_vote.hash, _voter, _support, _voterWeight);\n\n uint256 _forVoteWeight;\n uint256 _againstVoteWeight;\n if (_support == Ballot.VoteType.For) {\n _vote.forVoteds.push(_voter);\n _forVoteWeight = _vote.forVoteWeight += _voterWeight;\n } else if (_support == Ballot.VoteType.Against) {\n _vote.againstVoteds.push(_voter);\n _againstVoteWeight = _vote.againstVoteWeight += _voterWeight;\n } else {\n revert(\"CoreGovernance: unsupported vote type\");\n }\n\n if (_forVoteWeight >= _minimumForVoteWeight) {\n _done = true;\n _vote.status = VoteStatus.Approved;\n emit ProposalApproved(_vote.hash);\n _tryExecute(_vote, _proposal);\n } else if (_againstVoteWeight >= _minimumAgainstVoteWeight) {\n _done = true;\n _vote.status = VoteStatus.Rejected;\n emit ProposalRejected(_vote.hash);\n }\n }\n\n /**\n * @dev When the contract is on Ronin chain, checks whether the proposal is expired and delete it if is expired.\n *\n * Emits the event `ProposalExpired` if the vote is expired.\n *\n * Note: This function assumes the vote `_proposalVote` is already created, consider verifying the vote's existence\n * before or it will emit an unexpected event of `ProposalExpired`.\n */\n function _tryDeleteExpiredVotingRound(ProposalVote storage _proposalVote) internal returns (bool _isExpired) {\n _isExpired =\n _getChainType() == ChainType.RoninChain &&\n _proposalVote.status == VoteStatus.Pending &&\n _proposalVote.expiryTimestamp <= block.timestamp;\n\n if (_isExpired) {\n emit ProposalExpired(_proposalVote.hash);\n\n for (uint256 _i; _i < _proposalVote.forVoteds.length; _i++) {\n delete _proposalVote.voted[_proposalVote.forVoteds[_i]];\n delete _proposalVote.sig[_proposalVote.forVoteds[_i]];\n }\n for (uint256 _i; _i < _proposalVote.againstVoteds.length; _i++) {\n delete _proposalVote.voted[_proposalVote.againstVoteds[_i]];\n delete _proposalVote.sig[_proposalVote.againstVoteds[_i]];\n }\n delete _proposalVote.status;\n delete _proposalVote.hash;\n delete _proposalVote.againstVoteWeight;\n delete _proposalVote.forVoteWeight;\n delete _proposalVote.forVoteds;\n delete _proposalVote.againstVoteds;\n delete _proposalVote.expiryTimestamp;\n }\n }\n\n /**\n * @dev Executes the proposal and update the vote status once the proposal is executable.\n */\n function _tryExecute(ProposalVote storage _vote, Proposal.ProposalDetail memory _proposal) internal {\n if (_proposal.executable()) {\n _vote.status = VoteStatus.Executed;\n (bool[] memory _successCalls, bytes[] memory _returnDatas) = _proposal.execute();\n emit ProposalExecuted(_vote.hash, _successCalls, _returnDatas);\n }\n }\n\n /**\n * @dev Sets the expiry duration for a new proposal.\n */\n function _setProposalExpiryDuration(uint256 _expiryDuration) internal {\n _proposalExpiryDuration = _expiryDuration;\n }\n\n /**\n * @dev Returns whether the voter casted for the proposal.\n */\n function _voted(ProposalVote storage _vote, address _voter) internal view returns (bool) {\n return _vote.voted[_voter];\n }\n\n /**\n * @dev Returns the expiry duration for a new proposal.\n */\n function _getProposalExpiryDuration() internal view returns (uint256) {\n return _proposalExpiryDuration;\n }\n\n /**\n * @dev Returns total weight from validators.\n */\n function _getTotalWeights() internal view virtual returns (uint256);\n\n /**\n * @dev Returns minimum vote to pass a proposal.\n */\n function _getMinimumVoteWeight() internal view virtual returns (uint256);\n\n /**\n * @dev Returns current context is running on whether Ronin chain or on mainchain.\n */\n function _getChainType() internal view virtual returns (ChainType);\n}\n" + }, + "contracts/libraries/Proposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary Proposal {\n struct ProposalDetail {\n // Nonce to make sure proposals are executed in order\n uint256 nonce;\n // Value 0: all chain should run this proposal\n // Other values: only specifc chain has to execute\n uint256 chainId;\n uint256 expiryTimestamp;\n address[] targets;\n uint256[] values;\n bytes[] calldatas;\n uint256[] gasAmounts;\n }\n\n // keccak256(\"ProposalDetail(uint256 nonce,uint256 chainId,uint256 expiryTimestamp,address[] targets,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\");\n bytes32 public constant TYPE_HASH = 0xd051578048e6ff0bbc9fca3b65a42088dbde10f36ca841de566711087ad9b08a;\n\n /**\n * @dev Validates the proposal.\n */\n function validate(ProposalDetail memory _proposal, uint256 _maxExpiryDuration) internal view {\n require(\n _proposal.targets.length > 0 &&\n _proposal.targets.length == _proposal.values.length &&\n _proposal.targets.length == _proposal.calldatas.length &&\n _proposal.targets.length == _proposal.gasAmounts.length,\n \"Proposal: invalid array length\"\n );\n require(_proposal.expiryTimestamp <= block.timestamp + _maxExpiryDuration, \"Proposal: invalid expiry timestamp\");\n }\n\n /**\n * @dev Returns struct hash of the proposal.\n */\n function hash(ProposalDetail memory _proposal) internal pure returns (bytes32) {\n bytes32 _targetsHash;\n bytes32 _valuesHash;\n bytes32 _calldatasHash;\n bytes32 _gasAmountsHash;\n\n uint256[] memory _values = _proposal.values;\n address[] memory _targets = _proposal.targets;\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _calldataHashList.length; _i++) {\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\n }\n\n assembly {\n _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32))\n _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32))\n _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32))\n _gasAmountsHash := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32))\n }\n\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _proposal.nonce,\n _proposal.chainId,\n _proposal.expiryTimestamp,\n _targetsHash,\n _valuesHash,\n _calldatasHash,\n _gasAmountsHash\n )\n );\n }\n\n /**\n * @dev Returns whether the proposal is executable for the current chain.\n *\n * @notice Does not check whether the call result is successful or not. Please use `execute` instead.\n *\n */\n function executable(ProposalDetail memory _proposal) internal view returns (bool _result) {\n return _proposal.chainId == 0 || _proposal.chainId == block.chainid;\n }\n\n /**\n * @dev Executes the proposal.\n */\n function execute(ProposalDetail memory _proposal)\n internal\n returns (bool[] memory _successCalls, bytes[] memory _returnDatas)\n {\n require(executable(_proposal), \"Proposal: query for invalid chainId\");\n _successCalls = new bool[](_proposal.targets.length);\n _returnDatas = new bytes[](_proposal.targets.length);\n for (uint256 _i = 0; _i < _proposal.targets.length; ++_i) {\n require(gasleft() > _proposal.gasAmounts[_i], \"Proposal: insufficient gas\");\n\n (_successCalls[_i], _returnDatas[_i]) = _proposal.targets[_i].call{\n value: _proposal.values[_i],\n gas: _proposal.gasAmounts[_i]\n }(_proposal.calldatas[_i]);\n }\n }\n}\n" + }, + "contracts/libraries/GlobalProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Proposal.sol\";\n\nlibrary GlobalProposal {\n enum TargetOption {\n RoninTrustedOrganizationContract,\n GatewayContract\n }\n\n struct GlobalProposalDetail {\n // Nonce to make sure proposals are executed in order\n uint256 nonce;\n uint256 expiryTimestamp;\n TargetOption[] targetOptions;\n uint256[] values;\n bytes[] calldatas;\n uint256[] gasAmounts;\n }\n\n // keccak256(\"GlobalProposalDetail(uint256 nonce,uint256 expiryTimestamp,uint8[] targetOptions,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\");\n bytes32 public constant TYPE_HASH = 0x1463f426c05aff2c1a7a0957a71c9898bc8b47142540538e79ee25ee91141350;\n\n /**\n * @dev Returns struct hash of the proposal.\n */\n function hash(GlobalProposalDetail memory _proposal) internal pure returns (bytes32) {\n bytes32 _targetsHash;\n bytes32 _valuesHash;\n bytes32 _calldatasHash;\n bytes32 _gasAmountsHash;\n\n uint256[] memory _values = _proposal.values;\n TargetOption[] memory _targets = _proposal.targetOptions;\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _calldataHashList.length; _i++) {\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\n }\n\n assembly {\n _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32))\n _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32))\n _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32))\n _gasAmountsHash := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32))\n }\n\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _proposal.nonce,\n _proposal.expiryTimestamp,\n _targetsHash,\n _valuesHash,\n _calldatasHash,\n _gasAmountsHash\n )\n );\n }\n\n /**\n * @dev Converts into the normal proposal.\n */\n function into_proposal_detail(\n GlobalProposalDetail memory _proposal,\n address _roninTrustedOrganizationContract,\n address _gatewayContract\n ) internal pure returns (Proposal.ProposalDetail memory _detail) {\n _detail.nonce = _proposal.nonce;\n _detail.expiryTimestamp = _proposal.expiryTimestamp;\n _detail.chainId = 0;\n _detail.targets = new address[](_proposal.targetOptions.length);\n _detail.values = _proposal.values;\n _detail.calldatas = _proposal.calldatas;\n _detail.gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _proposal.targetOptions.length; _i++) {\n if (_proposal.targetOptions[_i] == TargetOption.GatewayContract) {\n _detail.targets[_i] = _gatewayContract;\n } else if (_proposal.targetOptions[_i] == TargetOption.RoninTrustedOrganizationContract) {\n _detail.targets[_i] = _roninTrustedOrganizationContract;\n } else {\n revert(\"GlobalProposal: unsupported target\");\n }\n }\n }\n}\n" + }, + "contracts/libraries/Ballot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary Ballot {\n using ECDSA for bytes32;\n\n enum VoteType {\n For,\n Against\n }\n\n // keccak256(\"Ballot(bytes32 proposalHash,uint8 support)\");\n bytes32 public constant BALLOT_TYPEHASH = 0xd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c2;\n\n function hash(bytes32 _proposalHash, VoteType _support) internal pure returns (bytes32) {\n return keccak256(abi.encode(BALLOT_TYPEHASH, _proposalHash, _support));\n }\n}\n" + }, + "contracts/interfaces/consumers/ChainTypeConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface ChainTypeConsumer {\n enum ChainType {\n RoninChain,\n Mainchain\n }\n}\n" + }, + "contracts/extensions/collections/HasProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/StorageSlot.sol\";\n\nabstract contract HasProxyAdmin {\n // bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n modifier onlyAdmin() {\n require(msg.sender == _getAdmin(), \"HasProxyAdmin: unauthorized sender\");\n _;\n }\n\n /**\n * @dev Returns proxy admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n}\n" + }, + "contracts/interfaces/collections/IHasValidatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasValidatorContract is IHasContract {\n /// @dev Emitted when the validator contract is updated.\n event ValidatorContractUpdated(address);\n\n /// @dev Error of method caller must be validator contract.\n error ErrCallerMustBeValidatorContract();\n\n /**\n * @dev Returns the validator contract.\n */\n function validatorContract() external view returns (address);\n\n /**\n * @dev Sets the validator contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `ValidatorContractUpdated`.\n *\n */\n function setValidatorContract(address) external;\n}\n" + }, + "contracts/interfaces/validator/IRoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ICandidateManager.sol\";\nimport \"./info-fragments/ICommonInfo.sol\";\nimport \"./ICoinbaseExecution.sol\";\nimport \"./ISlashingExecution.sol\";\nimport \"./IEmergencyExit.sol\";\n\ninterface IRoninValidatorSet is\n ICandidateManager,\n ICommonInfo,\n ISlashingExecution,\n ICoinbaseExecution,\n IEmergencyExit\n{}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "contracts/interfaces/collections/IHasContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IHasContract {\n /// @dev Error of set to non-contract.\n error ErrZeroCodeContract();\n}\n" + }, + "contracts/interfaces/validator/ICandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ICandidateManager {\n struct ValidatorCandidate {\n // Admin of the candidate\n address admin;\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n address consensusAddr;\n // Address that receives mining reward of the validator\n address payable treasuryAddr;\n // Address of the bridge operator corresponding to the candidate\n address bridgeOperatorAddr;\n // The percentage of reward that validators can be received, the rest goes to the delegators.\n // Values in range [0; 100_00] stands for 0-100%\n uint256 commissionRate;\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\n uint256 revokingTimestamp;\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\n uint256 topupDeadline;\n }\n\n struct CommissionSchedule {\n // The timestamp that the commission schedule gets affected (no schedule=0).\n uint256 effectiveTimestamp;\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\n uint256 commissionRate;\n }\n\n /// @dev Emitted when the maximum number of validator candidates is updated.\n event MaxValidatorCandidateUpdated(uint256 threshold);\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\n /// @dev Emitted when the validator candidate is granted.\n event CandidateGranted(\n address indexed consensusAddr,\n address indexed treasuryAddr,\n address indexed admin,\n address bridgeOperator\n );\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\n /// @dev Emitted when the topup deadline of a candidate is updated.\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\n /// @dev Emitted when the validator candidate is revoked.\n event CandidatesRevoked(address[] consensusAddrs);\n\n /// @dev Emitted when a schedule for updating commission rate is set.\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\n /// @dev Emitted when the commission rate of a validator is updated.\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\n\n /// @dev Error of exceeding maximum number of candidates.\n error ErrExceedsMaxNumberOfCandidate();\n /// @dev Error of querying for already existent candidate.\n error ErrExistentCandidate();\n /// @dev Error of querying for non-existent candidate.\n error ErrNonExistentCandidate();\n /// @dev Error of candidate admin already exists.\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\n /// @dev Error of treasury already exists.\n error ErrExistentTreasury(address _treasuryAddr);\n /// @dev Error of bridge operator already exists.\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\n /// @dev Error of invalid commission rate.\n error ErrInvalidCommissionRate();\n /// @dev Error of invalid effective days onwards.\n error ErrInvalidEffectiveDaysOnwards();\n /// @dev Error of invalid min effective days onwards.\n error ErrInvalidMinEffectiveDaysOnwards();\n /// @dev Error of already requested revoking candidate before.\n error ErrAlreadyRequestedRevokingCandidate();\n /// @dev Error of commission change schedule exists.\n error ErrAlreadyRequestedUpdatingCommissionRate();\n /// @dev Error of trusted org cannot renounce.\n error ErrTrustedOrgCannotRenounce();\n\n /**\n * @dev Returns the maximum number of validator candidate.\n */\n function maxValidatorCandidate() external view returns (uint256);\n\n /**\n * @dev Returns the minimum number of days to the effective date of commission rate change.\n */\n function minEffectiveDaysOnwards() external view returns (uint256);\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function setMaxValidatorCandidate(uint256) external;\n\n /**\n * @dev Sets the minimum number of days to the effective date of commision rate change.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\n\n /**\n * @dev Grants a validator candidate.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateGranted`.\n *\n */\n function execApplyValidatorCandidate(\n address _admin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external;\n\n /**\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateRevokingTimestampUpdated`.\n *\n */\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\n\n /**\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\n *\n * Requirements:\n * - The method caller is the staking contract.\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\n * - The `_rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdateScheduled`.\n *\n */\n function execRequestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveTimestamp,\n uint256 _rate\n ) external;\n\n /**\n * @dev Returns whether the address is a validator (candidate).\n */\n function isValidatorCandidate(address _addr) external view returns (bool);\n\n /**\n * @dev Returns the validator candidate.\n */\n function getValidatorCandidates() external view returns (address[] memory);\n\n /**\n * @dev Returns all candidate info.\n */\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\n\n /**\n * @dev Returns the info of a candidate.\n */\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\n\n /**\n * @dev Returns whether the address is the candidate admin.\n */\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\n\n /**\n * @dev Returns the schedule of changing commission rate of a candidate address.\n */\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ICommonInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IJailingInfo.sol\";\nimport \"./ITimingInfo.sol\";\nimport \"./IValidatorInfo.sol\";\n\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\n struct EmergencyExitInfo {\n uint256 lockedAmount;\n // The timestamp that this locked amount will be recycled to staking vesting contract\n uint256 recyclingAt;\n }\n\n /// @dev Emitted when the deprecated reward is withdrawn.\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\n /// @dev Emitted when the deprecated reward withdrawal is failed\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\n\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\n error ErrUnauthorizedReceiveRON();\n /// @dev Error thrown when queries for a non existent info.\n error NonExistentRecyclingInfo();\n\n /**\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\n */\n function totalDeprecatedReward() external view returns (uint256);\n\n /**\n * @dev Returns the emergency exit request.\n */\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\n}\n" + }, + "contracts/interfaces/validator/ICoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashingExecution.sol\";\n\ninterface ICoinbaseExecution is ISlashingExecution {\n enum BlockRewardDeprecatedType {\n UNKNOWN,\n UNAVAILABILITY,\n AFTER_BAILOUT\n }\n\n /// @dev Emitted when the validator set is updated\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated.\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\n\n /// @dev Emitted when the reward of the block producer is deprecated.\n event BlockRewardDeprecated(\n address indexed coinbaseAddr,\n uint256 rewardAmount,\n BlockRewardDeprecatedType deprecatedType\n );\n /// @dev Emitted when the block reward is submitted.\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\n\n /// @dev Emitted when the block producer reward is distributed.\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\n /// @dev Emitted when the contract fails when distributing the block producer reward.\n event MiningRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the bridge operator reward is distributed.\n event BridgeOperatorRewardDistributed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipientAddr,\n uint256 amount\n );\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\n event BridgeOperatorRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\n event StakingRewardDistributionFailed(\n uint256 totalAmount,\n address[] consensusAddrs,\n uint256[] amounts,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the epoch is wrapped up.\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\n /// @dev Emitted when the bridge tracking contract's response is incorrect\n event BridgeTrackingIncorrectlyResponded();\n\n /// @dev Error of method caller must be coinbase\n error ErrCallerMustBeCoinbase();\n /// @dev Error of only allowed at the end of epoch\n error ErrAtEndOfEpochOnly();\n /// @dev Error of query for already wrapped up epoch\n error ErrAlreadyWrappedEpoch();\n\n /**\n * @dev Submits reward of the current block.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\n * Emits the event `BlockRewardSubmitted` for the valid call.\n *\n */\n function submitBlockReward() external payable;\n\n /**\n * @dev Wraps up the current epoch.\n *\n * Requirements:\n * - The method must be called when the current epoch is ending.\n * - The epoch is not wrapped yet.\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\n * Emits the event `WrappedUpEpoch`.\n *\n */\n function wrapUpEpoch() external payable;\n}\n" + }, + "contracts/interfaces/validator/ISlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ISlashingExecution {\n /// @dev Emitted when the validator is punished.\n event ValidatorPunished(\n address indexed consensusAddr,\n uint256 indexed period,\n uint256 jailedUntil,\n uint256 deductedStakingAmount,\n bool blockProducerRewardDeprecated,\n bool bridgeOperatorRewardDeprecated\n );\n /// @dev Emitted when the validator get out of jail by bailout.\n event ValidatorUnjailed(address indexed validator, uint256 period);\n\n /// @dev Error of cannot bailout due to high tier slash.\n error ErrCannotBailout(address validator);\n\n /**\n * @dev Finalize the slash request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorPunished`.\n *\n */\n function execSlash(\n address _validatorAddr,\n uint256 _newJailedUntil,\n uint256 _slashAmount,\n bool _cannotBailout\n ) external;\n\n /**\n * @dev Finalize the bailout request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorUnjailed`.\n *\n */\n function execBailOut(address _validatorAddr, uint256 _period) external;\n}\n" + }, + "contracts/interfaces/validator/IEmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IEmergencyExit {\n /// @dev Emitted when the fund is locked from an emergency exit request\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\n event EmergencyExitLockedFundReleased(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount\n );\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\n event EmergencyExitLockedFundReleasingFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the emergency exit locked amount is updated.\n event EmergencyExitLockedAmountUpdated(uint256 amount);\n /// @dev Emitted when the emergency expiry duration is updated.\n event EmergencyExpiryDurationUpdated(uint256 amount);\n\n /// @dev Error of already requested emergency exit before.\n error ErrAlreadyRequestedEmergencyExit();\n\n /**\n * @dev Returns the amount of RON to lock from a consensus address.\n */\n function emergencyExitLockedAmount() external returns (uint256);\n\n /**\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\n */\n function emergencyExpiryDuration() external returns (uint256);\n\n /**\n * @dev Sets the amount of RON to lock from a consensus address.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedAmountUpdated`.\n *\n */\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\n\n /**\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExpiryDurationUpdated`.\n *\n */\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\n\n /**\n * @dev Unlocks fund for emergency exit request.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\n *\n */\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\n\n /**\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n */\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IJailingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IJailingInfo {\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\n */\n function checkJailed(address) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeft(address _addr)\n external\n view\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n );\n\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\n */\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\n external\n view\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n );\n\n /**\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\n */\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\n */\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\n */\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\n\n /**\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\n */\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\n\n /**\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\n */\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\n external\n view\n returns (bool _result);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ITimingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ITimingInfo {\n /**\n * @dev Returns the block that validator set was updated.\n */\n function getLastUpdatedBlock() external view returns (uint256);\n\n /**\n * @dev Returns the number of blocks in a epoch.\n */\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\n\n /**\n * @dev Returns the epoch index from the block number.\n */\n function epochOf(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Returns whether the epoch ending is at the block number `_block`.\n */\n function epochEndingAt(uint256 _block) external view returns (bool);\n\n /**\n * @dev Tries to get the period index from the epoch number.\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\n\n /**\n * @dev Returns whether the period ending at the current block number.\n */\n function isPeriodEnding() external view returns (bool);\n\n /**\n * @dev Returns the period index from the current block.\n */\n function currentPeriod() external view returns (uint256);\n\n /**\n * @dev Returns the block number that the current period starts at.\n */\n function currentPeriodStartAtBlock() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IValidatorInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\n\ninterface IValidatorInfo {\n /// @dev Emitted when the number of max validator is updated.\n event MaxValidatorNumberUpdated(uint256);\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\n event MaxPrioritizedValidatorNumberUpdated(uint256);\n\n /// @dev Error of number of prioritized greater than number of max validators.\n error ErrInvalidMaxPrioritizedValidatorNumber();\n\n /**\n * @dev Returns the maximum number of validators in the epoch.\n */\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\n\n /**\n * @dev Returns the number of reserved slots for prioritized validators.\n */\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\n\n /**\n * @dev Returns the current validator list.\n */\n function getValidators()\n external\n view\n returns (\n address[] memory _validatorList,\n address[] memory _bridgeOperators,\n EnumFlags.ValidatorFlag[] memory _flags\n );\n\n /**\n * @dev Returns whether the address is either a bridge operator or a block producer.\n */\n function isValidator(address _addr) external view returns (bool);\n\n /**\n * @dev Returns the current block producer list.\n */\n function getBlockProducers() external view returns (address[] memory);\n\n /**\n * @dev Returns whether the address is block producer or not.\n */\n function isBlockProducer(address _addr) external view returns (bool);\n\n /**\n * @dev Returns total numbers of the block producers.\n */\n function totalBlockProducers() external view returns (uint256);\n\n /**\n * @dev Returns the current bridge operator list.\n */\n function getBridgeOperators() external view returns (address[] memory);\n\n /**\n * @dev Returns the bridge operator list corresponding to validator address list.\n */\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\n\n /**\n * @dev Returns whether the address is bridge operator.\n */\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\n\n /**\n * @dev Returns whether the consensus address is operating the bridge or not.\n */\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns total numbers of the bridge operators.\n */\n function totalBridgeOperators() external view returns (uint256);\n\n /**\n * @dev Updates the max validator number\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxValidatorNumberUpdated`\n *\n */\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\n\n /**\n * @dev Updates the number of reserved slots for prioritized validators\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\n *\n */\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\n}\n" + }, + "contracts/libraries/EnumFlags.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This library implements checking flag of an enumerated value.\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\n */\nlibrary EnumFlags {\n enum ValidatorFlag {\n None, // bit(00)\n BlockProducer, // bit(01)\n BridgeOperator, // bit(10)\n Both // bit(11)\n }\n\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\n return uint8(_value) == 0;\n }\n\n /**\n * @dev Checks if `_value` has `_flag`.\n */\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\n return (uint8(_value) & uint8(_flag)) != 0;\n }\n\n /**\n * @dev Calculate new value of `_value` after adding `_flag`.\n */\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) | uint8(_flag));\n }\n\n /**\n * @dev Calculate new value of `_value` after remove `_flag`.\n */\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\n }\n}\n" + }, + "contracts/extensions/collections/HasRoninTrustedOrganizationContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\n\ncontract HasRoninTrustedOrganizationContract is IHasRoninTrustedOrganizationContract, HasProxyAdmin {\n IRoninTrustedOrganization internal _roninTrustedOrganizationContract;\n\n modifier onlyRoninTrustedOrganizationContract() {\n if (roninTrustedOrganizationContract() != msg.sender) revert ErrCallerMustBeRoninTrustedOrgContract();\n _;\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function roninTrustedOrganizationContract() public view override returns (address) {\n return address(_roninTrustedOrganizationContract);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function setRoninTrustedOrganizationContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setRoninTrustedOrganizationContract(_addr);\n }\n\n /**\n * @dev Sets the ronin trusted organization contract.\n *\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\n *\n */\n function _setRoninTrustedOrganizationContract(address _addr) internal {\n _roninTrustedOrganizationContract = IRoninTrustedOrganization(_addr);\n emit RoninTrustedOrganizationContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/collections/HasBridgeContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasBridgeContract.sol\";\nimport \"../../interfaces/IBridge.sol\";\n\ncontract HasBridgeContract is IHasBridgeContract, HasProxyAdmin {\n IBridge internal _bridgeContract;\n\n modifier onlyBridgeContract() {\n if (bridgeContract() != msg.sender) revert ErrCallerMustBeBridgeContract();\n _;\n }\n\n /**\n * @inheritdoc IHasBridgeContract\n */\n function bridgeContract() public view override returns (address) {\n return address(_bridgeContract);\n }\n\n /**\n * @inheritdoc IHasBridgeContract\n */\n function setBridgeContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length <= 0) revert ErrZeroCodeContract();\n _setBridgeContract(_addr);\n }\n\n /**\n * @dev Sets the bridge contract.\n *\n * Emits the event `BridgeContractUpdated`.\n *\n */\n function _setBridgeContract(address _addr) internal {\n _bridgeContract = IBridge(_addr);\n emit BridgeContractUpdated(_addr);\n }\n}\n" + }, + "contracts/interfaces/IRoninTrustedOrganization.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IQuorum.sol\";\n\ninterface IRoninTrustedOrganization is IQuorum {\n struct TrustedOrganization {\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n address consensusAddr;\n // Address to voting proposal\n address governor;\n // Address to voting bridge operators\n address bridgeVoter;\n // Its Weight\n uint256 weight;\n // The block that the organization was added\n uint256 addedBlock;\n }\n\n /// @dev Emitted when the trusted organization is added.\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is updated.\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is removed.\n event TrustedOrganizationsRemoved(address[] orgs);\n\n /**\n * @dev Adds a list of addresses into the trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n * - The field `addedBlock` should be blank.\n *\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\n *\n */\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\n\n /**\n * @dev Updates weights for a list of existent trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n *\n * Emits the `TrustedOrganizationUpdated` event.\n *\n */\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\n\n /**\n * @dev Removes a list of addresses from the trusted organization.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\n *\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\n */\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\n\n /**\n * @dev Returns total weights.\n */\n function totalWeights() external view returns (uint256);\n\n /**\n * @dev Returns the weight of a consensus.\n */\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a governor.\n */\n function getGovernorWeight(address _governor) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a bridge voter.\n */\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\n\n /**\n * @dev Returns the weights of a list of consensus addresses.\n */\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of governor addresses.\n */\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of bridge voter addresses.\n */\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns total weights of the consensus list.\n */\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\n\n /**\n * @dev Returns total weights of the governor list.\n */\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\n\n /**\n * @dev Returns total weights of the bridge voter list.\n */\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\n\n /**\n * @dev Returns the trusted organization at `_index`.\n */\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\n\n /**\n * @dev Returns the number of trusted organizations.\n */\n function countTrustedOrganizations() external view returns (uint256);\n\n /**\n * @dev Returns all of the trusted organizations.\n */\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\n\n /**\n * @dev Returns the trusted organization by consensus address.\n *\n * Reverts once the consensus address is non-existent.\n */\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\n}\n" + }, + "contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\n /// @dev Emitted when the ronin trusted organization contract is updated.\n event RoninTrustedOrganizationContractUpdated(address);\n\n /// @dev Error of method caller must be Ronin trusted org contract.\n error ErrCallerMustBeRoninTrustedOrgContract();\n\n /**\n * @dev Returns the ronin trusted organization contract.\n */\n function roninTrustedOrganizationContract() external view returns (address);\n\n /**\n * @dev Sets the ronin trusted organization contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\n *\n */\n function setRoninTrustedOrganizationContract(address) external;\n}\n" + }, + "contracts/interfaces/IQuorum.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IQuorum {\n /// @dev Emitted when the threshold is updated\n event ThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n\n /**\n * @dev Returns the threshold.\n */\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\n\n /**\n * @dev Checks whether the `_voteWeight` passes the threshold.\n */\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\n\n /**\n * @dev Returns the minimum vote weight to pass the threshold.\n */\n function minimumVoteWeight() external view returns (uint256);\n\n /**\n * @dev Sets the threshold.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n returns (uint256 _previousNum, uint256 _previousDenom);\n}\n" + }, + "contracts/interfaces/collections/IHasBridgeContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasBridgeContract is IHasContract {\n /// @dev Emitted when the bridge contract is updated.\n event BridgeContractUpdated(address);\n\n /// @dev Error of method caller must be bridge contract.\n error ErrCallerMustBeBridgeContract();\n\n /**\n * @dev Returns the bridge contract.\n */\n function bridgeContract() external view returns (address);\n\n /**\n * @dev Sets the bridge contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `BridgeContractUpdated`.\n *\n */\n function setBridgeContract(address) external;\n}\n" + }, + "contracts/interfaces/IBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBridge {\n /**\n * @dev Replaces the old bridge operator list by the new one.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emitted the event `BridgeOperatorsReplaced`.\n *\n */\n function replaceBridgeOperators(address[] calldata) external;\n\n /**\n * @dev Returns the bridge operator list.\n */\n function getBridgeOperators() external view returns (address[] memory);\n}\n" + }, + "contracts/ronin/validator/EmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\nimport \"../../interfaces/validator/IEmergencyExit.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\nimport \"./CandidateManager.sol\";\n\nabstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateManager, CommonStorage {\n /**\n * @inheritdoc IEmergencyExit\n */\n function emergencyExitLockedAmount() external view returns (uint256) {\n return _emergencyExitLockedAmount;\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function emergencyExpiryDuration() external view returns (uint256) {\n return _emergencyExpiryDuration;\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external onlyStakingContract {\n EmergencyExitInfo storage _info = _exitInfo[_consensusAddr];\n if (_info.recyclingAt != 0) revert ErrAlreadyRequestedEmergencyExit();\n\n uint256 _revokingTimestamp = block.timestamp + _secLeftToRevoke;\n _setRevokingTimestamp(_candidateInfo[_consensusAddr], _revokingTimestamp);\n _emergencyExitJailedTimestamp[_consensusAddr] = _revokingTimestamp;\n _bridgeRewardDeprecatedAtPeriod[_consensusAddr][currentPeriod()] = true;\n\n uint256 _deductedAmount = _stakingContract.execDeductStakingAmount(_consensusAddr, _emergencyExitLockedAmount);\n if (_deductedAmount > 0) {\n uint256 _recyclingAt = block.timestamp + _emergencyExpiryDuration;\n _lockedConsensusList.push(_consensusAddr);\n _info.lockedAmount = _deductedAmount;\n _info.recyclingAt = _recyclingAt;\n IRoninGovernanceAdmin(_getAdmin()).createEmergencyExitPoll(\n _consensusAddr,\n _candidateInfo[_consensusAddr].treasuryAddr,\n block.timestamp,\n _recyclingAt\n );\n }\n emit EmergencyExitRequested(_consensusAddr, _deductedAmount);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external onlyAdmin {\n _setEmergencyExitLockedAmount(_emergencyExitLockedAmount);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external onlyAdmin {\n _setEmergencyExpiryDuration(_emergencyExpiryDuration);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient)\n external\n onlyAdmin\n {\n if (_exitInfo[_consensusAddr].recyclingAt == 0) {\n return;\n }\n\n uint256 _length = _lockedConsensusList.length;\n uint256 _index = _length;\n\n for (uint _i; _i < _length; _i++) {\n if (_lockedConsensusList[_i] == _consensusAddr) {\n _index = _i;\n break;\n }\n }\n\n // The locked amount might be recycled\n if (_index == _length) {\n return;\n }\n\n uint256 _amount = _exitInfo[_consensusAddr].lockedAmount;\n if (_amount > 0) {\n delete _exitInfo[_consensusAddr];\n if (_length > 1) {\n _lockedConsensusList[_index] = _lockedConsensusList[_length - 1];\n }\n _lockedConsensusList.pop();\n\n _lockedFundReleased[_consensusAddr] = true;\n if (_unsafeSendRON(_recipient, _amount, DEFAULT_ADDITION_GAS)) {\n emit EmergencyExitLockedFundReleased(_consensusAddr, _recipient, _amount);\n return;\n }\n\n emit EmergencyExitLockedFundReleasingFailed(_consensusAddr, _recipient, _amount, address(this).balance);\n }\n }\n\n /**\n * @dev Tries to recycle the locked funds from emergency exit requests.\n */\n function _tryRecycleLockedFundsFromEmergencyExits() internal {\n uint256 _length = _lockedConsensusList.length;\n\n uint256 _i;\n address _addr;\n EmergencyExitInfo storage _info;\n\n while (_i < _length) {\n _addr = _lockedConsensusList[_i];\n _info = _exitInfo[_addr];\n\n if (_info.recyclingAt <= block.timestamp) {\n _totalDeprecatedReward += _info.lockedAmount;\n\n delete _exitInfo[_addr];\n if (--_length > 0) {\n _lockedConsensusList[_i] = _lockedConsensusList[_length];\n }\n _lockedConsensusList.pop();\n continue;\n }\n\n _i++;\n }\n }\n\n /**\n * @dev Override `CandidateManager-_emergencyExitLockedFundReleased`.\n */\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {\n return _lockedFundReleased[_consensusAddr];\n }\n\n /**\n * @dev Override `CandidateManager-_removeCandidate`.\n */\n function _removeCandidate(address _consensusAddr) internal override {\n delete _lockedFundReleased[_consensusAddr];\n super._removeCandidate(_consensusAddr);\n }\n\n /**\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\n */\n function _bridgeOperatorOf(address _consensusAddr)\n internal\n view\n virtual\n override(CandidateManager, ValidatorInfoStorage)\n returns (address)\n {\n return CandidateManager._bridgeOperatorOf(_consensusAddr);\n }\n\n /**\n * @dev See `setEmergencyExitLockedAmount.\n */\n function _setEmergencyExitLockedAmount(uint256 _amount) internal {\n _emergencyExitLockedAmount = _amount;\n emit EmergencyExitLockedAmountUpdated(_amount);\n }\n\n /**\n * @dev See `setEmergencyExpiryDuration`.\n */\n function _setEmergencyExpiryDuration(uint256 _duration) internal {\n _emergencyExpiryDuration = _duration;\n emit EmergencyExpiryDurationUpdated(_duration);\n }\n}\n" + }, + "contracts/extensions/RONTransferHelper.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nabstract contract RONTransferHelper {\n /// @dev Error of recipient not accepting RON when transfer RON.\n error ErrRecipientRevert();\n /// @dev Error of sender has insufficient balance.\n error ErrInsufficientBalance();\n\n /**\n * @dev See `_sendRON`.\n * Reverts if the recipient does not receive RON.\n */\n function _transferRON(address payable _recipient, uint256 _amount) internal {\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\n }\n\n /**\n * @dev Send `_amount` RON to the address `_recipient`.\n * Returns whether the recipient receives RON or not.\n * Reverts once the contract balance is insufficient.\n *\n * Note: consider using `ReentrancyGuard` before calling this function.\n *\n */\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\n return _unsafeSendRON(_recipient, _amount);\n }\n\n /**\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\n * the call does not revert.\n *\n * Note:\n * - Does not assert whether the balance of sender is sufficient.\n * - Does not assert whether the recipient accepts RON.\n * - Consider using `ReentrancyGuard` before calling this function.\n *\n */\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\n (_success, ) = _recipient.call{ value: _amount }(\"\");\n }\n\n /**\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\n */\n function _unsafeSendRON(\n address payable _recipient,\n uint256 _amount,\n uint256 _gas\n ) internal returns (bool _success) {\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\"\");\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/CommonStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../interfaces/validator/info-fragments/ICommonInfo.sol\";\nimport \"./JailingStorage.sol\";\nimport \"./TimingStorage.sol\";\nimport \"./ValidatorInfoStorage.sol\";\n\nabstract contract CommonStorage is ICommonInfo, TimingStorage, JailingStorage, ValidatorInfoStorage {\n /// @dev Mapping from consensus address => pending reward from producing block\n mapping(address => uint256) internal _miningReward;\n /// @dev Mapping from consensus address => pending reward from delegating\n mapping(address => uint256) internal _delegatingReward;\n\n /// @dev The total reward for bridge operators\n uint256 internal _totalBridgeReward;\n /// @dev Mapping from consensus address => pending reward for being bridge operator\n mapping(address => uint256) internal _bridgeOperatingReward;\n\n /// @dev The deprecated reward that has not been withdrawn by admin\n uint256 internal _totalDeprecatedReward;\n\n /// @dev The amount of RON to lock from a consensus address.\n uint256 internal _emergencyExitLockedAmount;\n /// @dev The duration that an emergency request is expired and the fund will be recycled.\n uint256 internal _emergencyExpiryDuration;\n /// @dev The address list of consensus addresses that being locked fund.\n address[] internal _lockedConsensusList;\n /// @dev Mapping from consensus => request exist info\n mapping(address => EmergencyExitInfo) internal _exitInfo;\n /// @dev Mapping from consensus => flag indicating whether the locked fund is released\n mapping(address => bool) internal _lockedFundReleased;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[44] private ______gap;\n\n /**\n * @inheritdoc ICommonInfo\n */\n function getEmergencyExitInfo(address _consensusAddr)\n external\n view\n override\n returns (EmergencyExitInfo memory _info)\n {\n _info = _exitInfo[_consensusAddr];\n if (_info.recyclingAt == 0) revert NonExistentRecyclingInfo();\n }\n\n /**\n * @inheritdoc ICommonInfo\n */\n function totalDeprecatedReward() external view override returns (uint256) {\n return _totalDeprecatedReward;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochOf(uint256 _block)\n public\n view\n virtual\n override(ITimingInfo, JailingStorage, TimingStorage)\n returns (uint256)\n {\n return TimingStorage.epochOf(_block);\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriod() public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) {\n return TimingStorage.currentPeriod();\n }\n}\n" + }, + "contracts/ronin/validator/CandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasStakingContract.sol\";\nimport \"../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../interfaces/validator/ICandidateManager.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\n\nabstract contract CandidateManager is ICandidateManager, PercentageConsumer, GlobalConfigConsumer, HasStakingContract {\n /// @dev Maximum number of validator candidate\n uint256 private _maxValidatorCandidate;\n\n /// @dev The validator candidate array\n address[] internal _candidates;\n /// @dev Mapping from candidate consensus address => bitwise negation of validator index in `_candidates`\n mapping(address => uint256) internal _candidateIndex;\n /// @dev Mapping from candidate consensus address => their info\n mapping(address => ValidatorCandidate) internal _candidateInfo;\n\n /**\n * @dev The minimum offset in day from current date to the effective date of a new commission schedule.\n * Value of 1 means the change gets affected at the beginning of the following day.\n **/\n uint256 internal _minEffectiveDaysOnwards;\n /// @dev Mapping from candidate consensus address => schedule commission change.\n mapping(address => CommissionSchedule) internal _candidateCommissionChangeSchedule;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc ICandidateManager\n */\n function maxValidatorCandidate() public view override returns (uint256) {\n return _maxValidatorCandidate;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function minEffectiveDaysOnwards() external view override returns (uint256) {\n return _minEffectiveDaysOnwards;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function setMaxValidatorCandidate(uint256 _number) external override onlyAdmin {\n _setMaxValidatorCandidate(_number);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external override onlyAdmin {\n _setMinEffectiveDaysOnwards(_numOfDays);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function execApplyValidatorCandidate(\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external override onlyStakingContract {\n uint256 _length = _candidates.length;\n if (_length >= maxValidatorCandidate()) revert ErrExceedsMaxNumberOfCandidate();\n if (isValidatorCandidate(_consensusAddr)) revert ErrExistentCandidate();\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\n\n for (uint _i; _i < _candidates.length; _i++) {\n ValidatorCandidate storage existentInfo = _candidateInfo[_candidates[_i]];\n if (_candidateAdmin == existentInfo.admin) revert ErrExistentCandidateAdmin(_candidateAdmin);\n if (_treasuryAddr == existentInfo.treasuryAddr) revert ErrExistentTreasury(_treasuryAddr);\n if (_bridgeOperatorAddr == existentInfo.bridgeOperatorAddr) revert ErrExistentBridgeOperator(_bridgeOperatorAddr);\n }\n\n _candidateIndex[_consensusAddr] = ~_length;\n _candidates.push(_consensusAddr);\n\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\n _info.admin = _candidateAdmin;\n _info.consensusAddr = _consensusAddr;\n _info.treasuryAddr = _treasuryAddr;\n _info.bridgeOperatorAddr = _bridgeOperatorAddr;\n _info.commissionRate = _commissionRate;\n emit CandidateGranted(_consensusAddr, _treasuryAddr, _candidateAdmin, _bridgeOperatorAddr);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function execRequestRenounceCandidate(address _consensusAddr, uint256 _secsLeft)\n external\n override\n onlyStakingContract\n {\n if (_isTrustedOrg(_consensusAddr)) revert ErrTrustedOrgCannotRenounce();\n\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\n if (_info.revokingTimestamp != 0) revert ErrAlreadyRequestedRevokingCandidate();\n _setRevokingTimestamp(_info, block.timestamp + _secsLeft);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function execRequestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveDaysOnwards,\n uint256 _commissionRate\n ) external override onlyStakingContract {\n if (_candidateCommissionChangeSchedule[_consensusAddr].effectiveTimestamp != 0) {\n revert ErrAlreadyRequestedUpdatingCommissionRate();\n }\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\n if (_effectiveDaysOnwards < _minEffectiveDaysOnwards) revert ErrInvalidEffectiveDaysOnwards();\n\n CommissionSchedule storage _schedule = _candidateCommissionChangeSchedule[_consensusAddr];\n uint256 _effectiveTimestamp = ((block.timestamp / PERIOD_DURATION) + _effectiveDaysOnwards) * PERIOD_DURATION;\n _schedule.effectiveTimestamp = _effectiveTimestamp;\n _schedule.commissionRate = _commissionRate;\n\n emit CommissionRateUpdateScheduled(_consensusAddr, _effectiveTimestamp, _commissionRate);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function isValidatorCandidate(address _addr) public view override returns (bool) {\n return _candidateIndex[_addr] != 0;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCandidateInfos() external view override returns (ValidatorCandidate[] memory _list) {\n _list = new ValidatorCandidate[](_candidates.length);\n for (uint _i; _i < _list.length; _i++) {\n _list[_i] = _candidateInfo[_candidates[_i]];\n }\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCandidateInfo(address _candidate) external view override returns (ValidatorCandidate memory) {\n if (!isValidatorCandidate(_candidate)) revert ErrNonExistentCandidate();\n return _candidateInfo[_candidate];\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getValidatorCandidates() public view override returns (address[] memory) {\n return _candidates;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCommissionChangeSchedule(address _candidate) external view override returns (CommissionSchedule memory) {\n return _candidateCommissionChangeSchedule[_candidate];\n }\n\n /**\n * @dev Removes unsastisfied candidates, the ones who have insufficient minimum candidate staking amount,\n * or the ones who requested to renounce their candidate role.\n *\n * Emits the event `CandidatesRevoked` when a candidate is revoked.\n *\n */\n function _syncCandidateSet(uint256 _nextPeriod) internal returns (address[] memory _unsatisfiedCandidates) {\n IStaking _staking = _stakingContract;\n uint256 _waitingSecsToRevoke = _staking.waitingSecsToRevoke();\n uint256 _minStakingAmount = _staking.minValidatorStakingAmount();\n uint256[] memory _selfStakings = _staking.getManySelfStakings(_candidates);\n\n uint256 _length = _candidates.length;\n uint256 _unsatisfiedCount;\n _unsatisfiedCandidates = new address[](_length);\n\n {\n uint256 _i;\n address _addr;\n ValidatorCandidate storage _info;\n while (_i < _length) {\n _addr = _candidates[_i];\n _info = _candidateInfo[_addr];\n\n // Checks for under-balance status of candidates\n bool _hasTopupDeadline = _info.topupDeadline != 0;\n if (_selfStakings[_i] < _minStakingAmount) {\n // Updates deadline on the first time unsatisfied the staking amount condition\n if (!_hasTopupDeadline) {\n uint256 _topupDeadline = block.timestamp + _waitingSecsToRevoke;\n _info.topupDeadline = _topupDeadline;\n emit CandidateTopupDeadlineUpdated(_addr, _topupDeadline);\n }\n } else if (_hasTopupDeadline) {\n // Removes the deadline if the staking amount condition is satisfied\n delete _info.topupDeadline;\n emit CandidateTopupDeadlineUpdated(_addr, 0);\n }\n\n // Removes unsastisfied candidates\n bool _revokingActivated = (_info.revokingTimestamp != 0 && _info.revokingTimestamp <= block.timestamp) ||\n _emergencyExitLockedFundReleased(_addr);\n bool _topupDeadlineMissed = _info.topupDeadline != 0 && _info.topupDeadline <= block.timestamp;\n if (_revokingActivated || _topupDeadlineMissed) {\n _selfStakings[_i] = _selfStakings[--_length];\n _unsatisfiedCandidates[_unsatisfiedCount++] = _addr;\n _removeCandidate(_addr);\n continue;\n }\n\n // Checks for schedule of commission change and updates commission rate\n uint256 _scheduleTimestamp = _candidateCommissionChangeSchedule[_addr].effectiveTimestamp;\n if (_scheduleTimestamp != 0 && _scheduleTimestamp <= block.timestamp) {\n uint256 _commisionRate = _candidateCommissionChangeSchedule[_addr].commissionRate;\n delete _candidateCommissionChangeSchedule[_addr];\n _info.commissionRate = _commisionRate;\n emit CommissionRateUpdated(_addr, _commisionRate);\n }\n\n _i++;\n }\n }\n\n assembly {\n mstore(_unsatisfiedCandidates, _unsatisfiedCount)\n }\n\n if (_unsatisfiedCount > 0) {\n emit CandidatesRevoked(_unsatisfiedCandidates);\n _staking.execDeprecatePools(_unsatisfiedCandidates, _nextPeriod);\n }\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function isCandidateAdmin(address _candidate, address _admin) external view override returns (bool) {\n return _candidateInfo[_candidate].admin == _admin;\n }\n\n /**\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\n */\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address) {\n return _candidateInfo[_consensusAddr].bridgeOperatorAddr;\n }\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function _setMaxValidatorCandidate(uint256 _threshold) internal {\n _maxValidatorCandidate = _threshold;\n emit MaxValidatorCandidateUpdated(_threshold);\n }\n\n /**\n * @dev Sets the minimum number of days onwards to the effective date of commission rate change.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function _setMinEffectiveDaysOnwards(uint256 _numOfDays) internal {\n if (_numOfDays < 1) revert ErrInvalidMinEffectiveDaysOnwards();\n _minEffectiveDaysOnwards = _numOfDays;\n emit MinEffectiveDaysOnwardsUpdated(_numOfDays);\n }\n\n /**\n * @dev Removes the candidate.\n */\n function _removeCandidate(address _addr) internal virtual {\n uint256 _idx = _candidateIndex[_addr];\n if (_idx == 0) {\n return;\n }\n\n delete _candidateInfo[_addr];\n delete _candidateIndex[_addr];\n delete _candidateCommissionChangeSchedule[_addr];\n\n address _lastCandidate = _candidates[_candidates.length - 1];\n if (_lastCandidate != _addr) {\n _candidateIndex[_lastCandidate] = _idx;\n _candidates[~_idx] = _lastCandidate;\n }\n\n _candidates.pop();\n }\n\n /**\n * @dev Sets timestamp to revoke a candidate.\n */\n function _setRevokingTimestamp(ValidatorCandidate storage _candidate, uint256 _timestamp) internal {\n if (!isValidatorCandidate(_candidate.consensusAddr)) revert ErrNonExistentCandidate();\n _candidate.revokingTimestamp = _timestamp;\n emit CandidateRevokingTimestampUpdated(_candidate.consensusAddr, _timestamp);\n }\n\n /**\n * @dev Returns a flag indicating whether the fund is unlocked.\n */\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual returns (bool);\n\n /**\n * @dev Returns whether the consensus address is a trusted org or not.\n */\n function _isTrustedOrg(address _consensusAddr) internal virtual returns (bool);\n}\n" + }, + "contracts/ronin/validator/storage-fragments/JailingStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../interfaces/validator/info-fragments/IJailingInfo.sol\";\nimport \"./TimingStorage.sol\";\n\nabstract contract JailingStorage is IJailingInfo {\n /// @dev Mapping from consensus address => period number => block producer has no pending reward.\n mapping(address => mapping(uint256 => bool)) internal _miningRewardDeprecatedAtPeriod;\n /// @dev Mapping from consensus address => period number => whether the block producer get cut off reward, due to bailout.\n mapping(address => mapping(uint256 => bool)) internal _miningRewardBailoutCutOffAtPeriod;\n /// @dev Mapping from consensus address => period number => block operator has no pending reward.\n mapping(address => mapping(uint256 => bool)) internal _bridgeRewardDeprecatedAtPeriod;\n\n /// @dev Mapping from consensus address => the last block that the block producer is jailed.\n mapping(address => uint256) internal _blockProducerJailedBlock;\n /// @dev Mapping from consensus address => the last timestamp that the bridge operator is jailed.\n mapping(address => uint256) internal _emergencyExitJailedTimestamp;\n /// @dev Mapping from consensus address => the last block that the block producer cannot bailout.\n mapping(address => uint256) internal _cannotBailoutUntilBlock;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkJailed(address _addr) external view override returns (bool) {\n return checkJailedAtBlock(_addr, block.number);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function getJailedTimeLeft(address _addr)\n external\n view\n override\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n )\n {\n return getJailedTimeLeftAtBlock(_addr, block.number);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkJailedAtBlock(address _addr, uint256 _blockNum) public view override returns (bool) {\n return _jailedAtBlock(_addr, _blockNum);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\n public\n view\n override\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n )\n {\n uint256 _jailedBlock = _blockProducerJailedBlock[_addr];\n if (_jailedBlock < _blockNum) {\n return (false, 0, 0);\n }\n\n isJailed_ = true;\n blockLeft_ = _jailedBlock - _blockNum + 1;\n epochLeft_ = epochOf(_jailedBlock) - epochOf(_blockNum) + 1;\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkManyJailed(address[] calldata _addrList) external view override returns (bool[] memory _result) {\n _result = new bool[](_addrList.length);\n for (uint256 _i; _i < _addrList.length; _i++) {\n _result[_i] = _jailed(_addrList[_i]);\n }\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkMiningRewardDeprecated(address _blockProducer) external view override returns (bool _result) {\n uint256 _period = currentPeriod();\n return _miningRewardDeprecated(_blockProducer, _period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period)\n external\n view\n override\n returns (bool _result)\n {\n return _miningRewardDeprecated(_blockProducer, _period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n *\n * @dev Because the information of deprecating bridge reward of a period is only determined at the end of that period, this\n * method will return the deprecating info of the latest period. A method for querying that info of current period is no need.\n */\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr)\n external\n view\n override\n returns (bool _result)\n {\n uint256 _period = currentPeriod() - 1;\n return _bridgeRewardDeprecated(_consensusAddr, _period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\n external\n view\n override\n returns (bool _result)\n {\n return _bridgeRewardDeprecated(_consensusAddr, _period);\n }\n\n /**\n * @dev See `ITimingInfo-epochOf`\n */\n function epochOf(uint256 _block) public view virtual returns (uint256);\n\n /**\n * @dev See `ITimingInfo-currentPeriod`\n */\n function currentPeriod() public view virtual returns (uint256);\n\n /**\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) during the current period.\n */\n function _jailed(address _validatorAddr) internal view returns (bool) {\n return _jailedAtBlock(_validatorAddr, block.number);\n }\n\n /**\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) at a specific block.\n */\n function _jailedAtBlock(address _validatorAddr, uint256 _blockNum) internal view returns (bool) {\n return _blockNum <= _blockProducerJailedBlock[_validatorAddr];\n }\n\n /**\n * @dev Returns whether the block producer has no pending reward in that period.\n */\n function _miningRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\n return _miningRewardDeprecatedAtPeriod[_validatorAddr][_period];\n }\n\n /**\n * @dev Returns whether the bridge operator has no pending reward in the period.\n */\n function _bridgeRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\n return _bridgeRewardDeprecatedAtPeriod[_validatorAddr][_period];\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/TimingStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../../interfaces/validator/info-fragments/ITimingInfo.sol\";\n\nabstract contract TimingStorage is ITimingInfo, GlobalConfigConsumer {\n /// @dev The number of blocks in a epoch\n uint256 internal _numberOfBlocksInEpoch;\n /// @dev The last updated block\n uint256 internal _lastUpdatedBlock;\n /// @dev The last updated period\n uint256 internal _lastUpdatedPeriod;\n /// @dev The starting block of the last updated period\n uint256 internal _currentPeriodStartAtBlock;\n\n /// @dev Mapping from epoch index => period index\n mapping(uint256 => uint256) internal _periodOf;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n /**\n * @inheritdoc ITimingInfo\n */\n function getLastUpdatedBlock() external view override returns (uint256) {\n return _lastUpdatedBlock;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochOf(uint256 _block) public view virtual override returns (uint256) {\n return _block / _numberOfBlocksInEpoch + 1;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber) {\n return (_epoch <= epochOf(block.number) || _periodOf[_epoch] > 0, _periodOf[_epoch]);\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function isPeriodEnding() external view override returns (bool) {\n return _isPeriodEnding(_computePeriod(block.timestamp));\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochEndingAt(uint256 _block) public view virtual override returns (bool) {\n return _block % _numberOfBlocksInEpoch == _numberOfBlocksInEpoch - 1;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriod() public view virtual override returns (uint256) {\n return _lastUpdatedPeriod;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriodStartAtBlock() public view override returns (uint256) {\n return _currentPeriodStartAtBlock;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function numberOfBlocksInEpoch() public view virtual override returns (uint256 _numberOfBlocks) {\n return _numberOfBlocksInEpoch;\n }\n\n /**\n * @dev See `ITimingInfo-isPeriodEnding`\n */\n function _isPeriodEnding(uint256 _newPeriod) internal view virtual returns (bool) {\n return _newPeriod > _lastUpdatedPeriod;\n }\n\n /**\n * @dev Returns the calculated period.\n */\n function _computePeriod(uint256 _timestamp) internal pure returns (uint256) {\n return _timestamp / PERIOD_DURATION;\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/ValidatorInfoStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\nimport \"../../../extensions/collections/HasRoninTrustedOrganizationContract.sol\";\nimport \"../../../interfaces/validator/info-fragments/IValidatorInfo.sol\";\n\nabstract contract ValidatorInfoStorage is IValidatorInfo, HasRoninTrustedOrganizationContract {\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n /// @dev The maximum number of validator.\n uint256 internal _maxValidatorNumber;\n\n /// @dev The total of validators\n uint256 public validatorCount;\n /// @dev Mapping from validator index => validator address\n mapping(uint256 => address) internal _validators;\n /// @dev Mapping from address => flag indicating the validator ability: producing block, operating bridge\n mapping(address => EnumFlags.ValidatorFlag) internal _validatorMap;\n /// @dev The number of slot that is reserved for prioritized validators\n uint256 internal _maxPrioritizedValidatorNumber;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getValidators()\n public\n view\n override\n returns (\n address[] memory _validatorList,\n address[] memory _bridgeOperators,\n EnumFlags.ValidatorFlag[] memory _flags\n )\n {\n _validatorList = new address[](validatorCount);\n _bridgeOperators = new address[](validatorCount);\n _flags = new EnumFlags.ValidatorFlag[](validatorCount);\n for (uint _i; _i < _validatorList.length; _i++) {\n address _validator = _validators[_i];\n _validatorList[_i] = _validator;\n _bridgeOperators[_i] = _bridgeOperatorOf(_validator);\n _flags[_i] = _validatorMap[_validator];\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isValidator(address _addr) public view override returns (bool) {\n return !_validatorMap[_addr].isNone();\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getBlockProducers() public view override returns (address[] memory _result) {\n _result = new address[](validatorCount);\n uint256 _count = 0;\n for (uint _i; _i < _result.length; _i++) {\n if (isBlockProducer(_validators[_i])) {\n _result[_count++] = _validators[_i];\n }\n }\n\n assembly {\n mstore(_result, _count)\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isBlockProducer(address _addr) public view override returns (bool) {\n return _validatorMap[_addr].hasFlag(EnumFlags.ValidatorFlag.BlockProducer);\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function totalBlockProducers() external view returns (uint256 _total) {\n for (uint _i; _i < validatorCount; _i++) {\n if (isBlockProducer(_validators[_i])) {\n _total++;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getBridgeOperators() public view override returns (address[] memory _result) {\n _result = new address[](validatorCount);\n uint256 _count = 0;\n for (uint _i; _i < _result.length; _i++) {\n if (isOperatingBridge(_validators[_i])) {\n _result[_count++] = _bridgeOperatorOf(_validators[_i]);\n }\n }\n\n assembly {\n mstore(_result, _count)\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getBridgeOperatorsOf(address[] memory _validatorAddrs)\n public\n view\n override\n returns (address[] memory _result)\n {\n _result = new address[](_validatorAddrs.length);\n for (uint _i; _i < _result.length; _i++) {\n _result[_i] = _bridgeOperatorOf(_validatorAddrs[_i]);\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isBridgeOperator(address _bridgeOperatorAddr) external view override returns (bool _isOperator) {\n for (uint _i; _i < validatorCount; _i++) {\n if (_bridgeOperatorOf(_validators[_i]) == _bridgeOperatorAddr && isOperatingBridge(_validators[_i])) {\n _isOperator = true;\n break;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isOperatingBridge(address _consensusAddr) public view override returns (bool) {\n return _validatorMap[_consensusAddr].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator);\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {\n return _maxValidatorNumber;\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function maxPrioritizedValidatorNumber() external view override returns (uint256 _maximumPrioritizedValidatorNumber) {\n return _maxPrioritizedValidatorNumber;\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function totalBridgeOperators() public view returns (uint256 _total) {\n for (uint _i; _i < validatorCount; _i++) {\n if (isOperatingBridge(_validators[_i])) {\n _total++;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function setMaxValidatorNumber(uint256 _max) external override onlyAdmin {\n _setMaxValidatorNumber(_max);\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function setMaxPrioritizedValidatorNumber(uint256 _number) external override onlyAdmin {\n _setMaxPrioritizedValidatorNumber(_number);\n }\n\n /**\n * @dev Returns the bridge operator of a consensus address.\n */\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address);\n\n /**\n * @dev See `IValidatorInfo-setMaxValidatorNumber`\n */\n function _setMaxValidatorNumber(uint256 _number) internal {\n _maxValidatorNumber = _number;\n emit MaxValidatorNumberUpdated(_number);\n }\n\n /**\n * @dev See `IValidatorInfo-setMaxPrioritizedValidatorNumber`\n */\n function _setMaxPrioritizedValidatorNumber(uint256 _number) internal {\n if (_number > _maxValidatorNumber) revert ErrInvalidMaxPrioritizedValidatorNumber();\n _maxPrioritizedValidatorNumber = _number;\n emit MaxPrioritizedValidatorNumberUpdated(_number);\n }\n}\n" + }, + "contracts/extensions/consumers/GlobalConfigConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nabstract contract GlobalConfigConsumer {\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\n /// @dev The length of a period in second.\n uint256 public constant PERIOD_DURATION = 1 days;\n}\n" + }, + "contracts/extensions/collections/HasStakingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasStakingContract.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\n\ncontract HasStakingContract is IHasStakingContract, HasProxyAdmin {\n IStaking internal _stakingContract;\n\n modifier onlyStakingContract() {\n if (stakingContract() != msg.sender) revert ErrCallerMustBeStakingContract();\n _;\n }\n\n /**\n * @inheritdoc IHasStakingContract\n */\n function stakingContract() public view override returns (address) {\n return address(_stakingContract);\n }\n\n /**\n * @inheritdoc IHasStakingContract\n */\n function setStakingContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setStakingContract(_addr);\n }\n\n /**\n * @dev Sets the staking contract.\n *\n * Emits the event `StakingContractUpdated`.\n *\n */\n function _setStakingContract(address _addr) internal {\n _stakingContract = IStaking(_addr);\n emit StakingContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/consumers/PercentageConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract PercentageConsumer {\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\n}\n" + }, + "contracts/interfaces/staking/IStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseStaking.sol\";\nimport \"./ICandidateStaking.sol\";\nimport \"./IDelegatorStaking.sol\";\n\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\n /**\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\n *\n * Note: This method should be called once at the period ending.\n *\n */\n function execRecordRewards(\n address[] calldata _consensusAddrs,\n uint256[] calldata _rewards,\n uint256 _period\n ) external payable;\n\n /**\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `Unstaked`.\n *\n */\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\n external\n returns (uint256 _actualDeductingAmount);\n}\n" + }, + "contracts/interfaces/collections/IHasStakingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasStakingContract is IHasContract {\n /// @dev Emitted when the staking contract is updated.\n event StakingContractUpdated(address);\n\n /// @dev Error of method caller must be staking contract.\n error ErrCallerMustBeStakingContract();\n\n /**\n * @dev Returns the staking contract.\n */\n function stakingContract() external view returns (address);\n\n /**\n * @dev Sets the staking contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `StakingContractUpdated`.\n *\n */\n function setStakingContract(address) external;\n}\n" + }, + "contracts/interfaces/staking/IBaseStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IBaseStaking {\n struct PoolDetail {\n // Address of the pool i.e. consensus address of the validator\n address addr;\n // Pool admin address\n address admin;\n // Self-staking amount\n uint256 stakingAmount;\n // Total number of RON staking for the pool\n uint256 stakingTotal;\n // Mapping from delegator => delegating amount\n mapping(address => uint256) delegatingAmount;\n // Mapping from delegator => the last timestamp that delegator staked\n mapping(address => uint256) lastDelegatingTimestamp;\n }\n\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\n event WaitingSecsToRevokeUpdated(uint256 secs);\n\n /// @dev Error of cannot transfer RON.\n error ErrCannotTransferRON();\n /// @dev Error of receiving zero message value.\n error ErrZeroValue();\n /// @dev Error of pool admin is not allowed to call.\n error ErrPoolAdminForbidden();\n /// @dev Error of no one is allowed to call but the pool's admin.\n error ErrOnlyPoolAdminAllowed();\n /// @dev Error of admin of any active pool cannot delegate.\n error ErrAdminOfAnyActivePoolForbidden(address admin);\n /// @dev Error of querying inactive pool.\n error ErrInactivePool(address poolAddr);\n /// @dev Error of length of input arrays are not of the same.\n error ErrInvalidArrays();\n\n /**\n * @dev Returns whether the `_poolAdminAddr` is currently active.\n */\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\n\n /**\n * @dev Returns the consensus address corresponding to the pool admin.\n */\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\n\n /**\n * @dev Returns the staking pool detail.\n */\n function getPoolDetail(address)\n external\n view\n returns (\n address _admin,\n uint256 _stakingAmount,\n uint256 _stakingTotal\n );\n\n /**\n * @dev Returns the self-staking amounts of the pools.\n */\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\n\n /**\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n */\n function cooldownSecsToUndelegate() external view returns (uint256);\n\n /**\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\n */\n function waitingSecsToRevoke() external view returns (uint256);\n\n /**\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CooldownSecsToUndelegateUpdated`.\n *\n */\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\n\n /**\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `WaitingSecsToRevokeUpdated`.\n *\n */\n function setWaitingSecsToRevoke(uint256 _secs) external;\n}\n" + }, + "contracts/interfaces/staking/ICandidateStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface ICandidateStaking is IRewardPool {\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\n event MinValidatorStakingAmountUpdated(uint256 threshold);\n /// @dev Emitted when the commission rate range is updated.\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\n\n /// @dev Emitted when the pool admin staked for themself.\n event Staked(address indexed consensuAddr, uint256 amount);\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\n event Unstaked(address indexed consensuAddr, uint256 amount);\n\n /// @dev Emitted when the validator pool is approved.\n event PoolApproved(address indexed validator, address indexed admin);\n /// @dev Emitted when the validator pool is deprecated.\n event PoolsDeprecated(address[] validator);\n /// @dev Emitted when the staking amount transfer failed.\n event StakingAmountTransferFailed(\n address indexed validator,\n address indexed admin,\n uint256 amount,\n uint256 contractBalance\n );\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\n event StakingAmountDeductFailed(\n address indexed validator,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Error of cannot transfer RON to specified target.\n error ErrCannotInitTransferRON(address addr, string extraInfo);\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\n error ErrThreeInteractionAddrsNotEqual();\n /// @dev Error of three operation addresses must be distinct in applying for validator candidate.\n error ErrThreeOperationAddrsNotDistinct();\n /// @dev Error of unstaking zero amount.\n error ErrUnstakeZeroAmount();\n /// @dev Error of invalid staking amount left after deducted.\n error ErrStakingAmountLeft();\n /// @dev Error of insufficient staking amount for unstaking.\n error ErrInsufficientStakingAmount();\n /// @dev Error of unstaking too early.\n error ErrUnstakeTooEarly();\n /// @dev Error of setting commission rate exceeds max allowed.\n error ErrInvalidCommissionRate();\n\n /**\n * @dev Returns the minimum threshold for being a validator candidate.\n */\n function minValidatorStakingAmount() external view returns (uint256);\n\n /**\n * @dev Returns the commission rate range that the candidate can set.\n */\n function getCommissionRateRange() external view returns (uint256 _minRange, uint256 _maxRange);\n\n /**\n * @dev Sets the minimum threshold for being a validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinValidatorStakingAmountUpdated` event.\n *\n */\n function setMinValidatorStakingAmount(uint256) external;\n\n /**\n * @dev Sets the commission rate range that a candidate can set.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `CommissionRateRangeUpdated` event.\n *\n */\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external;\n\n /**\n * @dev Proposes a candidate to become a validator.\n *\n * Requirements:\n * - The method caller is able to receive RON.\n * - The treasury is able to receive RON.\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\n *\n * Emits the event `PoolApproved`.\n *\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\n * to its candidate, e.g. scheduling maintenance.\n *\n */\n function applyValidatorCandidate(\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external payable;\n\n /**\n * @dev Deprecates the pool.\n * - Deduct self-staking amount of the pool admin to zero.\n * - Transfer the deducted amount to the pool admin.\n * - Deactivate the pool admin address in the mapping of active pool admins\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\n *\n */\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\n\n /**\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `msg.value` is larger than 0.\n *\n * Emits the event `Staked`.\n *\n */\n function stake(address _consensusAddr) external payable;\n\n /**\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n * Emits the event `Unstaked`.\n *\n */\n function unstake(address _consensusAddr, uint256 _amount) external;\n\n /**\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\n * - The `_rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdated`.\n *\n */\n function requestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveDaysOnwards,\n uint256 _commissionRate\n ) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestRenounce(address _consensusAddr) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestEmergencyExit(address _consensusAddr) external;\n}\n" + }, + "contracts/interfaces/staking/IDelegatorStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface IDelegatorStaking is IRewardPool {\n /// @dev Emitted when the delegator staked for a validator candidate.\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\n /// @dev Emitted when the delegator unstaked from a validator candidate.\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\n\n /// @dev Error of undelegating zero amount.\n error ErrUndelegateZeroAmount();\n /// @dev Error of undelegating insufficient amount.\n error ErrInsufficientDelegatingAmount();\n /// @dev Error of undelegating too early.\n error ErrUndelegateTooEarly();\n\n /**\n * @dev Stakes for a validator candidate `_consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is not the pool admin.\n *\n * Emits the `Delegated` event.\n *\n */\n function delegate(address _consensusAddr) external payable;\n\n /**\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the `Undelegated` event.\n *\n */\n function undelegate(address _consensusAddr, uint256 _amount) external;\n\n /**\n * @dev Bulk unstakes from a list of candidates.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the events `Undelegated`.\n *\n */\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\n\n /**\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `Undelegated` event and the `Delegated` event.\n *\n */\n function redelegate(\n address _consensusAddrSrc,\n address _consensusAddrDst,\n uint256 _amount\n ) external;\n\n /**\n * @dev Returns the claimable reward of the user `_user`.\n */\n function getRewards(address _user, address[] calldata _poolAddrList)\n external\n view\n returns (uint256[] memory _rewards);\n\n /**\n * @dev Claims the reward of method caller.\n *\n * Emits the `RewardClaimed` event.\n *\n */\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\n\n /**\n * @dev Claims the rewards and delegates them to the consensus address.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `RewardClaimed` event and the `Delegated` event.\n *\n */\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\n external\n returns (uint256 _amount);\n}\n" + }, + "contracts/interfaces/staking/IRewardPool.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/consumers/PeriodWrapperConsumer.sol\";\n\ninterface IRewardPool is PeriodWrapperConsumer {\n struct UserRewardFields {\n // Recorded reward amount.\n uint256 debited;\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\n uint256 aRps;\n // Lowest staking amount in the period.\n uint256 lowestAmount;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n\n struct PoolFields {\n // Accumulated of the amount rewards per share (one unit staking).\n uint256 aRps;\n // The staking total to share reward of the current period.\n PeriodWrapper shares;\n }\n\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\n /// @dev Emitted when the user claimed their reward\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\n\n /// @dev Emitted when the pool shares are updated\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\n /// @dev Emitted when the pools are updated\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\n /// @dev Emitted when the contract fails when updating the pools\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\n /// @dev Emitted when the contract fails when updating the pools that already set\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\n\n /// @dev Error of invalid pool share.\n error ErrInvalidPoolShare();\n\n /**\n * @dev Returns the reward amount that user claimable.\n */\n function getReward(address _poolAddr, address _user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amount of an user.\n */\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amounts of the users.\n */\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Returns the total staking amount of all users for a pool.\n */\n function getStakingTotal(address _poolAddr) external view returns (uint256);\n\n /**\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\n */\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\n}\n" + }, + "contracts/interfaces/consumers/PeriodWrapperConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface PeriodWrapperConsumer {\n struct PeriodWrapper {\n // Inner value.\n uint256 inner;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n}\n" + }, + "contracts/mocks/validator/MockValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../ronin/validator/CandidateManager.sol\";\n\ncontract MockValidatorSet is IRoninValidatorSet, CandidateManager {\n address public stakingVestingContract;\n address public slashIndicatorContract;\n\n uint256 internal _lastUpdatedPeriod;\n uint256 internal _numberOfBlocksInEpoch;\n /// @dev Mapping from period number => slashed\n mapping(uint256 => bool) internal _periodSlashed;\n\n constructor(\n address __stakingContract,\n address _slashIndicatorContract,\n address _stakingVestingContract,\n uint256 __maxValidatorCandidate,\n uint256 __numberOfBlocksInEpoch,\n uint256 __minEffectiveDaysOnwards\n ) {\n _setStakingContract(__stakingContract);\n _setMaxValidatorCandidate(__maxValidatorCandidate);\n slashIndicatorContract = _slashIndicatorContract;\n stakingVestingContract = _stakingVestingContract;\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\n _minEffectiveDaysOnwards = __minEffectiveDaysOnwards;\n }\n\n function submitBlockReward() external payable override {}\n\n function wrapUpEpoch() external payable override {\n _syncCandidateSet(_lastUpdatedPeriod + 1);\n _lastUpdatedPeriod = currentPeriod();\n }\n\n function getLastUpdatedBlock() external view override returns (uint256) {}\n\n function checkManyJailed(address[] calldata) external view override returns (bool[] memory) {}\n\n function checkMiningRewardDeprecatedAtPeriod(address, uint256 _period) external view override returns (bool) {}\n\n function checkMiningRewardDeprecated(address) external view override returns (bool) {}\n\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr)\n external\n view\n override\n returns (bool _result)\n {}\n\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\n external\n view\n returns (bool _result)\n {}\n\n function epochOf(uint256 _block) external view override returns (uint256) {}\n\n function getValidators()\n external\n view\n override\n returns (\n address[] memory,\n address[] memory,\n EnumFlags.ValidatorFlag[] memory\n )\n {}\n\n function epochEndingAt(uint256 _block) external view override returns (bool) {}\n\n function execSlash(\n address _validatorAddr,\n uint256 _newJailedUntil,\n uint256 _slashAmount,\n bool _cannotBailout\n ) external override {}\n\n function execBailOut(address, uint256) external override {}\n\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external override {}\n\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external override {}\n\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {}\n\n function maxPrioritizedValidatorNumber()\n external\n view\n override\n returns (uint256 _maximumPrioritizedValidatorNumber)\n {}\n\n function isValidator(address) external pure override returns (bool) {\n return true;\n }\n\n function numberOfBlocksInEpoch() public view override returns (uint256) {\n return _numberOfBlocksInEpoch;\n }\n\n function getBridgeOperators() external view override returns (address[] memory) {}\n\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view override returns (address[] memory) {}\n\n function isBridgeOperator(address) external pure override returns (bool) {\n return true;\n }\n\n function totalBridgeOperators() external view override returns (uint256) {}\n\n function getBlockProducers() external view override returns (address[] memory) {}\n\n function isBlockProducer(address) external pure override returns (bool) {\n return true;\n }\n\n function totalBlockProducers() external view override returns (uint256) {}\n\n function tryGetPeriodOfEpoch(uint256) external view returns (bool, uint256) {}\n\n function isPeriodEnding() public view virtual returns (bool) {\n return currentPeriod() > _lastUpdatedPeriod;\n }\n\n function currentPeriod() public view override returns (uint256) {\n return block.timestamp / 86400;\n }\n\n function checkJailed(address) external view override returns (bool) {}\n\n function getJailedTimeLeft(address)\n external\n view\n override\n returns (\n bool,\n uint256,\n uint256\n )\n {}\n\n function currentPeriodStartAtBlock() external view override returns (uint256) {}\n\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view override returns (bool) {}\n\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\n external\n view\n override\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n )\n {}\n\n function totalDeprecatedReward() external view override returns (uint256) {}\n\n function _bridgeOperatorOf(address _consensusAddr) internal view override returns (address) {\n return super._bridgeOperatorOf(_consensusAddr);\n }\n\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient)\n external\n override\n {}\n\n function emergencyExitLockedAmount() external override returns (uint256) {}\n\n function emergencyExpiryDuration() external override returns (uint256) {}\n\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external override {}\n\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external override {}\n\n function getEmergencyExitInfo(address _consensusAddr) external view override returns (EmergencyExitInfo memory) {}\n\n function execEmergencyExit(address, uint256) external {}\n\n function isOperatingBridge(address) external view returns (bool) {}\n\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {}\n\n function _isTrustedOrg(address _consensusAddr) internal virtual override returns (bool) {}\n}\n" + }, + "contracts/ronin/staking/Staking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"./CandidateStaking.sol\";\nimport \"./DelegatorStaking.sol\";\n\ncontract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable {\n constructor() {\n _disableInitializers();\n }\n\n receive() external payable onlyValidatorContract {}\n\n fallback() external payable onlyValidatorContract {}\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 __minValidatorStakingAmount,\n uint256 __maxCommissionRate,\n uint256 __cooldownSecsToUndelegate,\n uint256 __waitingSecsToRevoke\n ) external initializer {\n _setValidatorContract(__validatorContract);\n _setMinValidatorStakingAmount(__minValidatorStakingAmount);\n _setCommissionRateRange(0, __maxCommissionRate);\n _setCooldownSecsToUndelegate(__cooldownSecsToUndelegate);\n _setWaitingSecsToRevoke(__waitingSecsToRevoke);\n }\n\n /**\n * @inheritdoc IStaking\n */\n function execRecordRewards(\n address[] calldata _consensusAddrs,\n uint256[] calldata _rewards,\n uint256 _period\n ) external payable override onlyValidatorContract {\n _recordRewards(_consensusAddrs, _rewards, _period);\n }\n\n /**\n * @inheritdoc IStaking\n */\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\n external\n override\n onlyValidatorContract\n returns (uint256 _actualDeductingAmount)\n {\n _actualDeductingAmount = _deductStakingAmount(_stakingPool[_consensusAddr], _amount);\n address payable _validatorContractAddr = payable(validatorContract());\n if (!_unsafeSendRON(_validatorContractAddr, _actualDeductingAmount)) {\n emit StakingAmountDeductFailed(\n _consensusAddr,\n _validatorContractAddr,\n _actualDeductingAmount,\n address(this).balance\n );\n }\n }\n\n /**\n * @inheritdoc RewardCalculation\n */\n function _currentPeriod() internal view virtual override returns (uint256) {\n return _validatorContract.currentPeriod();\n }\n\n /**\n * @inheritdoc CandidateStaking\n */\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount)\n internal\n override\n returns (uint256 _actualDeductingAmount)\n {\n _actualDeductingAmount = Math.min(_pool.stakingAmount, _amount);\n\n _pool.stakingAmount -= _actualDeductingAmount;\n _changeDelegatingAmount(\n _pool,\n _pool.admin,\n _pool.stakingAmount,\n Math.subNonNegative(_pool.stakingTotal, _actualDeductingAmount)\n );\n emit Unstaked(_pool.addr, _actualDeductingAmount);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "contracts/libraries/Math.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns whether the number `c` is in range of [a; b].\n */\n function inRange(\n uint256 c,\n uint256 a,\n uint256 b\n ) internal pure returns (bool) {\n return a <= c && c <= b;\n }\n\n /**\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\n */\n function twoRangeOverlap(\n uint256 x1,\n uint256 x2,\n uint256 y1,\n uint256 y2\n ) internal pure returns (bool) {\n return x1 <= y2 && y1 <= x2;\n }\n\n /**\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\n */\n function addWithUpperbound(\n uint256 a,\n uint256 b,\n uint256 upperbound\n ) internal pure returns (uint256) {\n return min(a + b, upperbound);\n }\n\n /**\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\n */\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a - b : 0;\n }\n\n /**\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\n */\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\n return zeroable != 0 ? a + zeroable : 0;\n }\n}\n" + }, + "contracts/ronin/staking/CandidateStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../libraries/AddressArrayUtils.sol\";\nimport \"../../interfaces/staking/ICandidateStaking.sol\";\nimport \"./BaseStaking.sol\";\n\nabstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConfigConsumer, PercentageConsumer {\n /// @dev The minimum threshold for being a validator candidate.\n uint256 internal _minValidatorStakingAmount;\n\n /// @dev The max commission rate that the validator can set (in range of [0;100_00] means [0-100%])\n uint256 internal _maxCommissionRate;\n /// @dev The min commission rate that the validator can set (in range of [0;100_00] means [0-100%])\n uint256 internal _minCommissionRate;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] ______gap;\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function minValidatorStakingAmount() public view override returns (uint256) {\n return _minValidatorStakingAmount;\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function getCommissionRateRange() external view override returns (uint256, uint256) {\n return (_minCommissionRate, _maxCommissionRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function setMinValidatorStakingAmount(uint256 _threshold) external override onlyAdmin {\n _setMinValidatorStakingAmount(_threshold);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external override onlyAdmin {\n _setCommissionRateRange(_minRate, _maxRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function applyValidatorCandidate(\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external payable override nonReentrant {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\n\n uint256 _amount = msg.value;\n address payable _poolAdmin = payable(msg.sender);\n _applyValidatorCandidate(\n _poolAdmin,\n _candidateAdmin,\n _consensusAddr,\n _treasuryAddr,\n _bridgeOperatorAddr,\n _commissionRate,\n _amount\n );\n\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\n _pool.admin = _poolAdmin;\n _pool.addr = _consensusAddr;\n _adminOfActivePoolMapping[_poolAdmin] = _consensusAddr;\n\n _stake(_stakingPool[_consensusAddr], _poolAdmin, _amount);\n emit PoolApproved(_consensusAddr, _poolAdmin);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveDaysOnwards,\n uint256 _commissionRate\n ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) {\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\n _validatorContract.execRequestUpdateCommissionRate(_consensusAddr, _effectiveDaysOnwards, _commissionRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function execDeprecatePools(address[] calldata _pools, uint256 _newPeriod) external override onlyValidatorContract {\n if (_pools.length == 0) {\n return;\n }\n\n for (uint _i = 0; _i < _pools.length; _i++) {\n PoolDetail storage _pool = _stakingPool[_pools[_i]];\n // Deactivate the pool admin in the active mapping.\n delete _adminOfActivePoolMapping[_pool.admin];\n\n // Deduct and transfer the self staking amount to the pool admin.\n uint256 _deductingAmount = _pool.stakingAmount;\n if (_deductingAmount > 0) {\n _deductStakingAmount(_pool, _deductingAmount);\n if (!_unsafeSendRON(payable(_pool.admin), _deductingAmount, DEFAULT_ADDITION_GAS)) {\n emit StakingAmountTransferFailed(_pool.addr, _pool.admin, _deductingAmount, address(this).balance);\n }\n }\n\n // Settle the unclaimed reward and transfer to the pool admin.\n uint256 _lastRewardAmount = _claimReward(_pools[_i], _pool.admin, _newPeriod);\n if (_lastRewardAmount > 0) {\n _unsafeSendRON(payable(_pool.admin), _lastRewardAmount, DEFAULT_ADDITION_GAS);\n }\n }\n\n emit PoolsDeprecated(_pools);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function stake(address _consensusAddr) external payable override noEmptyValue poolIsActive(_consensusAddr) {\n _stake(_stakingPool[_consensusAddr], msg.sender, msg.value);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function unstake(address _consensusAddr, uint256 _amount)\n external\n override\n nonReentrant\n poolIsActive(_consensusAddr)\n {\n if (_amount == 0) revert ErrUnstakeZeroAmount();\n address _requester = msg.sender;\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\n uint256 _remainAmount = _pool.stakingAmount - _amount;\n if (_remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft();\n\n _unstake(_pool, _requester, _amount);\n if (!_unsafeSendRON(payable(_requester), _amount, DEFAULT_ADDITION_GAS)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestRenounce(address _consensusAddr)\n external\n override\n poolIsActive(_consensusAddr)\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\n {\n _validatorContract.execRequestRenounceCandidate(_consensusAddr, _waitingSecsToRevoke);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestEmergencyExit(address _consensusAddr)\n external\n override\n poolIsActive(_consensusAddr)\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\n {\n _validatorContract.execEmergencyExit(_consensusAddr, _waitingSecsToRevoke);\n }\n\n /**\n * @dev See `ICandidateStaking-applyValidatorCandidate`\n */\n function _applyValidatorCandidate(\n address payable _poolAdmin,\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate,\n uint256 _amount\n ) internal {\n if (!_unsafeSendRON(_poolAdmin, 0)) revert ErrCannotInitTransferRON(_poolAdmin, \"pool admin\");\n if (!_unsafeSendRON(_treasuryAddr, 0)) revert ErrCannotInitTransferRON(_treasuryAddr, \"treasury\");\n if (_amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount();\n if (_poolAdmin != _candidateAdmin || _candidateAdmin != _treasuryAddr) revert ErrThreeInteractionAddrsNotEqual();\n\n address[] memory _diffAddrs = new address[](3);\n _diffAddrs[0] = _poolAdmin;\n _diffAddrs[1] = _consensusAddr;\n _diffAddrs[2] = _bridgeOperatorAddr;\n if (AddressArrayUtils.hasDuplicate(_diffAddrs)) revert ErrThreeOperationAddrsNotDistinct();\n\n _validatorContract.execApplyValidatorCandidate(\n _candidateAdmin,\n _consensusAddr,\n _treasuryAddr,\n _bridgeOperatorAddr,\n _commissionRate\n );\n }\n\n /**\n * @dev See `ICandidateStaking-stake`\n */\n function _stake(\n PoolDetail storage _pool,\n address _requester,\n uint256 _amount\n ) internal onlyPoolAdmin(_pool, _requester) {\n _pool.stakingAmount += _amount;\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal + _amount);\n _pool.lastDelegatingTimestamp[_requester] = block.timestamp;\n emit Staked(_pool.addr, _amount);\n }\n\n /**\n * @dev See `ICandidateStaking-unstake`\n */\n function _unstake(\n PoolDetail storage _pool,\n address _requester,\n uint256 _amount\n ) internal onlyPoolAdmin(_pool, _requester) {\n if (_amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount();\n if (_pool.lastDelegatingTimestamp[_requester] + _cooldownSecsToUndelegate > block.timestamp) {\n revert ErrUnstakeTooEarly();\n }\n\n _pool.stakingAmount -= _amount;\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal - _amount);\n emit Unstaked(_pool.addr, _amount);\n }\n\n /**\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\n *\n * Emits the event `Unstaked`.\n *\n * @return The actual deducted amount\n */\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount) internal virtual returns (uint256);\n\n /**\n * @dev Sets the minimum threshold for being a validator candidate.\n *\n * Emits the `MinValidatorStakingAmountUpdated` event.\n *\n */\n function _setMinValidatorStakingAmount(uint256 _threshold) internal {\n _minValidatorStakingAmount = _threshold;\n emit MinValidatorStakingAmountUpdated(_threshold);\n }\n\n /**\n * @dev Sets the max commission rate that a candidate can set.\n *\n * Emits the `MaxCommissionRateUpdated` event.\n *\n */\n function _setCommissionRateRange(uint256 _minRate, uint256 _maxRate) internal {\n if (_maxRate > _MAX_PERCENTAGE || _minRate > _maxRate) revert ErrInvalidCommissionRate();\n _maxCommissionRate = _maxRate;\n _minCommissionRate = _minRate;\n emit CommissionRateRangeUpdated(_minRate, _maxRate);\n }\n}\n" + }, + "contracts/ronin/staking/DelegatorStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/staking/IDelegatorStaking.sol\";\nimport \"./BaseStaking.sol\";\n\nabstract contract DelegatorStaking is BaseStaking, IDelegatorStaking {\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function delegate(address _consensusAddr) external payable noEmptyValue poolIsActive(_consensusAddr) {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n _delegate(_stakingPool[_consensusAddr], msg.sender, msg.value);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function undelegate(address _consensusAddr, uint256 _amount) external nonReentrant {\n address payable _delegator = payable(msg.sender);\n _undelegate(_stakingPool[_consensusAddr], _delegator, _amount);\n if (!_sendRON(_delegator, _amount)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external nonReentrant {\n if (_consensusAddrs.length == 0 || _consensusAddrs.length != _amounts.length) revert ErrInvalidArrays();\n\n address payable _delegator = payable(msg.sender);\n uint256 _total;\n\n for (uint _i = 0; _i < _consensusAddrs.length; _i++) {\n _total += _amounts[_i];\n _undelegate(_stakingPool[_consensusAddrs[_i]], _delegator, _amounts[_i]);\n }\n\n if (!_sendRON(_delegator, _total)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function redelegate(\n address _consensusAddrSrc,\n address _consensusAddrDst,\n uint256 _amount\n ) external nonReentrant poolIsActive(_consensusAddrDst) {\n address _delegator = msg.sender;\n _undelegate(_stakingPool[_consensusAddrSrc], _delegator, _amount);\n _delegate(_stakingPool[_consensusAddrDst], _delegator, _amount);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function claimRewards(address[] calldata _consensusAddrList)\n external\n override\n nonReentrant\n returns (uint256 _amount)\n {\n _amount = _claimRewards(msg.sender, _consensusAddrList);\n _transferRON(payable(msg.sender), _amount);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\n external\n override\n nonReentrant\n poolIsActive(_consensusAddrDst)\n returns (uint256 _amount)\n {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n return _delegateRewards(msg.sender, _consensusAddrList, _consensusAddrDst);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function getRewards(address _user, address[] calldata _poolAddrList)\n external\n view\n returns (uint256[] memory _rewards)\n {\n address _consensusAddr;\n uint256 _period = _validatorContract.currentPeriod();\n _rewards = new uint256[](_poolAddrList.length);\n\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\n _consensusAddr = _poolAddrList[_i];\n _rewards[_i] = _getReward(_consensusAddr, _user, _period, getStakingAmount(_consensusAddr, _user));\n }\n }\n\n /**\n * @dev Delegates from a validator address.\n *\n * Requirements:\n * - The delegator is not the pool admin.\n *\n * Emits the `Delegated` event.\n *\n * Note: This function does not verify the `msg.value` with the amount.\n *\n */\n function _delegate(\n PoolDetail storage _pool,\n address _delegator,\n uint256 _amount\n ) internal notPoolAdmin(_pool, _delegator) {\n _changeDelegatingAmount(\n _pool,\n _delegator,\n _pool.delegatingAmount[_delegator] + _amount,\n _pool.stakingTotal + _amount\n );\n _pool.lastDelegatingTimestamp[_delegator] = block.timestamp;\n emit Delegated(_delegator, _pool.addr, _amount);\n }\n\n /**\n * @dev Undelegates from a validator address.\n *\n * Requirements:\n * - The delegator is not the pool admin.\n * - The amount is larger than 0.\n * - The delegating amount is larger than or equal to the undelegating amount.\n *\n * Emits the `Undelegated` event.\n *\n * Note: Consider transferring back the amount of RON after calling this function.\n *\n */\n function _undelegate(\n PoolDetail storage _pool,\n address _delegator,\n uint256 _amount\n ) private notPoolAdmin(_pool, _delegator) {\n if (_amount == 0) revert ErrUndelegateZeroAmount();\n if (_pool.delegatingAmount[_delegator] < _amount) revert ErrInsufficientDelegatingAmount();\n\n if (\n _validatorContract.isValidatorCandidate(_pool.addr) &&\n _validatorContract.getCandidateInfo(_pool.addr).revokingTimestamp == 0 && // if candidate is not on renunciation\n _pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp // delegator is still in cooldown\n ) revert ErrUndelegateTooEarly();\n\n _changeDelegatingAmount(\n _pool,\n _delegator,\n _pool.delegatingAmount[_delegator] - _amount,\n _pool.stakingTotal - _amount\n );\n emit Undelegated(_delegator, _pool.addr, _amount);\n }\n\n /**\n * @dev Claims rewards from the pools `_poolAddrList`.\n * Note: This function does not transfer reward to user.\n */\n function _claimRewards(address _user, address[] memory _poolAddrList) internal returns (uint256 _amount) {\n uint256 _period = _currentPeriod();\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\n _amount += _claimReward(_poolAddrList[_i], _user, _period);\n }\n }\n\n /**\n * @dev Claims the rewards and delegates them to the consensus address.\n */\n function _delegateRewards(\n address _user,\n address[] calldata _poolAddrList,\n address _poolAddrDst\n ) internal returns (uint256 _amount) {\n _amount = _claimRewards(_user, _poolAddrList);\n _delegate(_stakingPool[_poolAddrDst], _user, _amount);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/libraries/AddressArrayUtils.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary AddressArrayUtils {\n /**\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\n * @param A Array to search\n * @return Returns true if duplicate, false otherwise\n */\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\n if (A.length == 0) {\n return false;\n }\n for (uint256 i = 0; i < A.length - 1; i++) {\n for (uint256 j = i + 1; j < A.length; j++) {\n if (A[i] == A[j]) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * @dev Returns whether two arrays of addresses are equal or not.\n */\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool) {\n bytes32 _thisHash;\n bytes32 _otherHash;\n\n assembly {\n _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\n _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\n }\n\n return _thisHash == _otherHash;\n }\n}\n" + }, + "contracts/ronin/staking/BaseStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\nimport \"../../interfaces/staking/IBaseStaking.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"./RewardCalculation.sol\";\n\nabstract contract BaseStaking is\n RONTransferHelper,\n ReentrancyGuard,\n RewardCalculation,\n HasValidatorContract,\n IBaseStaking\n{\n /// @dev Mapping from pool address => staking pool detail\n mapping(address => PoolDetail) internal _stakingPool;\n\n /// @dev The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n uint256 internal _cooldownSecsToUndelegate;\n /// @dev The number of seconds that a candidate must wait to be revoked and take the self-staking amount back.\n uint256 internal _waitingSecsToRevoke;\n\n /// @dev Mapping from admin address of an active pool => consensus address.\n mapping(address => address) internal _adminOfActivePoolMapping;\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n modifier noEmptyValue() {\n if (msg.value == 0) revert ErrZeroValue();\n _;\n }\n\n modifier notPoolAdmin(PoolDetail storage _pool, address _delegator) {\n if (_pool.admin == _delegator) revert ErrPoolAdminForbidden();\n _;\n }\n\n modifier onlyPoolAdmin(PoolDetail storage _pool, address _requester) {\n if (_pool.admin != _requester) revert ErrOnlyPoolAdminAllowed();\n _;\n }\n\n modifier poolIsActive(address _poolAddr) {\n if (!_validatorContract.isValidatorCandidate(_poolAddr)) revert ErrInactivePool(_poolAddr);\n _;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function isAdminOfActivePool(address _poolAdminAddr) public view override returns (bool) {\n return _adminOfActivePoolMapping[_poolAdminAddr] != address(0);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getPoolAddressOf(address _poolAdminAddr) external view override returns (address) {\n return _adminOfActivePoolMapping[_poolAdminAddr];\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getPoolDetail(address _poolAddr)\n external\n view\n returns (\n address _admin,\n uint256 _stakingAmount,\n uint256 _stakingTotal\n )\n {\n PoolDetail storage _pool = _stakingPool[_poolAddr];\n return (_pool.admin, _pool.stakingAmount, _pool.stakingTotal);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getManySelfStakings(address[] calldata _pools) external view returns (uint256[] memory _selfStakings) {\n _selfStakings = new uint256[](_pools.length);\n for (uint _i = 0; _i < _pools.length; _i++) {\n _selfStakings[_i] = _stakingPool[_pools[_i]].stakingAmount;\n }\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingTotal(address _poolAddr) public view override returns (uint256) {\n return _stakingPool[_poolAddr].stakingTotal;\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getManyStakingTotals(address[] calldata _poolList)\n public\n view\n override\n returns (uint256[] memory _stakingAmounts)\n {\n _stakingAmounts = new uint256[](_poolList.length);\n for (uint _i = 0; _i < _poolList.length; _i++) {\n _stakingAmounts[_i] = getStakingTotal(_poolList[_i]);\n }\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingAmount(address _poolAddr, address _user) public view override returns (uint256) {\n return _stakingPool[_poolAddr].delegatingAmount[_user];\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\n external\n view\n override\n returns (uint256[] memory _stakingAmounts)\n {\n if (_poolAddrs.length != _userList.length) revert ErrInvalidArrays();\n _stakingAmounts = new uint256[](_poolAddrs.length);\n for (uint _i = 0; _i < _stakingAmounts.length; _i++) {\n _stakingAmounts[_i] = _stakingPool[_poolAddrs[_i]].delegatingAmount[_userList[_i]];\n }\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function cooldownSecsToUndelegate() external view returns (uint256) {\n return _cooldownSecsToUndelegate;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function waitingSecsToRevoke() external view returns (uint256) {\n return _waitingSecsToRevoke;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external override onlyAdmin {\n _setCooldownSecsToUndelegate(_cooldownSecs);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function setWaitingSecsToRevoke(uint256 _secs) external override onlyAdmin {\n _setWaitingSecsToRevoke(_secs);\n }\n\n /**\n * @dev Sets the minium number of seconds to undelegate.\n *\n * Emits the event `CooldownSecsToUndelegateUpdated`.\n *\n */\n function _setCooldownSecsToUndelegate(uint256 _cooldownSecs) internal {\n _cooldownSecsToUndelegate = _cooldownSecs;\n emit CooldownSecsToUndelegateUpdated(_cooldownSecs);\n }\n\n /**\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\n *\n * Emits the event `WaitingSecsToRevokeUpdated`.\n *\n */\n function _setWaitingSecsToRevoke(uint256 _secs) internal {\n _waitingSecsToRevoke = _secs;\n emit WaitingSecsToRevokeUpdated(_secs);\n }\n\n /**\n * @dev Changes the delegate amount.\n */\n function _changeDelegatingAmount(\n PoolDetail storage _pool,\n address _delegator,\n uint256 _newDelegatingAmount,\n uint256 _newStakingTotal\n ) internal {\n _syncUserReward(_pool.addr, _delegator, _newDelegatingAmount);\n _pool.stakingTotal = _newStakingTotal;\n _pool.delegatingAmount[_delegator] = _newDelegatingAmount;\n }\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "contracts/ronin/staking/RewardCalculation.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/staking/IRewardPool.sol\";\nimport \"../../libraries/Math.sol\";\n\n/**\n * @title RewardCalculation contract\n * @dev This contract mainly contains the methods to calculate reward for staking contract.\n */\nabstract contract RewardCalculation is IRewardPool {\n /// @dev Mapping from pool address => period number => accumulated rewards per share (one unit staking)\n mapping(address => mapping(uint256 => PeriodWrapper)) private _accumulatedRps;\n /// @dev Mapping from the pool address => user address => the reward info of the user\n mapping(address => mapping(address => UserRewardFields)) private _userReward;\n /// @dev Mapping from the pool address => reward pool fields\n mapping(address => PoolFields) private _stakingPool;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IRewardPool\n */\n function getReward(address _poolAddr, address _user) external view returns (uint256) {\n return _getReward(_poolAddr, _user, _currentPeriod(), getStakingAmount(_poolAddr, _user));\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingAmount(address _poolAddr, address _user) public view virtual returns (uint256);\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingTotal(address _poolAddr) public view virtual returns (uint256);\n\n /**\n * @dev Returns the reward amount that user claimable.\n */\n function _getReward(\n address _poolAddr,\n address _user,\n uint256 _latestPeriod,\n uint256 _latestStakingAmount\n ) internal view returns (uint256) {\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\n\n if (_reward.lastPeriod == _latestPeriod) {\n return _reward.debited;\n }\n\n uint256 _aRps;\n uint256 _lastPeriodReward;\n PoolFields storage _pool = _stakingPool[_poolAddr];\n PeriodWrapper storage _wrappedArps = _accumulatedRps[_poolAddr][_reward.lastPeriod];\n\n if (_wrappedArps.lastPeriod > 0) {\n // Calculates the last period reward if the aRps at the period is set\n _aRps = _wrappedArps.inner;\n _lastPeriodReward = _reward.lowestAmount * (_aRps - _reward.aRps);\n } else {\n // Fallbacks to the previous aRps in case the aRps is not set\n _aRps = _reward.aRps;\n }\n\n uint256 _newPeriodsReward = _latestStakingAmount * (_pool.aRps - _aRps);\n return _reward.debited + (_lastPeriodReward + _newPeriodsReward) / 1e18;\n }\n\n /**\n * @dev Syncs the user reward.\n *\n * Emits the event `UserRewardUpdated` once the debit amount is updated.\n * Emits the event `PoolSharesUpdated` once the pool share is updated.\n *\n * Note: The method should be called whenever the user's staking amount changes.\n *\n */\n function _syncUserReward(\n address _poolAddr,\n address _user,\n uint256 _newStakingAmount\n ) internal {\n uint256 _period = _currentPeriod();\n PoolFields storage _pool = _stakingPool[_poolAddr];\n uint256 _lastShares = _pool.shares.inner;\n\n // Updates the pool shares if it is outdated\n if (_pool.shares.lastPeriod < _period) {\n _pool.shares = PeriodWrapper(getStakingTotal(_poolAddr), _period);\n }\n\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\n uint256 _debited = _getReward(_poolAddr, _user, _period, _currentStakingAmount);\n\n if (_reward.debited != _debited) {\n _reward.debited = _debited;\n emit UserRewardUpdated(_poolAddr, _user, _debited);\n }\n\n _syncMinStakingAmount(_pool, _reward, _period, _newStakingAmount, _currentStakingAmount);\n _reward.aRps = _pool.aRps;\n _reward.lastPeriod = _period;\n\n if (_pool.shares.inner != _lastShares) {\n emit PoolSharesUpdated(_period, _poolAddr, _pool.shares.inner);\n }\n }\n\n /**\n * @dev Syncs the minimum staking amount of an user in the current period.\n */\n function _syncMinStakingAmount(\n PoolFields storage _pool,\n UserRewardFields storage _reward,\n uint256 _latestPeriod,\n uint256 _newStakingAmount,\n uint256 _currentStakingAmount\n ) internal {\n if (_reward.lastPeriod < _latestPeriod) {\n _reward.lowestAmount = _currentStakingAmount;\n }\n\n uint256 _lowestAmount = Math.min(_reward.lowestAmount, _newStakingAmount);\n uint256 _diffAmount = _reward.lowestAmount - _lowestAmount;\n if (_diffAmount > 0) {\n _reward.lowestAmount = _lowestAmount;\n if (_pool.shares.inner < _diffAmount) revert ErrInvalidPoolShare();\n _pool.shares.inner -= _diffAmount;\n }\n }\n\n /**\n * @dev Claims the settled reward for a specific user.\n *\n * @param _lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or\n * `_currentPeriod + 1` in case of calculating the reward for revoked validators.\n *\n * Emits the `RewardClaimed` event and the `UserRewardUpdated` event.\n *\n * Note: This method should be called before transferring rewards for the user.\n *\n */\n function _claimReward(\n address _poolAddr,\n address _user,\n uint256 _lastPeriod\n ) internal returns (uint256 _amount) {\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\n _amount = _getReward(_poolAddr, _user, _lastPeriod, _currentStakingAmount);\n emit RewardClaimed(_poolAddr, _user, _amount);\n\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\n _reward.debited = 0;\n _syncMinStakingAmount(_stakingPool[_poolAddr], _reward, _lastPeriod, _currentStakingAmount, _currentStakingAmount);\n _reward.lastPeriod = _lastPeriod;\n _reward.aRps = _stakingPool[_poolAddr].aRps;\n emit UserRewardUpdated(_poolAddr, _user, 0);\n }\n\n /**\n * @dev Records the amount of rewards `_rewards` for the pools `_poolAddrs`.\n *\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\n * Emits the event `PoolUpdateConflicted` when the pool is already updated in the period.\n *\n * Note: This method should be called once at the period ending.\n *\n */\n function _recordRewards(\n address[] memory _poolAddrs,\n uint256[] calldata _rewards,\n uint256 _period\n ) internal {\n if (_poolAddrs.length != _rewards.length) {\n emit PoolsUpdateFailed(_period, _poolAddrs, _rewards);\n return;\n }\n\n uint256 _rps;\n uint256 _count;\n address _poolAddr;\n uint256 _stakingTotal;\n uint256[] memory _aRps = new uint256[](_poolAddrs.length);\n uint256[] memory _shares = new uint256[](_poolAddrs.length);\n address[] memory _conflicted = new address[](_poolAddrs.length);\n\n for (uint _i = 0; _i < _poolAddrs.length; _i++) {\n _poolAddr = _poolAddrs[_i];\n PoolFields storage _pool = _stakingPool[_poolAddr];\n _stakingTotal = getStakingTotal(_poolAddr);\n\n if (_accumulatedRps[_poolAddr][_period].lastPeriod == _period) {\n _conflicted[_count++] = _poolAddr;\n continue;\n }\n\n // Updates the pool shares if it is outdated\n if (_pool.shares.lastPeriod < _period) {\n _pool.shares = PeriodWrapper(_stakingTotal, _period);\n }\n\n // The rps is 0 if no one stakes for the pool\n _rps = _pool.shares.inner == 0 ? 0 : (_rewards[_i] * 1e18) / _pool.shares.inner;\n _aRps[_i - _count] = _pool.aRps += _rps;\n _accumulatedRps[_poolAddr][_period] = PeriodWrapper(_pool.aRps, _period);\n _pool.shares.inner = _stakingTotal;\n _shares[_i - _count] = _pool.shares.inner;\n _poolAddrs[_i - _count] = _poolAddr;\n }\n\n if (_count > 0) {\n assembly {\n mstore(_conflicted, _count)\n mstore(_poolAddrs, sub(mload(_poolAddrs), _count))\n }\n emit PoolsUpdateConflicted(_period, _conflicted);\n }\n\n if (_poolAddrs.length > 0) {\n emit PoolsUpdated(_period, _poolAddrs, _aRps, _shares);\n }\n }\n\n /**\n * @dev Returns the current period.\n */\n function _currentPeriod() internal view virtual returns (uint256);\n}\n" + }, + "contracts/ronin/Maintenance.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../interfaces/IMaintenance.sol\";\nimport \"../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../extensions/collections/HasValidatorContract.sol\";\nimport \"../libraries/Math.sol\";\n\ncontract Maintenance is IMaintenance, HasValidatorContract, Initializable {\n using Math for uint256;\n\n /// @dev Mapping from consensus address => maintenance schedule.\n mapping(address => Schedule) internal _schedule;\n\n /// @dev The min duration to maintenance in blocks.\n uint256 public minMaintenanceDurationInBlock;\n /// @dev The max duration to maintenance in blocks.\n uint256 public maxMaintenanceDurationInBlock;\n /// @dev The offset to the min block number that the schedule can start.\n uint256 public minOffsetToStartSchedule;\n /// @dev The offset to the max block number that the schedule can start.\n uint256 public maxOffsetToStartSchedule;\n /// @dev The max number of scheduled maintenances.\n uint256 public maxSchedules;\n /// @dev The cooldown time to request new schedule.\n uint256 public cooldownSecsToMaintain;\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) external initializer {\n _setValidatorContract(__validatorContract);\n _setMaintenanceConfig(\n _minMaintenanceDurationInBlock,\n _maxMaintenanceDurationInBlock,\n _minOffsetToStartSchedule,\n _maxOffsetToStartSchedule,\n _maxSchedules,\n _cooldownSecsToMaintain\n );\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function setMaintenanceConfig(\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) external onlyAdmin {\n _setMaintenanceConfig(\n _minMaintenanceDurationInBlock,\n _maxMaintenanceDurationInBlock,\n _minOffsetToStartSchedule,\n _maxOffsetToStartSchedule,\n _maxSchedules,\n _cooldownSecsToMaintain\n );\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function schedule(\n address _consensusAddr,\n uint256 _startedAtBlock,\n uint256 _endedAtBlock\n ) external override {\n IRoninValidatorSet _validator = _validatorContract;\n\n require(_validator.isBlockProducer(_consensusAddr), \"Maintenance: consensus address must be a block producer\");\n require(\n _validator.isCandidateAdmin(_consensusAddr, msg.sender),\n \"Maintenance: method caller must be a candidate admin\"\n );\n require(!checkScheduled(_consensusAddr), \"Maintenance: already scheduled\");\n require(checkCooldownEnds(_consensusAddr), \"Maintainance: cooldown time not end\");\n require(totalSchedules() < maxSchedules, \"Maintenance: exceeds total of schedules\");\n require(\n _startedAtBlock.inRange(block.number + minOffsetToStartSchedule, block.number + maxOffsetToStartSchedule),\n \"Maintenance: start block is out of offset\"\n );\n require(_startedAtBlock < _endedAtBlock, \"Maintenance: start block must be less than end block\");\n uint256 _maintenanceElapsed = _endedAtBlock - _startedAtBlock + 1;\n require(\n _maintenanceElapsed.inRange(minMaintenanceDurationInBlock, maxMaintenanceDurationInBlock),\n \"Maintenance: invalid maintenance duration\"\n );\n require(_validator.epochEndingAt(_startedAtBlock - 1), \"Maintenance: start block is not at the start of an epoch\");\n require(_validator.epochEndingAt(_endedAtBlock), \"Maintenance: end block is not at the end of an epoch\");\n\n Schedule storage _sSchedule = _schedule[_consensusAddr];\n _sSchedule.from = _startedAtBlock;\n _sSchedule.to = _endedAtBlock;\n _sSchedule.lastUpdatedBlock = block.number;\n _sSchedule.requestTimestamp = block.timestamp;\n emit MaintenanceScheduled(_consensusAddr, _sSchedule);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function cancelSchedule(address _consensusAddr) external override {\n require(\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\n \"Maintenance: method caller must be the candidate admin\"\n );\n require(checkScheduled(_consensusAddr), \"Maintenance: no schedule exists\");\n require(!checkMaintained(_consensusAddr, block.number), \"Maintenance: already on maintenance\");\n Schedule storage _sSchedule = _schedule[_consensusAddr];\n delete _sSchedule.from;\n delete _sSchedule.to;\n _sSchedule.lastUpdatedBlock = block.number;\n emit MaintenanceScheduleCancelled(_consensusAddr);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function getSchedule(address _consensusAddr) external view override returns (Schedule memory) {\n return _schedule[_consensusAddr];\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkManyMaintained(address[] calldata _addrList, uint256 _block)\n external\n view\n override\n returns (bool[] memory _resList)\n {\n _resList = new bool[](_addrList.length);\n for (uint _i = 0; _i < _addrList.length; _i++) {\n _resList[_i] = checkMaintained(_addrList[_i], _block);\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkManyMaintainedInBlockRange(\n address[] calldata _addrList,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view override returns (bool[] memory _resList) {\n _resList = new bool[](_addrList.length);\n for (uint _i = 0; _i < _addrList.length; _i++) {\n _resList[_i] = _maintainingInBlockRange(_addrList[_i], _fromBlock, _toBlock);\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function totalSchedules() public view override returns (uint256 _count) {\n (address[] memory _validators, , ) = _validatorContract.getValidators();\n for (uint _i = 0; _i < _validators.length; _i++) {\n if (checkScheduled(_validators[_i])) {\n _count++;\n }\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkMaintained(address _consensusAddr, uint256 _block) public view override returns (bool) {\n Schedule storage _s = _schedule[_consensusAddr];\n return _s.from <= _block && _block <= _s.to;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkMaintainedInBlockRange(\n address _consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) public view override returns (bool) {\n return _maintainingInBlockRange(_consensusAddr, _fromBlock, _toBlock);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkScheduled(address _consensusAddr) public view override returns (bool) {\n return block.number <= _schedule[_consensusAddr].to;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkCooldownEnds(address _consensusAddr) public view override returns (bool) {\n return block.timestamp > _schedule[_consensusAddr].requestTimestamp + cooldownSecsToMaintain;\n }\n\n /**\n * @dev Sets the min block period and max block period to maintenance.\n *\n * Requirements:\n * - The max period is larger than the min period.\n *\n * Emits the event `MaintenanceConfigUpdated`.\n *\n */\n function _setMaintenanceConfig(\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) internal {\n require(\n _minMaintenanceDurationInBlock < _maxMaintenanceDurationInBlock,\n \"Maintenance: invalid maintenance duration configs\"\n );\n require(\n _minOffsetToStartSchedule < _maxOffsetToStartSchedule,\n \"Maintenance: invalid offset to start schedule configs\"\n );\n minMaintenanceDurationInBlock = _minMaintenanceDurationInBlock;\n maxMaintenanceDurationInBlock = _maxMaintenanceDurationInBlock;\n minOffsetToStartSchedule = _minOffsetToStartSchedule;\n maxOffsetToStartSchedule = _maxOffsetToStartSchedule;\n maxSchedules = _maxSchedules;\n cooldownSecsToMaintain = _cooldownSecsToMaintain;\n emit MaintenanceConfigUpdated(\n _minMaintenanceDurationInBlock,\n _maxMaintenanceDurationInBlock,\n _minOffsetToStartSchedule,\n _maxOffsetToStartSchedule,\n _maxSchedules,\n _cooldownSecsToMaintain\n );\n }\n\n /**\n * @dev Check if the validator was maintaining in the current period.\n *\n * Note: This method should be called at the end of the period.\n */\n function _maintainingInBlockRange(\n address _consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) private view returns (bool) {\n Schedule storage _s = _schedule[_consensusAddr];\n return Math.twoRangeOverlap(_fromBlock, _toBlock, _s.from, _s.to);\n }\n}\n" + }, + "contracts/interfaces/IMaintenance.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IMaintenance {\n struct Schedule {\n uint256 from;\n uint256 to;\n uint256 lastUpdatedBlock;\n uint256 requestTimestamp;\n }\n\n /// @dev Emitted when a maintenance is scheduled.\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\n /// @dev Emitted when a schedule of maintenance is cancelled.\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\n /// @dev Emitted when the maintenance config is updated.\n event MaintenanceConfigUpdated(\n uint256 minMaintenanceDurationInBlock,\n uint256 maxMaintenanceDurationInBlock,\n uint256 minOffsetToStartSchedule,\n uint256 maxOffsetToStartSchedule,\n uint256 maxSchedules,\n uint256 cooldownSecsToMaintain\n );\n\n /**\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\n */\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\n */\n function checkMaintainedInBlockRange(\n address _consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool);\n\n /**\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\n */\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\n\n /**\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\n */\n function checkManyMaintainedInBlockRange(\n address[] calldata _addrList,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\n */\n function checkScheduled(address _consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `_consensusAddr`\n */\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\n */\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\n\n /**\n * @dev Returns the total of current schedules.\n */\n function totalSchedules() external view returns (uint256 _count);\n\n /**\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\n *\n * Requirements:\n * - The method caller is admin.\n * - The max duration is larger than the min duration.\n * - The max offset is larger than the min offset.\n *\n * Emits the event `MaintenanceConfigUpdated`.\n *\n */\n function setMaintenanceConfig(\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) external;\n\n /**\n * @dev Returns the min duration for maintenance in block.\n */\n function minMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev Returns the max duration for maintenance in block.\n */\n function maxMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev The offset to the min block number that the schedule can start\n */\n function minOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev The offset to the max block number that the schedule can start\n */\n function maxOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev Returns the max number of scheduled maintenances.\n */\n function maxSchedules() external view returns (uint256);\n\n /**\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\n *\n * Requirements:\n * - The candidate `_consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\n * - The total number of schedules is not larger than `maxSchedules()`.\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\n * - The end block is larger than the start block.\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\n * - The start block is at the start of an epoch.\n * - The end block is at the end of an epoch.\n *\n * Emits the event `MaintenanceScheduled`.\n *\n */\n function schedule(\n address _consensusAddr,\n uint256 _startedAtBlock,\n uint256 _endedAtBlock\n ) external;\n\n /**\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\n *\n * Requirements:\n * - The candidate `_consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\n *\n * Emits the event `MaintenanceScheduleCancelled`.\n */\n function cancelSchedule(address _consensusAddr) external;\n}\n" + }, + "contracts/ronin/StakingVesting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../interfaces/IStakingVesting.sol\";\nimport \"../extensions/collections/HasValidatorContract.sol\";\nimport \"../extensions/RONTransferHelper.sol\";\n\ncontract StakingVesting is IStakingVesting, HasValidatorContract, RONTransferHelper, Initializable {\n /// @dev The block bonus for the block producer whenever a new block is mined.\n uint256 internal _blockProducerBonusPerBlock;\n /// @dev The block bonus for the bridge operator whenever a new block is mined.\n uint256 internal _bridgeOperatorBonusPerBlock;\n /// @dev The last block number that the staking vesting sent.\n uint256 public lastBlockSendingBonus;\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 __blockProducerBonusPerBlock,\n uint256 __bridgeOperatorBonusPerBlock\n ) external payable initializer {\n _setValidatorContract(__validatorContract);\n _setBlockProducerBonusPerBlock(__blockProducerBonusPerBlock);\n _setBridgeOperatorBonusPerBlock(__bridgeOperatorBonusPerBlock);\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function receiveRON() external payable {}\n\n /**\n * @inheritdoc IStakingVesting\n */\n function blockProducerBlockBonus(\n uint256 /* _block */\n ) public view override returns (uint256) {\n return _blockProducerBonusPerBlock;\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function bridgeOperatorBlockBonus(\n uint256 /* _block */\n ) public view override returns (uint256) {\n return _bridgeOperatorBonusPerBlock;\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\n external\n override\n onlyValidatorContract\n returns (\n bool _success,\n uint256 _blockProducerBonus,\n uint256 _bridgeOperatorBonus\n )\n {\n require(block.number > lastBlockSendingBonus, \"StakingVesting: bonus for already sent\");\n lastBlockSendingBonus = block.number;\n\n _blockProducerBonus = _forBlockProducer ? blockProducerBlockBonus(block.number) : 0;\n _bridgeOperatorBonus = _forBridgeOperator ? bridgeOperatorBlockBonus(block.number) : 0;\n\n uint256 _totalAmount = _blockProducerBonus + _bridgeOperatorBonus;\n\n if (_totalAmount > 0) {\n address payable _validatorContractAddr = payable(validatorContract());\n\n _success = _unsafeSendRON(_validatorContractAddr, _totalAmount);\n\n if (!_success) {\n emit BonusTransferFailed(\n block.number,\n _validatorContractAddr,\n _blockProducerBonus,\n _bridgeOperatorBonus,\n address(this).balance\n );\n return (_success, 0, 0);\n }\n\n emit BonusTransferred(block.number, _validatorContractAddr, _blockProducerBonus, _bridgeOperatorBonus);\n }\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function setBlockProducerBonusPerBlock(uint256 _amount) external override onlyAdmin {\n _setBlockProducerBonusPerBlock(_amount);\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external override onlyAdmin {\n _setBridgeOperatorBonusPerBlock(_amount);\n }\n\n /**\n * @dev Sets the bonus amount per block for block producer.\n *\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\n *\n */\n function _setBlockProducerBonusPerBlock(uint256 _amount) internal {\n _blockProducerBonusPerBlock = _amount;\n emit BlockProducerBonusPerBlockUpdated(_amount);\n }\n\n /**\n * @dev Sets the bonus amount per block for bridge operator.\n *\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\n *\n */\n function _setBridgeOperatorBonusPerBlock(uint256 _amount) internal {\n _bridgeOperatorBonusPerBlock = _amount;\n emit BridgeOperatorBonusPerBlockUpdated(_amount);\n }\n}\n" + }, + "contracts/interfaces/IStakingVesting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IStakingVesting {\n /// @dev Emitted when the block bonus for block producer is transferred.\n event BonusTransferred(\n uint256 indexed blockNumber,\n address indexed recipient,\n uint256 blockProducerAmount,\n uint256 bridgeOperatorAmount\n );\n /// @dev Emitted when the transfer of block bonus for block producer is failed.\n event BonusTransferFailed(\n uint256 indexed blockNumber,\n address indexed recipient,\n uint256 blockProducerAmount,\n uint256 bridgeOperatorAmount,\n uint256 contractBalance\n );\n /// @dev Emitted when the block bonus for block producer is updated\n event BlockProducerBonusPerBlockUpdated(uint256);\n /// @dev Emitted when the block bonus for bridge operator is updated\n event BridgeOperatorBonusPerBlockUpdated(uint256);\n\n /**\n * @dev Returns the bonus amount for the block producer at `_block`.\n */\n function blockProducerBlockBonus(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Returns the bonus amount for the bridge validator at `_block`.\n */\n function bridgeOperatorBlockBonus(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Receives RON from any address.\n */\n function receiveRON() external payable;\n\n /**\n * @dev Returns the last block number that the staking vesting is sent.\n */\n function lastBlockSendingBonus() external view returns (uint256);\n\n /**\n * @dev Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined.\n *\n * Requirements:\n * - The method caller must be validator contract.\n * - The method must be called only once per block.\n *\n * Emits the event `BonusTransferred` or `BonusTransferFailed`.\n *\n * Notes:\n * - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method\n * will not be reverted, and the underlying nodes does not hang.\n *\n * @param _forBlockProducer Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\n * @param _forBridgeOperator Indicates whether requesting the bonus for the bridge operator.\n *\n * @return _success Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\n * @return _blockProducerBonus The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\n * @return _bridgeOperatorBonus The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\n *\n */\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\n external\n returns (\n bool _success,\n uint256 _blockProducerBonus,\n uint256 _bridgeOperatorBonus\n );\n\n /**\n * @dev Sets the bonus amount per block for block producer.\n *\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setBlockProducerBonusPerBlock(uint256 _amount) external;\n\n /**\n * @dev Sets the bonus amount per block for bridge operator.\n *\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external;\n}\n" + }, + "contracts/ronin/VaultForwarder.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../extensions/forwarder/Forwarder.sol\";\nimport \"../extensions/RONTransferHelper.sol\";\n\n/**\n * @title A vault contract that keeps RON, and behaves as an EOA account to interact with a target contract.\n * @dev There are three roles of interaction:\n * - Admin: top-up and withdraw RON to the vault, cannot forward call to the target.\n * - Moderator: forward all calls to the target, can top-up RON, cannot withdraw RON.\n * - Others: can top-up RON, cannot execute any other actions.\n */\ncontract VaultForwarder is Forwarder, RONTransferHelper {\n /// @dev Emitted when the admin withdraws all RON from the forwarder contract.\n event ForwarderRONWithdrawn(address indexed _recipient, uint256 _value);\n\n constructor(\n address[] memory _targets,\n address _admin,\n address _mod\n ) Forwarder(_targets, _admin, _mod) {}\n\n /**\n * @dev Withdraws all balance from the transfer to the admin.\n *\n * Requirements:\n * - Only the admin can call this method.\n */\n function withdrawAll() external onlyRole(DEFAULT_ADMIN_ROLE) {\n uint256 _value = address(this).balance;\n emit ForwarderRONWithdrawn(msg.sender, _value);\n _transferRON(payable(msg.sender), _value);\n }\n}\n" + }, + "contracts/extensions/forwarder/Forwarder.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\n\ncontract Forwarder is AccessControlEnumerable {\n /// @dev Only user with moderator role can invoke {functionCall} method to forward the call to the target.\n bytes32 public constant MODERATOR_ROLE = keccak256(\"MODERATOR_ROLE\");\n\n /**\n * @dev The target contracts must be registerred by the admin before called to. The admin can register the targets at\n * the contract construction or by assigning {TARGET_ROLE} to the target addresses.\n */\n bytes32 public constant TARGET_ROLE = keccak256(\"TARGET_ROLE\");\n\n /**\n * @dev Initializes the forwarder with an initial target address and a contract admin.\n */\n constructor(\n address[] memory _targets,\n address _admin,\n address _moderator\n ) payable {\n for (uint _i = 0; _i < _targets.length; _i++) {\n _setupRole(TARGET_ROLE, _targets[_i]);\n }\n _setupRole(DEFAULT_ADMIN_ROLE, _admin);\n _setupRole(MODERATOR_ROLE, _moderator);\n }\n\n modifier validTarget(address _target) {\n _checkRole(TARGET_ROLE, _target);\n _;\n }\n\n /**\n * @dev Receives RON transfer from all addresses.\n */\n fallback() external payable {}\n\n /**\n * @dev Receives RON transfer from all addresses.\n */\n receive() external payable {}\n\n /**\n * @dev Forwards the encoded call specified by `_data` to the target. The forwarder attachs `_val` value\n * from the forwarder contract and sends along with the call.\n *\n * Requirements:\n * - Only target with {TARGET_ROLE} can be called to.\n * - Only user with {MODERATOR_ROLE} can call this method.\n */\n function functionCall(\n address _target,\n bytes memory _data,\n uint256 _val\n ) external payable validTarget(_target) onlyRole(MODERATOR_ROLE) {\n require(_val <= address(this).balance, \"Forwarder: invalid forwarding value\");\n _call(_target, _data, _val);\n }\n\n /**\n * @dev Forwards the current call to `target`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _call(\n address _target,\n bytes memory _data,\n uint256 _value\n ) internal {\n (bool _success, bytes memory _res) = _target.call{ value: _value }(_data);\n if (!_success) {\n uint _size = _res.length;\n require(_size >= 4, \"Forwarder: target reverts silently\");\n assembly {\n _res := add(_res, 0x20)\n revert(_res, _size)\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/AccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerable.sol\";\nimport \"./AccessControl.sol\";\nimport \"../utils/structs/EnumerableSet.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override {\n super._grantRole(role, account);\n _roleMembers[role].add(account);\n }\n\n /**\n * @dev Overload {_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override {\n super._revokeRole(role, account);\n _roleMembers[role].remove(account);\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(uint160(account), 20),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/ronin/gateway/PauseEnforcer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"../../interfaces/IPauseTarget.sol\";\n\ncontract PauseEnforcer is AccessControlEnumerable {\n bytes32 public constant SENTRY_ROLE = keccak256(\"SENTRY_ROLE\");\n\n /// @dev The contract that can be paused or unpaused by the SENTRY_ROLE.\n IPauseTarget public target;\n /// @dev Indicating whether or not the target contract is paused in emergency mode.\n bool public emergency;\n\n /// @dev Emitted when the emergency ppause is triggered by `account`.\n event EmergencyPaused(address account);\n /// @dev Emitted when the emergency unpause is triggered by `account`.\n event EmergencyUnpaused(address account);\n /// @dev Emitted when the target is changed.\n event TargetChanged(IPauseTarget target);\n\n modifier onEmergency() {\n require(emergency, \"PauseEnforcer: not on emergency pause\");\n _;\n }\n\n modifier targetPaused() {\n require(target.paused(), \"PauseEnforcer: target is on pause\");\n _;\n }\n\n modifier targetNotPaused() {\n require(!target.paused(), \"PauseEnforcer: target is not on pause\");\n _;\n }\n\n constructor(\n IPauseTarget _target,\n address _admin,\n address[] memory _sentries\n ) {\n _changeTarget(_target);\n _setupRole(DEFAULT_ADMIN_ROLE, _admin);\n for (uint _i; _i < _sentries.length; _i++) {\n _grantRole(SENTRY_ROLE, _sentries[_i]);\n }\n }\n\n /**\n * @dev Grants the SENTRY_ROLE to the specified address.\n */\n function grantSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _grantRole(SENTRY_ROLE, _sentry);\n }\n\n /**\n * @dev Revokes the SENTRY_ROLE from the specified address.\n */\n function revokeSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _revokeRole(SENTRY_ROLE, _sentry);\n }\n\n /**\n * @dev Triggers a pause on the target contract.\n *\n * Requirements:\n * - Only be called by accounts with the SENTRY_ROLE,\n * - The target contract is not already paused.\n */\n function triggerPause() external onlyRole(SENTRY_ROLE) targetNotPaused {\n emergency = true;\n target.pause();\n emit EmergencyPaused(msg.sender);\n }\n\n /**\n * @dev Triggers an unpause on the target contract.\n *\n * Requirements:\n * - Only be called by accounts with the SENTRY_ROLE,\n * - The target contract is already paused.\n * - The target contract is paused in emergency mode.\n */\n function triggerUnpause() external onlyRole(SENTRY_ROLE) onEmergency targetPaused {\n emergency = false;\n target.unpause();\n emit EmergencyUnpaused(msg.sender);\n }\n\n /**\n * @dev Setter for `target`.\n *\n * Requirements:\n * - Only admin can call this method.\n */\n function changeTarget(IPauseTarget _target) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _changeTarget(_target);\n }\n\n /**\n * @dev Internal helper for setting value to `target`.\n */\n function _changeTarget(IPauseTarget _target) internal {\n target = _target;\n emit TargetChanged(_target);\n }\n}\n" + }, + "contracts/interfaces/IPauseTarget.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IPauseTarget {\n function pause() external;\n\n function unpause() external;\n\n function paused() external returns (bool);\n}\n" + }, + "contracts/ronin/gateway/RoninGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../extensions/GatewayV2.sol\";\nimport \"../../extensions/MinimumWithdrawal.sol\";\nimport \"../../interfaces/IERC20Mintable.sol\";\nimport \"../../interfaces/IERC721Mintable.sol\";\nimport \"../../interfaces/IBridgeTracking.sol\";\nimport \"../../interfaces/IRoninGatewayV2.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/collections/IHasValidatorContract.sol\";\nimport \"../../interfaces/collections/IHasBridgeTrackingContract.sol\";\nimport \"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\n\ncontract RoninGatewayV2 is\n GatewayV2,\n Initializable,\n MinimumWithdrawal,\n AccessControlEnumerable,\n VoteStatusConsumer,\n IRoninGatewayV2,\n IHasValidatorContract,\n IHasBridgeTrackingContract,\n IHasRoninTrustedOrganizationContract\n{\n using Token for Token.Info;\n using Transfer for Transfer.Request;\n using Transfer for Transfer.Receipt;\n using IsolatedGovernance for IsolatedGovernance.Vote;\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n /// @dev Withdrawal unlocker role hash\n bytes32 public constant WITHDRAWAL_MIGRATOR = keccak256(\"WITHDRAWAL_MIGRATOR\");\n\n /// @dev Flag indicating whether the withdrawal migrate progress is done\n bool public withdrawalMigrated;\n /// @dev Total withdrawal\n uint256 public withdrawalCount;\n /// @dev Mapping from chain id => deposit id => deposit vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) public depositVote;\n /// @dev Mapping from withdrawal id => mainchain withdrew vote\n mapping(uint256 => IsolatedGovernance.Vote) public mainchainWithdrewVote;\n /// @dev Mapping from withdrawal id => withdrawal receipt\n mapping(uint256 => Transfer.Receipt) public withdrawal;\n /// @dev Mapping from withdrawal id => validator address => signatures\n mapping(uint256 => mapping(address => bytes)) internal _withdrawalSig;\n /// @dev Mapping from token address => chain id => mainchain token address\n mapping(address => mapping(uint256 => MappedToken)) internal _mainchainToken;\n\n /// @dev The ronin validator contract\n IRoninValidatorSet internal _validatorContract;\n /// @dev The bridge tracking contract\n IBridgeTracking internal _bridgeTrackingContract;\n\n /// @dev Mapping from withdrawal id => vote for recording withdrawal stats\n mapping(uint256 => IsolatedGovernance.Vote) public withdrawalStatVote;\n\n /// @dev The trusted organization contract\n IRoninTrustedOrganization internal _trustedOrgContract;\n\n uint256 internal _trustedNum;\n uint256 internal _trustedDenom;\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n modifier onlyBridgeOperator() {\n require(_validatorContract.isBridgeOperator(msg.sender), \"RoninGatewayV2: unauthorized sender\");\n _;\n }\n\n /**\n * @dev Initializes contract storage.\n */\n function initialize(\n address _roleSetter,\n uint256 _numerator,\n uint256 _denominator,\n uint256 _trustedNumerator,\n uint256 _trustedDenominator,\n address[] calldata _withdrawalMigrators,\n // _packedAddresses[0]: roninTokens\n // _packedAddresses[1]: mainchainTokens\n address[][2] calldata _packedAddresses,\n // _packedNumbers[0]: chainIds\n // _packedNumbers[1]: minimumThresholds\n uint256[][2] calldata _packedNumbers,\n Token.Standard[] calldata _standards\n ) external virtual initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n _setThreshold(_numerator, _denominator);\n _setTrustedThreshold(_trustedNumerator, _trustedDenominator);\n if (_packedAddresses[0].length > 0) {\n _mapTokens(_packedAddresses[0], _packedAddresses[1], _packedNumbers[0], _standards);\n _setMinimumThresholds(_packedAddresses[0], _packedNumbers[1]);\n }\n\n for (uint256 _i; _i < _withdrawalMigrators.length; _i++) {\n _grantRole(WITHDRAWAL_MIGRATOR, _withdrawalMigrators[_i]);\n }\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function validatorContract() external view returns (address) {\n return address(_validatorContract);\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function setValidatorContract(address _addr) external override onlyAdmin {\n require(_addr.code.length > 0, \"RoninGatewayV2: set to non-contract\");\n _setValidatorContract(_addr);\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function bridgeTrackingContract() external view override returns (address) {\n return address(_bridgeTrackingContract);\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function setBridgeTrackingContract(address _addr) external override onlyAdmin {\n require(_addr.code.length > 0, \"RoninGatewayV2: set to non-contract\");\n _setBridgeTrackingContract(_addr);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function roninTrustedOrganizationContract() external view override returns (address) {\n return address(_trustedOrgContract);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function setRoninTrustedOrganizationContract(address _addr) external override onlyAdmin {\n require(_addr.code.length > 0, \"RoninGatewayV2: set to non-contract\");\n _setRoninTrustedOrganizationContract(_addr);\n }\n\n /**\n * @dev Migrates withdrawals.\n *\n * Requirements:\n * - The method caller is the migrator.\n * - The arrays have the same length and its length larger than 0.\n *\n */\n function migrateWithdrawals(Transfer.Request[] calldata _requests, address[] calldata _requesters)\n external\n onlyRole(WITHDRAWAL_MIGRATOR)\n {\n require(!withdrawalMigrated, \"RoninGatewayV2: withdrawals migrated\");\n require(_requesters.length == _requests.length && _requests.length > 0, \"RoninGatewayV2: invalid array lengths\");\n for (uint256 _i; _i < _requests.length; _i++) {\n MappedToken memory _token = getMainchainToken(_requests[_i].tokenAddr, 1);\n require(_requests[_i].info.erc == _token.erc, \"RoninGatewayV2: invalid token standard\");\n _storeAsReceipt(_requests[_i], 1, _requesters[_i], _token.tokenAddr);\n }\n }\n\n /**\n * @dev Mark the migration as done.\n */\n function markWithdrawalMigrated() external {\n require(\n hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(WITHDRAWAL_MIGRATOR, msg.sender),\n \"RoninGatewayV2: unauthorized sender\"\n );\n require(!withdrawalMigrated, \"RoninGatewayV2: withdrawals migrated\");\n withdrawalMigrated = true;\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function getWithdrawalSignatures(uint256 _withdrawalId, address[] calldata _validators)\n external\n view\n returns (bytes[] memory _signatures)\n {\n _signatures = new bytes[](_validators.length);\n for (uint256 _i = 0; _i < _validators.length; _i++) {\n _signatures[_i] = _withdrawalSig[_withdrawalId][_validators[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function depositFor(Transfer.Receipt calldata _receipt) external whenNotPaused onlyBridgeOperator {\n address _sender = msg.sender;\n _depositFor(_receipt, _sender, minimumVoteWeight(), minimumTrustedVoteWeight());\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds)\n external\n onlyBridgeOperator\n returns (bool[] memory _executedReceipts)\n {\n address _governor = msg.sender;\n uint256 _minVoteWeight = minimumVoteWeight();\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\n\n uint256 _withdrawalId;\n _executedReceipts = new bool[](_withdrawalIds.length);\n for (uint256 _i; _i < _withdrawalIds.length; _i++) {\n _withdrawalId = _withdrawalIds[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId, _governor);\n if (mainchainWithdrew(_withdrawalId)) {\n _executedReceipts[_i] = true;\n } else {\n IsolatedGovernance.Vote storage _vote = mainchainWithdrewVote[_withdrawalId];\n Transfer.Receipt memory _withdrawal = withdrawal[_withdrawalId];\n bytes32 _hash = _withdrawal.hash();\n VoteStatus _status = _castIsolatedVote(_vote, _governor, _minVoteWeight, _minTrustedVoteWeight, _hash);\n if (_status == VoteStatus.Approved) {\n _vote.status = VoteStatus.Executed;\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId);\n emit MainchainWithdrew(_hash, _withdrawal);\n }\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts)\n external\n whenNotPaused\n onlyBridgeOperator\n returns (bool[] memory _executedReceipts)\n {\n address _sender = msg.sender;\n\n Transfer.Receipt memory _receipt;\n _executedReceipts = new bool[](_receipts.length);\n uint256 _minVoteWeight = minimumVoteWeight();\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\n for (uint256 _i; _i < _receipts.length; _i++) {\n _receipt = _receipts[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\n if (depositVote[_receipt.mainchain.chainId][_receipt.id].status == VoteStatus.Executed) {\n _executedReceipts[_i] = true;\n } else {\n _depositFor(_receipt, _sender, _minVoteWeight, _minTrustedVoteWeight);\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external whenNotPaused {\n _requestWithdrawalFor(_request, msg.sender, _chainId);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external whenNotPaused {\n require(_requests.length > 0, \"RoninGatewayV2: empty array\");\n for (uint256 _i; _i < _requests.length; _i++) {\n _requestWithdrawalFor(_requests[_i], msg.sender, _chainId);\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function requestWithdrawalSignatures(uint256 _withdrawalId) external whenNotPaused {\n require(!mainchainWithdrew(_withdrawalId), \"RoninGatewayV2: withdrew on mainchain already\");\n Transfer.Receipt memory _receipt = withdrawal[_withdrawalId];\n require(_receipt.ronin.chainId == block.chainid, \"RoninGatewayV2: query for invalid withdrawal\");\n emit WithdrawalSignaturesRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures)\n external\n whenNotPaused\n onlyBridgeOperator\n {\n address _validator = msg.sender;\n\n require(\n _withdrawals.length > 0 && _withdrawals.length == _signatures.length,\n \"RoninGatewayV2: invalid array length\"\n );\n\n uint256 _minVoteWeight = minimumVoteWeight();\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\n\n uint256 _id;\n for (uint256 _i; _i < _withdrawals.length; _i++) {\n _id = _withdrawals[_i];\n _withdrawalSig[_id][_validator] = _signatures[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Withdrawal, _id, _validator);\n\n IsolatedGovernance.Vote storage _proposal = withdrawalStatVote[_id];\n VoteStatus _status = _castIsolatedVote(\n _proposal,\n _validator,\n _minVoteWeight,\n _minTrustedVoteWeight,\n bytes32(_id)\n );\n if (_status == VoteStatus.Approved) {\n _proposal.status = VoteStatus.Executed;\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Withdrawal, _id);\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata _chainIds,\n Token.Standard[] calldata _standards\n ) external onlyAdmin {\n require(_roninTokens.length > 0, \"RoninGatewayV2: invalid array length\");\n _mapTokens(_roninTokens, _mainchainTokens, _chainIds, _standards);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function depositVoted(\n uint256 _chainId,\n uint256 _depositId,\n address _voter\n ) external view returns (bool) {\n return depositVote[_chainId][_depositId].voted(_voter);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool) {\n return mainchainWithdrewVote[_withdrawalId].voted(_voter);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function mainchainWithdrew(uint256 _withdrawalId) public view returns (bool) {\n return mainchainWithdrewVote[_withdrawalId].status == VoteStatus.Executed;\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function getMainchainToken(address _roninToken, uint256 _chainId) public view returns (MappedToken memory _token) {\n _token = _mainchainToken[_roninToken][_chainId];\n require(_token.tokenAddr != address(0), \"RoninGatewayV2: unsupported token\");\n }\n\n /**\n * @dev Maps Ronin tokens to mainchain networks.\n *\n * Requirement:\n * - The arrays have the same length.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function _mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata _chainIds,\n Token.Standard[] calldata _standards\n ) internal {\n require(\n _roninTokens.length == _mainchainTokens.length && _roninTokens.length == _chainIds.length,\n \"RoninGatewayV2: invalid array length\"\n );\n\n for (uint256 _i; _i < _roninTokens.length; _i++) {\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].tokenAddr = _mainchainTokens[_i];\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].erc = _standards[_i];\n }\n\n emit TokenMapped(_roninTokens, _mainchainTokens, _chainIds, _standards);\n }\n\n /**\n * @dev Deposits based on the receipt.\n *\n * Emits the `Deposited` once the assets are released.\n *\n */\n function _depositFor(\n Transfer.Receipt memory _receipt,\n address _validator,\n uint256 _minVoteWeight,\n uint256 _minTrustedVoteWeight\n ) internal {\n uint256 _id = _receipt.id;\n _receipt.info.validate();\n require(_receipt.kind == Transfer.Kind.Deposit, \"RoninGatewayV2: invalid receipt kind\");\n require(_receipt.ronin.chainId == block.chainid, \"RoninGatewayV2: invalid chain id\");\n MappedToken memory _token = getMainchainToken(_receipt.ronin.tokenAddr, _receipt.mainchain.chainId);\n require(\n _token.erc == _receipt.info.erc && _token.tokenAddr == _receipt.mainchain.tokenAddr,\n \"RoninGatewayV2: invalid receipt\"\n );\n\n IsolatedGovernance.Vote storage _proposal = depositVote[_receipt.mainchain.chainId][_id];\n bytes32 _receiptHash = _receipt.hash();\n VoteStatus _status = _castIsolatedVote(_proposal, _validator, _minVoteWeight, _minTrustedVoteWeight, _receiptHash);\n emit DepositVoted(_validator, _id, _receipt.mainchain.chainId, _receiptHash);\n if (_status == VoteStatus.Approved) {\n _proposal.status = VoteStatus.Executed;\n _receipt.info.handleAssetTransfer(payable(_receipt.ronin.addr), _receipt.ronin.tokenAddr, IWETH(address(0)));\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Deposit, _receipt.id);\n emit Deposited(_receiptHash, _receipt);\n }\n }\n\n /**\n * @dev Locks the assets and request withdrawal.\n *\n * Requirements:\n * - The token info is valid.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function _requestWithdrawalFor(\n Transfer.Request calldata _request,\n address _requester,\n uint256 _chainId\n ) internal {\n _request.info.validate();\n _checkWithdrawal(_request);\n MappedToken memory _token = getMainchainToken(_request.tokenAddr, _chainId);\n require(_request.info.erc == _token.erc, \"RoninGatewayV2: invalid token standard\");\n _request.info.transferFrom(_requester, address(this), _request.tokenAddr);\n _storeAsReceipt(_request, _chainId, _requester, _token.tokenAddr);\n }\n\n /**\n * @dev Stores the withdrawal request as a receipt.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function _storeAsReceipt(\n Transfer.Request calldata _request,\n uint256 _chainId,\n address _requester,\n address _mainchainTokenAddr\n ) internal returns (uint256 _withdrawalId) {\n _withdrawalId = withdrawalCount++;\n Transfer.Receipt memory _receipt = _request.into_withdrawal_receipt(\n _requester,\n _withdrawalId,\n _mainchainTokenAddr,\n _chainId\n );\n withdrawal[_withdrawalId] = _receipt;\n emit WithdrawalRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @dev Don't send me RON.\n */\n function _fallback() internal virtual {\n revert(\"RoninGatewayV2: invalid request\");\n }\n\n /**\n * @inheritdoc GatewayV2\n */\n function _getTotalWeight() internal view virtual override returns (uint256) {\n return _validatorContract.totalBridgeOperators();\n }\n\n /**\n * @dev Returns the total trusted weight.\n */\n function _getTotalTrustedWeight() internal view virtual returns (uint256) {\n return _trustedOrgContract.countTrustedOrganizations();\n }\n\n /**\n * @dev Sets the validator contract.\n *\n * Emits the event `ValidatorContractUpdated`.\n *\n */\n function _setValidatorContract(address _addr) internal {\n _validatorContract = IRoninValidatorSet(_addr);\n emit ValidatorContractUpdated(_addr);\n }\n\n /**\n * @dev Sets the bridge tracking contract.\n *\n * Emits the event `BridgeTrackingContractUpdated`.\n *\n */\n function _setBridgeTrackingContract(address _addr) internal {\n _bridgeTrackingContract = IBridgeTracking(_addr);\n emit BridgeTrackingContractUpdated(_addr);\n }\n\n /**\n * @dev Sets the ronin trusted organization contract.\n *\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\n *\n */\n function _setRoninTrustedOrganizationContract(address _addr) internal {\n _trustedOrgContract = IRoninTrustedOrganization(_addr);\n emit RoninTrustedOrganizationContractUpdated(_addr);\n }\n\n /**\n * @dev Casts and updates the vote result.\n *\n * Requirements:\n * - The vote is not finalized.\n * - The voter has not voted for the round.\n *\n */\n function _castIsolatedVote(\n IsolatedGovernance.Vote storage _v,\n address _voter,\n uint256 _minVoteWeight,\n uint256 _minTrustedVoteWeight,\n bytes32 _hash\n ) internal virtual returns (VoteStatus _status) {\n _v.castVote(_voter, _hash);\n (uint256 _totalWeight, uint256 _trustedWeight) = _getVoteWeight(_v, _hash);\n return _v.syncVoteStatus(_minVoteWeight, _totalWeight, _minTrustedVoteWeight, _trustedWeight, _hash);\n }\n\n /**\n * @dev Returns the vote weight for a specified hash.\n */\n function _getVoteWeight(IsolatedGovernance.Vote storage _v, bytes32 _hash)\n internal\n view\n returns (uint256 _totalWeight, uint256 _trustedWeight)\n {\n (\n address[] memory _consensusList,\n address[] memory _bridgeOperators,\n EnumFlags.ValidatorFlag[] memory _flags\n ) = _validatorContract.getValidators();\n uint256[] memory _trustedWeights = _trustedOrgContract.getConsensusWeights(_consensusList);\n\n for (uint _i; _i < _bridgeOperators.length; _i++) {\n if (_flags[_i].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator) && _v.voteHashOf[_bridgeOperators[_i]] == _hash) {\n _totalWeight++;\n if (_trustedWeights[_i] > 0) {\n _trustedWeight++;\n }\n }\n }\n }\n\n function setTrustedThreshold(uint256 _trustedNumerator, uint256 _trustedDenominator)\n external\n virtual\n onlyAdmin\n returns (uint256, uint256)\n {\n return _setTrustedThreshold(_trustedNumerator, _trustedDenominator);\n }\n\n /**\n * @dev Returns the minimum trusted vote weight to pass the threshold.\n */\n function minimumTrustedVoteWeight() public view virtual returns (uint256) {\n return _minimumTrustedVoteWeight(_getTotalTrustedWeight());\n }\n\n /**\n * @dev Returns the threshold about trusted org.\n */\n function getTrustedThreshold() external view virtual returns (uint256 trustedNum_, uint256 trustedDenom_) {\n return (_trustedNum, _trustedDenom);\n }\n\n /**\n * @dev Sets trusted threshold and returns the old one.\n *\n * Emits the `TrustedThresholdUpdated` event.\n *\n */\n function _setTrustedThreshold(uint256 _trustedNumerator, uint256 _trustedDenominator)\n internal\n virtual\n returns (uint256 _previousTrustedNum, uint256 _previousTrustedDenom)\n {\n require(_trustedNumerator <= _trustedDenominator, \"GatewayV2: invalid trusted threshold\");\n _previousTrustedNum = _num;\n _previousTrustedDenom = _denom;\n _trustedNum = _trustedNumerator;\n _trustedDenom = _trustedDenominator;\n emit TrustedThresholdUpdated(\n nonce++,\n _trustedNumerator,\n _trustedDenominator,\n _previousTrustedNum,\n _previousTrustedDenom\n );\n }\n\n /**\n * @dev Returns minimum trusted vote weight.\n */\n function _minimumTrustedVoteWeight(uint256 _totalTrustedWeight) internal view virtual returns (uint256) {\n return (_trustedNum * _totalTrustedWeight + _trustedDenom - 1) / _trustedDenom;\n }\n}\n" + }, + "contracts/extensions/GatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/security/Pausable.sol\";\nimport \"../interfaces/IQuorum.sol\";\nimport \"./collections/HasProxyAdmin.sol\";\n\nabstract contract GatewayV2 is HasProxyAdmin, Pausable, IQuorum {\n uint256 internal _num;\n uint256 internal _denom;\n\n address private ______deprecated;\n uint256 public nonce;\n\n address public emergencyPauser;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n /**\n * @dev Grant emergency pauser role for `_addr`.\n */\n function setEmergencyPauser(address _addr) external onlyAdmin {\n emergencyPauser = _addr;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\n return (_num, _denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _denom >= _num * _getTotalWeight();\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n virtual\n onlyAdmin\n returns (uint256, uint256)\n {\n return _setThreshold(_numerator, _denominator);\n }\n\n /**\n * @dev Triggers paused state.\n */\n function pause() external {\n require(msg.sender == _getAdmin() || msg.sender == emergencyPauser, \"GatewayV2: not authorized pauser\");\n _pause();\n }\n\n /**\n * @dev Triggers unpaused state.\n */\n function unpause() external {\n require(msg.sender == _getAdmin() || msg.sender == emergencyPauser, \"GatewayV2: not authorized pauser\");\n _unpause();\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function minimumVoteWeight() public view virtual returns (uint256) {\n return _minimumVoteWeight(_getTotalWeight());\n }\n\n /**\n * @dev Sets threshold and returns the old one.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function _setThreshold(uint256 _numerator, uint256 _denominator)\n internal\n virtual\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n require(_numerator <= _denominator, \"GatewayV2: invalid threshold\");\n _previousNum = _num;\n _previousDenom = _denom;\n _num = _numerator;\n _denom = _denominator;\n emit ThresholdUpdated(nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n\n /**\n * @dev Returns minimum vote weight.\n */\n function _minimumVoteWeight(uint256 _totalWeight) internal view virtual returns (uint256) {\n return (_num * _totalWeight + _denom - 1) / _denom;\n }\n\n /**\n * @dev Returns the total weight.\n */\n function _getTotalWeight() internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/MinimumWithdrawal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./collections/HasProxyAdmin.sol\";\nimport \"../libraries/Transfer.sol\";\n\nabstract contract MinimumWithdrawal is HasProxyAdmin {\n /// @dev Emitted when the minimum thresholds are updated\n event MinimumThresholdsUpdated(address[] tokens, uint256[] threshold);\n\n /// @dev Mapping from token address => minimum thresholds\n mapping(address => uint256) public minimumThreshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @dev Sets the minimum thresholds to withdraw.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `MinimumThresholdsUpdated` event.\n *\n */\n function setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) external virtual onlyAdmin {\n require(_tokens.length > 0, \"MinimumWithdrawal: invalid array length\");\n _setMinimumThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets minimum thresholds.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `MinimumThresholdsUpdated` event.\n *\n */\n function _setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n require(_tokens.length == _thresholds.length, \"MinimumWithdrawal: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n minimumThreshold[_tokens[_i]] = _thresholds[_i];\n }\n emit MinimumThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Checks whether the request is larger than or equal to the minimum threshold.\n */\n function _checkWithdrawal(Transfer.Request calldata _request) internal view {\n require(\n _request.info.erc != Token.Standard.ERC20 || _request.info.quantity >= minimumThreshold[_request.tokenAddr],\n \"MinimumWithdrawal: query for too small quantity\"\n );\n }\n}\n" + }, + "contracts/interfaces/IERC20Mintable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\ninterface IERC20Mintable {\n function mint(address _to, uint256 _value) external returns (bool _success);\n}\n" + }, + "contracts/interfaces/IERC721Mintable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC721Mintable {\n function mint(address _to, uint256 _tokenId) external returns (bool);\n}\n" + }, + "contracts/interfaces/IBridgeTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBridgeTracking {\n struct Request {\n VoteKind kind;\n uint256 id;\n }\n\n enum VoteKind {\n Deposit,\n Withdrawal,\n MainchainWithdrawal\n }\n\n /**\n * @dev Returns the total number of votes at the specific period `_period`.\n */\n function totalVotes(uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the total number of ballots at the specific period `_period`.\n */\n function totalBallots(uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\n */\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\n */\n function totalBallotsOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\n\n /**\n * @dev Handles the request once it is approved.\n *\n * Requirements:\n * - The method caller is the bridge contract.\n *\n */\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\n\n /**\n * @dev Records vote for a receipt and a operator.\n *\n * Requirements:\n * - The method caller is the bridge contract.\n *\n */\n function recordVote(\n VoteKind _kind,\n uint256 _requestId,\n address _operator\n ) external;\n}\n" + }, + "contracts/interfaces/IRoninGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/Transfer.sol\";\nimport \"./consumers/MappedTokenConsumer.sol\";\n\ninterface IRoninGatewayV2 is MappedTokenConsumer {\n /// @dev Emitted when the assets are depositted\n event Deposited(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal is requested\n event WithdrawalRequested(bytes32 receiptHash, Transfer.Receipt);\n /// @dev Emitted when the assets are withdrawn on mainchain\n event MainchainWithdrew(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal signatures is requested\n event WithdrawalSignaturesRequested(bytes32 receiptHash, Transfer.Receipt);\n /// @dev Emitted when the tokens are mapped\n event TokenMapped(address[] roninTokens, address[] mainchainTokens, uint256[] chainIds, Token.Standard[] standards);\n /// @dev Emitted when the threshold is updated\n event TrustedThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n /// @dev Emitted when a deposit is voted\n event DepositVoted(address indexed bridgeOperator, uint256 indexed id, uint256 indexed chainId, bytes32 receiptHash);\n\n /**\n * @dev Returns withdrawal count.\n */\n function withdrawalCount() external view returns (uint256);\n\n /**\n * @dev Returns withdrawal signatures.\n */\n function getWithdrawalSignatures(uint256 _withdrawalId, address[] calldata _validators)\n external\n view\n returns (bytes[] memory);\n\n /**\n * @dev Deposits based on the receipt.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Deposited` once the assets are released.\n *\n * @notice The assets will be transferred whenever the valid call passes the quorum threshold.\n *\n */\n function depositFor(Transfer.Receipt calldata _receipt) external;\n\n /**\n * @dev Marks the withdrawals are done on mainchain and returns the boolean array indicating whether the withdrawal\n * vote is already done before.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `MainchainWithdrew` once the valid call passes the quorum threshold.\n *\n * @notice Not reverting to avoid unnecessary failed transactions because the validators can send transactions at the\n * same time.\n *\n */\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds) external returns (bool[] memory);\n\n /**\n * @dev Tries bulk deposits based on the receipts and returns the boolean array indicating whether the deposit vote\n * is already done before. Reverts if the deposit is invalid or is voted by the validator again.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Deposited` once the assets are released.\n *\n * @notice The assets will be transferred whenever the valid call for the receipt passes the quorum threshold. Not\n * reverting to avoid unnecessary failed transactions because the validators can send transactions at the same time.\n *\n */\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts) external returns (bool[] memory);\n\n /**\n * @dev Locks the assets and request withdrawal.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external;\n\n /**\n * @dev Bulk requests withdrawals.\n *\n * Emits the `WithdrawalRequested` events.\n *\n */\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external;\n\n /**\n * @dev Requests withdrawal signatures for a specific withdrawal.\n *\n * Emits the `WithdrawalSignaturesRequested` event.\n *\n */\n function requestWithdrawalSignatures(uint256 _withdrawalId) external;\n\n /**\n * @dev Submits withdrawal signatures.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n */\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures) external;\n\n /**\n * @dev Maps Ronin tokens to mainchain networks.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata chainIds,\n Token.Standard[] calldata _standards\n ) external;\n\n /**\n * @dev Returns whether the deposit is casted by the voter.\n */\n function depositVoted(\n uint256 _chainId,\n uint256 _depositId,\n address _voter\n ) external view returns (bool);\n\n /**\n * @dev Returns whether the mainchain withdrew is casted by the voter.\n */\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool);\n\n /**\n * @dev Returns whether the withdrawal is done on mainchain.\n */\n function mainchainWithdrew(uint256 _withdrawalId) external view returns (bool);\n\n /**\n * @dev Returns mainchain token address.\n * Reverts for unsupported token.\n */\n function getMainchainToken(address _roninToken, uint256 _chainId) external view returns (MappedToken memory _token);\n}\n" + }, + "contracts/interfaces/collections/IHasBridgeTrackingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasBridgeTrackingContract is IHasContract {\n /// @dev Emitted when the bridge tracking contract is updated.\n event BridgeTrackingContractUpdated(address);\n\n /// @dev Error of method caller must be bridge tracking contract.\n error ErrCallerMustBeBridgeTrackingContract();\n\n /**\n * @dev Returns the bridge tracking contract.\n */\n function bridgeTrackingContract() external view returns (address);\n\n /**\n * @dev Sets the bridge tracking contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `BridgeTrackingContractUpdated`.\n *\n */\n function setBridgeTrackingContract(address) external;\n}\n" + }, + "@openzeppelin/contracts/security/Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" + }, + "contracts/libraries/Transfer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"./Token.sol\";\n\nlibrary Transfer {\n using ECDSA for bytes32;\n\n enum Kind {\n Deposit,\n Withdrawal\n }\n\n struct Request {\n // For deposit request: Recipient address on Ronin network\n // For withdrawal request: Recipient address on mainchain network\n address recipientAddr;\n // Token address to deposit/withdraw\n // Value 0: native token\n address tokenAddr;\n Token.Info info;\n }\n\n /**\n * @dev Converts the transfer request into the deposit receipt.\n */\n function into_deposit_receipt(\n Request memory _request,\n address _requester,\n uint256 _id,\n address _roninTokenAddr,\n uint256 _roninChainId\n ) internal view returns (Receipt memory _receipt) {\n _receipt.id = _id;\n _receipt.kind = Kind.Deposit;\n _receipt.mainchain.addr = _requester;\n _receipt.mainchain.tokenAddr = _request.tokenAddr;\n _receipt.mainchain.chainId = block.chainid;\n _receipt.ronin.addr = _request.recipientAddr;\n _receipt.ronin.tokenAddr = _roninTokenAddr;\n _receipt.ronin.chainId = _roninChainId;\n _receipt.info = _request.info;\n }\n\n /**\n * @dev Converts the transfer request into the withdrawal receipt.\n */\n function into_withdrawal_receipt(\n Request memory _request,\n address _requester,\n uint256 _id,\n address _mainchainTokenAddr,\n uint256 _mainchainId\n ) internal view returns (Receipt memory _receipt) {\n _receipt.id = _id;\n _receipt.kind = Kind.Withdrawal;\n _receipt.ronin.addr = _requester;\n _receipt.ronin.tokenAddr = _request.tokenAddr;\n _receipt.ronin.chainId = block.chainid;\n _receipt.mainchain.addr = _request.recipientAddr;\n _receipt.mainchain.tokenAddr = _mainchainTokenAddr;\n _receipt.mainchain.chainId = _mainchainId;\n _receipt.info = _request.info;\n }\n\n struct Receipt {\n uint256 id;\n Kind kind;\n Token.Owner mainchain;\n Token.Owner ronin;\n Token.Info info;\n }\n\n // keccak256(\"Receipt(uint256 id,uint8 kind,TokenOwner mainchain,TokenOwner ronin,TokenInfo info)TokenInfo(uint8 erc,uint256 id,uint256 quantity)TokenOwner(address addr,address tokenAddr,uint256 chainId)\");\n bytes32 public constant TYPE_HASH = 0xb9d1fe7c9deeec5dc90a2f47ff1684239519f2545b2228d3d91fb27df3189eea;\n\n /**\n * @dev Returns token info struct hash.\n */\n function hash(Receipt memory _receipt) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _receipt.id,\n _receipt.kind,\n Token.hash(_receipt.mainchain),\n Token.hash(_receipt.ronin),\n Token.hash(_receipt.info)\n )\n );\n }\n\n /**\n * @dev Returns the receipt digest.\n */\n function receiptDigest(bytes32 _domainSeparator, bytes32 _receiptHash) internal pure returns (bytes32) {\n return _domainSeparator.toTypedDataHash(_receiptHash);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "contracts/libraries/Token.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../interfaces/IWETH.sol\";\n\nlibrary Token {\n enum Standard {\n ERC20,\n ERC721\n }\n struct Info {\n Standard erc;\n // For ERC20: the id must be 0 and the quantity is larger than 0.\n // For ERC721: the quantity must be 0.\n uint256 id;\n uint256 quantity;\n }\n\n // keccak256(\"TokenInfo(uint8 erc,uint256 id,uint256 quantity)\");\n bytes32 public constant INFO_TYPE_HASH = 0x1e2b74b2a792d5c0f0b6e59b037fa9d43d84fbb759337f0112fcc15ca414fc8d;\n\n /**\n * @dev Returns token info struct hash.\n */\n function hash(Info memory _info) internal pure returns (bytes32) {\n return keccak256(abi.encode(INFO_TYPE_HASH, _info.erc, _info.id, _info.quantity));\n }\n\n /**\n * @dev Validates the token info.\n */\n function validate(Info memory _info) internal pure {\n require(\n (_info.erc == Standard.ERC20 && _info.quantity > 0 && _info.id == 0) ||\n (_info.erc == Standard.ERC721 && _info.quantity == 0),\n \"Token: invalid info\"\n );\n }\n\n /**\n * @dev Transfer asset from.\n *\n * Requirements:\n * - The `_from` address must approve for the contract using this library.\n *\n */\n function transferFrom(\n Info memory _info,\n address _from,\n address _to,\n address _token\n ) internal {\n bool _success;\n bytes memory _data;\n if (_info.erc == Standard.ERC20) {\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, _from, _to, _info.quantity));\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\n } else if (_info.erc == Standard.ERC721) {\n // bytes4(keccak256(\"transferFrom(address,address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x23b872dd, _from, _to, _info.id));\n } else {\n revert(\"Token: unsupported token standard\");\n }\n\n if (!_success) {\n revert(\n string(\n abi.encodePacked(\n \"Token: could not transfer \",\n toString(_info),\n \" from \",\n Strings.toHexString(uint160(_from), 20),\n \" to \",\n Strings.toHexString(uint160(_to), 20),\n \" token \",\n Strings.toHexString(uint160(_token), 20)\n )\n )\n );\n }\n }\n\n /**\n * @dev Transfers ERC721 token and returns the result.\n */\n function tryTransferERC721(\n address _token,\n address _to,\n uint256 _id\n ) internal returns (bool _success) {\n (_success, ) = _token.call(abi.encodeWithSelector(IERC721.transferFrom.selector, address(this), _to, _id));\n }\n\n /**\n * @dev Transfers ERC20 token and returns the result.\n */\n function tryTransferERC20(\n address _token,\n address _to,\n uint256 _quantity\n ) internal returns (bool _success) {\n bytes memory _data;\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transfer.selector, _to, _quantity));\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\n }\n\n /**\n * @dev Transfer assets from current address to `_to` address.\n */\n function transfer(\n Info memory _info,\n address _to,\n address _token\n ) internal {\n bool _success;\n if (_info.erc == Standard.ERC20) {\n _success = tryTransferERC20(_token, _to, _info.quantity);\n } else if (_info.erc == Standard.ERC721) {\n _success = tryTransferERC721(_token, _to, _info.id);\n } else {\n revert(\"Token: unsupported token standard\");\n }\n\n if (!_success) {\n revert(\n string(\n abi.encodePacked(\n \"Token: could not transfer \",\n toString(_info),\n \" to \",\n Strings.toHexString(uint160(_to), 20),\n \" token \",\n Strings.toHexString(uint160(_token), 20)\n )\n )\n );\n }\n }\n\n /**\n * @dev Tries minting and transfering assets.\n *\n * @notice Prioritizes transfer native token if the token is wrapped.\n *\n */\n function handleAssetTransfer(\n Info memory _info,\n address payable _to,\n address _token,\n IWETH _wrappedNativeToken\n ) internal {\n bool _success;\n if (_token == address(_wrappedNativeToken)) {\n // Try sending the native token before transferring the wrapped token\n if (!_to.send(_info.quantity)) {\n _wrappedNativeToken.deposit{ value: _info.quantity }();\n transfer(_info, _to, _token);\n }\n } else if (_info.erc == Token.Standard.ERC20) {\n uint256 _balance = IERC20(_token).balanceOf(address(this));\n\n if (_balance < _info.quantity) {\n // bytes4(keccak256(\"mint(address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, address(this), _info.quantity - _balance));\n require(_success, \"Token: ERC20 minting failed\");\n }\n\n transfer(_info, _to, _token);\n } else if (_info.erc == Token.Standard.ERC721) {\n if (!tryTransferERC721(_token, _to, _info.id)) {\n // bytes4(keccak256(\"mint(address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, _to, _info.id));\n require(_success, \"Token: ERC721 minting failed\");\n }\n } else {\n revert(\"Token: unsupported token standard\");\n }\n }\n\n /**\n * @dev Returns readable string.\n */\n function toString(Info memory _info) internal pure returns (string memory) {\n return\n string(\n abi.encodePacked(\n \"TokenInfo(\",\n Strings.toHexString(uint160(_info.erc), 1),\n \",\",\n Strings.toHexString(_info.id),\n \",\",\n Strings.toHexString(_info.quantity),\n \")\"\n )\n );\n }\n\n struct Owner {\n address addr;\n address tokenAddr;\n uint256 chainId;\n }\n\n // keccak256(\"TokenOwner(address addr,address tokenAddr,uint256 chainId)\");\n bytes32 public constant OWNER_TYPE_HASH = 0x353bdd8d69b9e3185b3972e08b03845c0c14a21a390215302776a7a34b0e8764;\n\n /**\n * @dev Returns ownership struct hash.\n */\n function hash(Owner memory _owner) internal pure returns (bytes32) {\n return keccak256(abi.encode(OWNER_TYPE_HASH, _owner.addr, _owner.tokenAddr, _owner.chainId));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IWETH.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IWETH {\n function deposit() external payable;\n\n function withdraw(uint256 _wad) external;\n\n function balanceOf(address) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/consumers/MappedTokenConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../libraries/Token.sol\";\n\ninterface MappedTokenConsumer {\n struct MappedToken {\n Token.Standard erc;\n address tokenAddr;\n }\n}\n" + }, + "contracts/extensions/bridge-operator-governance/BOsGovernanceRelay.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\nimport \"../../libraries/BridgeOperatorsBallot.sol\";\nimport \"../../libraries/AddressArrayUtils.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\n\nabstract contract BOsGovernanceRelay is SignatureConsumer, VoteStatusConsumer {\n /// @dev The last the brige operator set info.\n BridgeOperatorsBallot.BridgeOperatorSet internal _lastSyncedBridgeOperatorSetInfo;\n /// @dev Mapping from period index => epoch index => bridge operators vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) internal _vote;\n\n /**\n * @dev Returns the synced bridge operator set info.\n */\n function lastSyncedBridgeOperatorSetInfo() external view returns (BridgeOperatorsBallot.BridgeOperatorSet memory) {\n return _lastSyncedBridgeOperatorSetInfo;\n }\n\n /**\n * @dev Relays votes by signatures.\n *\n * Requirements:\n * - The period of voting is larger than the last synced period.\n * - The arrays are not empty.\n * - The signature signers are in order.\n *\n * @notice Does not store the voter signature into storage.\n *\n */\n function _relayVotesBySignatures(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures,\n uint256 _minimumVoteWeight,\n bytes32 _domainSeperator\n ) internal {\n require(\n (_ballot.period >= _lastSyncedBridgeOperatorSetInfo.period &&\n _ballot.epoch > _lastSyncedBridgeOperatorSetInfo.epoch),\n \"BOsGovernanceRelay: query for outdated bridge operator set\"\n );\n BridgeOperatorsBallot.verifyBallot(_ballot);\n require(\n !AddressArrayUtils.isEqual(_ballot.operators, _lastSyncedBridgeOperatorSetInfo.operators),\n \"BOsGovernanceRelay: bridge operator set is already voted\"\n );\n require(_signatures.length > 0, \"BOsGovernanceRelay: invalid array length\");\n\n Signature calldata _sig;\n address[] memory _signers = new address[](_signatures.length);\n address _lastSigner;\n bytes32 _hash = BridgeOperatorsBallot.hash(_ballot);\n bytes32 _digest = ECDSA.toTypedDataHash(_domainSeperator, _hash);\n\n for (uint256 _i = 0; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n _signers[_i] = ECDSA.recover(_digest, _sig.v, _sig.r, _sig.s);\n require(_lastSigner < _signers[_i], \"BOsGovernanceRelay: invalid order\");\n _lastSigner = _signers[_i];\n }\n\n IsolatedGovernance.Vote storage _v = _vote[_ballot.period][_ballot.epoch];\n uint256 _totalVoteWeight = _sumBridgeVoterWeights(_signers);\n if (_totalVoteWeight >= _minimumVoteWeight) {\n require(_totalVoteWeight > 0, \"BOsGovernanceRelay: invalid vote weight\");\n _v.status = VoteStatus.Approved;\n _lastSyncedBridgeOperatorSetInfo = _ballot;\n return;\n }\n\n revert(\"BOsGovernanceRelay: relay failed\");\n }\n\n /**\n * @dev Returns the weight of the governor list.\n */\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual returns (uint256);\n}\n" + }, + "contracts/mainchain/MainchainGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"../extensions/bridge-operator-governance/BOsGovernanceRelay.sol\";\nimport \"../extensions/sequential-governance/GovernanceRelay.sol\";\nimport \"../extensions/TransparentUpgradeableProxyV2.sol\";\nimport \"../extensions/GovernanceAdmin.sol\";\nimport \"../interfaces/IBridge.sol\";\n\ncontract MainchainGovernanceAdmin is AccessControlEnumerable, GovernanceRelay, GovernanceAdmin, BOsGovernanceRelay {\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n uint256 private constant DEFAULT_EXPIRY_DURATION = 1 << 255;\n\n constructor(\n uint256 _roninChainId,\n address _roleSetter,\n address _roninTrustedOrganizationContract,\n address _bridgeContract,\n address[] memory _relayers\n ) GovernanceAdmin(_roninChainId, _roninTrustedOrganizationContract, _bridgeContract, DEFAULT_EXPIRY_DURATION) {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n for (uint256 _i; _i < _relayers.length; _i++) {\n _grantRole(RELAYER_ROLE, _relayers[_i]);\n }\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for the proposal.\n */\n function proposalRelayed(uint256 _chainId, uint256 _round) external view returns (bool) {\n return vote[_chainId][_round].status != VoteStatus.Pending;\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for bridge operators at a specific period.\n */\n function bridgeOperatorsRelayed(uint256 _period, uint256 _epoch) external view returns (bool) {\n return _vote[_period][_epoch].status != VoteStatus.Pending;\n }\n\n /**\n * @dev See `GovernanceRelay-_relayProposal`.\n *\n * Requirements:\n * - The method caller is relayer.\n *\n */\n function relayProposal(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyRole(RELAYER_ROLE) {\n _relayProposal(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender);\n }\n\n /**\n * @dev See `GovernanceRelay-_relayGlobalProposal`.\n *\n * Requirements:\n * - The method caller is relayer.\n *\n */\n function relayGlobalProposal(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyRole(RELAYER_ROLE) {\n _relayGlobalProposal(\n _globalProposal,\n _supports,\n _signatures,\n DOMAIN_SEPARATOR,\n roninTrustedOrganizationContract(),\n bridgeContract(),\n msg.sender\n );\n }\n\n /**\n * @dev See `BOsGovernanceRelay-_relayVotesBySignatures`.\n *\n * Requirements:\n * - The method caller is relayer.\n *\n */\n function relayBridgeOperators(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures\n ) external onlyRole(RELAYER_ROLE) {\n _relayVotesBySignatures(_ballot, _signatures, _getMinimumVoteWeight(), DOMAIN_SEPARATOR);\n TransparentUpgradeableProxyV2(payable(bridgeContract())).functionDelegateCall(\n abi.encodeWithSelector(_bridgeContract.replaceBridgeOperators.selector, _ballot.operators)\n );\n }\n\n /**\n * @inheritdoc GovernanceRelay\n */\n function _sumWeights(address[] memory _governors) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumGovernorWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governors)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @inheritdoc BOsGovernanceRelay\n */\n function _sumBridgeVoterWeights(address[] memory _governors) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumBridgeVoterWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governors)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev See {CoreGovernance-_getChainType}\n */\n function _getChainType() internal pure override returns (ChainType) {\n return ChainType.Mainchain;\n }\n}\n" + }, + "contracts/extensions/sequential-governance/GovernanceRelay.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./CoreGovernance.sol\";\n\nabstract contract GovernanceRelay is CoreGovernance {\n using Proposal for Proposal.ProposalDetail;\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\n\n /**\n * @dev Relays votes by signatures.\n *\n * @notice Does not store the voter signature into storage.\n *\n */\n function _relayVotesBySignatures(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _forDigest,\n bytes32 _againstDigest\n ) internal {\n require(_supports.length > 0 && _supports.length == _signatures.length, \"GovernanceRelay: invalid array length\");\n uint256 _forVoteCount;\n uint256 _againstVoteCount;\n address[] memory _forVoteSigners = new address[](_signatures.length);\n address[] memory _againstVoteSigners = new address[](_signatures.length);\n\n {\n address _signer;\n address _lastSigner;\n Ballot.VoteType _support;\n Signature calldata _sig;\n\n for (uint256 _i; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n _support = _supports[_i];\n\n if (_support == Ballot.VoteType.For) {\n _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s);\n _forVoteSigners[_forVoteCount++] = _signer;\n } else if (_support == Ballot.VoteType.Against) {\n _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s);\n _againstVoteSigners[_againstVoteCount++] = _signer;\n } else {\n revert(\"GovernanceRelay: query for unsupported vote type\");\n }\n\n require(_lastSigner < _signer, \"GovernanceRelay: invalid order\");\n _lastSigner = _signer;\n }\n }\n\n assembly {\n mstore(_forVoteSigners, _forVoteCount)\n mstore(_againstVoteSigners, _againstVoteCount)\n }\n\n ProposalVote storage _vote = vote[_proposal.chainId][_proposal.nonce];\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _totalForVoteWeight = _sumWeights(_forVoteSigners);\n if (_totalForVoteWeight >= _minimumForVoteWeight) {\n require(_totalForVoteWeight > 0, \"GovernanceRelay: invalid vote weight\");\n _vote.status = VoteStatus.Approved;\n emit ProposalApproved(_vote.hash);\n _tryExecute(_vote, _proposal);\n return;\n }\n\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\n uint256 _totalAgainstVoteWeight = _sumWeights(_againstVoteSigners);\n if (_totalAgainstVoteWeight >= _minimumAgainstVoteWeight) {\n require(_totalAgainstVoteWeight > 0, \"GovernanceRelay: invalid vote weight\");\n _vote.status = VoteStatus.Rejected;\n emit ProposalRejected(_vote.hash);\n return;\n }\n\n revert(\"GovernanceRelay: relay failed\");\n }\n\n /**\n * @dev Relays voted proposal.\n *\n * Requirements:\n * - The relay proposal is finalized.\n *\n */\n function _relayProposal(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _creator\n ) internal {\n _proposeProposalStruct(_proposal, _creator);\n bytes32 _proposalHash = _proposal.hash();\n _relayVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Relays voted global proposal.\n *\n * Requirements:\n * - The relay proposal is finalized.\n *\n */\n function _relayGlobalProposal(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal {\n Proposal.ProposalDetail memory _proposal = _proposeGlobalStruct(\n _globalProposal,\n _roninTrustedOrganizationContract,\n _gatewayContract,\n _creator\n );\n bytes32 _globalProposalHash = _globalProposal.hash();\n _relayVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Returns the weight of the governor list.\n */\n function _sumWeights(address[] memory _governors) internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/TransparentUpgradeableProxyV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\n\n /**\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\n *\n * Requirements:\n * - Only the admin can call this function.\n *\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\n * reviewing the encoded data `_data` and the method which is called before using this.\n *\n */\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\n address _addr = _implementation();\n assembly {\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\n returndatacopy(0, 0, returndatasize())\n switch _result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "contracts/mocks/MockBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol\";\nimport \"../interfaces/IBridge.sol\";\n\ncontract MockBridge is IBridge {\n /// @dev Mapping from validator address => last block that the bridge operator is added\n mapping(address => uint256) public bridgeOperatorAddedBlock;\n /// @dev Bridge operators array\n address[] public bridgeOperators;\n\n function replaceBridgeOperators(address[] calldata _list) external {\n address _addr;\n for (uint256 _i = 0; _i < _list.length; _i++) {\n _addr = _list[_i];\n if (bridgeOperatorAddedBlock[_addr] == 0) {\n bridgeOperators.push(_addr);\n }\n bridgeOperatorAddedBlock[_addr] = block.number;\n }\n\n {\n uint256 _i;\n while (_i < bridgeOperators.length) {\n _addr = bridgeOperators[_i];\n if (bridgeOperatorAddedBlock[_addr] < block.number) {\n delete bridgeOperatorAddedBlock[_addr];\n bridgeOperators[_i] = bridgeOperators[bridgeOperators.length - 1];\n bridgeOperators.pop();\n continue;\n }\n _i++;\n }\n }\n }\n\n function getBridgeOperators() external view override returns (address[] memory) {\n return bridgeOperators;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetMinterPauser.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../extensions/ERC20Burnable.sol\";\nimport \"../extensions/ERC20Pausable.sol\";\nimport \"../../../access/AccessControlEnumerable.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev {ERC20} token, including:\n *\n * - ability for holders to burn (destroy) their tokens\n * - a minter role that allows for token minting (creation)\n * - a pauser role that allows to stop all token transfers\n *\n * This contract uses {AccessControl} to lock permissioned functions using the\n * different roles - head to its documentation for details.\n *\n * The account that deploys the contract will be granted the minter and pauser\n * roles, as well as the default admin role, which will let it grant both minter\n * and pauser roles to other accounts.\n *\n * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._\n */\ncontract ERC20PresetMinterPauser is Context, AccessControlEnumerable, ERC20Burnable, ERC20Pausable {\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant PAUSER_ROLE = keccak256(\"PAUSER_ROLE\");\n\n /**\n * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the\n * account that deploys the contract.\n *\n * See {ERC20-constructor}.\n */\n constructor(string memory name, string memory symbol) ERC20(name, symbol) {\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n\n _setupRole(MINTER_ROLE, _msgSender());\n _setupRole(PAUSER_ROLE, _msgSender());\n }\n\n /**\n * @dev Creates `amount` new tokens for `to`.\n *\n * See {ERC20-_mint}.\n *\n * Requirements:\n *\n * - the caller must have the `MINTER_ROLE`.\n */\n function mint(address to, uint256 amount) public virtual {\n require(hasRole(MINTER_ROLE, _msgSender()), \"ERC20PresetMinterPauser: must have minter role to mint\");\n _mint(to, amount);\n }\n\n /**\n * @dev Pauses all token transfers.\n *\n * See {ERC20Pausable} and {Pausable-_pause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function pause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC20PresetMinterPauser: must have pauser role to pause\");\n _pause();\n }\n\n /**\n * @dev Unpauses all token transfers.\n *\n * See {ERC20Pausable} and {Pausable-_unpause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function unpause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC20PresetMinterPauser: must have pauser role to unpause\");\n _unpause();\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override(ERC20, ERC20Pausable) {\n super._beforeTokenTransfer(from, to, amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\n * tokens and those that they have an allowance for, in a way that can be\n * recognized off-chain (via event analysis).\n */\nabstract contract ERC20Burnable is Context, ERC20 {\n /**\n * @dev Destroys `amount` tokens from the caller.\n *\n * See {ERC20-_burn}.\n */\n function burn(uint256 amount) public virtual {\n _burn(_msgSender(), amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\n * allowance.\n *\n * See {ERC20-_burn} and {ERC20-allowance}.\n *\n * Requirements:\n *\n * - the caller must have allowance for ``accounts``'s tokens of at least\n * `amount`.\n */\n function burnFrom(address account, uint256 amount) public virtual {\n _spendAllowance(account, _msgSender(), amount);\n _burn(account, amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../security/Pausable.sol\";\n\n/**\n * @dev ERC20 token with pausable token transfers, minting and burning.\n *\n * Useful for scenarios such as preventing trades until the end of an evaluation\n * period, or having an emergency switch for freezing all token transfers in the\n * event of a large bug.\n */\nabstract contract ERC20Pausable is ERC20, Pausable {\n /**\n * @dev See {ERC20-_beforeTokenTransfer}.\n *\n * Requirements:\n *\n * - the contract must not be paused.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, amount);\n\n require(!paused(), \"ERC20Pausable: token transfer while paused\");\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"../../access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" + }, + "contracts/multi-chains/RoninTrustedOrganization.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../libraries/AddressArrayUtils.sol\";\nimport \"../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../extensions/collections/HasProxyAdmin.sol\";\n\ncontract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, Initializable {\n uint256 internal _num;\n uint256 internal _denom;\n uint256 internal _totalWeight;\n uint256 internal _nonce;\n\n /// @dev Mapping from consensus address => weight\n mapping(address => uint256) internal _consensusWeight;\n /// @dev Mapping from governor address => weight\n mapping(address => uint256) internal _governorWeight;\n /// @dev Mapping from bridge voter address => weight\n mapping(address => uint256) internal _bridgeVoterWeight;\n\n /// @dev Mapping from consensus address => added block\n mapping(address => uint256) internal _addedBlock;\n\n /// @dev Consensus array\n address[] internal _consensusList;\n /// @dev Governors array\n address[] internal _governorList;\n /// @dev Bridge voters array\n address[] internal _bridgeVoterList;\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n TrustedOrganization[] calldata _trustedOrgs,\n uint256 __num,\n uint256 __denom\n ) external initializer {\n if (_trustedOrgs.length > 0) {\n _addTrustedOrganizations(_trustedOrgs);\n }\n _setThreshold(__num, __denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\n return (_num, _denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _denom >= _num * _totalWeight;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function minimumVoteWeight() external view virtual returns (uint256) {\n return (_num * _totalWeight + _denom - 1) / _denom;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n override\n onlyAdmin\n returns (uint256, uint256)\n {\n return _setThreshold(_numerator, _denominator);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function addTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\n _addTrustedOrganizations(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\n require(_list.length > 0, \"RoninTrustedOrganization: invalid array length\");\n for (uint256 _i; _i < _list.length; _i++) {\n _updateTrustedOrganization(_list[_i]);\n }\n emit TrustedOrganizationsUpdated(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function removeTrustedOrganizations(address[] calldata _list) external override onlyAdmin {\n require(_list.length > 0, \"RoninTrustedOrganization: invalid array length\");\n for (uint _i = 0; _i < _list.length; _i++) {\n _removeTrustedOrganization(_list[_i]);\n }\n emit TrustedOrganizationsRemoved(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function totalWeights() external view virtual returns (uint256) {\n return _totalWeight;\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getConsensusWeight(address _consensusAddr) external view returns (uint256) {\n return _consensusWeight[_consensusAddr];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getGovernorWeight(address _governor) external view returns (uint256) {\n return _governorWeight[_governor];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getBridgeVoterWeight(address _addr) external view returns (uint256) {\n return _bridgeVoterWeight[_addr];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; _i++) {\n _res[_i] = _consensusWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; _i++) {\n _res[_i] = _governorWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; _i++) {\n _res[_i] = _bridgeVoterWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; _i++) {\n _res += _consensusWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; _i++) {\n _res += _governorWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; _i++) {\n _res += _bridgeVoterWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function countTrustedOrganizations() external view override returns (uint256) {\n return _consensusList.length;\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getAllTrustedOrganizations() external view override returns (TrustedOrganization[] memory _list) {\n _list = new TrustedOrganization[](_consensusList.length);\n address _addr;\n for (uint256 _i; _i < _list.length; _i++) {\n _addr = _consensusList[_i];\n _list[_i].consensusAddr = _addr;\n _list[_i].governor = _governorList[_i];\n _list[_i].bridgeVoter = _bridgeVoterList[_i];\n _list[_i].weight = _consensusWeight[_addr];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory) {\n for (uint _i = 0; _i < _consensusList.length; _i++) {\n if (_consensusList[_i] == _consensusAddr) {\n return getTrustedOrganizationAt(_i);\n }\n }\n revert(\"RoninTrustedOrganization: query for non-existent consensus address\");\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getTrustedOrganizationAt(uint256 _idx) public view override returns (TrustedOrganization memory) {\n address _addr = _consensusList[_idx];\n return\n TrustedOrganization(\n _addr,\n _governorList[_idx],\n _bridgeVoterList[_idx],\n _consensusWeight[_addr],\n _addedBlock[_addr]\n );\n }\n\n /**\n * @dev Adds a list of trusted organizations.\n */\n function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {\n for (uint256 _i; _i < _list.length; _i++) {\n _addTrustedOrganization(_list[_i]);\n }\n emit TrustedOrganizationsAdded(_list);\n }\n\n /**\n * @dev Adds a trusted organization.\n *\n * Requirements:\n * - The weight is larger than 0.\n * - The consensus address is not added.\n * - The govenor address is not added.\n * - The bridge voter address is not added.\n *\n */\n function _addTrustedOrganization(TrustedOrganization memory _v) internal virtual {\n require(_v.addedBlock == 0, \"RoninTrustedOrganization: invalid request\");\n _sanityCheckTrustedOrganizationData(_v);\n\n if (_consensusWeight[_v.consensusAddr] > 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: consensus address \",\n Strings.toHexString(uint160(_v.consensusAddr), 20),\n \" is added already\"\n )\n )\n );\n }\n\n if (_governorWeight[_v.governor] > 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: govenor address \",\n Strings.toHexString(uint160(_v.governor), 20),\n \" is added already\"\n )\n )\n );\n }\n\n if (_bridgeVoterWeight[_v.bridgeVoter] > 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: bridge voter address \",\n Strings.toHexString(uint160(_v.bridgeVoter), 20),\n \" is added already\"\n )\n )\n );\n }\n\n _consensusList.push(_v.consensusAddr);\n _consensusWeight[_v.consensusAddr] = _v.weight;\n\n _governorList.push(_v.governor);\n _governorWeight[_v.governor] = _v.weight;\n\n _bridgeVoterList.push(_v.bridgeVoter);\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\n\n _addedBlock[_v.consensusAddr] = block.number;\n\n _totalWeight += _v.weight;\n }\n\n /**\n * @dev Updates a trusted organization.\n *\n * Requirements:\n * - The weight is larger than 0.\n * - The consensus address is already added.\n *\n */\n function _updateTrustedOrganization(TrustedOrganization memory _v) internal virtual {\n _sanityCheckTrustedOrganizationData(_v);\n\n uint256 _weight = _consensusWeight[_v.consensusAddr];\n if (_weight == 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: consensus address \",\n Strings.toHexString(uint160(_v.consensusAddr), 20),\n \" is not added\"\n )\n )\n );\n }\n\n uint256 _count = _consensusList.length;\n for (uint256 _i = 0; _i < _count; _i++) {\n if (_consensusList[_i] == _v.consensusAddr) {\n _totalWeight -= _weight;\n _totalWeight += _v.weight;\n\n if (_governorList[_i] != _v.governor) {\n require(_governorWeight[_v.governor] == 0, \"RoninTrustedOrganization: query for duplicated governor\");\n delete _governorWeight[_governorList[_i]];\n _governorList[_i] = _v.governor;\n }\n\n if (_bridgeVoterList[_i] != _v.bridgeVoter) {\n require(\n _bridgeVoterWeight[_v.bridgeVoter] == 0,\n \"RoninTrustedOrganization: query for duplicated bridge voter\"\n );\n delete _bridgeVoterWeight[_bridgeVoterList[_i]];\n _bridgeVoterList[_i] = _v.bridgeVoter;\n }\n\n _consensusWeight[_v.consensusAddr] = _v.weight;\n _governorWeight[_v.governor] = _v.weight;\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\n return;\n }\n }\n }\n\n /**\n * @dev Removes a trusted organization.\n *\n * Requirements:\n * - The consensus address is added.\n *\n */\n function _removeTrustedOrganization(address _addr) internal virtual {\n uint256 _weight = _consensusWeight[_addr];\n if (_weight == 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: consensus address \",\n Strings.toHexString(uint160(_addr), 20),\n \" is not added\"\n )\n )\n );\n }\n\n uint256 _index;\n uint256 _count = _consensusList.length;\n for (uint256 _i = 0; _i < _count; _i++) {\n if (_consensusList[_i] == _addr) {\n _index = _i;\n break;\n }\n }\n\n _totalWeight -= _weight;\n\n delete _addedBlock[_addr];\n delete _consensusWeight[_addr];\n _consensusList[_index] = _consensusList[_count - 1];\n _consensusList.pop();\n\n delete _governorWeight[_governorList[_index]];\n _governorList[_index] = _governorList[_count - 1];\n _governorList.pop();\n\n delete _bridgeVoterWeight[_bridgeVoterList[_index]];\n _bridgeVoterList[_index] = _bridgeVoterList[_count - 1];\n _bridgeVoterList.pop();\n }\n\n /**\n * @dev Sets threshold and returns the old one.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function _setThreshold(uint256 _numerator, uint256 _denominator)\n internal\n virtual\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n require(_numerator <= _denominator, \"RoninTrustedOrganization: invalid threshold\");\n _previousNum = _num;\n _previousDenom = _denom;\n _num = _numerator;\n _denom = _denominator;\n emit ThresholdUpdated(_nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n\n /**\n * @dev Hook that checks trusted organization's data. Reverts if the requirements are not met.\n *\n * Requirements:\n * - The weight must be larger than 0.\n * - The consensus address, governor address, and bridge voter address are different.\n */\n function _sanityCheckTrustedOrganizationData(TrustedOrganization memory _v) private pure {\n require(_v.weight > 0, \"RoninTrustedOrganization: invalid weight\");\n\n address[] memory _addresses = new address[](3);\n _addresses[0] = _v.consensusAddr;\n _addresses[1] = _v.governor;\n _addresses[2] = _v.bridgeVoter;\n require(!AddressArrayUtils.hasDuplicate(_addresses), \"RoninTrustedOrganization: three addresses must be distinct\");\n }\n}\n" + }, + "contracts/ronin/gateway/BridgeTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../extensions/collections/HasBridgeContract.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\nimport \"../../interfaces/IBridgeTracking.sol\";\n\ncontract BridgeTracking is HasBridgeContract, HasValidatorContract, Initializable, IBridgeTracking {\n struct PeriodVotingMetric {\n /// @dev Total requests that are tracked in the period. This value is 0 until the {_bufferMetric.requests[]} gets added into a period metric.\n uint256 totalRequests;\n uint256 totalBallots;\n mapping(address => uint256) totalBallotsOf;\n address[] voters;\n }\n\n struct PeriodVotingMetricTimeWrapper {\n uint256 lastEpoch;\n Request[] requests;\n PeriodVotingMetric data;\n }\n\n struct ReceiptTrackingInfo {\n /// @dev The period that the receipt is approved. Value 0 means the receipt is not approved yet.\n uint256 approvedPeriod;\n /// @dev The address list of voters\n address[] voters;\n /// @dev Mapping from voter => flag indicating the voter casts vote for this receipt\n mapping(address => bool) voted;\n /// @dev The period that the receipt is tracked, i.e. the metric is transferred from buffer to the period. Value 0 means the receipt is currently in buffer or not tracked yet.\n uint256 trackedPeriod;\n }\n\n /// @dev The block that the contract allows incoming mutable calls.\n uint256 public startedAtBlock;\n\n /// @dev The temporary info of votes and ballots\n PeriodVotingMetricTimeWrapper internal _bufferMetric;\n /// @dev Mapping from period number => vote stats based on period\n mapping(uint256 => PeriodVotingMetric) internal _periodMetric;\n /// @dev Mapping from vote kind => receipt id => receipt stats\n mapping(VoteKind => mapping(uint256 => ReceiptTrackingInfo)) internal _receiptTrackingInfo;\n\n modifier skipOnUnstarted() {\n if (block.number < startedAtBlock) {\n return;\n }\n _;\n }\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address _bridgeContract,\n address _validatorContract,\n uint256 _startedAtBlock\n ) external initializer {\n _setBridgeContract(_bridgeContract);\n _setValidatorContract(_validatorContract);\n startedAtBlock = _startedAtBlock;\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalVotes(uint256 _period) external view override returns (uint256 _totalVotes) {\n _totalVotes = _periodMetric[_period].totalRequests;\n if (_isBufferCountedForPeriod(_period)) {\n _totalVotes += _bufferMetric.requests.length;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalBallots(uint256 _period) external view override returns (uint256 _totalBallots) {\n _totalBallots = _periodMetric[_period].totalBallots;\n if (_isBufferCountedForPeriod(_period)) {\n _totalBallots += _bufferMetric.data.totalBallots;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\n external\n view\n override\n returns (uint256[] memory _res)\n {\n _res = new uint256[](_bridgeOperators.length);\n bool _isBufferCounted = _isBufferCountedForPeriod(_period);\n for (uint _i = 0; _i < _bridgeOperators.length; _i++) {\n _res[_i] = _totalBallotsOf(_period, _bridgeOperators[_i], _isBufferCounted);\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalBallotsOf(uint256 _period, address _bridgeOperator) public view override returns (uint256) {\n return _totalBallotsOf(_period, _bridgeOperator, _isBufferCountedForPeriod(_period));\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external override onlyBridgeContract skipOnUnstarted {\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\n\n // Only records for the receipt which not approved\n if (_receiptInfo.approvedPeriod == 0) {\n _trySyncBuffer();\n uint256 _currentPeriod = _validatorContract.currentPeriod();\n _receiptInfo.approvedPeriod = _currentPeriod;\n\n Request storage _bufferRequest = _bufferMetric.requests.push();\n _bufferRequest.kind = _kind;\n _bufferRequest.id = _requestId;\n\n address[] storage _voters = _receiptInfo.voters;\n for (uint _i = 0; _i < _voters.length; _i++) {\n _increaseBallot(_kind, _requestId, _voters[_i], _currentPeriod);\n }\n\n delete _receiptInfo.voters;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function recordVote(\n VoteKind _kind,\n uint256 _requestId,\n address _operator\n ) external override onlyBridgeContract skipOnUnstarted {\n uint256 _period = _validatorContract.currentPeriod();\n _trySyncBuffer();\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\n\n // When the vote is not approved yet, the voters are saved in the receipt info, and not increase ballot metric.\n // The ballot metric will be increased later in the {handleVoteApproved} method.\n if (_receiptInfo.approvedPeriod == 0) {\n _receiptInfo.voters.push(_operator);\n return;\n }\n\n _increaseBallot(_kind, _requestId, _operator, _period);\n }\n\n /**\n * @dev Increases the ballot for the operator at a period.\n */\n function _increaseBallot(\n VoteKind _kind,\n uint256 _requestId,\n address _operator,\n uint256 _currentPeriod\n ) internal {\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\n if (_receiptInfo.voted[_operator]) {\n return;\n }\n\n _receiptInfo.voted[_operator] = true;\n\n uint256 _trackedPeriod = _receiptInfo.trackedPeriod;\n\n // Do not increase ballot for receipt that is neither in the buffer, nor in the most current tracked period.\n // If the receipt is not tracked in a period, increase metric in buffer.\n if (_trackedPeriod == 0) {\n if (_bufferMetric.data.totalBallotsOf[_operator] == 0) {\n _bufferMetric.data.voters.push(_operator);\n }\n _bufferMetric.data.totalBallots++;\n _bufferMetric.data.totalBallotsOf[_operator]++;\n }\n // If the receipt is tracked in the most current tracked period, increase metric in the period.\n else if (_trackedPeriod == _currentPeriod) {\n PeriodVotingMetric storage _metric = _periodMetric[_trackedPeriod];\n _metric.totalBallots++;\n _metric.totalBallotsOf[_operator]++;\n }\n }\n\n /**\n * @dev See `totalBallotsOf`.\n */\n function _totalBallotsOf(\n uint256 _period,\n address _bridgeOperator,\n bool _mustCountLastStats\n ) internal view returns (uint256 _totalBallots) {\n _totalBallots = _periodMetric[_period].totalBallotsOf[_bridgeOperator];\n if (_mustCountLastStats) {\n _totalBallots += _bufferMetric.data.totalBallotsOf[_bridgeOperator];\n }\n }\n\n /**\n * @dev Syncs period stats. Move all data from the buffer metric to the period metric.\n *\n * Requirements:\n * - The epoch after the buffer epoch is wrapped up.\n */\n function _trySyncBuffer() internal {\n uint256 _currentEpoch = _validatorContract.epochOf(block.number);\n if (_bufferMetric.lastEpoch < _currentEpoch) {\n (, uint256 _trackedPeriod) = _validatorContract.tryGetPeriodOfEpoch(_bufferMetric.lastEpoch + 1);\n _bufferMetric.lastEpoch = _currentEpoch;\n\n // Copy numbers of totals\n PeriodVotingMetric storage _metric = _periodMetric[_trackedPeriod];\n _metric.totalRequests += _bufferMetric.requests.length;\n _metric.totalBallots += _bufferMetric.data.totalBallots;\n\n // Copy voters info and voters' ballot\n for (uint _i = 0; _i < _bufferMetric.data.voters.length; _i++) {\n address _voter = _bufferMetric.data.voters[_i];\n _metric.totalBallotsOf[_voter] += _bufferMetric.data.totalBallotsOf[_voter];\n delete _bufferMetric.data.totalBallotsOf[_voter]; // need to manually delete each element, due to mapping\n }\n\n // Mark all receipts in the buffer as tracked. Keep total number of receipts and delete receipt details.\n for (uint _i = 0; _i < _bufferMetric.requests.length; _i++) {\n Request storage _bufferRequest = _bufferMetric.requests[_i];\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_bufferRequest.kind][_bufferRequest.id];\n _receiptInfo.trackedPeriod = _trackedPeriod;\n }\n\n delete _bufferMetric.requests;\n delete _bufferMetric.data;\n }\n }\n\n /**\n * @dev Returns whether the buffer stats must be counted or not.\n */\n function _isBufferCountedForPeriod(uint256 _queriedPeriod) internal view returns (bool) {\n uint256 _currentEpoch = _validatorContract.epochOf(block.number);\n (bool _filled, uint256 _periodOfNextTemporaryEpoch) = _validatorContract.tryGetPeriodOfEpoch(\n _bufferMetric.lastEpoch + 1\n );\n return _filled && _queriedPeriod == _periodOfNextTemporaryEpoch && _bufferMetric.lastEpoch < _currentEpoch;\n }\n}\n" + }, + "contracts/mocks/MockGatewayForTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../interfaces/IBridgeTracking.sol\";\nimport \"../extensions/collections/HasBridgeTrackingContract.sol\";\n\ncontract MockGatewayForTracking is HasBridgeTrackingContract {\n constructor(address _bridgeTrackingContract) {\n _setBridgeTrackingContract(_bridgeTrackingContract);\n }\n\n function sendBallot(\n IBridgeTracking.VoteKind _kind,\n uint256 _id,\n address[] memory _voters\n ) external {\n for (uint256 _i; _i < _voters.length; _i++) {\n _bridgeTrackingContract.recordVote(_kind, _id, _voters[_i]);\n }\n }\n\n function sendApprovedVote(IBridgeTracking.VoteKind _kind, uint256 _id) external {\n _bridgeTrackingContract.handleVoteApproved(_kind, _id);\n }\n}\n" + }, + "contracts/extensions/collections/HasBridgeTrackingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasBridgeTrackingContract.sol\";\nimport \"../../interfaces/IBridgeTracking.sol\";\n\ncontract HasBridgeTrackingContract is IHasBridgeTrackingContract, HasProxyAdmin {\n IBridgeTracking internal _bridgeTrackingContract;\n\n modifier onlyBridgeTrackingContract() {\n if (bridgeTrackingContract() != msg.sender) revert ErrCallerMustBeBridgeTrackingContract();\n _;\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function bridgeTrackingContract() public view override returns (address) {\n return address(_bridgeTrackingContract);\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function setBridgeTrackingContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setBridgeTrackingContract(_addr);\n }\n\n /**\n * @dev Sets the bridge tracking contract.\n *\n * Emits the event `BridgeTrackingContractUpdated`.\n *\n */\n function _setBridgeTrackingContract(address _addr) internal {\n _bridgeTrackingContract = IBridgeTracking(_addr);\n emit BridgeTrackingContractUpdated(_addr);\n }\n}\n" + }, + "contracts/ronin/validator/CoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasBridgeTrackingContract.sol\";\nimport \"../../extensions/collections/HasMaintenanceContract.sol\";\nimport \"../../extensions/collections/HasSlashIndicatorContract.sol\";\nimport \"../../extensions/collections/HasStakingVestingContract.sol\";\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../interfaces/validator/ICoinbaseExecution.sol\";\nimport \"../../libraries/EnumFlags.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"../../precompile-usages/PCUSortValidators.sol\";\nimport \"../../precompile-usages/PCUPickValidatorSet.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\nimport \"./CandidateManager.sol\";\nimport \"./EmergencyExit.sol\";\n\nabstract contract CoinbaseExecution is\n ICoinbaseExecution,\n RONTransferHelper,\n PCUSortValidators,\n PCUPickValidatorSet,\n HasStakingVestingContract,\n HasBridgeTrackingContract,\n HasMaintenanceContract,\n HasSlashIndicatorContract,\n EmergencyExit\n{\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n modifier onlyCoinbase() {\n if (msg.sender != block.coinbase) revert ErrCallerMustBeCoinbase();\n _;\n }\n\n modifier whenEpochEnding() {\n if (!epochEndingAt(block.number)) revert ErrAtEndOfEpochOnly();\n _;\n }\n\n modifier oncePerEpoch() {\n if (epochOf(_lastUpdatedBlock) >= epochOf(block.number)) revert ErrAlreadyWrappedEpoch();\n _lastUpdatedBlock = block.number;\n _;\n }\n\n /**\n * @inheritdoc ICoinbaseExecution\n */\n function submitBlockReward() external payable override onlyCoinbase {\n bool _requestForBlockProducer = isBlockProducer(msg.sender) &&\n !_jailed(msg.sender) &&\n !_miningRewardDeprecated(msg.sender, currentPeriod());\n\n (, uint256 _blockProducerBonus, uint256 _bridgeOperatorBonus) = _stakingVestingContract.requestBonus(\n _requestForBlockProducer,\n true // _requestForBridgeOperator\n );\n\n _totalBridgeReward += _bridgeOperatorBonus;\n\n // Deprecates reward for non-validator or slashed validator\n if (!_requestForBlockProducer) {\n _totalDeprecatedReward += msg.value;\n emit BlockRewardDeprecated(msg.sender, msg.value, BlockRewardDeprecatedType.UNAVAILABILITY);\n return;\n }\n\n emit BlockRewardSubmitted(msg.sender, msg.value, _blockProducerBonus);\n\n uint256 _period = currentPeriod();\n uint256 _reward = msg.value + _blockProducerBonus;\n uint256 _cutOffReward;\n if (_miningRewardBailoutCutOffAtPeriod[msg.sender][_period]) {\n (, , , uint256 _cutOffPercentage) = _slashIndicatorContract.getCreditScoreConfigs();\n _cutOffReward = (_reward * _cutOffPercentage) / _MAX_PERCENTAGE;\n _totalDeprecatedReward += _cutOffReward;\n emit BlockRewardDeprecated(msg.sender, _cutOffReward, BlockRewardDeprecatedType.AFTER_BAILOUT);\n }\n\n _reward -= _cutOffReward;\n (uint256 _minRate, uint256 _maxRate) = _stakingContract.getCommissionRateRange();\n uint256 _rate = Math.max(Math.min(_candidateInfo[msg.sender].commissionRate, _maxRate), _minRate);\n uint256 _miningAmount = (_rate * _reward) / _MAX_PERCENTAGE;\n _miningReward[msg.sender] += _miningAmount;\n\n uint256 _delegatingAmount = _reward - _miningAmount;\n _delegatingReward[msg.sender] += _delegatingAmount;\n }\n\n /**\n * @inheritdoc ICoinbaseExecution\n */\n function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {\n uint256 _newPeriod = _computePeriod(block.timestamp);\n bool _periodEnding = _isPeriodEnding(_newPeriod);\n\n (address[] memory _currentValidators, , ) = getValidators();\n address[] memory _revokedCandidates;\n uint256 _epoch = epochOf(block.number);\n uint256 _nextEpoch = _epoch + 1;\n uint256 _lastPeriod = currentPeriod();\n\n if (_periodEnding) {\n _syncBridgeOperatingReward(_lastPeriod, _currentValidators);\n (\n uint256 _totalDelegatingReward,\n uint256[] memory _delegatingRewards\n ) = _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(_lastPeriod, _currentValidators);\n _settleAndTransferDelegatingRewards(_lastPeriod, _currentValidators, _totalDelegatingReward, _delegatingRewards);\n _tryRecycleLockedFundsFromEmergencyExits();\n _recycleDeprecatedRewards();\n _slashIndicatorContract.updateCreditScores(_currentValidators, _lastPeriod);\n (_currentValidators, _revokedCandidates) = _syncValidatorSet(_newPeriod);\n if (_revokedCandidates.length > 0) {\n _slashIndicatorContract.execResetCreditScores(_revokedCandidates);\n }\n _currentPeriodStartAtBlock = block.number + 1;\n }\n _revampRoles(_newPeriod, _nextEpoch, _currentValidators);\n emit WrappedUpEpoch(_lastPeriod, _epoch, _periodEnding);\n _periodOf[_nextEpoch] = _newPeriod;\n _lastUpdatedPeriod = _newPeriod;\n }\n\n /**\n * @dev This loop over the all current validators to sync the bridge operating reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _syncBridgeOperatingReward(uint256 _lastPeriod, address[] memory _currentValidators) internal {\n uint256 _totalBridgeBallots = _bridgeTrackingContract.totalBallots(_lastPeriod);\n uint256 _totalBridgeVotes = _bridgeTrackingContract.totalVotes(_lastPeriod);\n uint256[] memory _bridgeBallots = _bridgeTrackingContract.getManyTotalBallots(\n _lastPeriod,\n getBridgeOperatorsOf(_currentValidators)\n );\n\n if (\n !_validateBridgeTrackingResponse(_totalBridgeBallots, _totalBridgeVotes, _bridgeBallots) || _totalBridgeVotes == 0\n ) {\n // Shares equally in case the bridge has nothing to vote or bridge tracking response is incorrect\n for (uint256 _i; _i < _currentValidators.length; _i++) {\n _bridgeOperatingReward[_currentValidators[_i]] = _totalBridgeReward / _currentValidators.length;\n }\n return;\n }\n\n (\n uint256 _missingVotesRatioTier1,\n uint256 _missingVotesRatioTier2,\n uint256 _jailDurationForMissingVotesRatioTier2,\n uint256 _skipBridgeOperatorSlashingThreshold\n ) = _slashIndicatorContract.getBridgeOperatorSlashingConfigs();\n\n // Slashes the bridge reward if the total of votes exceeds the slashing threshold.\n bool _shouldSlash = _totalBridgeVotes > _skipBridgeOperatorSlashingThreshold;\n for (uint256 _i; _i < _currentValidators.length; _i++) {\n // Shares the bridge operators reward proportionally.\n _bridgeOperatingReward[_currentValidators[_i]] = (_totalBridgeReward * _bridgeBallots[_i]) / _totalBridgeBallots;\n if (_shouldSlash) {\n _slashBridgeOperatorBasedOnPerformance(\n _lastPeriod,\n _currentValidators[_i],\n _MAX_PERCENTAGE - (_bridgeBallots[_i] * _MAX_PERCENTAGE) / _totalBridgeVotes,\n _jailDurationForMissingVotesRatioTier2,\n _missingVotesRatioTier1,\n _missingVotesRatioTier2\n );\n }\n }\n }\n\n /**\n * @dev Returns whether the responses from bridge tracking are correct.\n */\n function _validateBridgeTrackingResponse(\n uint256 _totalBridgeBallots,\n uint256 _totalBridgeVotes,\n uint256[] memory _bridgeBallots\n ) private returns (bool _valid) {\n _valid = true;\n uint256 _sumBallots;\n for (uint _i; _i < _bridgeBallots.length; _i++) {\n if (_bridgeBallots[_i] > _totalBridgeVotes) {\n _valid = false;\n break;\n }\n _sumBallots += _bridgeBallots[_i];\n }\n _valid = _valid && (_sumBallots <= _totalBridgeBallots);\n if (!_valid) {\n emit BridgeTrackingIncorrectlyResponded();\n }\n }\n\n /**\n * @dev Slashes the validator on the corresponding bridge operator performance. Updates the status of the deprecated reward. Not update the reward amount.\n *\n * Consider validating the bridge tracking response by using the method `_validateBridgeTrackingResponse` before calling this function.\n */\n function _slashBridgeOperatorBasedOnPerformance(\n uint256 _period,\n address _validator,\n uint256 _missedRatio,\n uint256 _jailDurationTier2,\n uint256 _ratioTier1,\n uint256 _ratioTier2\n ) internal {\n if (_missedRatio >= _ratioTier2) {\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\n _miningRewardDeprecatedAtPeriod[_validator][_period] = true;\n\n uint256 _newJailUntilBlock = Math.addIfNonZero(block.number, _jailDurationTier2);\n _blockProducerJailedBlock[_validator] = Math.max(_newJailUntilBlock, _blockProducerJailedBlock[_validator]);\n _cannotBailoutUntilBlock[_validator] = Math.max(_newJailUntilBlock, _cannotBailoutUntilBlock[_validator]);\n\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 2, _period);\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, true, true);\n } else if (_missedRatio >= _ratioTier1) {\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 1, _period);\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, false, true);\n }\n }\n\n /**\n * @dev This loops over all current validators to:\n * - Update delegating reward for and calculate total delegating rewards to be sent to the staking contract,\n * - Distribute the reward of block producers and bridge operators to their treasury addresses,\n * - Update the total deprecated reward if the two previous conditions do not sastify.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(\n uint256 _lastPeriod,\n address[] memory _currentValidators\n ) private returns (uint256 _totalDelegatingReward, uint256[] memory _delegatingRewards) {\n address _consensusAddr;\n address payable _treasury;\n _delegatingRewards = new uint256[](_currentValidators.length);\n for (uint _i; _i < _currentValidators.length; _i++) {\n _consensusAddr = _currentValidators[_i];\n _treasury = _candidateInfo[_consensusAddr].treasuryAddr;\n\n if (!_bridgeRewardDeprecated(_consensusAddr, _lastPeriod)) {\n _distributeBridgeOperatingReward(_consensusAddr, _candidateInfo[_consensusAddr].bridgeOperatorAddr, _treasury);\n } else {\n _totalDeprecatedReward += _bridgeOperatingReward[_consensusAddr];\n }\n\n if (!_jailed(_consensusAddr) && !_miningRewardDeprecated(_consensusAddr, _lastPeriod)) {\n _totalDelegatingReward += _delegatingReward[_consensusAddr];\n _delegatingRewards[_i] = _delegatingReward[_consensusAddr];\n _distributeMiningReward(_consensusAddr, _treasury);\n } else {\n _totalDeprecatedReward += _miningReward[_consensusAddr] + _delegatingReward[_consensusAddr];\n }\n\n delete _delegatingReward[_consensusAddr];\n delete _miningReward[_consensusAddr];\n delete _bridgeOperatingReward[_consensusAddr];\n }\n delete _totalBridgeReward;\n }\n\n /**\n * @dev Distributes bonus of staking vesting and mining fee for the block producer.\n *\n * Emits the `MiningRewardDistributed` once the reward is distributed successfully.\n * Emits the `MiningRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeMiningReward(address _consensusAddr, address payable _treasury) private {\n uint256 _amount = _miningReward[_consensusAddr];\n if (_amount > 0) {\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\n emit MiningRewardDistributed(_consensusAddr, _treasury, _amount);\n return;\n }\n\n emit MiningRewardDistributionFailed(_consensusAddr, _treasury, _amount, address(this).balance);\n }\n }\n\n /**\n * @dev Distribute bonus of staking vesting for the bridge operator.\n *\n * Emits the `BridgeOperatorRewardDistributed` once the reward is distributed successfully.\n * Emits the `BridgeOperatorRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeBridgeOperatingReward(\n address _consensusAddr,\n address _bridgeOperator,\n address payable _treasury\n ) private {\n uint256 _amount = _bridgeOperatingReward[_consensusAddr];\n if (_amount > 0) {\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\n emit BridgeOperatorRewardDistributed(_consensusAddr, _bridgeOperator, _treasury, _amount);\n return;\n }\n\n emit BridgeOperatorRewardDistributionFailed(\n _consensusAddr,\n _bridgeOperator,\n _treasury,\n _amount,\n address(this).balance\n );\n }\n }\n\n /**\n * @dev Helper function to settle rewards for delegators of `_currentValidators` at the end of each period,\n * then transfer the rewards from this contract to the staking contract, in order to finalize a period.\n *\n * Emits the `StakingRewardDistributed` once the reward is distributed successfully.\n * Emits the `StakingRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _settleAndTransferDelegatingRewards(\n uint256 _period,\n address[] memory _currentValidators,\n uint256 _totalDelegatingReward,\n uint256[] memory _delegatingRewards\n ) private {\n IStaking _staking = _stakingContract;\n if (_totalDelegatingReward > 0) {\n if (_unsafeSendRON(payable(address(_staking)), _totalDelegatingReward)) {\n _staking.execRecordRewards(_currentValidators, _delegatingRewards, _period);\n emit StakingRewardDistributed(_totalDelegatingReward, _currentValidators, _delegatingRewards);\n return;\n }\n\n emit StakingRewardDistributionFailed(\n _totalDelegatingReward,\n _currentValidators,\n _delegatingRewards,\n address(this).balance\n );\n }\n }\n\n /**\n * @dev Transfer the deprecated rewards e.g. the rewards that get deprecated when validator is slashed/maintained,\n * to the staking vesting contract\n *\n * Note: This method should be called once in the end of each period.\n */\n function _recycleDeprecatedRewards() private {\n uint256 _withdrawAmount = _totalDeprecatedReward;\n\n if (_withdrawAmount != 0) {\n address _withdrawTarget = stakingVestingContract();\n\n delete _totalDeprecatedReward;\n\n (bool _success, ) = _withdrawTarget.call{ value: _withdrawAmount }(\n abi.encodeWithSelector(IStakingVesting.receiveRON.selector)\n );\n\n if (_success) {\n emit DeprecatedRewardRecycled(_withdrawTarget, _withdrawAmount);\n } else {\n emit DeprecatedRewardRecycleFailed(_withdrawTarget, _withdrawAmount, address(this).balance);\n }\n }\n }\n\n /**\n * @dev Updates the validator set based on the validator candidates from the Staking contract.\n *\n * Emits the `ValidatorSetUpdated` event.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _syncValidatorSet(uint256 _newPeriod)\n private\n returns (address[] memory _newValidators, address[] memory _unsastifiedCandidates)\n {\n _unsastifiedCandidates = _syncCandidateSet(_newPeriod);\n uint256[] memory _weights = _stakingContract.getManyStakingTotals(_candidates);\n uint256[] memory _trustedWeights = _roninTrustedOrganizationContract.getConsensusWeights(_candidates);\n uint256 _newValidatorCount;\n (_newValidators, _newValidatorCount) = _pcPickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n _setNewValidatorSet(_newValidators, _newValidatorCount, _newPeriod);\n }\n\n /**\n * @dev Private helper function helps writing the new validator set into the contract storage.\n *\n * Emits the `ValidatorSetUpdated` event.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _setNewValidatorSet(\n address[] memory _newValidators,\n uint256 _newValidatorCount,\n uint256 _newPeriod\n ) private {\n // Remove exceeding validators in the current set\n for (uint256 _i = _newValidatorCount; _i < validatorCount; _i++) {\n delete _validatorMap[_validators[_i]];\n delete _validators[_i];\n }\n\n // Remove flag for all validator in the current set\n for (uint _i; _i < _newValidatorCount; _i++) {\n delete _validatorMap[_validators[_i]];\n }\n\n // Update new validator set and set flag correspondingly.\n for (uint256 _i; _i < _newValidatorCount; _i++) {\n address _newValidator = _newValidators[_i];\n _validatorMap[_newValidator] = EnumFlags.ValidatorFlag.Both;\n _validators[_i] = _newValidator;\n }\n\n validatorCount = _newValidatorCount;\n emit ValidatorSetUpdated(_newPeriod, _newValidators);\n }\n\n /**\n * @dev Activate/Deactivate the validators from producing blocks, based on their in jail status and maintenance status.\n *\n * Requirements:\n * - This method is called at the end of each epoch\n *\n * Emits the `BlockProducerSetUpdated` event.\n * Emits the `BridgeOperatorSetUpdated` event.\n *\n */\n function _revampRoles(\n uint256 _newPeriod,\n uint256 _nextEpoch,\n address[] memory _currentValidators\n ) private {\n bool[] memory _maintainedList = _maintenanceContract.checkManyMaintained(_currentValidators, block.number + 1);\n\n for (uint _i; _i < _currentValidators.length; _i++) {\n address _validator = _currentValidators[_i];\n bool _emergencyExitRequested = block.timestamp <= _emergencyExitJailedTimestamp[_validator];\n bool _isProducerBefore = isBlockProducer(_validator);\n bool _isProducerAfter = !(_jailedAtBlock(_validator, block.number + 1) ||\n _maintainedList[_i] ||\n _emergencyExitRequested);\n\n if (!_isProducerBefore && _isProducerAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BlockProducer);\n } else if (_isProducerBefore && !_isProducerAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BlockProducer);\n }\n\n bool _isBridgeOperatorBefore = isOperatingBridge(_validator);\n bool _isBridgeOperatorAfter = !_emergencyExitRequested;\n if (!_isBridgeOperatorBefore && _isBridgeOperatorAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BridgeOperator);\n } else if (_isBridgeOperatorBefore && !_isBridgeOperatorAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BridgeOperator);\n }\n }\n\n emit BlockProducerSetUpdated(_newPeriod, _nextEpoch, getBlockProducers());\n emit BridgeOperatorSetUpdated(_newPeriod, _nextEpoch, getBridgeOperators());\n }\n\n /**\n * @dev Override `CandidateManager-_isTrustedOrg`.\n */\n function _isTrustedOrg(address _consensusAddr) internal view override returns (bool) {\n return _roninTrustedOrganizationContract.getConsensusWeight(_consensusAddr) > 0;\n }\n}\n" + }, + "contracts/extensions/collections/HasMaintenanceContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasMaintenanceContract.sol\";\nimport \"../../interfaces/IMaintenance.sol\";\n\ncontract HasMaintenanceContract is IHasMaintenanceContract, HasProxyAdmin {\n IMaintenance internal _maintenanceContract;\n\n modifier onlyMaintenanceContract() {\n if (maintenanceContract() != msg.sender) revert ErrCallerMustBeMaintenanceContract();\n _;\n }\n\n /**\n * @inheritdoc IHasMaintenanceContract\n */\n function maintenanceContract() public view override returns (address) {\n return address(_maintenanceContract);\n }\n\n /**\n * @inheritdoc IHasMaintenanceContract\n */\n function setMaintenanceContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setMaintenanceContract(_addr);\n }\n\n /**\n * @dev Sets the scheduled maintenance contract.\n *\n * Emits the event `MaintenanceContractUpdated`.\n *\n */\n function _setMaintenanceContract(address _addr) internal {\n _maintenanceContract = IMaintenance(_addr);\n emit MaintenanceContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/collections/HasSlashIndicatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasSlashIndicatorContract.sol\";\nimport \"../../interfaces/slash-indicator/ISlashIndicator.sol\";\n\ncontract HasSlashIndicatorContract is IHasSlashIndicatorContract, HasProxyAdmin {\n ISlashIndicator internal _slashIndicatorContract;\n\n modifier onlySlashIndicatorContract() {\n if (slashIndicatorContract() != msg.sender) revert ErrCallerMustBeSlashIndicatorContract();\n _;\n }\n\n /**\n * @inheritdoc IHasSlashIndicatorContract\n */\n function slashIndicatorContract() public view override returns (address) {\n return address(_slashIndicatorContract);\n }\n\n /**\n * @inheritdoc IHasSlashIndicatorContract\n */\n function setSlashIndicatorContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setSlashIndicatorContract(_addr);\n }\n\n /**\n * @dev Sets the slash indicator contract.\n *\n * Emits the event `SlashIndicatorContractUpdated`.\n *\n */\n function _setSlashIndicatorContract(address _addr) internal {\n _slashIndicatorContract = ISlashIndicator(_addr);\n emit SlashIndicatorContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/collections/HasStakingVestingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasStakingVestingContract.sol\";\nimport \"../../interfaces/IStakingVesting.sol\";\n\ncontract HasStakingVestingContract is IHasStakingVestingContract, HasProxyAdmin {\n IStakingVesting internal _stakingVestingContract;\n\n modifier onlyStakingVestingContract() {\n if (stakingVestingContract() != msg.sender) revert ErrCallerMustBeStakingVestingContract();\n _;\n }\n\n /**\n * @inheritdoc IHasStakingVestingContract\n */\n function stakingVestingContract() public view override returns (address) {\n return address(_stakingVestingContract);\n }\n\n /**\n * @inheritdoc IHasStakingVestingContract\n */\n function setStakingVestingContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setStakingVestingContract(_addr);\n }\n\n /**\n * @dev Sets the staking vesting contract.\n *\n * Emits the event `StakingVestingContractUpdated`.\n *\n */\n function _setStakingVestingContract(address _addr) internal {\n _stakingVestingContract = IStakingVesting(_addr);\n emit StakingVestingContractUpdated(_addr);\n }\n}\n" + }, + "contracts/precompile-usages/PCUSortValidators.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUSortValidators is PrecompiledUsage {\n /// @dev Gets the address of the precompile of sorting validators\n function precompileSortValidatorsAddress() public view virtual returns (address) {\n return address(0x66);\n }\n\n /**\n * @dev Sorts candidates descending by their weights by calling precompile contract.\n *\n * Note: This function is marked as virtual for being wrapping in mock contract for testing purpose.\n */\n function _pcSortCandidates(address[] memory _candidates, uint256[] memory _weights)\n internal\n view\n virtual\n returns (address[] memory _result)\n {\n address _smc = precompileSortValidatorsAddress();\n bool _success = true;\n\n bytes memory _payload = abi.encodeWithSignature(\"sortValidators(address[],uint256[])\", _candidates, _weights);\n uint256 _payloadLength = _payload.length;\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n\n _result := add(_result, 0x20)\n }\n\n if (!_success) revert ErrCallPrecompiled();\n }\n}\n" + }, + "contracts/precompile-usages/PCUPickValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUPickValidatorSet is PrecompiledUsage {\n /// @dev Gets the address of the precompile of picking validator set\n function precompilePickValidatorSetAddress() public view virtual returns (address) {\n return address(0x68);\n }\n\n /**\n * @dev Sorts and arranges to return a new validator set.\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcPickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) internal view virtual returns (address[] memory _result, uint256 _newValidatorCount) {\n address _smc = precompilePickValidatorSetAddress();\n bytes memory _payload = abi.encodeWithSignature(\n \"pickValidatorSet(address[],uint256[],uint256[],uint256,uint256)\",\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n bool _success = true;\n\n uint256 _payloadLength = _payload.length;\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n\n _result := add(_result, 0x20)\n }\n\n if (!_success) revert ErrCallPrecompiled();\n\n _newValidatorCount = _result.length;\n }\n}\n" + }, + "contracts/interfaces/collections/IHasMaintenanceContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasMaintenanceContract is IHasContract {\n /// @dev Emitted when the maintenance contract is updated.\n event MaintenanceContractUpdated(address);\n\n /// @dev Error of method caller must be maintenance contract.\n error ErrCallerMustBeMaintenanceContract();\n\n /**\n * @dev Returns the maintenance contract.\n */\n function maintenanceContract() external view returns (address);\n\n /**\n * @dev Sets the maintenance contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `MaintenanceContractUpdated`.\n *\n */\n function setMaintenanceContract(address) external;\n}\n" + }, + "contracts/interfaces/collections/IHasSlashIndicatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasSlashIndicatorContract is IHasContract {\n /// @dev Emitted when the slash indicator contract is updated.\n event SlashIndicatorContractUpdated(address);\n\n /// @dev Error of method caller must be slash indicator contract.\n error ErrCallerMustBeSlashIndicatorContract();\n\n /**\n * @dev Returns the slash indicator contract.\n */\n function slashIndicatorContract() external view returns (address);\n\n /**\n * @dev Sets the slash indicator contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `SlashIndicatorContractUpdated`.\n *\n */\n function setSlashIndicatorContract(address) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashDoubleSign.sol\";\nimport \"./ISlashBridgeVoting.sol\";\nimport \"./ISlashBridgeOperator.sol\";\nimport \"./ISlashUnavailability.sol\";\nimport \"./ICreditScore.sol\";\n\ninterface ISlashIndicator is\n ISlashDoubleSign,\n ISlashBridgeVoting,\n ISlashBridgeOperator,\n ISlashUnavailability,\n ICreditScore\n{}\n" + }, + "contracts/interfaces/slash-indicator/ISlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashDoubleSign is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\n * for param details.\n */\n event DoubleSignSlashingConfigsUpdated(\n uint256 slashDoubleSignAmount,\n uint256 doubleSigningJailUntilBlock,\n uint256 doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Slashes for double signing.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\n */\n function slashDoubleSign(\n address _validatorAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) external;\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\n * double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n returns (\n uint256 _slashDoubleSignAmount,\n uint256 _doubleSigningJailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\n *\n * @param _slashAmount The amount of RON to slash double sign.\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashBridgeVoting is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash bridge voting is updated. See the method `getBridgeVotingSlashingConfigs` for param\n * details.\n */\n event BridgeVotingSlashingConfigsUpdated(uint256 bridgeVotingThreshold, uint256 bridgeVotingSlashAmount);\n\n /**\n * @dev Slashes for bridge voter governance.\n *\n * Emits the event `Slashed`.\n */\n function slashBridgeVoting(address _consensusAddr) external;\n\n /**\n * @dev Returns the configs related to bridge voting slashing.\n *\n * @return _bridgeVotingThreshold The threshold to slash when a trusted organization does not vote for bridge\n * operators.\n * @return _bridgeVotingSlashAmount The amount of RON to slash bridge voting.\n *\n */\n function getBridgeVotingSlashingConfigs()\n external\n view\n returns (uint256 _bridgeVotingThreshold, uint256 _bridgeVotingSlashAmount);\n\n /**\n * @dev Sets the configs to slash bridge voting.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeVotingSlashingConfigsUpdated`.\n *\n * @param _threshold The threshold to slash when a trusted organization does not vote for bridge operators.\n * @param _slashAmount The amount of RON to slash bridge voting.\n *\n */\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashBridgeOperator is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash bridge operator is updated. See the method\n * `getBridgeOperatorSlashingConfigs` for param details.\n */\n event BridgeOperatorSlashingConfigsUpdated(\n uint256 missingVotesRatioTier1,\n uint256 missingVotesRatioTier2,\n uint256 jailDurationForMissingVotesRatioTier2,\n uint256 skipBridgeOperatorSlashingThreshold\n );\n\n /**\n * @dev Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\n * @param _tier The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1`\n * and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2`\n *\n * Requirements:\n * - Only validator contract can invoke this method.\n * - Should be called only at the end of period.\n * - Should be called only when there is slash of bridge operator.\n *\n * Emits the event `Slashed`.\n */\n function execSlashBridgeOperator(\n address _consensusAddr,\n uint256 _tier,\n uint256 _period\n ) external;\n\n /**\n * @dev Returns the configs related to bridge operator slashing.\n *\n * @return _missingVotesRatioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio.\n * @return _missingVotesRatioTier2 The bridge reward and mining reward will be deprecated and the corresponding\n * block producer will be put in jail if (s)he misses more than this ratio.\n * @return _jailDurationForMissingVotesRatioTier2 The number of blocks to jail the corresponding block producer when\n * its bridge operator is slashed tier-2.\n * @return _skipBridgeOperatorSlashingThreshold The threshold to skip slashing the bridge operator in case the total\n * number of votes in the bridge is too small.\n *\n */\n function getBridgeOperatorSlashingConfigs()\n external\n view\n returns (\n uint256 _missingVotesRatioTier1,\n uint256 _missingVotesRatioTier2,\n uint256 _jailDurationForMissingVotesRatioTier2,\n uint256 _skipBridgeOperatorSlashingThreshold\n );\n\n /**\n * @dev Sets the configs to slash bridge operators.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\n *\n * @param _ratioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map\n * to 0%-100%.\n * @param _ratioTier2 The bridge reward and mining reward will be deprecated and the corresponding block producer will\n * be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\n * @param _jailDurationTier2 The number of blocks to jail the corresponding block producer when its bridge operator is\n * slashed tier-2.\n * @param _skipSlashingThreshold The threshold to skip slashing the bridge operator in case the total number of votes\n * in the bridge is too small.\n *\n */\n function setBridgeOperatorSlashingConfigs(\n uint256 _ratioTier1,\n uint256 _ratioTier2,\n uint256 _jailDurationTier2,\n uint256 _skipSlashingThreshold\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashUnavailability is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\n * for param details.\n */\n event UnavailabilitySlashingConfigsUpdated(\n uint256 unavailabilityTier1Threshold,\n uint256 unavailabilityTier2Threshold,\n uint256 slashAmountForUnavailabilityTier2Threshold,\n uint256 jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Returns the last block that a block producer is slashed for unavailability.\n */\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\n\n /**\n * @dev Slashes for unavailability by increasing the counter of block producer `_consensusAddr`.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` when the threshold is reached.\n *\n */\n function slashUnavailability(address _consensusAddr) external;\n\n /**\n * @dev Returns the current unavailability indicator of a block producer.\n */\n function currentUnavailabilityIndicator(address _validator) external view returns (uint256);\n\n /**\n * @dev Returns the unavailability indicator in the period `_period` of a block producer.\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return _unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\n * @return _unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n * @return _slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\n * producer when (s)he is slashed with tier-2 or tier-3.\n * @return _jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\n * slashed with tier-2 or tier-3.\n *\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n returns (\n uint256 _unavailabilityTier1Threshold,\n uint256 _unavailabilityTier2Threshold,\n uint256 _slashAmountForUnavailabilityTier2Threshold,\n uint256 _jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\n *\n * @param _tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\n * @param _tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold.\n * @param _slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\n * is slashed tier-2.\n * @param _jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\n *\n */\n function setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ICreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ICreditScore {\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\n event CreditScoreConfigsUpdated(\n uint256 gainCreditScore,\n uint256 maxCreditScore,\n uint256 bailOutCostMultiplier,\n uint256 cutOffPercentageAfterBailout\n );\n /// @dev Emitted the credit score of validators is updated.\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\n /// @dev Emitted when a validator bailed out of jail.\n event BailedOut(address indexed validator, uint256 period, uint256 usedCreditScore);\n\n /**\n * @dev Updates the credit score for the validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function updateCreditScores(address[] calldata _validators, uint256 _period) external;\n\n /**\n * @dev Resets the credit score for the revoked validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function execResetCreditScores(address[] calldata _validators) external;\n\n /**\n * @dev A slashed validator use this method to get out of jail.\n *\n * Requirements:\n * - The `_consensusAddr` must be a validator.\n * - Only validator's admin can call this method.\n *\n * Emits the event `BailedOut`.\n *\n */\n function bailOut(address _consensusAddr) external;\n\n /**\n * @dev Sets the configs to credit score.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CreditScoreConfigsUpdated`.\n *\n * @param _gainScore The score to gain per period.\n * @param _maxScore The max number of credit score that a validator can hold.\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external;\n\n /**\n * @dev Returns the configs related to credit score.\n *\n * @return _gainCreditScore The score to gain per period.\n * @return _maxCreditScore The max number of credit score that a validator can hold.\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function getCreditScoreConfigs()\n external\n view\n returns (\n uint256 _gainCreditScore,\n uint256 _maxCreditScore,\n uint256 _bailOutCostMultiplier,\n uint256 _cutOffPercentageAfterBailout\n );\n\n /**\n * @dev Returns the current credit score of the validator.\n */\n function getCreditScore(address _validator) external view returns (uint256);\n\n /**\n * @dev Returns the current credit score of a list of validators.\n */\n function getManyCreditScores(address[] calldata _validators) external view returns (uint256[] memory _resultList);\n\n /**\n * @dev Returns the whether the `_validator` has been bailed out at the `_period`.\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period) external view returns (bool);\n}\n" + }, + "contracts/interfaces/slash-indicator/IBaseSlash.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IBaseSlash {\n enum SlashType {\n UNKNOWN,\n UNAVAILABILITY_TIER_1,\n UNAVAILABILITY_TIER_2,\n DOUBLE_SIGNING,\n BRIDGE_VOTING,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\n UNAVAILABILITY_TIER_3\n }\n\n /// @dev Emitted when the validator is slashed.\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\n}\n" + }, + "contracts/interfaces/collections/IHasStakingVestingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasStakingVestingContract is IHasContract {\n /// @dev Emitted when the staking vesting contract is updated.\n event StakingVestingContractUpdated(address);\n\n /// @dev Error of method caller must be staking vesting contract.\n error ErrCallerMustBeStakingVestingContract();\n\n /**\n * @dev Returns the staking vesting contract.\n */\n function stakingVestingContract() external view returns (address);\n\n /**\n * @dev Sets the staking vesting contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `StakingVestingContractUpdated`.\n *\n */\n function setStakingVestingContract(address) external;\n}\n" + }, + "contracts/precompile-usages/PrecompiledUsage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PrecompiledUsage {\n /// @dev Error of call to precompile fails.\n error ErrCallPrecompiled();\n}\n" + }, + "contracts/ronin/validator/SlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasSlashIndicatorContract.sol\";\nimport \"../../extensions/collections/HasStakingContract.sol\";\nimport \"../../interfaces/validator/ISlashingExecution.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\n\nabstract contract SlashingExecution is\n ISlashingExecution,\n HasSlashIndicatorContract,\n HasStakingContract,\n CommonStorage\n{\n /**\n * @inheritdoc ISlashingExecution\n */\n function execSlash(\n address _validatorAddr,\n uint256 _newJailedUntil,\n uint256 _slashAmount,\n bool _cannotBailout\n ) external override onlySlashIndicatorContract {\n uint256 _period = currentPeriod();\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = true;\n\n _totalDeprecatedReward += _miningReward[_validatorAddr] + _delegatingReward[_validatorAddr];\n\n delete _miningReward[_validatorAddr];\n delete _delegatingReward[_validatorAddr];\n\n _blockProducerJailedBlock[_validatorAddr] = Math.max(_newJailedUntil, _blockProducerJailedBlock[_validatorAddr]);\n\n if (_slashAmount > 0) {\n uint256 _actualAmount = _stakingContract.execDeductStakingAmount(_validatorAddr, _slashAmount);\n _totalDeprecatedReward += _actualAmount;\n }\n\n if (_cannotBailout) {\n _cannotBailoutUntilBlock[_validatorAddr] = Math.max(_newJailedUntil, _cannotBailoutUntilBlock[_validatorAddr]);\n }\n\n emit ValidatorPunished(\n _validatorAddr,\n _period,\n _blockProducerJailedBlock[_validatorAddr],\n _slashAmount,\n true,\n false\n );\n }\n\n /**\n * @inheritdoc ISlashingExecution\n */\n function execBailOut(address _validatorAddr, uint256 _period) external override onlySlashIndicatorContract {\n if (block.number <= _cannotBailoutUntilBlock[_validatorAddr]) revert ErrCannotBailout(_validatorAddr);\n\n // Note: Removing rewards of validator in `bailOut` function is not needed, since the rewards have been\n // removed previously in the `slash` function.\n _miningRewardBailoutCutOffAtPeriod[_validatorAddr][_period] = true;\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = false;\n _blockProducerJailedBlock[_validatorAddr] = block.number - 1;\n\n emit ValidatorUnjailed(_validatorAddr, _period);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/slash-indicator/ISlashIndicator.sol\";\nimport \"./SlashDoubleSign.sol\";\nimport \"./SlashBridgeVoting.sol\";\nimport \"./SlashBridgeOperator.sol\";\nimport \"./SlashUnavailability.sol\";\nimport \"./CreditScore.sol\";\n\ncontract SlashIndicator is\n ISlashIndicator,\n SlashDoubleSign,\n SlashBridgeVoting,\n SlashBridgeOperator,\n SlashUnavailability,\n CreditScore,\n Initializable\n{\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n address __maintenanceContract,\n address __roninTrustedOrganizationContract,\n address __roninGovernanceAdminContract,\n // _bridgeOperatorSlashingConfigs[0]: _missingVotesRatioTier1\n // _bridgeOperatorSlashingConfigs[1]: _missingVotesRatioTier2\n // _bridgeOperatorSlashingConfigs[2]: _jailDurationForMissingVotesRatioTier2\n // _bridgeOperatorSlashingConfigs[3]: _skipBridgeOperatorSlashingThreshold\n uint256[4] calldata _bridgeOperatorSlashingConfigs,\n // _bridgeVotingSlashingConfigs[0]: _bridgeVotingThreshold\n // _bridgeVotingSlashingConfigs[1]: _bridgeVotingSlashAmount\n uint256[2] calldata _bridgeVotingSlashingConfigs,\n // _doubleSignSlashingConfigs[0]: _slashDoubleSignAmount\n // _doubleSignSlashingConfigs[1]: _doubleSigningJailUntilBlock\n // _doubleSignSlashingConfigs[2]: _doubleSigningOffsetLimitBlock\n uint256[3] calldata _doubleSignSlashingConfigs,\n // _unavailabilitySlashingConfigs[0]: _unavailabilityTier1Threshold\n // _unavailabilitySlashingConfigs[1]: _unavailabilityTier2Threshold\n // _unavailabilitySlashingConfigs[2]: _slashAmountForUnavailabilityTier2Threshold\n // _unavailabilitySlashingConfigs[3]: _jailDurationForUnavailabilityTier2Threshold\n uint256[4] calldata _unavailabilitySlashingConfigs,\n // _creditScoreConfigs[0]: _gainCreditScore\n // _creditScoreConfigs[1]: _maxCreditScore\n // _creditScoreConfigs[2]: _bailOutCostMultiplier\n // _creditScoreConfigs[3]: _cutOffPercentageAfterBailout\n uint256[4] calldata _creditScoreConfigs\n ) external initializer {\n _setValidatorContract(__validatorContract);\n _setMaintenanceContract(__maintenanceContract);\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\n _setRoninGovernanceAdminContract(__roninGovernanceAdminContract);\n _setBridgeOperatorSlashingConfigs(\n _bridgeOperatorSlashingConfigs[0],\n _bridgeOperatorSlashingConfigs[1],\n _bridgeOperatorSlashingConfigs[2],\n _bridgeOperatorSlashingConfigs[3]\n );\n _setBridgeVotingSlashingConfigs(_bridgeVotingSlashingConfigs[0], _bridgeVotingSlashingConfigs[1]);\n _setDoubleSignSlashingConfigs(\n _doubleSignSlashingConfigs[0],\n _doubleSignSlashingConfigs[1],\n _doubleSignSlashingConfigs[2]\n );\n _setUnavailabilitySlashingConfigs(\n _unavailabilitySlashingConfigs[0],\n _unavailabilitySlashingConfigs[1],\n _unavailabilitySlashingConfigs[2],\n _unavailabilitySlashingConfigs[3]\n );\n _setCreditScoreConfigs(\n _creditScoreConfigs[0],\n _creditScoreConfigs[1],\n _creditScoreConfigs[2],\n _creditScoreConfigs[3]\n );\n }\n\n /**\n * @dev Helper for CreditScore contract to reset the indicator of the validator after bailing out.\n */\n function _setUnavailabilityIndicator(\n address _validator,\n uint256 _period,\n uint256 _indicator\n ) internal override(CreditScore, SlashUnavailability) {\n SlashUnavailability._setUnavailabilityIndicator(_validator, _period, _indicator);\n }\n\n /**\n * @dev Helper for CreditScore contract to query indicator of the validator.\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period)\n public\n view\n override(CreditScore, ISlashUnavailability, SlashUnavailability)\n returns (uint256)\n {\n return SlashUnavailability.getUnavailabilityIndicator(_validator, _period);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period)\n public\n view\n override(CreditScore, ICreditScore, SlashUnavailability)\n returns (bool)\n {\n return CreditScore.checkBailedOutAtPeriod(_validator, _period);\n }\n\n /**\n * @dev Sanity check the address to be slashed\n */\n function _shouldSlash(address _addr) internal view override(SlashDoubleSign, SlashUnavailability) returns (bool) {\n return\n (msg.sender != _addr) &&\n _validatorContract.isBlockProducer(_addr) &&\n !_maintenanceContract.checkMaintained(_addr, block.number);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/slash-indicator/ISlashDoubleSign.sol\";\nimport \"../../precompile-usages/PCUValidateDoubleSign.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashDoubleSign is ISlashDoubleSign, HasValidatorContract, PCUValidateDoubleSign {\n /// @dev The amount of RON to slash double sign.\n uint256 internal _slashDoubleSignAmount;\n /// @dev The block number that the punished validator will be jailed until, due to double signing.\n uint256 internal _doubleSigningJailUntilBlock;\n /** @dev The offset from the submitted block to the current block, from which double signing will be invalidated.\n * This parameter is exposed for system transaction.\n **/\n uint256 internal _doubleSigningOffsetLimitBlock;\n /// @dev Recording of submitted proof to prevent relay attack.\n mapping(bytes32 => bool) _submittedEvidence;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function slashDoubleSign(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) external override onlyAdmin {\n bytes32 _header1Checksum = keccak256(_header1);\n bytes32 _header2Checksum = keccak256(_header2);\n\n require(\n !_submittedEvidence[_header1Checksum] && !_submittedEvidence[_header2Checksum],\n \"SlashDoubleSign: evidence already submitted\"\n );\n\n if (_pcValidateEvidence(_consensusAddr, _header1, _header2)) {\n uint256 _period = _validatorContract.currentPeriod();\n _submittedEvidence[_header1Checksum] = true;\n _submittedEvidence[_header2Checksum] = true;\n emit Slashed(_consensusAddr, SlashType.DOUBLE_SIGNING, _period);\n _validatorContract.execSlash(_consensusAddr, _doubleSigningJailUntilBlock, _slashDoubleSignAmount, true);\n }\n }\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n override\n returns (\n uint256 slashDoubleSignAmount_,\n uint256 doubleSigningJailUntilBlock_,\n uint256 doubleSigningOffsetLimitBlock_\n )\n {\n return (_slashDoubleSignAmount, _doubleSigningJailUntilBlock, _doubleSigningOffsetLimitBlock);\n }\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _offsetLimitBlock\n ) external override onlyAdmin {\n _setDoubleSignSlashingConfigs(_slashAmount, _jailUntilBlock, _offsetLimitBlock);\n }\n\n /**\n * @dev See `ISlashDoubleSign-setDoubleSignSlashingConfigs`.\n */\n function _setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _offsetLimitBlock\n ) internal {\n _slashDoubleSignAmount = _slashAmount;\n _doubleSigningJailUntilBlock = _jailUntilBlock;\n _doubleSigningOffsetLimitBlock = _offsetLimitBlock;\n emit DoubleSignSlashingConfigsUpdated(_slashAmount, _jailUntilBlock, _doubleSigningOffsetLimitBlock);\n }\n\n /**\n * @dev Returns whether the account `_addr` should be slashed or not.\n */\n function _shouldSlash(address _addr) internal view virtual returns (bool);\n}\n" + }, + "contracts/ronin/slash-indicator/SlashBridgeVoting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../libraries/Math.sol\";\nimport \"../../interfaces/slash-indicator/ISlashBridgeVoting.sol\";\nimport \"../../extensions/collections/HasRoninTrustedOrganizationContract.sol\";\nimport \"../../extensions/collections/HasRoninGovernanceAdminContract.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashBridgeVoting is\n ISlashBridgeVoting,\n HasValidatorContract,\n HasRoninTrustedOrganizationContract,\n HasRoninGovernanceAdminContract\n{\n /// @dev Mapping from validator address => period index => bridge voting slashed\n mapping(address => mapping(uint256 => bool)) internal _bridgeVotingSlashed;\n /// @dev The threshold to slash when a trusted organization does not vote for bridge operators.\n uint256 internal _bridgeVotingThreshold;\n /// @dev The amount of RON to slash bridge voting.\n uint256 internal _bridgeVotingSlashAmount;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ISlashBridgeVoting\n */\n function slashBridgeVoting(address _consensusAddr) external onlyAdmin {\n IRoninTrustedOrganization.TrustedOrganization memory _org = _roninTrustedOrganizationContract\n .getTrustedOrganization(_consensusAddr);\n uint256 _lastVotedBlock = Math.max(_roninGovernanceAdminContract.lastVotedBlock(_org.bridgeVoter), _org.addedBlock);\n uint256 _period = _validatorContract.currentPeriod();\n\n require(\n block.number - _lastVotedBlock > _bridgeVotingThreshold && !_bridgeVotingSlashed[_consensusAddr][_period],\n \"SlashBridgeVoting: invalid slash\"\n );\n\n _bridgeVotingSlashed[_consensusAddr][_period] = true;\n emit Slashed(_consensusAddr, SlashType.BRIDGE_VOTING, _period);\n _validatorContract.execSlash(_consensusAddr, 0, _bridgeVotingSlashAmount, false);\n }\n\n /**\n * @inheritdoc ISlashBridgeVoting\n */\n function getBridgeVotingSlashingConfigs()\n external\n view\n override\n returns (uint256 bridgeVotingThreshold_, uint256 bridgeVotingSlashAmount_)\n {\n return (_bridgeVotingThreshold, _bridgeVotingSlashAmount);\n }\n\n /**\n * @inheritdoc ISlashBridgeVoting\n */\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external override onlyAdmin {\n _setBridgeVotingSlashingConfigs(_threshold, _slashAmount);\n }\n\n /**\n * @dev See `ISlashBridgeVoting-setBridgeVotingSlashingConfigs`.\n */\n function _setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) internal {\n _bridgeVotingThreshold = _threshold;\n _bridgeVotingSlashAmount = _slashAmount;\n emit BridgeVotingSlashingConfigsUpdated(_threshold, _slashAmount);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashBridgeOperator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../extensions/collections/HasProxyAdmin.sol\";\nimport \"../../interfaces/slash-indicator/ISlashBridgeOperator.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashBridgeOperator is ISlashBridgeOperator, HasProxyAdmin, HasValidatorContract, PercentageConsumer {\n /**\n * @dev The bridge operators will be deprecated reward if (s)he missed more than the ratio.\n * Values 0-10,000 map to 0%-100%.\n */\n uint256 internal _missingVotesRatioTier1;\n /**\n * @dev The bridge operators will be deprecated all rewards including bridge reward and mining reward if (s)he missed\n * more than the ratio. Values 0-10,000 map to 0%-100%.\n */\n uint256 internal _missingVotesRatioTier2;\n /// @dev The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\n uint256 internal _jailDurationForMissingVotesRatioTier2;\n /// @dev The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\n uint256 internal _skipBridgeOperatorSlashingThreshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ISlashBridgeOperator\n */\n function getBridgeOperatorSlashingConfigs()\n external\n view\n override\n returns (\n uint256 missingVotesRatioTier1_,\n uint256 missingVotesRatioTier2_,\n uint256 jailDurationForMissingVotesRatioTier2_,\n uint256 skipBridgeOperatorSlashingThreshold_\n )\n {\n return (\n _missingVotesRatioTier1,\n _missingVotesRatioTier2,\n _jailDurationForMissingVotesRatioTier2,\n _skipBridgeOperatorSlashingThreshold\n );\n }\n\n /**\n * @inheritdoc ISlashBridgeOperator\n */\n function setBridgeOperatorSlashingConfigs(\n uint256 _ratioTier1,\n uint256 _ratioTier2,\n uint256 _jailDurationTier2,\n uint256 _skipSlashingThreshold\n ) external override onlyAdmin {\n _setBridgeOperatorSlashingConfigs(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\n }\n\n /**\n * @inheritdoc ISlashBridgeOperator\n */\n function execSlashBridgeOperator(\n address _consensusAddr,\n uint256 _tier,\n uint256 _period\n ) external onlyValidatorContract {\n if (_tier == 1) {\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1, _period);\n } else if (_tier == 2) {\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2, _period);\n }\n }\n\n /**\n * @dev See `ISlashBridgeOperator-setBridgeOperatorSlashingConfigs`.\n */\n function _setBridgeOperatorSlashingConfigs(\n uint256 _ratioTier1,\n uint256 _ratioTier2,\n uint256 _jailDurationTier2,\n uint256 _skipSlashingThreshold\n ) internal {\n require(\n _ratioTier1 <= _ratioTier2 && _ratioTier1 <= _MAX_PERCENTAGE && _ratioTier2 <= _MAX_PERCENTAGE,\n \"SlashIndicator: invalid ratios\"\n );\n _missingVotesRatioTier1 = _ratioTier1;\n _missingVotesRatioTier2 = _ratioTier2;\n _jailDurationForMissingVotesRatioTier2 = _jailDurationTier2;\n _skipBridgeOperatorSlashingThreshold = _skipSlashingThreshold;\n emit BridgeOperatorSlashingConfigsUpdated(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./CreditScore.sol\";\nimport \"../../interfaces/slash-indicator/ISlashUnavailability.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashUnavailability is ISlashUnavailability, HasValidatorContract {\n /// @dev The last block that a validator is slashed for unavailability.\n uint256 public lastUnavailabilitySlashedBlock;\n /// @dev Mapping from validator address => period index => unavailability indicator.\n mapping(address => mapping(uint256 => uint256)) internal _unavailabilityIndicator;\n\n /**\n * @dev The mining reward will be deprecated, if (s)he missed more than this threshold.\n * This threshold is applied for tier-1 and tier-3 of unavailability slash.\n */\n uint256 internal _unavailabilityTier1Threshold;\n /**\n * @dev The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n */\n uint256 internal _unavailabilityTier2Threshold;\n /**\n * @dev The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with\n * tier-2 or tier-3.\n **/\n uint256 internal _slashAmountForUnavailabilityTier2Threshold;\n /// @dev The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\n uint256 internal _jailDurationForUnavailabilityTier2Threshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n modifier oncePerBlock() {\n require(\n block.number > lastUnavailabilitySlashedBlock,\n \"SlashIndicator: cannot slash a validator twice or slash more than one validator in one block\"\n );\n lastUnavailabilitySlashedBlock = block.number;\n _;\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function slashUnavailability(address _validatorAddr) external override oncePerBlock {\n require(msg.sender == block.coinbase, \"SlashUnavailability: method caller must be coinbase\");\n if (!_shouldSlash(_validatorAddr)) {\n // Should return instead of throwing error since this is a part of system transaction.\n return;\n }\n\n uint256 _period = _validatorContract.currentPeriod();\n uint256 _count = ++_unavailabilityIndicator[_validatorAddr][_period];\n uint256 _newJailedUntilBlock = Math.addIfNonZero(block.number, _jailDurationForUnavailabilityTier2Threshold);\n\n if (_count == _unavailabilityTier2Threshold) {\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_2, _period);\n _validatorContract.execSlash(\n _validatorAddr,\n _newJailedUntilBlock,\n _slashAmountForUnavailabilityTier2Threshold,\n false\n );\n } else if (_count == _unavailabilityTier1Threshold) {\n bool _tier1SecondTime = checkBailedOutAtPeriod(_validatorAddr, _period);\n if (!_tier1SecondTime) {\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_1, _period);\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\n } else {\n /// Handles tier-3\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_3, _period);\n _validatorContract.execSlash(\n _validatorAddr,\n _newJailedUntilBlock,\n _slashAmountForUnavailabilityTier2Threshold,\n true\n );\n }\n }\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) external override onlyAdmin {\n _setUnavailabilitySlashingConfigs(\n _tier1Threshold,\n _tier2Threshold,\n _slashAmountForTier2Threshold,\n _jailDurationForTier2Threshold\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n override\n returns (\n uint256 unavailabilityTier1Threshold_,\n uint256 unavailabilityTier2Threshold_,\n uint256 slashAmountForUnavailabilityTier2Threshold_,\n uint256 jailDurationForUnavailabilityTier2Threshold_\n )\n {\n return (\n _unavailabilityTier1Threshold,\n _unavailabilityTier2Threshold,\n _slashAmountForUnavailabilityTier2Threshold,\n _jailDurationForUnavailabilityTier2Threshold\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function currentUnavailabilityIndicator(address _validator) external view override returns (uint256) {\n return getUnavailabilityIndicator(_validator, _validatorContract.currentPeriod());\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period)\n public\n view\n virtual\n override\n returns (uint256)\n {\n return _unavailabilityIndicator[_validator][_period];\n }\n\n /**\n * @dev Sets the unavailability indicator of the `_validator` at `_period`.\n */\n function _setUnavailabilityIndicator(\n address _validator,\n uint256 _period,\n uint256 _indicator\n ) internal virtual {\n _unavailabilityIndicator[_validator][_period] = _indicator;\n }\n\n /**\n * @dev See `ISlashUnavailability-setUnavailabilitySlashingConfigs`.\n */\n function _setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) internal {\n require(_unavailabilityTier1Threshold <= _unavailabilityTier2Threshold, \"SlashUnavailability: invalid threshold\");\n _unavailabilityTier1Threshold = _tier1Threshold;\n _unavailabilityTier2Threshold = _tier2Threshold;\n _slashAmountForUnavailabilityTier2Threshold = _slashAmountForTier2Threshold;\n _jailDurationForUnavailabilityTier2Threshold = _jailDurationForTier2Threshold;\n emit UnavailabilitySlashingConfigsUpdated(\n _tier1Threshold,\n _tier2Threshold,\n _slashAmountForTier2Threshold,\n _jailDurationForTier2Threshold\n );\n }\n\n /**\n * @dev Returns whether the account `_addr` should be slashed or not.\n */\n function _shouldSlash(address _addr) internal view virtual returns (bool);\n\n /**\n * @dev See `ICreditScore-checkBailedOutAtPeriod`\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual returns (bool);\n}\n" + }, + "contracts/ronin/slash-indicator/CreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/slash-indicator/ICreditScore.sol\";\nimport \"../../extensions/collections/HasMaintenanceContract.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../libraries/Math.sol\";\n\nabstract contract CreditScore is ICreditScore, HasValidatorContract, HasMaintenanceContract, PercentageConsumer {\n /// @dev Mapping from validator address => period index => whether bailed out before\n mapping(address => mapping(uint256 => bool)) internal _checkBailedOutAtPeriod;\n /// @dev Mapping from validator address => credit score\n mapping(address => uint256) internal _creditScore;\n\n /// @dev The max gained number of credit score per period.\n uint256 internal _gainCreditScore;\n /// @dev The max number of credit score that a validator can hold.\n uint256 internal _maxCreditScore;\n /// @dev The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n uint256 internal _bailOutCostMultiplier;\n /// @dev The percentage of reward to be cut off from the validator in the rest of the period after bailed out.\n uint256 internal _cutOffPercentageAfterBailout;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ICreditScore\n */\n function updateCreditScores(address[] calldata _validators, uint256 _period) external override onlyValidatorContract {\n uint256 _periodStartAtBlock = _validatorContract.currentPeriodStartAtBlock();\n\n bool[] memory _jaileds = _validatorContract.checkManyJailed(_validators);\n bool[] memory _maintaineds = _maintenanceContract.checkManyMaintainedInBlockRange(\n _validators,\n _periodStartAtBlock,\n block.number\n );\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\n\n for (uint _i = 0; _i < _validators.length; _i++) {\n address _validator = _validators[_i];\n\n uint256 _indicator = getUnavailabilityIndicator(_validator, _period);\n bool _isJailedInPeriod = _jaileds[_i];\n bool _isMaintainingInPeriod = _maintaineds[_i];\n\n uint256 _actualGain = (_isJailedInPeriod || _isMaintainingInPeriod)\n ? 0\n : Math.subNonNegative(_gainCreditScore, _indicator);\n\n _creditScore[_validator] = Math.addWithUpperbound(_creditScore[_validator], _actualGain, _maxCreditScore);\n _updatedCreditScores[_i] = _creditScore[_validator];\n }\n\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\n }\n\n function execResetCreditScores(address[] calldata _validators) external override onlyValidatorContract {\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\n for (uint _i = 0; _i < _validators.length; _i++) {\n address _validator = _validators[_i];\n delete _creditScore[_validator];\n delete _updatedCreditScores[_i];\n }\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function bailOut(address _consensusAddr) external override {\n require(\n _validatorContract.isValidatorCandidate(_consensusAddr),\n \"SlashIndicator: consensus address must be a validator candidate\"\n );\n require(\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\n \"SlashIndicator: method caller must be a candidate admin\"\n );\n\n (bool _isJailed, , uint256 _jailedEpochLeft) = _validatorContract.getJailedTimeLeft(_consensusAddr);\n require(_isJailed, \"SlashIndicator: caller must be jailed in the current period\");\n\n uint256 _period = _validatorContract.currentPeriod();\n require(!_checkBailedOutAtPeriod[_consensusAddr][_period], \"SlashIndicator: validator has bailed out previously\");\n\n uint256 _score = _creditScore[_consensusAddr];\n uint256 _cost = _jailedEpochLeft * _bailOutCostMultiplier;\n require(_score >= _cost, \"SlashIndicator: insufficient credit score to bail out\");\n\n _validatorContract.execBailOut(_consensusAddr, _period);\n\n _creditScore[_consensusAddr] -= _cost;\n _setUnavailabilityIndicator(_consensusAddr, _period, 0);\n _checkBailedOutAtPeriod[_consensusAddr][_period] = true;\n emit BailedOut(_consensusAddr, _period, _cost);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external override onlyAdmin {\n _setCreditScoreConfigs(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\n }\n\n /**\n * @dev See `ISlashUnavailability`\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period) public view virtual returns (uint256);\n\n /**\n * @inheritdoc ICreditScore\n */\n function getCreditScoreConfigs()\n external\n view\n override\n returns (\n uint256 gainCreditScore_,\n uint256 maxCreditScore_,\n uint256 bailOutCostMultiplier_,\n uint256 cutOffPercentageAfterBailout_\n )\n {\n return (_gainCreditScore, _maxCreditScore, _bailOutCostMultiplier, _cutOffPercentageAfterBailout);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function getCreditScore(address _validator) external view override returns (uint256) {\n return _creditScore[_validator];\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function getManyCreditScores(address[] calldata _validators)\n public\n view\n override\n returns (uint256[] memory _resultList)\n {\n _resultList = new uint256[](_validators.length);\n\n for (uint _i = 0; _i < _resultList.length; _i++) {\n _resultList[_i] = _creditScore[_validators[_i]];\n }\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual override returns (bool) {\n return _checkBailedOutAtPeriod[_validator][_period];\n }\n\n /**\n * @dev See `SlashUnavailability`.\n */\n function _setUnavailabilityIndicator(\n address _validator,\n uint256 _period,\n uint256 _indicator\n ) internal virtual;\n\n /**\n * @dev See `ICreditScore-setCreditScoreConfigs`.\n */\n function _setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) internal {\n require(_gainScore <= _maxScore, \"CreditScore: invalid credit score config\");\n require(_cutOffPercentage <= _MAX_PERCENTAGE, \"CreditScore: invalid cut off percentage config\");\n\n _gainCreditScore = _gainScore;\n _maxCreditScore = _maxScore;\n _bailOutCostMultiplier = _bailOutMultiplier;\n _cutOffPercentageAfterBailout = _cutOffPercentage;\n emit CreditScoreConfigsUpdated(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\n }\n}\n" + }, + "contracts/precompile-usages/PCUValidateDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUValidateDoubleSign is PrecompiledUsage {\n /// @dev Gets the address of the precompile of validating double sign evidence\n function precompileValidateDoubleSignAddress() public view virtual returns (address) {\n return address(0x67);\n }\n\n /**\n * @dev Validates the two submitted block header if they are produced by the same address\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcValidateEvidence(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) internal view virtual returns (bool _validEvidence) {\n address _smc = precompileValidateDoubleSignAddress();\n bool _success = true;\n\n bytes memory _payload = abi.encodeWithSignature(\n \"validatingDoubleSignProof(address,bytes,bytes)\",\n _consensusAddr,\n _header1,\n _header2\n );\n uint _payloadLength = _payload.length;\n uint[1] memory _output;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _output, 0x20)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n }\n\n if (!_success) revert ErrCallPrecompiled();\n return (_output[0] != 0);\n }\n}\n" + }, + "contracts/extensions/collections/HasRoninGovernanceAdminContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasRoninGovernanceAdminContract.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\n\ncontract HasRoninGovernanceAdminContract is IHasRoninGovernanceAdminContract, HasProxyAdmin {\n IRoninGovernanceAdmin internal _roninGovernanceAdminContract;\n\n modifier onlyRoninGovernanceAdminContract() {\n if (roninGovernanceAdminContract() != msg.sender) revert ErrCallerMustBeGovernanceAdminContract();\n _;\n }\n\n /**\n * @inheritdoc IHasRoninGovernanceAdminContract\n */\n function roninGovernanceAdminContract() public view override returns (address) {\n return address(_roninGovernanceAdminContract);\n }\n\n /**\n * @inheritdoc IHasRoninGovernanceAdminContract\n */\n function setRoninGovernanceAdminContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setRoninGovernanceAdminContract(_addr);\n }\n\n /**\n * @dev Sets the ronin governance admin contract.\n *\n * Emits the event `RoninGovernanceAdminContractUpdated`.\n *\n */\n function _setRoninGovernanceAdminContract(address _addr) internal {\n _roninGovernanceAdminContract = IRoninGovernanceAdmin(_addr);\n emit RoninGovernanceAdminContractUpdated(_addr);\n }\n}\n" + }, + "contracts/interfaces/collections/IHasRoninGovernanceAdminContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasRoninGovernanceAdminContract is IHasContract {\n /// @dev Emitted when the ronin governance admin contract is updated.\n event RoninGovernanceAdminContractUpdated(address);\n\n /// @dev Error of method caller must be goverance admin contract.\n error ErrCallerMustBeGovernanceAdminContract();\n\n /**\n * @dev Returns the ronin governance admin contract.\n */\n function roninGovernanceAdminContract() external view returns (address);\n\n /**\n * @dev Sets the ronin governance admin contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `RoninGovernanceAdminContractUpdated`.\n *\n */\n function setRoninGovernanceAdminContract(address) external;\n}\n" + }, + "contracts/mocks/validator/MockRoninValidatorSetExtended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./MockRoninValidatorSetOverridePrecompile.sol\";\nimport \"../../libraries/EnumFlags.sol\";\n\ncontract MockRoninValidatorSetExtended is MockRoninValidatorSetOverridePrecompile {\n bool private _initialized;\n uint256[] internal _epochs;\n\n constructor() {}\n\n function initEpoch() public {\n if (!_initialized) {\n _epochs.push(0);\n _initialized = true;\n }\n }\n\n function endEpoch() external {\n _epochs.push(block.number);\n }\n\n function epochOf(uint256 _block) public view override returns (uint256 _epoch) {\n for (uint256 _i = _epochs.length; _i > 0; _i--) {\n if (_block > _epochs[_i - 1]) {\n return _i;\n }\n }\n }\n\n function epochEndingAt(uint256 _block) public view override(ITimingInfo, TimingStorage) returns (bool) {\n for (uint _i = 0; _i < _epochs.length; _i++) {\n if (_block == _epochs[_i]) {\n return true;\n }\n }\n return false;\n }\n\n function getJailUntils(address[] calldata _addrs) public view returns (uint256[] memory jailUntils_) {\n jailUntils_ = new uint256[](_addrs.length);\n for (uint _i = 0; _i < _addrs.length; _i++) {\n jailUntils_[_i] = _blockProducerJailedBlock[_addrs[_i]];\n }\n }\n\n function addValidators(address[] calldata _addrs) public {\n for (uint _i = 0; _i < _addrs.length; _i++) {\n _validators[_i] = _addrs[_i];\n _validatorMap[_addrs[_i]] = EnumFlags.ValidatorFlag.Both;\n }\n }\n}\n" + }, + "contracts/mocks/validator/MockRoninValidatorSetOverridePrecompile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../MockPrecompile.sol\";\nimport \"../../ronin/validator/RoninValidatorSet.sol\";\n\ncontract MockRoninValidatorSetOverridePrecompile is RoninValidatorSet, MockPrecompile {\n constructor() {}\n\n function arrangeValidatorCandidates(\n address[] memory _candidates,\n uint256[] memory _trustedWeights,\n uint _newValidatorCount,\n uint _maxPrioritizedValidatorNumber\n ) external pure returns (address[] memory) {\n _arrangeValidatorCandidates(_candidates, _trustedWeights, _newValidatorCount, _maxPrioritizedValidatorNumber);\n return _candidates;\n }\n\n function _pcSortCandidates(address[] memory _candidates, uint256[] memory _weights)\n internal\n pure\n override\n returns (address[] memory _result)\n {\n return sortValidators(_candidates, _weights);\n }\n\n function _pcPickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) internal pure override returns (address[] memory _result, uint256 _newValidatorCount) {\n _result = pickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n\n _newValidatorCount = _result.length;\n }\n}\n" + }, + "contracts/mocks/MockPrecompile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./libraries/Sorting.sol\";\nimport \"../libraries/Math.sol\";\n\ncontract MockPrecompile {\n function sortValidators(address[] memory _validators, uint256[] memory _weights)\n public\n pure\n returns (address[] memory)\n {\n return Sorting.sort(_validators, _weights);\n }\n\n function validatingDoubleSignProof(\n address, /*consensusAddr*/\n bytes calldata, /*_header1*/\n bytes calldata /*_header2*/\n ) public pure returns (bool _validEvidence) {\n return true;\n }\n\n function pickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) public pure returns (address[] memory _result) {\n (_result, _trustedWeights) = Sorting.sortWithExternalKeys(_candidates, _weights, _trustedWeights);\n uint256 _newValidatorCount = Math.min(_maxValidatorNumber, _result.length);\n _arrangeValidatorCandidates(_result, _trustedWeights, _newValidatorCount, _maxPrioritizedValidatorNumber);\n }\n\n /**\n * @dev Arranges the sorted candidates to list of validators, by asserting prioritized and non-prioritized candidates\n *\n * @param _candidates A sorted list of candidates\n */\n function _arrangeValidatorCandidates(\n address[] memory _candidates,\n uint256[] memory _trustedWeights,\n uint _newValidatorCount,\n uint _maxPrioritizedValidatorNumber\n ) internal pure {\n address[] memory _waitingCandidates = new address[](_candidates.length);\n uint _waitingCounter;\n uint _prioritySlotCounter;\n\n for (uint _i = 0; _i < _candidates.length; _i++) {\n if (_trustedWeights[_i] > 0 && _prioritySlotCounter < _maxPrioritizedValidatorNumber) {\n _candidates[_prioritySlotCounter++] = _candidates[_i];\n continue;\n }\n _waitingCandidates[_waitingCounter++] = _candidates[_i];\n }\n\n _waitingCounter = 0;\n for (uint _i = _prioritySlotCounter; _i < _newValidatorCount; _i++) {\n _candidates[_i] = _waitingCandidates[_waitingCounter++];\n }\n\n assembly {\n mstore(_candidates, _newValidatorCount)\n }\n }\n}\n" + }, + "contracts/ronin/validator/RoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"./CoinbaseExecution.sol\";\nimport \"./SlashingExecution.sol\";\n\ncontract RoninValidatorSet is Initializable, CoinbaseExecution, SlashingExecution {\n constructor() {\n _disableInitializers();\n }\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __slashIndicatorContract,\n address __stakingContract,\n address __stakingVestingContract,\n address __maintenanceContract,\n address __roninTrustedOrganizationContract,\n address __bridgeTrackingContract,\n uint256 __maxValidatorNumber,\n uint256 __maxValidatorCandidate,\n uint256 __maxPrioritizedValidatorNumber,\n uint256 __minEffectiveDaysOnwards,\n uint256 __numberOfBlocksInEpoch,\n // __emergencyExitConfigs[0]: emergencyExitLockedAmount\n // __emergencyExitConfigs[1]: emergencyExpiryDuration\n uint256[2] calldata __emergencyExitConfigs\n ) external initializer {\n _setSlashIndicatorContract(__slashIndicatorContract);\n _setStakingContract(__stakingContract);\n _setStakingVestingContract(__stakingVestingContract);\n _setMaintenanceContract(__maintenanceContract);\n _setBridgeTrackingContract(__bridgeTrackingContract);\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\n _setMaxValidatorNumber(__maxValidatorNumber);\n _setMaxValidatorCandidate(__maxValidatorCandidate);\n _setMaxPrioritizedValidatorNumber(__maxPrioritizedValidatorNumber);\n _setMinEffectiveDaysOnwards(__minEffectiveDaysOnwards);\n _setEmergencyExitLockedAmount(__emergencyExitConfigs[0]);\n _setEmergencyExpiryDuration(__emergencyExitConfigs[1]);\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\n }\n\n /**\n * @dev Only receives RON from staking vesting contract (for topping up bonus), and from staking contract (for transferring\n * deducting amount on slashing).\n */\n function _fallback() internal view {\n if (msg.sender != stakingVestingContract() && msg.sender != stakingContract()) revert ErrUnauthorizedReceiveRON();\n }\n\n /**\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\n */\n function _bridgeOperatorOf(address _consensusAddr)\n internal\n view\n override(EmergencyExit, ValidatorInfoStorage)\n returns (address)\n {\n return super._bridgeOperatorOf(_consensusAddr);\n }\n}\n" + }, + "contracts/mocks/libraries/Sorting.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Sorting {\n struct Node {\n uint key;\n uint value;\n }\n\n struct Node3 {\n uint key;\n uint value;\n uint otherKey;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // VALUE SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sort(uint[] memory data) internal pure returns (uint[] memory) {\n return _quickSort(data, int(0), int(data.length - 1));\n }\n\n function _quickSort(\n uint[] memory arr,\n int left,\n int right\n ) private pure returns (uint[] memory) {\n int i = left;\n int j = right;\n if (i == j) return arr;\n uint pivot = arr[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (arr[uint(i)] > pivot) i++;\n while (pivot > arr[uint(j)]) j--;\n if (i <= j) {\n (arr[uint(i)], arr[uint(j)]) = (arr[uint(j)], arr[uint(i)]);\n i++;\n j--;\n }\n }\n if (left < j) arr = _quickSort(arr, left, j);\n if (i < right) arr = _quickSort(arr, i, right);\n\n return arr;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // NODE SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sort(address[] memory _keys, uint256[] memory _values) internal pure returns (address[] memory) {\n require(_values.length == _keys.length, \"Sorting: invalid array length\");\n if (_keys.length == 0) {\n return _keys;\n }\n\n Node[] memory _nodes = new Node[](_keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node(uint256(uint160(_keys[_i])), _values[_i]);\n }\n _quickSortNodes(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n _keys[_i] = address(uint160(_nodes[_i].key)); // Casting?\n }\n\n return _keys;\n }\n\n function sortNodes(Node[] memory nodes) internal pure returns (Node[] memory) {\n return _quickSortNodes(nodes, int(0), int(nodes.length - 1));\n }\n\n function _quickSortNodes(\n Node[] memory nodes,\n int left,\n int right\n ) private pure returns (Node[] memory) {\n int i = left;\n int j = right;\n if (i == j) return nodes;\n Node memory pivot = nodes[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (nodes[uint(i)].value > pivot.value) i++;\n while (pivot.value > nodes[uint(j)].value) j--;\n if (i <= j) {\n (nodes[uint(i)], nodes[uint(j)]) = __swapNodes(nodes[uint(i)], nodes[uint(j)]);\n i++;\n j--;\n }\n }\n if (left < j) nodes = _quickSortNodes(nodes, left, j);\n if (i < right) nodes = _quickSortNodes(nodes, i, right);\n\n return nodes;\n }\n\n function _bubbleSortNodes(Node[] memory nodes) private pure returns (Node[] memory) {\n uint length = nodes.length;\n for (uint i = 0; i < length - 1; i++) {\n for (uint j = i + 1; j < length; j++) {\n if (nodes[j].value > nodes[i].value) {\n (nodes[i], nodes[j]) = __swapNodes(nodes[i], nodes[j]);\n }\n }\n }\n return nodes;\n }\n\n function __swapNodes(Node memory x, Node memory y) private pure returns (Node memory, Node memory) {\n Node memory tmp = x;\n (x, y) = (y, tmp);\n return (x, y);\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // NODE3 SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sortWithExternalKeys(\n address[] memory _keys,\n uint256[] memory _values,\n uint256[] memory _otherKeys\n ) internal pure returns (address[] memory keys_, uint256[] memory otherKeys_) {\n require((_values.length == _keys.length) && (_otherKeys.length == _keys.length), \"Sorting: invalid array length\");\n if (_keys.length == 0) {\n return (_keys, _otherKeys);\n }\n\n Node3[] memory _nodes = new Node3[](_keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node3(uint256(uint160(_keys[_i])), _values[_i], _otherKeys[_i]);\n }\n _quickSortNode3s(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n _keys[_i] = address(uint160(_nodes[_i].key)); // Casting?\n }\n\n return (_keys, _otherKeys);\n }\n\n function sortNode3s(Node3[] memory nodes) internal pure returns (Node3[] memory) {\n return _quickSortNode3s(nodes, int(0), int(nodes.length - 1));\n }\n\n function _quickSortNode3s(\n Node3[] memory nodes,\n int left,\n int right\n ) private pure returns (Node3[] memory) {\n int i = left;\n int j = right;\n if (i == j) return nodes;\n Node3 memory pivot = nodes[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (nodes[uint(i)].value > pivot.value) i++;\n while (pivot.value > nodes[uint(j)].value) j--;\n if (i <= j) {\n (nodes[uint(i)], nodes[uint(j)]) = __swapNode3s(nodes[uint(i)], nodes[uint(j)]);\n i++;\n j--;\n }\n }\n if (left < j) nodes = _quickSortNode3s(nodes, left, j);\n if (i < right) nodes = _quickSortNode3s(nodes, i, right);\n\n return nodes;\n }\n\n function _bubbleSortNode3s(Node3[] memory nodes) private pure returns (Node3[] memory) {\n uint length = nodes.length;\n for (uint i = 0; i < length - 1; i++) {\n for (uint j = i + 1; j < length; j++) {\n if (nodes[j].value > nodes[i].value) {\n (nodes[i], nodes[j]) = __swapNode3s(nodes[i], nodes[j]);\n }\n }\n }\n return nodes;\n }\n\n function __swapNode3s(Node3 memory x, Node3 memory y) private pure returns (Node3 memory, Node3 memory) {\n Node3 memory tmp = x;\n (x, y) = (y, tmp);\n return (x, y);\n }\n}\n" + }, + "contracts/mainchain/MainchainGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../extensions/GatewayV2.sol\";\nimport \"../extensions/WithdrawalLimitation.sol\";\nimport \"../libraries/Transfer.sol\";\nimport \"../interfaces/IMainchainGatewayV2.sol\";\n\ncontract MainchainGatewayV2 is WithdrawalLimitation, Initializable, AccessControlEnumerable, IMainchainGatewayV2 {\n using Token for Token.Info;\n using Transfer for Transfer.Request;\n using Transfer for Transfer.Receipt;\n\n /// @dev Emitted when the bridge operators are replaced\n event BridgeOperatorsReplaced(address[] operators);\n\n /// @dev Withdrawal unlocker role hash\n bytes32 public constant WITHDRAWAL_UNLOCKER_ROLE = keccak256(\"WITHDRAWAL_UNLOCKER_ROLE\");\n\n /// @dev Wrapped native token address\n IWETH public wrappedNativeToken;\n /// @dev Ronin network id\n uint256 public roninChainId;\n /// @dev Total deposit\n uint256 public depositCount;\n /// @dev Domain seperator\n bytes32 internal _domainSeparator;\n /// @dev Mapping from mainchain token => token address on Ronin network\n mapping(address => MappedToken) internal _roninToken;\n /// @dev Mapping from withdrawal id => withdrawal hash\n mapping(uint256 => bytes32) public withdrawalHash;\n /// @dev Mapping from withdrawal id => locked\n mapping(uint256 => bool) public withdrawalLocked;\n\n /// @dev Mapping from validator address => last block that the bridge operator is added\n mapping(address => uint256) internal _bridgeOperatorAddedBlock;\n /// @dev Bridge operators array\n address[] internal _bridgeOperators;\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n /**\n * @dev Initializes contract storage.\n */\n function initialize(\n address _roleSetter,\n IWETH _wrappedToken,\n uint256 _roninChainId,\n uint256 _numerator,\n uint256 _highTierVWNumerator,\n uint256 _denominator,\n // _addresses[0]: mainchainTokens\n // _addresses[1]: roninTokens\n // _addresses[2]: withdrawalUnlockers\n address[][3] calldata _addresses,\n // _thresholds[0]: highTierThreshold\n // _thresholds[1]: lockedThreshold\n // _thresholds[2]: unlockFeePercentages\n // _thresholds[3]: dailyWithdrawalLimit\n uint256[][4] calldata _thresholds,\n Token.Standard[] calldata _standards\n ) external payable virtual initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n roninChainId = _roninChainId;\n\n _setWrappedNativeTokenContract(_wrappedToken);\n _updateDomainSeparator();\n _setThreshold(_numerator, _denominator);\n _setHighTierVoteWeightThreshold(_highTierVWNumerator, _denominator);\n _verifyThresholds();\n\n if (_addresses[0].length > 0) {\n // Map mainchain tokens to ronin tokens\n _mapTokens(_addresses[0], _addresses[1], _standards);\n // Sets thresholds based on the mainchain tokens\n _setHighTierThresholds(_addresses[0], _thresholds[0]);\n _setLockedThresholds(_addresses[0], _thresholds[1]);\n _setUnlockFeePercentages(_addresses[0], _thresholds[2]);\n _setDailyWithdrawalLimits(_addresses[0], _thresholds[3]);\n }\n\n // Grant role for withdrawal unlocker\n for (uint256 _i; _i < _addresses[2].length; _i++) {\n _grantRole(WITHDRAWAL_UNLOCKER_ROLE, _addresses[2][_i]);\n }\n }\n\n /**\n * @inheritdoc IBridge\n */\n function replaceBridgeOperators(address[] calldata _list) external onlyAdmin {\n address _addr;\n for (uint256 _i = 0; _i < _list.length; _i++) {\n _addr = _list[_i];\n if (_bridgeOperatorAddedBlock[_addr] == 0) {\n _bridgeOperators.push(_addr);\n }\n _bridgeOperatorAddedBlock[_addr] = block.number;\n }\n\n {\n uint256 _i;\n while (_i < _bridgeOperators.length) {\n _addr = _bridgeOperators[_i];\n if (_bridgeOperatorAddedBlock[_addr] < block.number) {\n delete _bridgeOperatorAddedBlock[_addr];\n _bridgeOperators[_i] = _bridgeOperators[_bridgeOperators.length - 1];\n _bridgeOperators.pop();\n continue;\n }\n _i++;\n }\n }\n\n emit BridgeOperatorsReplaced(_list);\n }\n\n /**\n * @inheritdoc IBridge\n */\n function getBridgeOperators() external view returns (address[] memory) {\n return _bridgeOperators;\n }\n\n /**\n * @dev Receives ether without doing anything. Use this function to topup native token.\n */\n function receiveEther() external payable {}\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {\n return _domainSeparator;\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function setWrappedNativeTokenContract(IWETH _wrappedToken) external virtual onlyAdmin {\n _setWrappedNativeTokenContract(_wrappedToken);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function requestDepositFor(Transfer.Request calldata _request) external payable virtual whenNotPaused {\n _requestDepositFor(_request, msg.sender);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function submitWithdrawal(Transfer.Receipt calldata _receipt, Signature[] calldata _signatures)\n external\n virtual\n whenNotPaused\n returns (bool _locked)\n {\n return _submitWithdrawal(_receipt, _signatures);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function unlockWithdrawal(Transfer.Receipt calldata _receipt) external onlyRole(WITHDRAWAL_UNLOCKER_ROLE) {\n bytes32 _receiptHash = _receipt.hash();\n require(withdrawalHash[_receipt.id] == _receipt.hash(), \"MainchainGatewayV2: invalid receipt\");\n require(withdrawalLocked[_receipt.id], \"MainchainGatewayV2: query for approved withdrawal\");\n delete withdrawalLocked[_receipt.id];\n emit WithdrawalUnlocked(_receiptHash, _receipt);\n\n address _token = _receipt.mainchain.tokenAddr;\n if (_receipt.info.erc == Token.Standard.ERC20) {\n Token.Info memory _feeInfo = _receipt.info;\n _feeInfo.quantity = _computeFeePercentage(_receipt.info.quantity, unlockFeePercentages[_token]);\n Token.Info memory _withdrawInfo = _receipt.info;\n _withdrawInfo.quantity = _receipt.info.quantity - _feeInfo.quantity;\n\n _feeInfo.handleAssetTransfer(payable(msg.sender), _token, wrappedNativeToken);\n _withdrawInfo.handleAssetTransfer(payable(_receipt.mainchain.addr), _token, wrappedNativeToken);\n } else {\n _receipt.info.handleAssetTransfer(payable(_receipt.mainchain.addr), _token, wrappedNativeToken);\n }\n\n emit Withdrew(_receiptHash, _receipt);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function mapTokens(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards\n ) external virtual onlyAdmin {\n require(_mainchainTokens.length > 0, \"MainchainGatewayV2: query for empty array\");\n _mapTokens(_mainchainTokens, _roninTokens, _standards);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function mapTokensAndThresholds(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards,\n // _thresholds[0]: highTierThreshold\n // _thresholds[1]: lockedThreshold\n // _thresholds[2]: unlockFeePercentages\n // _thresholds[3]: dailyWithdrawalLimit\n uint256[][4] calldata _thresholds\n ) external virtual onlyAdmin {\n require(_mainchainTokens.length > 0, \"MainchainGatewayV2: query for empty array\");\n _mapTokens(_mainchainTokens, _roninTokens, _standards);\n _setHighTierThresholds(_mainchainTokens, _thresholds[0]);\n _setLockedThresholds(_mainchainTokens, _thresholds[1]);\n _setUnlockFeePercentages(_mainchainTokens, _thresholds[2]);\n _setDailyWithdrawalLimits(_mainchainTokens, _thresholds[3]);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function getRoninToken(address _mainchainToken) public view returns (MappedToken memory _token) {\n _token = _roninToken[_mainchainToken];\n require(_token.tokenAddr != address(0), \"MainchainGatewayV2: unsupported token\");\n }\n\n /**\n * @dev Maps mainchain tokens to Ronin network.\n *\n * Requirement:\n * - The arrays have the same length.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function _mapTokens(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards\n ) internal virtual {\n require(\n _mainchainTokens.length == _roninTokens.length && _mainchainTokens.length == _standards.length,\n \"MainchainGatewayV2: invalid array length\"\n );\n\n for (uint256 _i; _i < _mainchainTokens.length; _i++) {\n _roninToken[_mainchainTokens[_i]].tokenAddr = _roninTokens[_i];\n _roninToken[_mainchainTokens[_i]].erc = _standards[_i];\n }\n\n emit TokenMapped(_mainchainTokens, _roninTokens, _standards);\n }\n\n /**\n * @dev Submits withdrawal receipt.\n *\n * Requirements:\n * - The receipt kind is withdrawal.\n * - The receipt is to withdraw on this chain.\n * - The receipt is not used to withdraw before.\n * - The withdrawal is not reached the limit threshold.\n * - The signer weight total is larger than or equal to the minimum threshold.\n * - The signature signers are in order.\n *\n * Emits the `Withdrew` once the assets are released.\n *\n */\n function _submitWithdrawal(Transfer.Receipt calldata _receipt, Signature[] memory _signatures)\n internal\n virtual\n returns (bool _locked)\n {\n uint256 _id = _receipt.id;\n uint256 _quantity = _receipt.info.quantity;\n address _tokenAddr = _receipt.mainchain.tokenAddr;\n\n _receipt.info.validate();\n require(_receipt.kind == Transfer.Kind.Withdrawal, \"MainchainGatewayV2: invalid receipt kind\");\n require(_receipt.mainchain.chainId == block.chainid, \"MainchainGatewayV2: invalid chain id\");\n MappedToken memory _token = getRoninToken(_receipt.mainchain.tokenAddr);\n require(\n _token.erc == _receipt.info.erc && _token.tokenAddr == _receipt.ronin.tokenAddr,\n \"MainchainGatewayV2: invalid receipt\"\n );\n require(withdrawalHash[_id] == bytes32(0), \"MainchainGatewayV2: query for processed withdrawal\");\n require(\n _receipt.info.erc == Token.Standard.ERC721 || !_reachedWithdrawalLimit(_tokenAddr, _quantity),\n \"MainchainGatewayV2: reached daily withdrawal limit\"\n );\n\n bytes32 _receiptHash = _receipt.hash();\n bytes32 _receiptDigest = Transfer.receiptDigest(_domainSeparator, _receiptHash);\n\n uint256 _minimumVoteWeight;\n (_minimumVoteWeight, _locked) = _computeMinVoteWeight(_receipt.info.erc, _tokenAddr, _quantity);\n\n {\n bool _passed;\n address _signer;\n address _lastSigner;\n Signature memory _sig;\n uint256 _weight;\n for (uint256 _i; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n _signer = ecrecover(_receiptDigest, _sig.v, _sig.r, _sig.s);\n require(_lastSigner < _signer, \"MainchainGatewayV2: invalid order\");\n _lastSigner = _signer;\n\n _weight += _getWeight(_signer);\n if (_weight >= _minimumVoteWeight) {\n _passed = true;\n break;\n }\n }\n require(_passed, \"MainchainGatewayV2: query for insufficient vote weight\");\n withdrawalHash[_id] = _receiptHash;\n }\n\n if (_locked) {\n withdrawalLocked[_id] = true;\n emit WithdrawalLocked(_receiptHash, _receipt);\n return _locked;\n }\n\n _recordWithdrawal(_tokenAddr, _quantity);\n _receipt.info.handleAssetTransfer(payable(_receipt.mainchain.addr), _tokenAddr, wrappedNativeToken);\n emit Withdrew(_receiptHash, _receipt);\n }\n\n /**\n * @dev Requests deposit made by `_requester` address.\n *\n * Requirements:\n * - The token info is valid.\n * - The `msg.value` is 0 while depositing ERC20 token.\n * - The `msg.value` is equal to deposit quantity while depositing native token.\n *\n * Emits the `DepositRequested` event.\n *\n */\n function _requestDepositFor(Transfer.Request memory _request, address _requester) internal virtual {\n MappedToken memory _token;\n address _weth = address(wrappedNativeToken);\n\n _request.info.validate();\n if (_request.tokenAddr == address(0)) {\n require(_request.info.quantity == msg.value, \"MainchainGatewayV2: invalid request\");\n _token = getRoninToken(_weth);\n require(_token.erc == _request.info.erc, \"MainchainGatewayV2: invalid token standard\");\n _request.tokenAddr = _weth;\n } else {\n require(msg.value == 0, \"MainchainGatewayV2: invalid request\");\n _token = getRoninToken(_request.tokenAddr);\n require(_token.erc == _request.info.erc, \"MainchainGatewayV2: invalid token standard\");\n _request.info.transferFrom(_requester, address(this), _request.tokenAddr);\n // Withdraw if token is WETH\n if (_weth == _request.tokenAddr) {\n IWETH(_weth).withdraw(_request.info.quantity);\n }\n }\n\n uint256 _depositId = depositCount++;\n Transfer.Receipt memory _receipt = _request.into_deposit_receipt(\n _requester,\n _depositId,\n _token.tokenAddr,\n roninChainId\n );\n\n emit DepositRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @dev Returns the minimum vote weight for the token.\n */\n function _computeMinVoteWeight(\n Token.Standard _erc,\n address _token,\n uint256 _quantity\n ) internal virtual returns (uint256 _weight, bool _locked) {\n uint256 _totalWeight = _getTotalWeight();\n _weight = _minimumVoteWeight(_totalWeight);\n if (_erc == Token.Standard.ERC20) {\n if (highTierThreshold[_token] <= _quantity) {\n _weight = _highTierVoteWeight(_totalWeight);\n }\n _locked = _lockedWithdrawalRequest(_token, _quantity);\n }\n }\n\n /**\n * @dev Update domain seperator.\n */\n function _updateDomainSeparator() internal {\n _domainSeparator = keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(\"MainchainGatewayV2\"),\n keccak256(\"2\"),\n block.chainid,\n address(this)\n )\n );\n }\n\n /**\n * @dev Sets the WETH contract.\n *\n * Emits the `WrappedNativeTokenContractUpdated` event.\n *\n */\n function _setWrappedNativeTokenContract(IWETH _wrapedToken) internal {\n wrappedNativeToken = _wrapedToken;\n emit WrappedNativeTokenContractUpdated(_wrapedToken);\n }\n\n /**\n * @dev Receives ETH from WETH or creates deposit request.\n */\n function _fallback() internal virtual whenNotPaused {\n if (msg.sender != address(wrappedNativeToken)) {\n Transfer.Request memory _request;\n _request.recipientAddr = msg.sender;\n _request.info.quantity = msg.value;\n _requestDepositFor(_request, _request.recipientAddr);\n }\n }\n\n /**\n * @inheritdoc GatewayV2\n */\n function _getTotalWeight() internal view override returns (uint256) {\n return _bridgeOperators.length;\n }\n\n /**\n * @dev Returns the weight of an address.\n */\n function _getWeight(address _addr) internal view returns (uint256) {\n return _bridgeOperatorAddedBlock[_addr] > 0 ? 1 : 0;\n }\n}\n" + }, + "contracts/extensions/WithdrawalLimitation.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./GatewayV2.sol\";\n\nabstract contract WithdrawalLimitation is GatewayV2 {\n /// @dev Emitted when the high-tier vote weight threshold is updated\n event HighTierVoteWeightThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n /// @dev Emitted when the thresholds for high-tier withdrawals that requires high-tier vote weights are updated\n event HighTierThresholdsUpdated(address[] tokens, uint256[] thresholds);\n /// @dev Emitted when the thresholds for locked withdrawals are updated\n event LockedThresholdsUpdated(address[] tokens, uint256[] thresholds);\n /// @dev Emitted when the fee percentages to unlock withdraw are updated\n event UnlockFeePercentagesUpdated(address[] tokens, uint256[] percentages);\n /// @dev Emitted when the daily limit thresholds are updated\n event DailyWithdrawalLimitsUpdated(address[] tokens, uint256[] limits);\n\n uint256 public constant _MAX_PERCENTAGE = 1_000_000;\n\n uint256 internal _highTierVWNum;\n uint256 internal _highTierVWDenom;\n\n /// @dev Mapping from mainchain token => the amount thresholds for high-tier withdrawals that requires high-tier vote weights\n mapping(address => uint256) public highTierThreshold;\n /// @dev Mapping from mainchain token => the amount thresholds to lock withdrawal\n mapping(address => uint256) public lockedThreshold;\n /// @dev Mapping from mainchain token => unlock fee percentages for unlocker\n /// @notice Values 0-1,000,000 map to 0%-100%\n mapping(address => uint256) public unlockFeePercentages;\n /// @dev Mapping from mainchain token => daily limit amount for withdrawal\n mapping(address => uint256) public dailyWithdrawalLimit;\n /// @dev Mapping from token address => today withdrawal amount\n mapping(address => uint256) public lastSyncedWithdrawal;\n /// @dev Mapping from token address => last date synced to record the `lastSyncedWithdrawal`\n mapping(address => uint256) public lastDateSynced;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @dev Override `GatewayV2-setThreshold`.\n *\n * Requirements:\n * - The high-tier vote weight threshold must equal to or larger than the normal threshold.\n *\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n virtual\n override\n onlyAdmin\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n (_previousNum, _previousDenom) = _setThreshold(_numerator, _denominator);\n _verifyThresholds();\n }\n\n /**\n * @dev Returns the high-tier vote weight threshold.\n */\n function getHighTierVoteWeightThreshold() external view virtual returns (uint256, uint256) {\n return (_highTierVWNum, _highTierVWDenom);\n }\n\n /**\n * @dev Checks whether the `_voteWeight` passes the high-tier vote weight threshold.\n */\n function checkHighTierVoteWeightThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _highTierVWDenom >= _highTierVWNum * _getTotalWeight();\n }\n\n /**\n * @dev Sets high-tier vote weight threshold and returns the old one.\n *\n * Requirements:\n * - The method caller is admin.\n * - The high-tier vote weight threshold must equal to or larger than the normal threshold.\n *\n * Emits the `HighTierVoteWeightThresholdUpdated` event.\n *\n */\n function setHighTierVoteWeightThreshold(uint256 _numerator, uint256 _denominator)\n external\n virtual\n onlyAdmin\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n (_previousNum, _previousDenom) = _setHighTierVoteWeightThreshold(_numerator, _denominator);\n _verifyThresholds();\n }\n\n /**\n * @dev Sets the thresholds for high-tier withdrawals that requires high-tier vote weights.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `HighTierThresholdsUpdated` event.\n *\n */\n function setHighTierThresholds(address[] calldata _tokens, uint256[] calldata _thresholds)\n external\n virtual\n onlyAdmin\n {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setHighTierThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets the amount thresholds to lock withdrawal.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `LockedThresholdsUpdated` event.\n *\n */\n function setLockedThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) external virtual onlyAdmin {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setLockedThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets fee percentages to unlock withdrawal.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `UnlockFeePercentagesUpdated` event.\n *\n */\n function setUnlockFeePercentages(address[] calldata _tokens, uint256[] calldata _percentages)\n external\n virtual\n onlyAdmin\n {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setUnlockFeePercentages(_tokens, _percentages);\n }\n\n /**\n * @dev Sets daily limit amounts for the withdrawals.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `DailyWithdrawalLimitsUpdated` event.\n *\n */\n function setDailyWithdrawalLimits(address[] calldata _tokens, uint256[] calldata _limits) external virtual onlyAdmin {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setDailyWithdrawalLimits(_tokens, _limits);\n }\n\n /**\n * @dev Checks whether the withdrawal reaches the limitation.\n */\n function reachedWithdrawalLimit(address _token, uint256 _quantity) external view virtual returns (bool) {\n return _reachedWithdrawalLimit(_token, _quantity);\n }\n\n /**\n * @dev Sets high-tier vote weight threshold and returns the old one.\n *\n * Emits the `HighTierVoteWeightThresholdUpdated` event.\n *\n */\n function _setHighTierVoteWeightThreshold(uint256 _numerator, uint256 _denominator)\n internal\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n require(_numerator <= _denominator, \"WithdrawalLimitation: invalid threshold\");\n _previousNum = _highTierVWNum;\n _previousDenom = _highTierVWDenom;\n _highTierVWNum = _numerator;\n _highTierVWDenom = _denominator;\n emit HighTierVoteWeightThresholdUpdated(nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n\n /**\n * @dev Sets the thresholds for high-tier withdrawals that requires high-tier vote weights.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `HighTierThresholdsUpdated` event.\n *\n */\n function _setHighTierThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n require(_tokens.length == _thresholds.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n highTierThreshold[_tokens[_i]] = _thresholds[_i];\n }\n emit HighTierThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets the amount thresholds to lock withdrawal.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `LockedThresholdsUpdated` event.\n *\n */\n function _setLockedThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n require(_tokens.length == _thresholds.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n lockedThreshold[_tokens[_i]] = _thresholds[_i];\n }\n emit LockedThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets fee percentages to unlock withdrawal.\n *\n * Requirements:\n * - The array lengths are equal.\n * - The percentage is equal to or less than 100_000.\n *\n * Emits the `UnlockFeePercentagesUpdated` event.\n *\n */\n function _setUnlockFeePercentages(address[] calldata _tokens, uint256[] calldata _percentages) internal virtual {\n require(_tokens.length == _percentages.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n require(_percentages[_i] <= _MAX_PERCENTAGE, \"WithdrawalLimitation: invalid percentage\");\n unlockFeePercentages[_tokens[_i]] = _percentages[_i];\n }\n emit UnlockFeePercentagesUpdated(_tokens, _percentages);\n }\n\n /**\n * @dev Sets daily limit amounts for the withdrawals.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `DailyWithdrawalLimitsUpdated` event.\n *\n */\n function _setDailyWithdrawalLimits(address[] calldata _tokens, uint256[] calldata _limits) internal virtual {\n require(_tokens.length == _limits.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n dailyWithdrawalLimit[_tokens[_i]] = _limits[_i];\n }\n emit DailyWithdrawalLimitsUpdated(_tokens, _limits);\n }\n\n /**\n * @dev Checks whether the withdrawal reaches the daily limitation.\n *\n * Requirements:\n * - The daily withdrawal threshold should not apply for locked withdrawals.\n *\n */\n function _reachedWithdrawalLimit(address _token, uint256 _quantity) internal view virtual returns (bool) {\n if (_lockedWithdrawalRequest(_token, _quantity)) {\n return false;\n }\n\n uint256 _currentDate = block.timestamp / 1 days;\n if (_currentDate > lastDateSynced[_token]) {\n return dailyWithdrawalLimit[_token] <= _quantity;\n } else {\n return dailyWithdrawalLimit[_token] <= lastSyncedWithdrawal[_token] + _quantity;\n }\n }\n\n /**\n * @dev Record withdrawal token.\n */\n function _recordWithdrawal(address _token, uint256 _quantity) internal virtual {\n uint256 _currentDate = block.timestamp / 1 days;\n if (_currentDate > lastDateSynced[_token]) {\n lastDateSynced[_token] = _currentDate;\n lastSyncedWithdrawal[_token] = _quantity;\n } else {\n lastSyncedWithdrawal[_token] += _quantity;\n }\n }\n\n /**\n * @dev Returns whether the withdrawal request is locked or not.\n */\n function _lockedWithdrawalRequest(address _token, uint256 _quantity) internal view virtual returns (bool) {\n return lockedThreshold[_token] <= _quantity;\n }\n\n /**\n * @dev Computes fee percentage.\n */\n function _computeFeePercentage(uint256 _amount, uint256 _percentage) internal view virtual returns (uint256) {\n return (_amount * _percentage) / _MAX_PERCENTAGE;\n }\n\n /**\n * @dev Returns high-tier vote weight.\n */\n function _highTierVoteWeight(uint256 _totalWeight) internal view virtual returns (uint256) {\n return (_highTierVWNum * _totalWeight + _highTierVWDenom - 1) / _highTierVWDenom;\n }\n\n /**\n * @dev Validates whether the high-tier vote weight threshold is larger than the normal threshold.\n */\n function _verifyThresholds() internal view {\n require(_num * _highTierVWDenom <= _highTierVWNum * _denom, \"WithdrawalLimitation: invalid thresholds\");\n }\n}\n" + }, + "contracts/interfaces/IMainchainGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./IBridge.sol\";\nimport \"./IWETH.sol\";\nimport \"./consumers/SignatureConsumer.sol\";\nimport \"./consumers/MappedTokenConsumer.sol\";\nimport \"../libraries/Transfer.sol\";\n\ninterface IMainchainGatewayV2 is SignatureConsumer, MappedTokenConsumer, IBridge {\n /// @dev Emitted when the deposit is requested\n event DepositRequested(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the assets are withdrawn\n event Withdrew(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the tokens are mapped\n event TokenMapped(address[] mainchainTokens, address[] roninTokens, Token.Standard[] standards);\n /// @dev Emitted when the wrapped native token contract is updated\n event WrappedNativeTokenContractUpdated(IWETH weth);\n /// @dev Emitted when the withdrawal is locked\n event WithdrawalLocked(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal is unlocked\n event WithdrawalUnlocked(bytes32 receiptHash, Transfer.Receipt receipt);\n\n /**\n * @dev Returns the domain seperator.\n */\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n /**\n * @dev Returns deposit count.\n */\n function depositCount() external view returns (uint256);\n\n /**\n * @dev Sets the wrapped native token contract.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `WrappedNativeTokenContractUpdated` event.\n *\n */\n function setWrappedNativeTokenContract(IWETH _wrappedToken) external;\n\n /**\n * @dev Returns whether the withdrawal is locked.\n */\n function withdrawalLocked(uint256 withdrawalId) external view returns (bool);\n\n /**\n * @dev Returns the withdrawal hash.\n */\n function withdrawalHash(uint256 withdrawalId) external view returns (bytes32);\n\n /**\n * @dev Locks the assets and request deposit.\n */\n function requestDepositFor(Transfer.Request calldata _request) external payable;\n\n /**\n * @dev Withdraws based on the receipt and the validator signatures.\n * Returns whether the withdrawal is locked.\n *\n * Emits the `Withdrew` once the assets are released.\n *\n */\n function submitWithdrawal(Transfer.Receipt memory _receipt, Signature[] memory _signatures)\n external\n returns (bool _locked);\n\n /**\n * @dev Approves a specific withdrawal.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Withdrew` once the assets are released.\n *\n */\n function unlockWithdrawal(Transfer.Receipt calldata _receipt) external;\n\n /**\n * @dev Maps mainchain tokens to Ronin network.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokens(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards\n ) external;\n\n /**\n * @dev Maps mainchain tokens to Ronin network and sets thresholds.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokensAndThresholds(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards,\n uint256[][4] calldata _thresholds\n ) external;\n\n /**\n * @dev Returns token address on Ronin network.\n * Note: Reverts for unsupported token.\n */\n function getRoninToken(address _mainchainToken) external view returns (MappedToken memory _token);\n}\n" + }, + "contracts/mocks/MockSlashIndicatorExtended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./MockPrecompile.sol\";\nimport \"../ronin/slash-indicator/SlashIndicator.sol\";\n\ncontract MockSlashIndicatorExtended is SlashIndicator, MockPrecompile {\n function slashFelony(address _validatorAddr) external {\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\n }\n\n function slashMisdemeanor(address _validatorAddr) external {\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\n }\n\n function _pcValidateEvidence(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) internal pure override returns (bool _validEvidence) {\n return validatingDoubleSignProof(_consensusAddr, _header1, _header2);\n }\n}\n" + }, + "contracts/mocks/sorting/MockSorting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\nimport \"../libraries/Sorting.sol\";\n\ncontract MockSorting {\n uint256[] public data;\n\n function addData(uint256[] memory _data) public {\n for (uint256 i; i < _data.length; i++) {\n data.push(_data[i]);\n }\n }\n\n function sort(uint256[] memory _data) public pure returns (uint256[] memory) {\n return Sorting.sort(_data);\n }\n\n function sortOnStorage() public returns (uint256[] memory, uint256) {\n uint256[] memory _tmpData = data;\n data = Sorting.sort(_tmpData);\n\n return (data, data.length);\n }\n\n function sortAddressesAndValues(address[] calldata _addrs, uint256[] calldata _values)\n public\n pure\n returns (address[] memory)\n {\n return Sorting.sort(_addrs, _values);\n }\n}\n" + }, + "contracts/mocks/MockStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../ronin/staking/RewardCalculation.sol\";\n\ncontract MockStaking is RewardCalculation, GlobalConfigConsumer {\n /// @dev Mapping from user => staking balance\n mapping(address => uint256) internal _stakingAmount;\n /// @dev Mapping from period number => slashed\n mapping(uint256 => bool) internal _periodSlashed;\n\n uint256 internal _stakingTotal;\n\n uint256 public lastUpdatedPeriod;\n uint256 public pendingReward;\n address public poolAddr;\n\n constructor(address _poolAddr) {\n poolAddr = _poolAddr;\n }\n\n function firstEverWrapup() external {\n delete pendingReward;\n lastUpdatedPeriod = block.timestamp / PERIOD_DURATION + 1;\n }\n\n function endPeriod() external {\n address[] memory _addrs = new address[](1);\n uint256[] memory _rewards = new uint256[](1);\n _addrs[0] = poolAddr;\n _rewards[0] = pendingReward;\n this.execRecordRewards(_addrs, _rewards);\n\n pendingReward = 0;\n lastUpdatedPeriod++;\n }\n\n function increasePeriod() external {\n lastUpdatedPeriod++;\n }\n\n function stake(address _user, uint256 _amount) external {\n uint256 _lastStakingAmount = _stakingAmount[_user];\n uint256 _newStakingAmount = _lastStakingAmount + _amount;\n _syncUserReward(poolAddr, _user, _newStakingAmount);\n _stakingAmount[_user] = _newStakingAmount;\n _stakingTotal += _amount;\n }\n\n function unstake(address _user, uint256 _amount) external {\n uint256 _lastStakingAmount = _stakingAmount[_user];\n uint256 _newStakingAmount = _lastStakingAmount - _amount;\n _syncUserReward(poolAddr, _user, _newStakingAmount);\n _stakingAmount[_user] = _newStakingAmount;\n _stakingTotal -= _amount;\n }\n\n function increaseReward(uint256 _amount) external {\n pendingReward += _amount;\n }\n\n function decreaseReward(uint256 _amount) external {\n pendingReward -= _amount;\n }\n\n function execRecordRewards(address[] calldata _addrList, uint256[] calldata _rewards) external {\n _recordRewards(_addrList, _rewards, _currentPeriod());\n }\n\n function getPeriod() public view returns (uint256) {\n return _currentPeriod();\n }\n\n function claimReward(address _user) external returns (uint256 _amount) {\n _amount = _claimReward(poolAddr, _user, getPeriod());\n }\n\n function getStakingAmount(address, address _user) public view override returns (uint256) {\n return _stakingAmount[_user];\n }\n\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\n external\n view\n override\n returns (uint256[] memory)\n {}\n\n function getStakingTotal(address _addr) public view virtual override returns (uint256) {\n return _addr == poolAddr ? _stakingTotal : 0;\n }\n\n function _currentPeriod() internal view override returns (uint256 _period) {\n return lastUpdatedPeriod;\n }\n\n function getManyStakingTotals(address[] calldata _poolAddr) external view override returns (uint256[] memory) {}\n}\n" + }, + "contracts/mocks/precompile-usages/MockPCUValidateDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../precompile-usages/PCUValidateDoubleSign.sol\";\n\ncontract MockPCUValidateDoubleSign is PCUValidateDoubleSign {\n address internal _precompileValidateDoubleSignAddress;\n\n constructor(address _precompile) {\n setPrecompileValidateDoubleSignAddress(_precompile);\n }\n\n function setPrecompileValidateDoubleSignAddress(address _addr) public {\n _precompileValidateDoubleSignAddress = _addr;\n }\n\n function precompileValidateDoubleSignAddress() public view override returns (address) {\n return _precompileValidateDoubleSignAddress;\n }\n\n function callPrecompile(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) public view returns (bool) {\n return _pcValidateEvidence(_consensusAddr, _header1, _header2);\n }\n}\n" + }, + "contracts/mocks/precompile-usages/MockPCUSortValidators.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../precompile-usages/PCUSortValidators.sol\";\n\ncontract MockPCUSortValidators is PCUSortValidators {\n address internal _precompileSortValidatorAddress;\n\n constructor(address _precompile) {\n setPrecompileSortValidatorAddress(_precompile);\n }\n\n function setPrecompileSortValidatorAddress(address _addr) public {\n _precompileSortValidatorAddress = _addr;\n }\n\n function precompileSortValidatorsAddress() public view override returns (address) {\n return _precompileSortValidatorAddress;\n }\n\n function callPrecompile(address[] calldata _validators, uint256[] calldata _weights)\n public\n view\n returns (address[] memory _result)\n {\n return _pcSortCandidates(_validators, _weights);\n }\n}\n" + }, + "contracts/mocks/precompile-usages/MockPCUPickValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../precompile-usages/PCUPickValidatorSet.sol\";\n\ncontract MockPCUPickValidatorSet is PCUPickValidatorSet {\n address internal _precompileSortValidatorAddress;\n\n constructor(address _precompile) {\n setPrecompileSortValidatorAddress(_precompile);\n }\n\n function setPrecompileSortValidatorAddress(address _addr) public {\n _precompileSortValidatorAddress = _addr;\n }\n\n function precompilePickValidatorSetAddress() public view override returns (address) {\n return _precompileSortValidatorAddress;\n }\n\n function callPrecompile(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) public view returns (address[] memory _result) {\n (_result, ) = _pcPickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n }\n}\n" + }, + "contracts/mocks/ronin/MockRoninGatewayV2Extended.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../ronin/gateway/RoninGatewayV2.sol\";\n\ncontract MockRoninGatewayV2Extended is RoninGatewayV2 {\n /*\n * @dev Returns the vote weight for a deposit based on its corressponding hash.\n */\n function getDepositVoteWeight(\n uint256 _chainId,\n uint256 _depositId,\n bytes32 _hash\n ) external view returns (uint256, uint256) {\n return _getVoteWeight(depositVote[_chainId][_depositId], _hash);\n }\n\n /**\n * @dev Returns the vote weight for a mainchain withdrew acknowledgement based on its corressponding hash.\n */\n function getMainchainWithdrewVoteWeight(uint256 _withdrawalId, bytes32 _hash)\n external\n view\n returns (uint256, uint256)\n {\n return _getVoteWeight(mainchainWithdrewVote[_withdrawalId], _hash);\n }\n\n /**\n * @dev Returns the vote weight for a withdraw stats based on its corressponding hash.\n */\n function getWithdrawalStatVoteWeight(uint256 _withdrawalId, bytes32 _hash) external view returns (uint256, uint256) {\n return _getVoteWeight(withdrawalStatVote[_withdrawalId], _hash);\n }\n}\n" + }, + "contracts/mocks/MockTransferFallback.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"../extensions/RONTransferHelper.sol\";\n\ncontract MockPaymentFallback {\n event SafeReceived(address indexed sender, uint256 value);\n\n /// @dev Fallback function accepts ether transactions.\n receive() external payable {\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n\ncontract MockPaymentFallbackExpensive {\n uint[] public array;\n event SafeReceived(address indexed sender, uint256 value);\n\n constructor() {\n array.push(0);\n }\n\n /// @dev Fallback function accepts ether transactions and set non-zero value to a zero value slot.\n receive() external payable {\n array.push(block.number);\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n\ncontract MockTransfer is RONTransferHelper {\n uint256 public track;\n\n constructor() payable {}\n\n function fooTransfer(\n address payable _recipient,\n uint256 _amount,\n uint256 _gas\n ) external {\n if (_unsafeSendRON(_recipient, _amount, _gas)) {\n track++;\n }\n }\n}\n" + }, + "contracts/mocks/forwarder/MockForwarderTarget.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/RONTransferHelper.sol\";\n\ncontract MockForwarderTarget is RONTransferHelper {\n address public owner;\n uint256 public data;\n\n event TargetWithdrawn(address indexed _origin, address indexed _caller, address indexed _recipient);\n\n error ErrIntentionally();\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"MockForwarderContract: only owner can call method\");\n _;\n }\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n constructor(address _owner, uint256 _data) payable {\n owner = _owner;\n data = _data;\n }\n\n function foo(uint256 _data) external onlyOwner {\n data = _data;\n }\n\n function fooPayable(uint256 _data) external payable onlyOwner {\n data = _data;\n }\n\n function fooSilentRevert() external view onlyOwner {\n revert();\n }\n\n function fooCustomErrorRevert() external view onlyOwner {\n revert ErrIntentionally();\n }\n\n function fooRevert() external view onlyOwner {\n revert(\"MockForwarderContract: revert intentionally\");\n }\n\n function getBalance() external view returns (uint256) {\n return address(this).balance;\n }\n\n function withdrawAll() external onlyOwner {\n emit TargetWithdrawn(tx.origin, msg.sender, msg.sender);\n _transferRON(payable(msg.sender), address(this).balance);\n }\n\n function _fallback() private pure {\n revert(\"MockForwardTarget: hello from fallback\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "storageLayout" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file From f4a27d5f8c3fca59be77198685dd99b2cdfd89c6 Mon Sep 17 00:00:00 2001 From: Bao Date: Mon, 15 May 2023 14:08:23 +0700 Subject: [PATCH 07/10] Remove `@axie` package (#220) * using legacy `hardhat-deploy` * using legacy `hardhat-4byte-uploader` --- hardhat.config.ts | 4 +- package.json | 4 +- src/deploy/vault-forwarder.ts | 2 +- src/script/governance-admin-interface.ts | 2 +- src/script/proposal.ts | 2 +- src/script/verify-address.ts | 2 +- src/utils.ts | 2 +- test/helpers/fixture.ts | 2 +- test/helpers/staking-vesting.ts | 2 +- test/helpers/utils.ts | 2 +- .../integration/ActionSlashValidators.test.ts | 2 +- test/integration/ActionWrapUpEpoch.test.ts | 2 +- .../PrecompileUsageValidateDoubleSign.test.ts | 2 +- test/validator/ArrangeValidators.test.ts | 2 +- test/validator/EmergencyExit.test.ts | 2 +- .../RoninValidatorSet-Candidate.test.ts | 2 +- ...oninValidatorSet-CoinbaseExecution.test.ts | 2 +- yarn.lock | 79 +++++++++++-------- 18 files changed, 64 insertions(+), 53 deletions(-) diff --git a/hardhat.config.ts b/hardhat.config.ts index a37e53999..caa0e5e66 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -1,11 +1,11 @@ import '@typechain/hardhat'; import '@nomiclabs/hardhat-waffle'; import '@nomiclabs/hardhat-ethers'; -import '@axieinfinity/hardhat-deploy'; +import 'hardhat-deploy'; import 'hardhat-gas-reporter'; import '@nomicfoundation/hardhat-chai-matchers'; import 'hardhat-contract-sizer'; -import '@axieinfinity/hardhat-4byte-uploader'; +import '@solidstate/hardhat-4byte-uploader'; import 'hardhat-storage-layout'; import * as dotenv from 'dotenv'; diff --git a/package.json b/package.json index 73e8186bc..dcb7165d8 100644 --- a/package.json +++ b/package.json @@ -26,11 +26,10 @@ "@openzeppelin/contracts": "4.7.3" }, "devDependencies": { - "@axieinfinity/hardhat-4byte-uploader": "^1.0.0", - "@axieinfinity/hardhat-deploy": "^0.11.12-trezor-alpha-4", "@nomicfoundation/hardhat-chai-matchers": "^1.0.3", "@nomiclabs/hardhat-ethers": "^2.0.3", "@nomiclabs/hardhat-waffle": "^2.0.1", + "@solidstate/hardhat-4byte-uploader": "^1.1.0", "@typechain/ethers-v5": "^8.0.5", "@typechain/hardhat": "^3.0.0", "@types/chai": "^4.3.0", @@ -40,6 +39,7 @@ "dotenv": "^10.0.0", "ethers": "^5.5.2", "hardhat": "^2.7.1", + "hardhat-deploy": "0.11.29", "hardhat-contract-sizer": "^2.6.1", "hardhat-gas-reporter": "^1.0.8", "hardhat-storage-layout": "^0.1.7", diff --git a/src/deploy/vault-forwarder.ts b/src/deploy/vault-forwarder.ts index 386f9653c..11ab55b43 100644 --- a/src/deploy/vault-forwarder.ts +++ b/src/deploy/vault-forwarder.ts @@ -1,5 +1,5 @@ import { network } from 'hardhat'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { roninchainNetworks, vaultForwarderConf } from '../configs/config'; diff --git a/src/script/governance-admin-interface.ts b/src/script/governance-admin-interface.ts index 9cf10f6f8..a695fea64 100644 --- a/src/script/governance-admin-interface.ts +++ b/src/script/governance-admin-interface.ts @@ -1,7 +1,7 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; import { BigNumber, BigNumberish, BytesLike } from 'ethers'; import { ethers, network } from 'hardhat'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; import { TypedDataDomain } from '@ethersproject/abstract-signer'; import { AbiCoder, Interface, keccak256, _TypedDataEncoder } from 'ethers/lib/utils'; diff --git a/src/script/proposal.ts b/src/script/proposal.ts index a36452cf0..d51f3cf11 100644 --- a/src/script/proposal.ts +++ b/src/script/proposal.ts @@ -1,6 +1,6 @@ import { BigNumberish } from 'ethers'; import { AbiCoder, keccak256, solidityKeccak256 } from 'ethers/lib/utils'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; import { GlobalProposalDetailStruct, ProposalDetailStruct } from '../types/GovernanceAdmin'; diff --git a/src/script/verify-address.ts b/src/script/verify-address.ts index ec554db6d..d8ca7c9d6 100644 --- a/src/script/verify-address.ts +++ b/src/script/verify-address.ts @@ -1,4 +1,4 @@ -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; export const verifyAddress = (actual: Address, expected?: Address) => { if (actual.toLowerCase() != (expected || '').toLowerCase()) { diff --git a/src/utils.ts b/src/utils.ts index b1d6be65c..6d49af7c7 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,6 +1,6 @@ import { BigNumber, BigNumberish } from 'ethers'; import { ethers } from 'hardhat'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; import { TrustedOrganizationStruct } from './types/IRoninTrustedOrganization'; diff --git a/test/helpers/fixture.ts b/test/helpers/fixture.ts index 509cffab3..20c3309c1 100644 --- a/test/helpers/fixture.ts +++ b/test/helpers/fixture.ts @@ -1,6 +1,6 @@ import { BigNumber, BigNumberish } from 'ethers'; import { deployments, ethers, network } from 'hardhat'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; import { EpochController } from './ronin-validator-set'; import { diff --git a/test/helpers/staking-vesting.ts b/test/helpers/staking-vesting.ts index 6c1bbabae..721ae60ec 100644 --- a/test/helpers/staking-vesting.ts +++ b/test/helpers/staking-vesting.ts @@ -3,7 +3,7 @@ import { BigNumberish, ContractTransaction } from 'ethers'; import { expectEvent } from './utils'; import { StakingVesting__factory } from '../../src/types'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; const contractInterface = StakingVesting__factory.createInterface(); diff --git a/test/helpers/utils.ts b/test/helpers/utils.ts index da32054cc..54bfa46a7 100644 --- a/test/helpers/utils.ts +++ b/test/helpers/utils.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import { ContractTransaction } from 'ethers'; import { Interface, LogDescription } from 'ethers/lib/utils'; import { ethers, network } from 'hardhat'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; export const expectEvent = async ( contractInterface: Interface, diff --git a/test/integration/ActionSlashValidators.test.ts b/test/integration/ActionSlashValidators.test.ts index b406c206d..f2d08b180 100644 --- a/test/integration/ActionSlashValidators.test.ts +++ b/test/integration/ActionSlashValidators.test.ts @@ -1,7 +1,7 @@ import { expect } from 'chai'; import { network, ethers } from 'hardhat'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; import { BigNumber, BigNumberish, ContractTransaction } from 'ethers'; import { diff --git a/test/integration/ActionWrapUpEpoch.test.ts b/test/integration/ActionWrapUpEpoch.test.ts index 5e3ee2488..a32a1e3a6 100644 --- a/test/integration/ActionWrapUpEpoch.test.ts +++ b/test/integration/ActionWrapUpEpoch.test.ts @@ -18,7 +18,7 @@ import { EpochController, expects as ValidatorSetExpects } from '../helpers/roni import { mineBatchTxs } from '../helpers/utils'; import { initTest } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../src/script/governance-admin-interface'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; import { createManyTrustedOrganizationAddressSets, createManyValidatorCandidateAddressSets, diff --git a/test/precompile-usages/PrecompileUsageValidateDoubleSign.test.ts b/test/precompile-usages/PrecompileUsageValidateDoubleSign.test.ts index c2ccfdd16..3c12bb579 100644 --- a/test/precompile-usages/PrecompileUsageValidateDoubleSign.test.ts +++ b/test/precompile-usages/PrecompileUsageValidateDoubleSign.test.ts @@ -8,7 +8,7 @@ import { MockPCUValidateDoubleSign, MockPCUValidateDoubleSign__factory, } from '../../src/types'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; let deployer: SignerWithAddress; let signers: SignerWithAddress[]; diff --git a/test/validator/ArrangeValidators.test.ts b/test/validator/ArrangeValidators.test.ts index e4dedf913..9ecb3e723 100644 --- a/test/validator/ArrangeValidators.test.ts +++ b/test/validator/ArrangeValidators.test.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import { BigNumber, BigNumberish } from 'ethers'; import { ethers, network } from 'hardhat'; import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; import { MockRoninValidatorSetExtended, diff --git a/test/validator/EmergencyExit.test.ts b/test/validator/EmergencyExit.test.ts index 4111ce899..394052228 100644 --- a/test/validator/EmergencyExit.test.ts +++ b/test/validator/EmergencyExit.test.ts @@ -19,7 +19,7 @@ import * as RoninValidatorSet from '../helpers/ronin-validator-set'; import { mineBatchTxs } from '../helpers/utils'; import { initTest } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../src/script/governance-admin-interface'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; import { createManyTrustedOrganizationAddressSets, createManyValidatorCandidateAddressSets, diff --git a/test/validator/RoninValidatorSet-Candidate.test.ts b/test/validator/RoninValidatorSet-Candidate.test.ts index cff4fdd34..21ad353ac 100644 --- a/test/validator/RoninValidatorSet-Candidate.test.ts +++ b/test/validator/RoninValidatorSet-Candidate.test.ts @@ -20,7 +20,7 @@ import * as RoninValidatorSet from '../helpers/ronin-validator-set'; import { getLastBlockTimestamp, mineBatchTxs } from '../helpers/utils'; import { defaultTestConfig, initTest } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../src/script/governance-admin-interface'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; import { createManyTrustedOrganizationAddressSets, createManyValidatorCandidateAddressSets, diff --git a/test/validator/RoninValidatorSet-CoinbaseExecution.test.ts b/test/validator/RoninValidatorSet-CoinbaseExecution.test.ts index d53db26eb..ceb119855 100644 --- a/test/validator/RoninValidatorSet-CoinbaseExecution.test.ts +++ b/test/validator/RoninValidatorSet-CoinbaseExecution.test.ts @@ -23,7 +23,7 @@ import { getLastBlockTimestamp, mineBatchTxs } from '../helpers/utils'; import { initTest } from '../helpers/fixture'; import { GovernanceAdminInterface } from '../../src/script/governance-admin-interface'; import { BlockRewardDeprecatedType } from '../../src/script/ronin-validator-set'; -import { Address } from '@axieinfinity/hardhat-deploy/dist/types'; +import { Address } from 'hardhat-deploy/dist/types'; import { createManyTrustedOrganizationAddressSets, createManyValidatorCandidateAddressSets, diff --git a/yarn.lock b/yarn.lock index 8b66ff27a..aa1eb7fa3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,32 +2,6 @@ # yarn lockfile v1 -"@axieinfinity/hardhat-4byte-uploader@^1.0.0": - version "1.0.0" - resolved "https://npm.pkg.github.com/download/@axieinfinity/hardhat-4byte-uploader/1.0.0/95fb4f6a8138a676118b7962dda18b7b337b5716#95fb4f6a8138a676118b7962dda18b7b337b5716" - integrity sha512-ZCZcT3uGjrVkSP8p3t4vs6CNaHoaBF/1/GsHn9GxLijKAagnmea8JzXSl6O2DU7p8loKrDn5WLEgtcU+Eoly+A== - dependencies: - axios "^0.24.0" - -"@axieinfinity/hardhat-deploy@^0.11.12-trezor-alpha-4": - version "0.11.12-trezor-alpha-4" - resolved "https://npm.pkg.github.com/download/@axieinfinity/hardhat-deploy/0.11.12-trezor-alpha-4/25ebfb694a1d01a4954c4fedd525b79c1227c4d4#25ebfb694a1d01a4954c4fedd525b79c1227c4d4" - integrity sha512-JnvD0XTWbRdAqCeG+e1prrWG6aDtzXeI7X82nT/QNgLQkpqTi40B0xjPXXfaizJlE23ebMeqswByLDyhEsJZTw== - dependencies: - "@types/qs" "^6.9.7" - axios "^0.21.1" - chalk "^4.1.2" - chokidar "^3.5.2" - debug "^4.3.2" - enquirer "^2.3.6" - ethers "^5.5.3" - form-data "^4.0.0" - fs-extra "^10.0.0" - match-all "^1.2.6" - murmur-128 "^0.2.1" - qs "^6.9.4" - zksync-web3 "^0.7.8" - "@babel/code-frame@^7.0.0": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" @@ -322,7 +296,7 @@ "@ethersproject/properties" "^5.6.0" "@ethersproject/transactions" "^5.6.2" -"@ethersproject/contracts@5.7.0": +"@ethersproject/contracts@5.7.0", "@ethersproject/contracts@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.7.0.tgz#c305e775abd07e48aa590e1a877ed5c316f8bd1e" integrity sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg== @@ -544,7 +518,7 @@ bech32 "1.1.4" ws "7.4.6" -"@ethersproject/providers@5.7.2": +"@ethersproject/providers@5.7.2", "@ethersproject/providers@^5.7.2": version "5.7.2" resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.7.2.tgz#f8b1a4f275d7ce58cf0a2eec222269a08beb18cb" integrity sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg== @@ -656,7 +630,7 @@ "@ethersproject/sha2" "^5.6.1" "@ethersproject/strings" "^5.6.1" -"@ethersproject/solidity@5.7.0": +"@ethersproject/solidity@5.7.0", "@ethersproject/solidity@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.7.0.tgz#5e9c911d8a2acce2a5ebb48a5e2e0af20b631cb8" integrity sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA== @@ -755,7 +729,7 @@ "@ethersproject/transactions" "^5.6.2" "@ethersproject/wordlists" "^5.6.1" -"@ethersproject/wallet@5.7.0": +"@ethersproject/wallet@5.7.0", "@ethersproject/wallet@^5.7.0": version "5.7.0" resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.7.0.tgz#4e5d0790d96fe21d61d38fb40324e6c7ef350b2d" integrity sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA== @@ -1112,6 +1086,13 @@ dependencies: antlr4ts "^0.5.0-alpha.4" +"@solidstate/hardhat-4byte-uploader@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@solidstate/hardhat-4byte-uploader/-/hardhat-4byte-uploader-1.1.0.tgz#de1b9964827c1caeb516f048855c8a4082fd98fc" + integrity sha512-OCyBrPqtLoC7/WPlq7c9fosEOKgAT8jqRHCy/fJ8cK1DSQgYymcgC9g619Je9XjaLKPFgamRgt/HuTpTQnAFdQ== + dependencies: + axios "^0.24.0" + "@tsconfig/node10@^1.0.7": version "1.0.9" resolved "https://registry.yarnpkg.com/@tsconfig/node10/-/node10-1.0.9.tgz#df4907fc07a886922637b15e02d4cebc4c0021b2" @@ -3176,6 +3157,36 @@ hardhat-contract-sizer@^2.6.1: chalk "^4.0.0" cli-table3 "^0.6.0" +hardhat-deploy@0.11.29: + version "0.11.29" + resolved "https://registry.yarnpkg.com/hardhat-deploy/-/hardhat-deploy-0.11.29.tgz#e6d76e37fa2ed74d76d15b01f3849da3bda49a81" + integrity sha512-9F+MRFkEocelzB8d+SDDCcTL7edBYAj2S63ldknvfIIBSajeB6q1/jm+dlK1GjcWzAzw7EVoxtjJXzxAxZfZcg== + dependencies: + "@ethersproject/abi" "^5.7.0" + "@ethersproject/abstract-signer" "^5.7.0" + "@ethersproject/address" "^5.7.0" + "@ethersproject/bignumber" "^5.7.0" + "@ethersproject/bytes" "^5.7.0" + "@ethersproject/constants" "^5.7.0" + "@ethersproject/contracts" "^5.7.0" + "@ethersproject/providers" "^5.7.2" + "@ethersproject/solidity" "^5.7.0" + "@ethersproject/transactions" "^5.7.0" + "@ethersproject/wallet" "^5.7.0" + "@types/qs" "^6.9.7" + axios "^0.21.1" + chalk "^4.1.2" + chokidar "^3.5.2" + debug "^4.3.2" + enquirer "^2.3.6" + ethers "^5.5.3" + form-data "^4.0.0" + fs-extra "^10.0.0" + match-all "^1.2.6" + murmur-128 "^0.2.1" + qs "^6.9.4" + zksync-web3 "^0.14.3" + hardhat-gas-reporter@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.8.tgz#93ce271358cd748d9c4185dbb9d1d5525ec145e0" @@ -5913,7 +5924,7 @@ yocto-queue@^0.1.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b" integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q== -zksync-web3@^0.7.8: - version "0.7.13" - resolved "https://registry.yarnpkg.com/zksync-web3/-/zksync-web3-0.7.13.tgz#9d87cfeac8a38e0c5702c2e05f80e50215d1102d" - integrity sha512-Zz83eOWLqPs88kgczkJLhst192oqtj7uzI3PaGyR9lkfQLL5eMEMZ+pD1eYPppTE1GohmGxhqnEf5HxG7WF0QA== +zksync-web3@^0.14.3: + version "0.14.3" + resolved "https://registry.yarnpkg.com/zksync-web3/-/zksync-web3-0.14.3.tgz#64ac2a16d597464c3fc4ae07447a8007631c57c9" + integrity sha512-hT72th4AnqyLW1d5Jlv8N2B/qhEnl2NePK2A3org7tAa24niem/UAaHMkEvmWI3SF9waYUPtqAtjpf+yvQ9zvQ== From db87bd4f88b4378340c7bdd8cff3efe8ebbcfcaf Mon Sep 17 00:00:00 2001 From: Bao Date: Tue, 16 May 2023 10:05:56 +0700 Subject: [PATCH 08/10] [test] Fix assertion on arrays of BigNumbers (#222) Replace `elq` to `deep.equal` --- test/bridge/BridgeTracking.test.ts | 2 +- test/bridge/GatewayPauseEnforcer.test.ts | 2 +- test/bridge/RoninGatewayV2.test.ts | 2 +- test/governance-admin/GovernanceAdmin.test.ts | 22 ++++++------- test/helpers/candidate-manager.ts | 10 +++--- test/helpers/governance-admin.ts | 4 +-- test/helpers/ronin-validator-set.ts | 18 ++++++----- test/helpers/staking-vesting.ts | 18 +++++------ test/helpers/staking.ts | 6 ++-- test/helpers/utils.ts | 5 ++- test/integration/ActionBridgeTracking.test.ts | 4 +-- .../integration/ActionSlashValidators.test.ts | 32 +++++++++++-------- test/integration/ActionWrapUpEpoch.test.ts | 10 +++--- test/integration/Configuration.test.ts | 20 ++++++++---- test/maintainance/Maintenance.test.ts | 20 ++++++++---- .../PrecompileUsageSortValidators.test.ts | 2 +- .../PrecompileUsageValidateDoubleSign.test.ts | 2 +- test/slash/CreditScore.test.ts | 4 +-- test/slash/SlashIndicator.test.ts | 4 ++- test/sorting/QuickSort.test.ts | 2 +- test/staking/Staking.test.ts | 8 ++--- test/validator/ArrangeValidators.test.ts | 24 +++++++------- test/validator/EmergencyExit.test.ts | 8 +++-- .../RoninValidatorSet-Candidate.test.ts | 8 ++--- ...oninValidatorSet-CoinbaseExecution.test.ts | 18 +++++------ 25 files changed, 142 insertions(+), 113 deletions(-) diff --git a/test/bridge/BridgeTracking.test.ts b/test/bridge/BridgeTracking.test.ts index 9d2ea8553..dec0f73e9 100644 --- a/test/bridge/BridgeTracking.test.ts +++ b/test/bridge/BridgeTracking.test.ts @@ -128,7 +128,7 @@ describe('Bridge Tracking test', () => { await roninValidatorSet.connect(coinbase).wrapUpEpoch(); }); period = await roninValidatorSet.currentPeriod(); - expect(await roninValidatorSet.getBridgeOperators()).eql(candidates.map((v) => v.bridgeOperator.address)); + expect(await roninValidatorSet.getBridgeOperators()).deep.equal(candidates.map((v) => v.bridgeOperator.address)); }); after(async () => { diff --git a/test/bridge/GatewayPauseEnforcer.test.ts b/test/bridge/GatewayPauseEnforcer.test.ts index 126f7ca69..5b6b31325 100644 --- a/test/bridge/GatewayPauseEnforcer.test.ts +++ b/test/bridge/GatewayPauseEnforcer.test.ts @@ -185,7 +185,7 @@ describe('Ronin Gateway V2 test', () => { await roninValidatorSet.connect(coinbase).wrapUpEpoch(); }); period = await roninValidatorSet.currentPeriod(); - expect(await roninValidatorSet.getBridgeOperators()).eql(candidates.map((v) => v.bridgeOperator.address)); + expect(await roninValidatorSet.getBridgeOperators()).deep.equal(candidates.map((v) => v.bridgeOperator.address)); }); after(async () => { diff --git a/test/bridge/RoninGatewayV2.test.ts b/test/bridge/RoninGatewayV2.test.ts index 5ec9eba3b..6720d7dc6 100644 --- a/test/bridge/RoninGatewayV2.test.ts +++ b/test/bridge/RoninGatewayV2.test.ts @@ -174,7 +174,7 @@ describe('Ronin Gateway V2 test', () => { await roninValidatorSet.connect(coinbase).wrapUpEpoch(); }); period = await roninValidatorSet.currentPeriod(); - expect(await roninValidatorSet.getBridgeOperators()).eql(candidates.map((v) => v.bridgeOperator.address)); + expect(await roninValidatorSet.getBridgeOperators()).deep.equal(candidates.map((v) => v.bridgeOperator.address)); }); after(async () => { diff --git a/test/governance-admin/GovernanceAdmin.test.ts b/test/governance-admin/GovernanceAdmin.test.ts index 3b5063375..366e2245c 100644 --- a/test/governance-admin/GovernanceAdmin.test.ts +++ b/test/governance-admin/GovernanceAdmin.test.ts @@ -156,7 +156,7 @@ describe('Governance Admin test', () => { const latestBOset = await governanceAdmin.lastSyncedBridgeOperatorSetInfo(); expect(latestBOset.period).eq(0); expect(latestBOset.epoch).eq(0); - expect(latestBOset.operators).eql([]); + expect(latestBOset.operators).deep.equal([]); }); it('Should be able to vote bridge operators', async () => { @@ -186,7 +186,7 @@ describe('Governance Admin test', () => { const latestBOset = await governanceAdmin.lastSyncedBridgeOperatorSetInfo(); expect(latestBOset.period).eq(ballot.period); expect(latestBOset.epoch).eq(ballot.epoch); - expect(latestBOset.operators).eql(ballot.operators); + expect(latestBOset.operators).deep.equal(ballot.operators); }); it('Should be able relay vote bridge operators', async () => { @@ -195,11 +195,11 @@ describe('Governance Admin test', () => { await mainchainGovernanceAdmin.connect(relayer).relayBridgeOperators(ballot, signatures); expect(await mainchainGovernanceAdmin.bridgeOperatorsRelayed(ballot.period, ballot.epoch)).to.true; const bridgeOperators = await bridgeContract.getBridgeOperators(); - expect([...bridgeOperators].sort(compareAddrs)).eql(ballot.operators); + expect([...bridgeOperators].sort(compareAddrs)).deep.equal(ballot.operators); const latestBOset = await mainchainGovernanceAdmin.lastSyncedBridgeOperatorSetInfo(); expect(latestBOset.period).eq(ballot.period); expect(latestBOset.epoch).eq(ballot.epoch); - expect(latestBOset.operators).eql(ballot.operators); + expect(latestBOset.operators).deep.equal(ballot.operators); }); it('Should not able to relay again', async () => { @@ -307,18 +307,18 @@ describe('Governance Admin test', () => { expect(lastLength).not.eq(ballot.operators.length); expect(latestBOset.period).eq(ballot.period); expect(latestBOset.epoch).eq(ballot.epoch); - expect(latestBOset.operators).eql(ballot.operators); + expect(latestBOset.operators).deep.equal(ballot.operators); }); it('Should be able relay vote bridge operators', async () => { const [, signatures] = await governanceAdmin.getBridgeOperatorVotingSignatures(ballot.period, ballot.epoch); await mainchainGovernanceAdmin.connect(relayer).relayBridgeOperators(ballot, signatures); const bridgeOperators = await bridgeContract.getBridgeOperators(); - expect([...bridgeOperators].sort(compareAddrs)).eql(ballot.operators); + expect([...bridgeOperators].sort(compareAddrs)).deep.equal(ballot.operators); const latestBOset = await mainchainGovernanceAdmin.lastSyncedBridgeOperatorSetInfo(); expect(latestBOset.period).eq(ballot.period); expect(latestBOset.epoch).eq(ballot.epoch); - expect(latestBOset.operators).eql(ballot.operators); + expect(latestBOset.operators).deep.equal(ballot.operators); }); it('Should be able to vote for a same number of bridge operators', async () => { @@ -341,7 +341,7 @@ describe('Governance Admin test', () => { expect(lastLength).eq(ballot.operators.length); expect(latestBOset.period).eq(ballot.period); expect(latestBOset.epoch).eq(ballot.epoch); - expect(latestBOset.operators).eql(ballot.operators); + expect(latestBOset.operators).deep.equal(ballot.operators); }); }); }); @@ -766,14 +766,14 @@ describe('Governance Admin test', () => { proposal.chainId, proposal.nonce ); - expect(voters).eql([ + expect(voters).deep.equal([ trustedOrgs[1].governor.address, trustedOrgs[0].governor.address, trustedOrgs[2].governor.address, ]); - expect(supports).eql([VoteType.For, VoteType.Against, VoteType.Against]); + expect(supports).deep.equal([VoteType.For, VoteType.Against, VoteType.Against]); const emptySignatures = [0, ethers.constants.HashZero, ethers.constants.HashZero]; - expect(signatures).eql([ + expect(signatures).deep.equal([ emptySignatures, emptySignatures, ...votedSignatures.map((sig) => [sig.v, sig.r, sig.s]), diff --git a/test/helpers/candidate-manager.ts b/test/helpers/candidate-manager.ts index dc76a07e1..d6b0f887e 100644 --- a/test/helpers/candidate-manager.ts +++ b/test/helpers/candidate-manager.ts @@ -15,7 +15,7 @@ export const expects = { 'CandidatesRevoked', tx, (event) => { - expect(event.args[0], 'invalid revoked candidates').eql(expectingRevokedCandidates); + expect(event.args[0], 'invalid revoked candidates').deep.equal(expectingRevokedCandidates); }, 1 ); @@ -33,10 +33,10 @@ export const expects = { 'CandidateGranted', tx, (event) => { - expect(event.args[0], 'invalid consensus address').eql(expectingConsensusAddr); - expect(event.args[1], 'invalid treasury address').eql(expectingTreasuryAddr); - expect(event.args[2], 'invalid admin address').eql(expectingAdmin); - expect(event.args[3], 'invalid bridge operator address').eql(expectingBridgeOperatorAddr); + expect(event.args[0], 'invalid consensus address').deep.equal(expectingConsensusAddr); + expect(event.args[1], 'invalid treasury address').deep.equal(expectingTreasuryAddr); + expect(event.args[2], 'invalid admin address').deep.equal(expectingAdmin); + expect(event.args[3], 'invalid bridge operator address').deep.equal(expectingBridgeOperatorAddr); }, 1 ); diff --git a/test/helpers/governance-admin.ts b/test/helpers/governance-admin.ts index f45c0a381..089b4c9ef 100644 --- a/test/helpers/governance-admin.ts +++ b/test/helpers/governance-admin.ts @@ -19,8 +19,8 @@ export const expects = { tx, (event) => { expect(event.args[0], 'invalid proposal hash').eq(expectingProposalHash); - expect(event.args[1], 'invalid success calls').eql(expectingSuccessCalls); - expect(event.args[2], 'invalid returned datas').eql(expectingReturnedDatas); + expect(event.args[1], 'invalid success calls').deep.equal(expectingSuccessCalls); + expect(event.args[2], 'invalid returned datas').deep.equal(expectingReturnedDatas); }, 1 ); diff --git a/test/helpers/ronin-validator-set.ts b/test/helpers/ronin-validator-set.ts index e923deb49..b7e327262 100644 --- a/test/helpers/ronin-validator-set.ts +++ b/test/helpers/ronin-validator-set.ts @@ -136,10 +136,10 @@ export const expects = { (event) => { expect(event.args[0], 'invalid total distributing reward').eq(expectingTotalAmount); if (expectingValidators) { - expect(event.args[1], 'invalid validator list').eql(expectingValidators); + expect(event.args[1], 'invalid validator list').deep.equal(expectingValidators); } if (expectingAmounts) { - expect(event.args[2], 'invalid amount list').eql(expectingAmounts); + expect(event.args[2], 'invalid amount list').deep.equal(expectingAmounts); } }, 1 @@ -157,7 +157,7 @@ export const expects = { tx, (event) => { expect(event.args[0], 'invalid period').eq(expectingPeriod); - expect(event.args[1], 'invalid validator set').eql(expectingValidators); + expect(event.args[1], 'invalid validator set').deep.equal(expectingValidators); }, 1 ); @@ -176,7 +176,8 @@ export const expects = { (event) => { !!expectingPeriod && expect(event.args[0], 'invalid period').eq(expectingPeriod); !!expectingEpoch && expect(event.args[1], 'invalid epoch').eq(expectingEpoch); - !!expectingBlockProducers && expect(event.args[2], 'invalid block producers').eql(expectingBlockProducers); + !!expectingBlockProducers && + expect(event.args[2], 'invalid block producers').deep.equal(expectingBlockProducers); }, 1 ); @@ -195,7 +196,8 @@ export const expects = { (event) => { !!expectingPeriod && expect(event.args[0], 'invalid period').eq(expectingPeriod); !!expectingEpoch && expect(event.args[1], 'invalid epoch').eq(expectingEpoch); - !!expectingBridgeOperators && expect(event.args[2], 'invalid bridge operators').eql(expectingBridgeOperators); + !!expectingBridgeOperators && + expect(event.args[2], 'invalid bridge operators').deep.equal(expectingBridgeOperators); }, 1 ); @@ -213,8 +215,8 @@ export const expects = { tx, (event) => { expect(event.args[0], 'invalid validator').eq(expectingValidator); - expect(event.args[1], 'invalid removed reward').eql(expectingRemovedReward); - expect(event.args[2], 'invalid deprecated type').eql(expectingDeprecatedType); + expect(event.args[1], 'invalid removed reward').deep.equal(expectingRemovedReward); + expect(event.args[2], 'invalid deprecated type').deep.equal(expectingDeprecatedType); }, 1 ); @@ -231,7 +233,7 @@ export const expects = { tx, (event) => { expect(event.args[0], 'invalid withdraw target').eq(expectingWithdrawnTarget); - expect(event.args[1], 'invalid withdraw amount').eql(expectingWithdrawnAmount); + expect(event.args[1], 'invalid withdraw amount').deep.equal(expectingWithdrawnAmount); }, 1 ); diff --git a/test/helpers/staking-vesting.ts b/test/helpers/staking-vesting.ts index 721ae60ec..4133a30f0 100644 --- a/test/helpers/staking-vesting.ts +++ b/test/helpers/staking-vesting.ts @@ -22,16 +22,16 @@ export const expects = { tx, (event) => { if (blockNumber) { - expect(event.args[0], eventName + ': invalid block number').eql(blockNumber); + expect(event.args[0], eventName + ': invalid block number').deep.equal(blockNumber); } if (recipient) { - expect(event.args[1], eventName + ': invalid recipient').eql(recipient); + expect(event.args[1], eventName + ': invalid recipient').deep.equal(recipient); } if (blockProducerBonus) { - expect(event.args[2], eventName + ': invalid block producer bonus').eql(blockProducerBonus); + expect(event.args[2], eventName + ': invalid block producer bonus').deep.equal(blockProducerBonus); } if (bridgeOperatorBonus) { - expect(event.args[3], eventName + ': invalid bridge operator bonus').eql(bridgeOperatorBonus); + expect(event.args[3], eventName + ': invalid bridge operator bonus').deep.equal(bridgeOperatorBonus); } }, 1 @@ -53,19 +53,19 @@ export const expects = { tx, (event) => { if (blockNumber) { - expect(event.args[0], eventName + ': invalid block number').eql(blockNumber); + expect(event.args[0], eventName + ': invalid block number').deep.equal(blockNumber); } if (recipient) { - expect(event.args[1], eventName + ': invalid recipient').eql(recipient); + expect(event.args[1], eventName + ': invalid recipient').deep.equal(recipient); } if (blockProducerBonus) { - expect(event.args[2], eventName + ': invalid block producer bonus').eql(blockProducerBonus); + expect(event.args[2], eventName + ': invalid block producer bonus').deep.equal(blockProducerBonus); } if (bridgeOperatorBonus) { - expect(event.args[3], eventName + ': invalid bridge operator bonus').eql(bridgeOperatorBonus); + expect(event.args[3], eventName + ': invalid bridge operator bonus').deep.equal(bridgeOperatorBonus); } if (bridgeOperatorBonus) { - expect(event.args[4], eventName + ': invalid contract balance').eql(contractBalance); + expect(event.args[4], eventName + ': invalid contract balance').deep.equal(contractBalance); } }, 1 diff --git a/test/helpers/staking.ts b/test/helpers/staking.ts index 6383bd541..0268baf57 100644 --- a/test/helpers/staking.ts +++ b/test/helpers/staking.ts @@ -19,13 +19,13 @@ export const expects = { tx, (event) => { if (!!expectingPeriod) { - expect(event.args[0], 'invalid period').eql(expectingPeriod); + expect(event.args[0], 'invalid period').deep.equal(expectingPeriod); } if (!!expectingPoolAddressList) { - expect(event.args[1], 'invalid pool address list').eql(expectingPoolAddressList); + expect(event.args[1], 'invalid pool address list').deep.equal(expectingPoolAddressList); } if (!!expectingAccumulatedRpsList) { - expect(event.args[2], 'invalid accumulated rps list').eql(expectingAccumulatedRpsList); + expect(event.args[2], 'invalid accumulated rps list').deep.equal(expectingAccumulatedRpsList); } }, 1 diff --git a/test/helpers/utils.ts b/test/helpers/utils.ts index 54bfa46a7..981899e0c 100644 --- a/test/helpers/utils.ts +++ b/test/helpers/utils.ts @@ -1,5 +1,5 @@ import { expect } from 'chai'; -import { ContractTransaction } from 'ethers'; +import { BigNumber, ContractTransaction } from 'ethers'; import { Interface, LogDescription } from 'ethers/lib/utils'; import { ethers, network } from 'hardhat'; import { Address } from 'hardhat-deploy/dist/types'; @@ -53,3 +53,6 @@ export const compareAddrs = (firstStr: string, secondStr: string) => export const accessControlRevertStr = (addr: Address, role: string): string => `AccessControl: account ${addr.toLocaleLowerCase()} is missing role ${role}`; + +export const compareBigNumbers = (firstBigNumbers: BigNumber[], secondBigNumbers: BigNumber[]) => + expect(firstBigNumbers.map((_) => _.toHexString())).deep.equal(secondBigNumbers.map((_) => _.toHexString())); diff --git a/test/integration/ActionBridgeTracking.test.ts b/test/integration/ActionBridgeTracking.test.ts index e90abf189..977bf3fd5 100644 --- a/test/integration/ActionBridgeTracking.test.ts +++ b/test/integration/ActionBridgeTracking.test.ts @@ -170,7 +170,7 @@ describe('[Integration] Bridge Tracking test', () => { await roninValidatorSet.connect(coinbase).wrapUpEpoch(); }); period = await roninValidatorSet.currentPeriod(); - expect(await roninValidatorSet.getBridgeOperators()).eql(candidates.map((v) => v.bridgeOperator.address)); + expect(await roninValidatorSet.getBridgeOperators()).deep.equal(candidates.map((v) => v.bridgeOperator.address)); }); after(async () => { @@ -181,7 +181,7 @@ describe('[Integration] Bridge Tracking test', () => { expect(await bridgeTracking.bridgeContract()).eq(bridgeContract.address); expect(await bridgeContract.bridgeTrackingContract()).eq(bridgeTracking.address); expect(await bridgeContract.validatorContract()).eq(roninValidatorSet.address); - expect(await bridgeContract.getMainchainToken(token.address, mainchainId)).eql([0, token.address]); + expect(await bridgeContract.getMainchainToken(token.address, mainchainId)).deep.equal([0, token.address]); expect(await roninValidatorSet.currentPeriod()).eq(period); }); diff --git a/test/integration/ActionSlashValidators.test.ts b/test/integration/ActionSlashValidators.test.ts index f2d08b180..f9bd4844b 100644 --- a/test/integration/ActionSlashValidators.test.ts +++ b/test/integration/ActionSlashValidators.test.ts @@ -183,8 +183,8 @@ describe('[Integration] Slash validators', () => { expectingBlockProducerSet.push(slashee.consensusAddr.address); await RoninValidatorSetExpects.emitValidatorSetUpdatedEvent(wrapUpEpochTx!, period, expectingValidatorSet); - expect((await validatorContract.getValidators())[0]).eql(expectingValidatorSet); - expect(await validatorContract.getBlockProducers()).eql(expectingBlockProducerSet); + expect((await validatorContract.getValidators())[0]).deep.equal(expectingValidatorSet); + expect(await validatorContract.getBlockProducers()).deep.equal(expectingBlockProducerSet); }); it('Should the ValidatorSet contract emit event', async () => { @@ -213,7 +213,11 @@ describe('[Integration] Slash validators', () => { it('Should the validator is put in jail', async () => { let blockNumber = await network.provider.send('eth_blockNumber'); - expect(await validatorContract.getJailUntils(expectingValidatorSet)).eql([ + // await compareBigNumbers(await validatorContract.getJailUntils(expectingValidatorSet), [ + // BigNumber.from(blockNumber).add(jailDurationForUnavailabilityTier2Threshold), + // ]); + + expect(await validatorContract.getJailUntils(expectingValidatorSet)).deep.equal([ BigNumber.from(blockNumber).add(jailDurationForUnavailabilityTier2Threshold), ]); }); @@ -237,7 +241,7 @@ describe('[Integration] Slash validators', () => { wrapUpEpochTx = await validatorContract.connect(coinbase).wrapUpEpoch(); }); expectingBlockProducerSet.pop(); - expect(await validatorContract.getBlockProducers()).eql(expectingBlockProducerSet); + expect(await validatorContract.getBlockProducers()).deep.equal(expectingBlockProducerSet); await RoninValidatorSetExpects.emitBlockProducerSetUpdatedEvent( wrapUpEpochTx!, period, @@ -273,7 +277,7 @@ describe('[Integration] Slash validators', () => { }); expectingBlockProducerSet.push(slashee.consensusAddr.address); - expect(await validatorContract.getBlockProducers()).eql(expectingBlockProducerSet); + expect(await validatorContract.getBlockProducers()).deep.equal(expectingBlockProducerSet); await RoninValidatorSetExpects.emitBlockProducerSetUpdatedEvent( wrapUpEpochTx!, period, @@ -328,7 +332,7 @@ describe('[Integration] Slash validators', () => { period = await validatorContract.currentPeriod(); await RoninValidatorSetExpects.emitValidatorSetUpdatedEvent(wrapUpEpochTx!, period, expectingValidatorSet); - expect((await validatorContract.getValidators())[0]).eql(expectingValidatorSet); + expect((await validatorContract.getValidators())[0]).deep.equal(expectingValidatorSet); }); describe('Check effects on indicator and staking amount', async () => { @@ -362,7 +366,7 @@ describe('[Integration] Slash validators', () => { it('Should the validators are put in jail', async () => { const blockNumber = await network.provider.send('eth_blockNumber'); - expect(await validatorContract.getJailUntils(slashees.map((v) => v.consensusAddr.address))).eql([ + expect(await validatorContract.getJailUntils(slashees.map((v) => v.consensusAddr.address))).deep.equal([ BigNumber.from(blockNumber).add(jailDurationForUnavailabilityTier2Threshold).sub(1), BigNumber.from(blockNumber).add(jailDurationForUnavailabilityTier2Threshold).sub(0), ]); @@ -394,7 +398,7 @@ describe('[Integration] Slash validators', () => { await validatorContract.connect(coinbase).endEpoch(); wrapUpEpochTx = await validatorContract.connect(coinbase).wrapUpEpoch(); }); - expect(await validatorContract.getBlockProducers()).eql(expectingBlockProducerSet); + expect(await validatorContract.getBlockProducers()).deep.equal(expectingBlockProducerSet); await RoninValidatorSetExpects.emitBlockProducerSetUpdatedEvent( wrapUpEpochTx!, period, @@ -429,8 +433,8 @@ describe('[Integration] Slash validators', () => { }); slashees.forEach((slashee) => expectingBlockProducerSet.push(slashee.consensusAddr.address)); - expect(await validatorContract.getBlockProducers()).eql(expectingBlockProducerSet); - expect((await validatorContract.getValidators())[0]).eql(expectingBlockProducerSet); + expect(await validatorContract.getBlockProducers()).deep.equal(expectingBlockProducerSet); + expect((await validatorContract.getValidators())[0]).deep.equal(expectingBlockProducerSet); await RoninValidatorSetExpects.emitBlockProducerSetUpdatedEvent( wrapUpEpochTx!, period, @@ -460,8 +464,8 @@ describe('[Integration] Slash validators', () => { period = await validatorContract.currentPeriod(); await RoninValidatorSetExpects.emitValidatorSetUpdatedEvent(wrapUpEpochTx!, period, expectingValidatorSet); - expect(await validatorContract.getBlockProducers()).eql(expectingBlockProducerSet); - expect((await validatorContract.getValidators())[0]).eql(expectingValidatorSet); + expect(await validatorContract.getBlockProducers()).deep.equal(expectingBlockProducerSet); + expect((await validatorContract.getValidators())[0]).deep.equal(expectingValidatorSet); }); it('The validator should be able to top up before deadline', async () => { @@ -495,8 +499,8 @@ describe('[Integration] Slash validators', () => { period = await validatorContract.currentPeriod(); await RoninValidatorSetExpects.emitValidatorSetUpdatedEvent(wrapUpEpochTx!, period, expectingValidatorSet); - expect(await validatorContract.getBlockProducers()).eql(expectingBlockProducerSet); - expect((await validatorContract.getValidators())[0]).eql(expectingValidatorSet); + expect(await validatorContract.getBlockProducers()).deep.equal(expectingBlockProducerSet); + expect((await validatorContract.getValidators())[0]).deep.equal(expectingValidatorSet); }); it('Should the event of revoking under balance candidates emitted', async () => { diff --git a/test/integration/ActionWrapUpEpoch.test.ts b/test/integration/ActionWrapUpEpoch.test.ts index a32a1e3a6..8507b753d 100644 --- a/test/integration/ActionWrapUpEpoch.test.ts +++ b/test/integration/ActionWrapUpEpoch.test.ts @@ -219,7 +219,7 @@ describe('[Integration] Wrap up epoch', () => { await Promise.all( validators.map(async (v) => slashContract.currentUnavailabilityIndicator(v.consensusAddr.address)) ) - ).eql( + ).deep.equal( validators.map((v) => (v.consensusAddr.address == coinbase.address ? BigNumber.from(0) : BigNumber.from(1))) ); }); @@ -234,7 +234,7 @@ describe('[Integration] Wrap up epoch', () => { await Promise.all( validators.map(async (v) => slashContract.currentUnavailabilityIndicator(v.consensusAddr.address)) ) - ).eql(validators.map(() => BigNumber.from(0))); + ).deep.equal(validators.map(() => BigNumber.from(0))); }); }); }); @@ -308,10 +308,10 @@ describe('[Integration] Wrap up epoch', () => { expectingBlockProducerSet ); - expect((await validatorContract.getValidators())[0]).eql( + expect((await validatorContract.getValidators())[0]).deep.equal( [validators[1], validators[2], validators[3]].map((_) => _.consensusAddr.address).reverse() ); - expect(await validatorContract.getBlockProducers()).eql(expectingBlockProducerSet); + expect(await validatorContract.getBlockProducers()).deep.equal(expectingBlockProducerSet); }); it('Should the validators in the previous epoch (including slashed one) got slashing counter reset, when the epoch ends', async () => { @@ -324,7 +324,7 @@ describe('[Integration] Wrap up epoch', () => { await Promise.all( validators.map(async (v) => slashContract.currentUnavailabilityIndicator(v.consensusAddr.address)) ) - ).eql(validators.map(() => BigNumber.from(0))); + ).deep.equal(validators.map(() => BigNumber.from(0))); }); }); }); diff --git a/test/integration/Configuration.test.ts b/test/integration/Configuration.test.ts index e1d8ebdc2..1fdb8bb0b 100644 --- a/test/integration/Configuration.test.ts +++ b/test/integration/Configuration.test.ts @@ -26,6 +26,7 @@ import { import { initTest, InitTestInput } from '../helpers/fixture'; import { MAX_UINT255, randomAddress } from '../../src/utils'; import { createManyTrustedOrganizationAddressSets, TrustedOrganizationAddressSet } from '../helpers/address-set-types'; +import { compareBigNumbers } from '../helpers/utils'; let stakingVestingContract: StakingVesting; let maintenanceContract: Maintenance; @@ -198,7 +199,7 @@ describe('[Integration] Configuration check', () => { addedBlock: undefined, }) ) - ).eql( + ).deep.equal( trustedOrgs.map((v) => ({ consensusAddr: v.consensusAddr.address, governor: v.governor.address, @@ -207,7 +208,7 @@ describe('[Integration] Configuration check', () => { addedBlock: undefined, })) ); - expect(await roninTrustedOrganizationContract.getThreshold()).eql( + expect(await roninTrustedOrganizationContract.getThreshold()).deep.equal( [config.roninTrustedOrganizationArguments?.numerator, config.roninTrustedOrganizationArguments?.denominator].map( BigNumber.from ) @@ -219,7 +220,8 @@ describe('[Integration] Configuration check', () => { expect(await slashContract.maintenanceContract()).to.eq(maintenanceContract.address); expect(await slashContract.roninTrustedOrganizationContract()).to.eq(roninTrustedOrganizationContract.address); expect(await slashContract.roninGovernanceAdminContract()).to.eq(roninGovernanceAdminContract.address); - expect(await slashContract.getBridgeOperatorSlashingConfigs()).to.eql( + await compareBigNumbers( + await slashContract.getBridgeOperatorSlashingConfigs(), [ config.slashIndicatorArguments?.bridgeOperatorSlashing?.missingVotesRatioTier1, config.slashIndicatorArguments?.bridgeOperatorSlashing?.missingVotesRatioTier2, @@ -227,20 +229,23 @@ describe('[Integration] Configuration check', () => { config.slashIndicatorArguments?.bridgeOperatorSlashing?.skipBridgeOperatorSlashingThreshold, ].map(BigNumber.from) ); - expect(await slashContract.getBridgeVotingSlashingConfigs()).to.eql( + await compareBigNumbers( + await slashContract.getBridgeVotingSlashingConfigs(), [ config.slashIndicatorArguments?.bridgeVotingSlashing?.bridgeVotingThreshold, config.slashIndicatorArguments?.bridgeVotingSlashing?.bridgeVotingSlashAmount, ].map(BigNumber.from) ); - expect(await slashContract.getDoubleSignSlashingConfigs()).to.eql( + await compareBigNumbers( + await slashContract.getDoubleSignSlashingConfigs(), [ config.slashIndicatorArguments?.doubleSignSlashing?.slashDoubleSignAmount, config.slashIndicatorArguments?.doubleSignSlashing?.doubleSigningJailUntilBlock, config.slashIndicatorArguments?.doubleSignSlashing?.doubleSigningOffsetLimitBlock, ].map(BigNumber.from) ); - expect(await slashContract.getUnavailabilitySlashingConfigs()).to.eql( + await compareBigNumbers( + await slashContract.getUnavailabilitySlashingConfigs(), [ config.slashIndicatorArguments?.unavailabilitySlashing?.unavailabilityTier1Threshold, config.slashIndicatorArguments?.unavailabilitySlashing?.unavailabilityTier2Threshold, @@ -248,7 +253,8 @@ describe('[Integration] Configuration check', () => { config.slashIndicatorArguments?.unavailabilitySlashing?.jailDurationForUnavailabilityTier2Threshold, ].map(BigNumber.from) ); - expect(await slashContract.getCreditScoreConfigs()).to.eql( + await compareBigNumbers( + await slashContract.getCreditScoreConfigs(), [ config.slashIndicatorArguments?.creditScore?.gainCreditScore, config.slashIndicatorArguments?.creditScore?.maxCreditScore, diff --git a/test/maintainance/Maintenance.test.ts b/test/maintainance/Maintenance.test.ts index e2dc7054e..acd4af297 100644 --- a/test/maintainance/Maintenance.test.ts +++ b/test/maintainance/Maintenance.test.ts @@ -141,8 +141,12 @@ describe('Maintenance test', () => { validatorCandidates.map((_) => _.consensusAddr.address) ); - expect((await validatorContract.getValidators())[0]).eql(validatorCandidates.map((_) => _.consensusAddr.address)); - expect(await validatorContract.getBlockProducers()).eql(validatorCandidates.map((_) => _.consensusAddr.address)); + expect((await validatorContract.getValidators())[0]).deep.equal( + validatorCandidates.map((_) => _.consensusAddr.address) + ); + expect(await validatorContract.getBlockProducers()).deep.equal( + validatorCandidates.map((_) => _.consensusAddr.address) + ); }); after(async () => { @@ -310,7 +314,9 @@ describe('Maintenance test', () => { let tx = await validatorContract.connect(coinbase).wrapUpEpoch(); currentBlock = (await ethers.provider.getBlockNumber()) + 1; - expect(await validatorContract.getBlockProducers()).eql(validatorCandidates.map((_) => _.consensusAddr.address)); + expect(await validatorContract.getBlockProducers()).deep.equal( + validatorCandidates.map((_) => _.consensusAddr.address) + ); }); it('Should the validator not appear in the block producer list since the maintenance is started', async () => { @@ -327,7 +333,7 @@ describe('Maintenance test', () => { await validatorContract.epochOf((await ethers.provider.getBlockNumber()) + 1), expectingBlockProducerSet ); - expect(await validatorContract.getBlockProducers()).eql( + expect(await validatorContract.getBlockProducers()).deep.equal( validatorCandidates.slice(2).map((_) => _.consensusAddr.address) ); }); @@ -351,7 +357,7 @@ describe('Maintenance test', () => { await validatorContract.epochOf((await ethers.provider.getBlockNumber()) + 1), expectingBlockProducerSet ); - expect(await validatorContract.getBlockProducers()).eql(expectingBlockProducerSet); + expect(await validatorContract.getBlockProducers()).deep.equal(expectingBlockProducerSet); }); it('Should not be able to schedule again when cooldown time is not over', async () => { @@ -450,7 +456,9 @@ describe('Maintenance test', () => { await validatorContract.epochOf((await ethers.provider.getBlockNumber()) + 1), expectingBlockProducerSet ); - expect(await validatorContract.getBlockProducers()).eql(validatorCandidates.map((_) => _.consensusAddr.address)); + expect(await validatorContract.getBlockProducers()).deep.equal( + validatorCandidates.map((_) => _.consensusAddr.address) + ); }); }); }); diff --git a/test/precompile-usages/PrecompileUsageSortValidators.test.ts b/test/precompile-usages/PrecompileUsageSortValidators.test.ts index bb3337b7d..8bf2fd71c 100644 --- a/test/precompile-usages/PrecompileUsageSortValidators.test.ts +++ b/test/precompile-usages/PrecompileUsageSortValidators.test.ts @@ -45,7 +45,7 @@ describe('[Precompile] Sorting validators test', () => { .sort((a, b) => (a.balance > b.balance ? -1 : 1)) .map((_) => _.address); - expect(sortedValidators).eql(expectingValidators); + expect(sortedValidators).deep.equal(expectingValidators); }); it('Should the usage contract revert with proper message on calling the precompile contract fails', async () => { diff --git a/test/precompile-usages/PrecompileUsageValidateDoubleSign.test.ts b/test/precompile-usages/PrecompileUsageValidateDoubleSign.test.ts index 3c12bb579..f1a566fdd 100644 --- a/test/precompile-usages/PrecompileUsageValidateDoubleSign.test.ts +++ b/test/precompile-usages/PrecompileUsageValidateDoubleSign.test.ts @@ -35,7 +35,7 @@ describe('[Precompile] Validate double sign test', () => { it('Should the usage contract can call the precompile address', async () => { let sortedValidators = await usageValidating.callPrecompile(slasheeAddr, header1, header2); - expect(sortedValidators).eql(true); + expect(sortedValidators).deep.equal(true); }); it('Should the usage contract revert with proper message on calling the precompile contract fails', async () => { diff --git a/test/slash/CreditScore.test.ts b/test/slash/CreditScore.test.ts index f7a8bd2ae..f939f0e4d 100644 --- a/test/slash/CreditScore.test.ts +++ b/test/slash/CreditScore.test.ts @@ -233,10 +233,10 @@ describe('Credit score and bail out test', () => { localEpochController = new EpochController(minOffsetToStartSchedule, numberOfBlocksInEpoch); await localEpochController.mineToBeforeEndOfEpoch(2); await validatorContract.connect(coinbase).wrapUpEpoch(); - expect((await validatorContract.getValidators())[0]).eql( + expect((await validatorContract.getValidators())[0]).deep.equal( validatorCandidates.slice(0, maxValidatorNumber).map((_) => _.consensusAddr.address) ); - expect(await validatorContract.getBlockProducers()).eql( + expect(await validatorContract.getBlockProducers()).deep.equal( validatorCandidates.slice(0, maxValidatorNumber).map((_) => _.consensusAddr.address) ); diff --git a/test/slash/SlashIndicator.test.ts b/test/slash/SlashIndicator.test.ts index 82e61e2f0..188c80bda 100644 --- a/test/slash/SlashIndicator.test.ts +++ b/test/slash/SlashIndicator.test.ts @@ -166,7 +166,9 @@ describe('Slash indicator test', () => { localEpochController = new EpochController(minOffsetToStartSchedule, numberOfBlocksInEpoch); await localEpochController.mineToBeforeEndOfEpoch(2); await validatorContract.connect(coinbase).wrapUpEpoch(); - expect((await validatorContract.getValidators())[0]).eql(validatorCandidates.map((_) => _.consensusAddr.address)); + expect((await validatorContract.getValidators())[0]).deep.equal( + validatorCandidates.map((_) => _.consensusAddr.address) + ); localIndicators = new IndicatorController(validatorCandidates.length); }); diff --git a/test/sorting/QuickSort.test.ts b/test/sorting/QuickSort.test.ts index e53938c18..370ba8121 100644 --- a/test/sorting/QuickSort.test.ts +++ b/test/sorting/QuickSort.test.ts @@ -38,7 +38,7 @@ const runSortWithNRecords = async (numOfRecords: number) => { balances.map((_) => _.value) ); - expect(sorted).eql(balances.map((_) => _.address)); + expect(sorted).deep.equal(balances.map((_) => _.address)); return gasUsed.toString(); }; diff --git a/test/staking/Staking.test.ts b/test/staking/Staking.test.ts index bdcd93652..9a9d86c62 100644 --- a/test/staking/Staking.test.ts +++ b/test/staking/Staking.test.ts @@ -325,7 +325,7 @@ describe('Staking test', () => { it('Should the consensus account is no longer be a candidate, and the staked amount is transferred back to the pool admin', async () => { await network.provider.send('evm_increaseTime', [waitingSecsToRevoke]); const stakingAmount = minValidatorStakingAmount.mul(2); - expect(await stakingContract.getPoolDetail(poolAddrSet.consensusAddr.address)).eql([ + expect(await stakingContract.getPoolDetail(poolAddrSet.consensusAddr.address)).deep.equal([ poolAddrSet.poolAdmin.address, stakingAmount, stakingAmount.add(9), @@ -497,7 +497,7 @@ describe('Staking test', () => { 2, /* 0.02% */ { value: minValidatorStakingAmount } ); - expect(await stakingContract.getPoolDetail(poolAddrSet.consensusAddr.address)).eql([ + expect(await stakingContract.getPoolDetail(poolAddrSet.consensusAddr.address)).deep.equal([ poolAddrSet.poolAdmin.address, minValidatorStakingAmount, minValidatorStakingAmount.add(8), @@ -516,7 +516,7 @@ describe('Staking test', () => { [poolAddrSet.consensusAddr.address, poolAddrSet.consensusAddr.address], [userA.address, userB.address] ) - ).eql([2, 2].map(BigNumber.from)); + ).deep.equal([2, 2].map(BigNumber.from)); await network.provider.send('evm_increaseTime', [cooldownSecsToUndelegate + 1]); await stakingContract.connect(userA).undelegate(poolAddrSet.consensusAddr.address, 2); @@ -526,7 +526,7 @@ describe('Staking test', () => { [poolAddrSet.consensusAddr.address, poolAddrSet.consensusAddr.address], [userA.address, userB.address] ) - ).eql([0, 1].map(BigNumber.from)); + ).deep.equal([0, 1].map(BigNumber.from)); }); it('Should be able to delegate for a renouncing candidate', async () => { diff --git a/test/validator/ArrangeValidators.test.ts b/test/validator/ArrangeValidators.test.ts index 9ecb3e723..d9c9c6e62 100644 --- a/test/validator/ArrangeValidators.test.ts +++ b/test/validator/ArrangeValidators.test.ts @@ -218,7 +218,7 @@ describe('Arrange validators', () => { maxPrioritizedValidatorNumber ); - expect(outputValidators).eql(expectingValidatorAddrs); + expect(outputValidators).deep.equal(expectingValidatorAddrs); }); it('Actual(prioritized) == MaxNum(prioritized); Actual(regular) > MaxNum(regular)', async () => { @@ -244,7 +244,7 @@ describe('Arrange validators', () => { maxValidatorNumber, maxPrioritizedValidatorNumber ); - expect(outputValidators).eql(expectingValidatorAddrs); + expect(outputValidators).deep.equal(expectingValidatorAddrs); }); it('Actual(prioritized) == MaxNum(prioritized); Actual(regular) < MaxNum(regular)', async () => { @@ -270,7 +270,7 @@ describe('Arrange validators', () => { actualPrioritizedNumber + actualRegularNumber, maxPrioritizedValidatorNumber ); - expect(outputValidators).eql(expectingValidatorAddrs); + expect(outputValidators).deep.equal(expectingValidatorAddrs); }); it('Actual(prioritized) > MaxNum(prioritized); Actual(regular) == MaxNum(regular)', async () => { @@ -296,7 +296,7 @@ describe('Arrange validators', () => { maxValidatorNumber, maxPrioritizedValidatorNumber ); - expect(outputValidators).eql(expectingValidatorAddrs); + expect(outputValidators).deep.equal(expectingValidatorAddrs); }); it('Actual(prioritized) > MaxNum(prioritized); Actual(regular) > MaxNum(regular)', async () => { @@ -322,7 +322,7 @@ describe('Arrange validators', () => { maxValidatorNumber, maxPrioritizedValidatorNumber ); - expect(outputValidators).eql(expectingValidatorAddrs); + expect(outputValidators).deep.equal(expectingValidatorAddrs); }); it('Actual(prioritized) > MaxNum(prioritized); Actual(regular) < MaxNum(regular)', async () => { @@ -350,7 +350,7 @@ describe('Arrange validators', () => { maxValidatorNumber, maxPrioritizedValidatorNumber ); - expect(outputValidators).eql(expectingValidatorAddrs); + expect(outputValidators).deep.equal(expectingValidatorAddrs); }); it('Actual(prioritized) < MaxNum(prioritized); Actual(regular) == MaxNum(regular)', async () => { @@ -376,7 +376,7 @@ describe('Arrange validators', () => { actualPrioritizedNumber + actualRegularNumber, maxPrioritizedValidatorNumber ); - expect(outputValidators).eql(expectingValidatorAddrs); + expect(outputValidators).deep.equal(expectingValidatorAddrs); }); it('Actual(prioritized) < MaxNum(prioritized); Actual(regular) > MaxNum(regular)', async () => { @@ -404,7 +404,7 @@ describe('Arrange validators', () => { maxValidatorNumber, maxPrioritizedValidatorNumber ); - expect(outputValidators).eql(expectingValidatorAddrs); + expect(outputValidators).deep.equal(expectingValidatorAddrs); }); it('Actual(prioritized) < MaxNum(prioritized); Actual(regular) < MaxNum(regular)', async () => { @@ -430,7 +430,7 @@ describe('Arrange validators', () => { actualPrioritizedNumber + actualRegularNumber, maxPrioritizedValidatorNumber ); - expect(outputValidators).eql(expectingValidatorAddrs); + expect(outputValidators).deep.equal(expectingValidatorAddrs); }); }); @@ -457,7 +457,7 @@ describe('Arrange validators', () => { maxValidatorNumber, maxPrioritizedValidatorNumber ); - expect(outputValidators).eql(expectingValidatorAddrs); + expect(outputValidators).deep.equal(expectingValidatorAddrs); }); it('Shuffled: Actual(prioritized) > MaxNum(prioritized); Actual(regular) < MaxNum(regular)', async () => { @@ -476,7 +476,7 @@ describe('Arrange validators', () => { maxValidatorNumber, maxPrioritizedValidatorNumber ); - expect(outputValidators).eql(expectingValidatorAddrs); + expect(outputValidators).deep.equal(expectingValidatorAddrs); }); it('Shuffled: Actual(prioritized) < MaxNum(prioritized); Actual(regular) > MaxNum(regular)', async () => { @@ -495,7 +495,7 @@ describe('Arrange validators', () => { maxValidatorNumber, maxPrioritizedValidatorNumber ); - expect(outputValidators).eql(expectingValidatorAddrs); + expect(outputValidators).deep.equal(expectingValidatorAddrs); }); }); }); diff --git a/test/validator/EmergencyExit.test.ts b/test/validator/EmergencyExit.test.ts index 394052228..2ef186419 100644 --- a/test/validator/EmergencyExit.test.ts +++ b/test/validator/EmergencyExit.test.ts @@ -163,7 +163,9 @@ describe('Emergency Exit test', () => { }); it('Should be able to get list of the validator candidates', async () => { - expect(validatorCandidates.map((v) => v.consensusAddr.address)).eql(await roninValidatorSet.getBlockProducers()); + expect(validatorCandidates.map((v) => v.consensusAddr.address)).deep.equal( + await roninValidatorSet.getBlockProducers() + ); }); it('Should not be able to request emergency exit using unauthorized accounts', async () => { @@ -212,7 +214,9 @@ describe('Emergency Exit test', () => { }); it("Should the emergency exit's requester be still in the validator list", async () => { - expect(validatorCandidates.map((v) => v.consensusAddr.address)).eql(await roninValidatorSet.getBlockProducers()); + expect(validatorCandidates.map((v) => v.consensusAddr.address)).deep.equal( + await roninValidatorSet.getBlockProducers() + ); expect(await roninValidatorSet.isValidator(compromisedValidator.consensusAddr.address)).to.true; expect(await roninValidatorSet.isBlockProducer(compromisedValidator.consensusAddr.address)).to.true; expect(await roninValidatorSet.isOperatingBridge(compromisedValidator.consensusAddr.address)).to.true; diff --git a/test/validator/RoninValidatorSet-Candidate.test.ts b/test/validator/RoninValidatorSet-Candidate.test.ts index 21ad353ac..873a8218d 100644 --- a/test/validator/RoninValidatorSet-Candidate.test.ts +++ b/test/validator/RoninValidatorSet-Candidate.test.ts @@ -185,8 +185,8 @@ describe('Ronin Validator Set: candidate test', () => { await expect(tx!).emit(roninValidatorSet, 'WrappedUpEpoch').withArgs(lastPeriod, epoch, true); lastPeriod = await roninValidatorSet.currentPeriod(); await RoninValidatorSet.expects.emitValidatorSetUpdatedEvent(tx!, lastPeriod, expectingValidatorsAddr); - expect((await roninValidatorSet.getValidators())[0]).eql(expectingValidatorsAddr); - expect(await roninValidatorSet.getBlockProducers()).eql(expectingValidatorsAddr); + expect((await roninValidatorSet.getValidators())[0]).deep.equal(expectingValidatorsAddr); + expect(await roninValidatorSet.getBlockProducers()).deep.equal(expectingValidatorsAddr); }); it('Should trusted org can apply for candidate and the set get synced', async () => { @@ -223,8 +223,8 @@ describe('Ronin Validator Set: candidate test', () => { await expect(tx!).emit(roninValidatorSet, 'WrappedUpEpoch').withArgs(lastPeriod, epoch, true); lastPeriod = await roninValidatorSet.currentPeriod(); await RoninValidatorSet.expects.emitValidatorSetUpdatedEvent(tx!, lastPeriod, expectingValidatorsAddr); - expect((await roninValidatorSet.getValidators())[0]).eql(expectingValidatorsAddr); - expect(await roninValidatorSet.getBlockProducers()).eql(expectingValidatorsAddr); + expect((await roninValidatorSet.getValidators())[0]).deep.equal(expectingValidatorsAddr); + expect(await roninValidatorSet.getBlockProducers()).deep.equal(expectingValidatorsAddr); }); }); diff --git a/test/validator/RoninValidatorSet-CoinbaseExecution.test.ts b/test/validator/RoninValidatorSet-CoinbaseExecution.test.ts index ceb119855..ddbb5970c 100644 --- a/test/validator/RoninValidatorSet-CoinbaseExecution.test.ts +++ b/test/validator/RoninValidatorSet-CoinbaseExecution.test.ts @@ -180,7 +180,7 @@ describe('Ronin Validator Set: Coinbase execution test', () => { await expect(tx!).emit(roninValidatorSet, 'WrappedUpEpoch').withArgs(lastPeriod, epoch, true); lastPeriod = await roninValidatorSet.currentPeriod(); await RoninValidatorSetExpects.emitBlockProducerSetUpdatedEvent(tx!, lastPeriod, nextEpoch, []); - expect((await roninValidatorSet.getValidators())[0]).eql([]); + expect((await roninValidatorSet.getValidators())[0]).deep.equal([]); }); }); @@ -208,8 +208,8 @@ describe('Ronin Validator Set: Coinbase execution test', () => { tx = await roninValidatorSet.connect(consensusAddr).wrapUpEpoch(); }); await expect(tx!).emit(roninValidatorSet, 'WrappedUpEpoch').withArgs(lastPeriod, epoch, false); - expect((await roninValidatorSet.getValidators())[0]).eql([]); - expect(await roninValidatorSet.getBlockProducers()).eql([]); + expect((await roninValidatorSet.getValidators())[0]).deep.equal([]); + expect(await roninValidatorSet.getBlockProducers()).deep.equal([]); await expect(tx!).not.emit(roninValidatorSet, 'ValidatorSetUpdated'); }); }); @@ -234,8 +234,8 @@ describe('Ronin Validator Set: Coinbase execution test', () => { await expect(tx!).emit(roninValidatorSet, 'WrappedUpEpoch').withArgs(lastPeriod, epoch, true); lastPeriod = await roninValidatorSet.currentPeriod(); await RoninValidatorSetExpects.emitValidatorSetUpdatedEvent(tx!, lastPeriod, expectingValidatorsAddr); - expect((await roninValidatorSet.getValidators())[0]).eql(expectingValidatorsAddr); - expect(await roninValidatorSet.getBlockProducers()).eql(expectingValidatorsAddr); + expect((await roninValidatorSet.getValidators())[0]).deep.equal(expectingValidatorsAddr); + expect(await roninValidatorSet.getBlockProducers()).deep.equal(expectingValidatorsAddr); }); it('Should validator is set with correct flags', async () => { @@ -309,8 +309,8 @@ describe('Ronin Validator Set: Coinbase execution test', () => { await expect(tx!).emit(roninValidatorSet, 'WrappedUpEpoch').withArgs(lastPeriod, epoch, true); lastPeriod = await roninValidatorSet.currentPeriod(); await RoninValidatorSetExpects.emitValidatorSetUpdatedEvent(tx!, lastPeriod, currentValidatorSet); - expect((await roninValidatorSet.getValidators())[0]).eql(currentValidatorSet); - expect(await roninValidatorSet.getBlockProducers()).eql(currentValidatorSet); + expect((await roninValidatorSet.getValidators())[0]).deep.equal(currentValidatorSet); + expect(await roninValidatorSet.getBlockProducers()).deep.equal(currentValidatorSet); }); }); @@ -351,8 +351,8 @@ describe('Ronin Validator Set: Coinbase execution test', () => { }); it('Should validator is set with correct flags', async () => { - expect((await roninValidatorSet.getValidators())[0]).eql(expectingValidatorsAddr); - expect(await roninValidatorSet.getBlockProducers()).eql(expectingValidatorsAddr); + expect((await roninValidatorSet.getValidators())[0]).deep.equal(expectingValidatorsAddr); + expect(await roninValidatorSet.getBlockProducers()).deep.equal(expectingValidatorsAddr); for (let validatorAddr of expectingValidatorsAddr) { expect(await roninValidatorSet.isValidator(validatorAddr)).eq( true, From a6b8132912e4c9d3b0aeffbc94b6001f0f9444a5 Mon Sep 17 00:00:00 2001 From: Bao Date: Tue, 16 May 2023 14:34:21 +0700 Subject: [PATCH 09/10] [upgrade] Script for set min commission rate (#221) * add script * add deployments of new logic * rename deploy script for consistency * add upgrade contract script * add script for update new pause enforcer * add proposal for changing mainchain pause enforcer * add assertion --- .../ronin-mainnet/MaintenanceLogic.json | 62 +-- .../RoninGatewayPauseEnforcer.json | 72 ++- .../ronin-mainnet/RoninValidatorSetLogic.json | 176 +++--- deployments/ronin-mainnet/StakingLogic.json | 210 ++++--- .../2a8db5de0d3bfe0cb40ba15ae8460f16.json | 525 ++++++++++++++++++ .../85b953b22882c536a643bf4b61b3153b.json | 525 ++++++++++++++++++ ...idator-proxy.ts => validator-set-proxy.ts} | 0 ...15-change-min-commission-rate-5-percent.ts | 91 +++ ...16-set-pause-enforcer-mainchain-gateway.ts | 65 +++ src/utils.ts | 1 + 10 files changed, 1477 insertions(+), 250 deletions(-) create mode 100644 deployments/ronin-mainnet/solcInputs/2a8db5de0d3bfe0cb40ba15ae8460f16.json create mode 100644 deployments/ronin-mainnet/solcInputs/85b953b22882c536a643bf4b61b3153b.json rename src/deploy/proxy/{ronin-validator-proxy.ts => validator-set-proxy.ts} (100%) create mode 100644 src/upgrades/230515-change-min-commission-rate-5-percent.ts create mode 100644 src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts diff --git a/deployments/ronin-mainnet/MaintenanceLogic.json b/deployments/ronin-mainnet/MaintenanceLogic.json index 52a0a00b7..0856ef658 100644 --- a/deployments/ronin-mainnet/MaintenanceLogic.json +++ b/deployments/ronin-mainnet/MaintenanceLogic.json @@ -1,5 +1,5 @@ { - "address": "0x44dCC40067233d3E45b93951184fB389c068466d", + "address": "0xB6a13e481f060c6a9130238EEb84a3c98A0A5FEa", "abi": [ { "inputs": [], @@ -559,41 +559,41 @@ "type": "function" } ], - "transactionHash": "0xf7275892638322ca78779c3b8c9718312207ba3d1c2368a99513333db0630a73", + "transactionHash": "0x4a0b26846fc54088b10b0fe0afd85420bc234dac81f23509eda3d1a4a45d55c2", "receipt": { "to": null, - "from": "0x0F68eDBE14C8f68481771016d7E2871d6a35DE11", - "contractAddress": "0x44dCC40067233d3E45b93951184fB389c068466d", - "transactionIndex": 9, - "gasUsed": "1408139", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000200000000000000000000000000800000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000", - "blockHash": "0xe0ae22019c2f9c1b38ee69be1366a442a6f7d03d69148c1bb4b5d7636f04323f", - "transactionHash": "0xf7275892638322ca78779c3b8c9718312207ba3d1c2368a99513333db0630a73", + "from": "0x4d58Ea7231c394d5804e8B06B1365915f906E27F", + "contractAddress": "0xB6a13e481f060c6a9130238EEb84a3c98A0A5FEa", + "transactionIndex": 1, + "gasUsed": "1410539", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0xde0c1aa121664bb771882b7b61c67e7cec6aa5db5a2c891aa978b67b3793acac", + "transactionHash": "0x4a0b26846fc54088b10b0fe0afd85420bc234dac81f23509eda3d1a4a45d55c2", "logs": [ { - "transactionIndex": 9, - "blockNumber": 22608282, - "transactionHash": "0xf7275892638322ca78779c3b8c9718312207ba3d1c2368a99513333db0630a73", - "address": "0x44dCC40067233d3E45b93951184fB389c068466d", + "transactionIndex": 1, + "blockNumber": 24127446, + "transactionHash": "0x4a0b26846fc54088b10b0fe0afd85420bc234dac81f23509eda3d1a4a45d55c2", + "address": "0xB6a13e481f060c6a9130238EEb84a3c98A0A5FEa", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", - "logIndex": 16, - "blockHash": "0xe0ae22019c2f9c1b38ee69be1366a442a6f7d03d69148c1bb4b5d7636f04323f" + "logIndex": 1, + "blockHash": "0xde0c1aa121664bb771882b7b61c67e7cec6aa5db5a2c891aa978b67b3793acac" } ], - "blockNumber": 22608282, - "cumulativeGasUsed": "2179820", + "blockNumber": 24127446, + "cumulativeGasUsed": "1469957", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "a50a3f056fa24c0b5a230a9cb29a1cb4", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxSchedules\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"MaintenanceConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"MaintenanceScheduleCancelled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"from\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"to\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdatedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestTimestamp\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IMaintenance.Schedule\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"MaintenanceScheduled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"cancelSchedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkCooldownEnds\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"checkMaintained\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_toBlock\",\"type\":\"uint256\"}],\"name\":\"checkMaintainedInBlockRange\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintained\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_resList\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_toBlock\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintainedInBlockRange\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_resList\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkScheduled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownSecsToMaintain\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getSchedule\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"from\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"to\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdatedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestTimestamp\",\"type\":\"uint256\"}],\"internalType\":\"struct IMaintenance.Schedule\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxSchedules\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxMaintenanceDurationInBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxOffsetToStartSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxSchedules\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minMaintenanceDurationInBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minOffsetToStartSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startedAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endedAtBlock\",\"type\":\"uint256\"}],\"name\":\"schedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxSchedules\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"setMaintenanceConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSchedules\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"cancelSchedule(address)\":{\"details\":\"Cancel the schedule of maintenance for the `_consensusAddr`. Requirements: - The candidate `_consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `_consensusAddr`. - A schedule for the `_consensusAddr` must be existent and not executed yet. Emits the event `MaintenanceScheduleCancelled`.\"},\"checkCooldownEnds(address)\":{\"details\":\"Returns whether the validator `_consensusAddr`\"},\"checkMaintained(address,uint256)\":{\"details\":\"Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\"},\"checkMaintainedInBlockRange(address,uint256,uint256)\":{\"details\":\"Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\"},\"checkManyMaintained(address[],uint256)\":{\"details\":\"Returns the bool array indicating the validators maintained at block number `_block` or not.\"},\"checkManyMaintainedInBlockRange(address[],uint256,uint256)\":{\"details\":\"Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\"},\"checkScheduled(address)\":{\"details\":\"Returns whether the validator `_consensusAddr` has scheduled.\"},\"getSchedule(address)\":{\"details\":\"Returns the detailed schedule of the validator `_consensusAddr`.\"},\"initialize(address,uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"schedule(address,uint256,uint256)\":{\"details\":\"Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`. Requirements: - The candidate `_consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `_consensusAddr`. - The candidate `_consensusAddr` has no schedule yet or the previous is done. - The total number of schedules is not larger than `maxSchedules()`. - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block. - The end block is larger than the start block. - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`. - The start block is at the start of an epoch. - The end block is at the end of an epoch. Emits the event `MaintenanceScheduled`.\"},\"setMaintenanceConfig(uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the duration restriction, start time restriction, and max allowed for maintenance. Requirements: - The method caller is admin. - The max duration is larger than the min duration. - The max offset is larger than the min offset. Emits the event `MaintenanceConfigUpdated`.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"totalSchedules()\":{\"details\":\"Returns the total of current schedules.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"}},\"stateVariables\":{\"_schedule\":{\"details\":\"Mapping from consensus address => maintenance schedule.\"},\"cooldownSecsToMaintain\":{\"details\":\"The cooldown time to request new schedule.\"},\"maxMaintenanceDurationInBlock\":{\"details\":\"The max duration to maintenance in blocks.\"},\"maxOffsetToStartSchedule\":{\"details\":\"The offset to the max block number that the schedule can start.\"},\"maxSchedules\":{\"details\":\"The max number of scheduled maintenances.\"},\"minMaintenanceDurationInBlock\":{\"details\":\"The min duration to maintenance in blocks.\"},\"minOffsetToStartSchedule\":{\"details\":\"The offset to the min block number that the schedule can start.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/Maintenance.sol\":\"Maintenance\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IMaintenance {\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\\n */\\n function checkScheduled(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr`\\n */\\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\\n */\\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedules() external view returns (uint256 _count);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedules() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4f06c8f3ad7ec8b863882c655ddf443675d557272445e51d8a1e1f3454089d09\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - min(a, b);\\n }\\n}\\n\",\"keccak256\":\"0xa9e2a3ad43d7999a3cdbfb040b0f2dec282eae91ff8fe6ad26fdd19087121ce7\",\"license\":\"UNLICENSED\"},\"contracts/ronin/Maintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../interfaces/IMaintenance.sol\\\";\\nimport \\\"../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../libraries/Math.sol\\\";\\n\\ncontract Maintenance is IMaintenance, HasValidatorContract, Initializable {\\n using Math for uint256;\\n\\n /// @dev Mapping from consensus address => maintenance schedule.\\n mapping(address => Schedule) internal _schedule;\\n\\n /// @dev The min duration to maintenance in blocks.\\n uint256 public minMaintenanceDurationInBlock;\\n /// @dev The max duration to maintenance in blocks.\\n uint256 public maxMaintenanceDurationInBlock;\\n /// @dev The offset to the min block number that the schedule can start.\\n uint256 public minOffsetToStartSchedule;\\n /// @dev The offset to the max block number that the schedule can start.\\n uint256 public maxOffsetToStartSchedule;\\n /// @dev The max number of scheduled maintenances.\\n uint256 public maxSchedules;\\n /// @dev The cooldown time to request new schedule.\\n uint256 public cooldownSecsToMaintain;\\n\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external initializer {\\n _setValidatorContract(__validatorContract);\\n _setMaintenanceConfig(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external onlyAdmin {\\n _setMaintenanceConfig(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external override {\\n IRoninValidatorSet _validator = _validatorContract;\\n\\n require(_validator.isBlockProducer(_consensusAddr), \\\"Maintenance: consensus address must be a block producer\\\");\\n require(\\n _validator.isCandidateAdmin(_consensusAddr, msg.sender),\\n \\\"Maintenance: method caller must be a candidate admin\\\"\\n );\\n require(!checkScheduled(_consensusAddr), \\\"Maintenance: already scheduled\\\");\\n require(checkCooldownEnds(_consensusAddr), \\\"Maintainance: cooldown time not end\\\");\\n require(totalSchedules() < maxSchedules, \\\"Maintenance: exceeds total of schedules\\\");\\n require(\\n _startedAtBlock.inRange(block.number + minOffsetToStartSchedule, block.number + maxOffsetToStartSchedule),\\n \\\"Maintenance: start block is out of offset\\\"\\n );\\n require(_startedAtBlock < _endedAtBlock, \\\"Maintenance: start block must be less than end block\\\");\\n uint256 _blockPeriod = _endedAtBlock - _startedAtBlock;\\n require(\\n _blockPeriod.inRange(minMaintenanceDurationInBlock, maxMaintenanceDurationInBlock),\\n \\\"Maintenance: invalid maintenance duration\\\"\\n );\\n require(_validator.epochEndingAt(_startedAtBlock - 1), \\\"Maintenance: start block is not at the start of an epoch\\\");\\n require(_validator.epochEndingAt(_endedAtBlock), \\\"Maintenance: end block is not at the end of an epoch\\\");\\n\\n Schedule storage _sSchedule = _schedule[_consensusAddr];\\n _sSchedule.from = _startedAtBlock;\\n _sSchedule.to = _endedAtBlock;\\n _sSchedule.lastUpdatedBlock = block.number;\\n _sSchedule.requestTimestamp = block.timestamp;\\n emit MaintenanceScheduled(_consensusAddr, _sSchedule);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function cancelSchedule(address _consensusAddr) external override {\\n require(\\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\\n \\\"Maintenance: method caller must be the candidate admin\\\"\\n );\\n require(checkScheduled(_consensusAddr), \\\"Maintenance: no schedule exists\\\");\\n require(!checkMaintained(_consensusAddr, block.number), \\\"Maintenance: already on maintenance\\\");\\n Schedule storage _sSchedule = _schedule[_consensusAddr];\\n delete _sSchedule.from;\\n delete _sSchedule.to;\\n _sSchedule.lastUpdatedBlock = block.number;\\n emit MaintenanceScheduleCancelled(_consensusAddr);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function getSchedule(address _consensusAddr) external view override returns (Schedule memory) {\\n return _schedule[_consensusAddr];\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block)\\n external\\n view\\n override\\n returns (bool[] memory _resList)\\n {\\n _resList = new bool[](_addrList.length);\\n for (uint _i = 0; _i < _addrList.length; _i++) {\\n _resList[_i] = checkMaintained(_addrList[_i], _block);\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view override returns (bool[] memory _resList) {\\n _resList = new bool[](_addrList.length);\\n for (uint _i = 0; _i < _addrList.length; _i++) {\\n _resList[_i] = _maintainingInBlockRange(_addrList[_i], _fromBlock, _toBlock);\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function totalSchedules() public view override returns (uint256 _count) {\\n (address[] memory _validators, , ) = _validatorContract.getValidators();\\n for (uint _i = 0; _i < _validators.length; _i++) {\\n if (checkScheduled(_validators[_i])) {\\n _count++;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) public view override returns (bool) {\\n Schedule storage _s = _schedule[_consensusAddr];\\n return _s.from <= _block && _block <= _s.to;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) public view override returns (bool) {\\n return _maintainingInBlockRange(_consensusAddr, _fromBlock, _toBlock);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkScheduled(address _consensusAddr) public view override returns (bool) {\\n return block.number <= _schedule[_consensusAddr].to;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkCooldownEnds(address _consensusAddr) public view override returns (bool) {\\n return block.timestamp > _schedule[_consensusAddr].requestTimestamp + cooldownSecsToMaintain;\\n }\\n\\n /**\\n * @dev Sets the min block period and max block period to maintenance.\\n *\\n * Requirements:\\n * - The max period is larger than the min period.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function _setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) internal {\\n require(\\n _minMaintenanceDurationInBlock < _maxMaintenanceDurationInBlock,\\n \\\"Maintenance: invalid maintenance duration configs\\\"\\n );\\n require(\\n _minOffsetToStartSchedule < _maxOffsetToStartSchedule,\\n \\\"Maintenance: invalid offset to start schedule configs\\\"\\n );\\n minMaintenanceDurationInBlock = _minMaintenanceDurationInBlock;\\n maxMaintenanceDurationInBlock = _maxMaintenanceDurationInBlock;\\n minOffsetToStartSchedule = _minOffsetToStartSchedule;\\n maxOffsetToStartSchedule = _maxOffsetToStartSchedule;\\n maxSchedules = _maxSchedules;\\n cooldownSecsToMaintain = _cooldownSecsToMaintain;\\n emit MaintenanceConfigUpdated(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @dev Check if the validator was maintaining in the current period.\\n *\\n * Note: This method should be called at the end of the period.\\n */\\n function _maintainingInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) private view returns (bool) {\\n Schedule storage _s = _schedule[_consensusAddr];\\n return Math.twoRangeOverlap(_fromBlock, _toBlock, _s.from, _s.to);\\n }\\n}\\n\",\"keccak256\":\"0x70394a9a86001a6a10034bbe45ac94b789bc1d8270836fac8a9b7b3eb87df459\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100eb565b600054600160a81b900460ff161561008c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff600160a01b909104811610156100e9576000805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b611803806100fa6000396000f3fe608060405234801561001057600080fd5b50600436106100fc5760003560e01c8063088e8de71461010157806309e34c38146101295780630fbeb37f146101405780632d538c2c146101535780632ddc08a2146101685780637a50802d1461017b5780638142951a14610184578063965720af14610197578063994390891461019f578063b59f403e146101b8578063ba303755146101cb578063bc1710e9146101eb578063bfa89b9b146101f4578063c09fe460146101fd578063c44cb23314610210578063cdf64a7614610219578063d39fee341461022c578063dec3628414610272578063f0caaafb1461027b578063fdadda811461028e575b600080fd5b61011461010f36600461127f565b6102a1565b60405190151581526020015b60405180910390f35b61013260025481565b604051908152602001610120565b61011461014e3660046112b4565b6102b6565b61016661016136600461127f565b6102ed565b005b6101146101763660046112e0565b610954565b61013260055481565b610166610192366004611304565b610976565b610132610ab8565b6000546001600160a01b03166040516101209190611359565b6101146101c63660046112e0565b610b85565b6101de6101d93660046113b8565b610bb7565b6040516101209190611408565b61013260045481565b61013260035481565b61016661020b36600461144e565b610c76565b61013260065481565b6101666102273660046112e0565b610cc4565b61023f61023a3660046112e0565b610d33565b60405161012091908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b61013260075481565b6101666102893660046112e0565b610dab565b6101de61029c366004611491565b610f84565b60006102ae848484611041565b949350505050565b6001600160a01b0382166000908152600160205260408120805483108015906102e3575080600101548311155b9150505b92915050565b600054604051633292276760e11b81526001600160a01b039091169081906365244ece9061031f908790600401611359565b602060405180830381865afa15801561033c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036091906114dc565b6103d15760405162461bcd60e51b815260206004820152603760248201527f4d61696e74656e616e63653a20636f6e73656e7375732061646472657373206d6044820152763ab9ba103132903090313637b1b590383937b23ab1b2b960491b60648201526084015b60405180910390fd5b6040516304d971ab60e01b81526001600160a01b038216906304d971ab906103ff90879033906004016114fe565b602060405180830381865afa15801561041c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044091906114dc565b6104975760405162461bcd60e51b8152602060048201526034602482015260008051602061178e833981519152604482015273313290309031b0b73234b230ba329030b236b4b760611b60648201526084016103c8565b6104a084610954565b156104ed5760405162461bcd60e51b815260206004820152601e60248201527f4d61696e74656e616e63653a20616c7265616479207363686564756c6564000060448201526064016103c8565b6104f684610b85565b61054e5760405162461bcd60e51b815260206004820152602360248201527f4d61696e7461696e616e63653a20636f6f6c646f776e2074696d65206e6f7420604482015262195b9960ea1b60648201526084016103c8565b600654610559610ab8565b106105b65760405162461bcd60e51b815260206004820152602760248201527f4d61696e74656e616e63653a206578636565647320746f74616c206f66207363604482015266686564756c657360c81b60648201526084016103c8565b6105dc600454436105c7919061152e565b6005546105d4904361152e565b859190611079565b61063a5760405162461bcd60e51b815260206004820152602960248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206f7574206044820152681bd9881bd9999cd95d60ba1b60648201526084016103c8565b8183106106a65760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20737461727420626c6f636b206d757374206265604482015273206c657373207468616e20656e6420626c6f636b60601b60648201526084016103c8565b60006106b28484611541565b90506106cd600254600354836110799092919063ffffffff16565b6107195760405162461bcd60e51b815260206004820152602960248201526000805160206117ae83398151915260448201526810323ab930ba34b7b760b91b60648201526084016103c8565b6001600160a01b038216637593ff71610733600187611541565b6040518263ffffffff1660e01b815260040161075191815260200190565b602060405180830381865afa15801561076e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079291906114dc565b6107ff5760405162461bcd60e51b815260206004820152603860248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206e6f74206044820152770c2e840e8d0ca40e6e8c2e4e840decc40c2dc40cae0dec6d60431b60648201526084016103c8565b604051637593ff7160e01b8152600481018490526001600160a01b03831690637593ff7190602401602060405180830381865afa158015610844573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086891906114dc565b6108d15760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20656e6420626c6f636b206973206e6f74206174604482015273040e8d0ca40cadcc840decc40c2dc40cae0dec6d60631b60648201526084016103c8565b6001600160a01b0385166000818152600160208181526040928390208881559182018790554360028301819055426003840181905584518a815292830189905293820152606081019290925291907f48e8b2f7348b1ec693bbb999258a8d6bd514732a19c6057b6e2a56a4c405253b9060800160405180910390a2505050505050565b6001600160a01b03166000908152600160208190526040909120015443111590565b600054600160a81b900460ff161580801561099e57506000546001600160a01b90910460ff16105b806109bf5750303b1580156109bf5750600054600160a01b900460ff166001145b610a225760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103c8565b6000805460ff60a01b1916600160a01b1790558015610a4f576000805460ff60a81b1916600160a81b1790555b610a5888611090565b610a668787878787876110e6565b8015610aae576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600080546040805163b7ab4db560e01b8152905183926001600160a01b03169163b7ab4db591600480830192869291908290030181865afa158015610b01573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b299190810190611631565b5050905060005b8151811015610b8057610b5b828281518110610b4e57610b4e61171c565b6020026020010151610954565b15610b6e5782610b6a81611732565b9350505b80610b7881611732565b915050610b30565b505090565b6007546001600160a01b0382166000908152600160205260408120600301549091610baf9161152e565b421192915050565b6060836001600160401b03811115610bd157610bd1611554565b604051908082528060200260200182016040528015610bfa578160200160208202803683370190505b50905060005b84811015610c6d57610c39868683818110610c1d57610c1d61171c565b9050602002016020810190610c3291906112e0565b8585611041565b828281518110610c4b57610c4b61171c565b9115156020928302919091019091015280610c6581611732565b915050610c00565b50949350505050565b610c7e611226565b6001600160a01b0316336001600160a01b031614610cae5760405162461bcd60e51b81526004016103c89061174b565b610cbc8686868686866110e6565b505050505050565b610ccc611226565b6001600160a01b0316336001600160a01b031614610cfc5760405162461bcd60e51b81526004016103c89061174b565b806001600160a01b03163b600003610d2757604051637bcd509160e01b815260040160405180910390fd5b610d3081611090565b50565b610d5e6040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b03166000908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b6000546040516304d971ab60e01b81526001600160a01b03909116906304d971ab90610ddd90849033906004016114fe565b602060405180830381865afa158015610dfa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1e91906114dc565b610e775760405162461bcd60e51b8152602060048201526036602482015260008051602061178e8339815191526044820152753132903a34329031b0b73234b230ba329030b236b4b760511b60648201526084016103c8565b610e8081610954565b610ecc5760405162461bcd60e51b815260206004820152601f60248201527f4d61696e74656e616e63653a206e6f207363686564756c65206578697374730060448201526064016103c8565b610ed681436102b6565b15610f2f5760405162461bcd60e51b815260206004820152602360248201527f4d61696e74656e616e63653a20616c7265616479206f6e206d61696e74656e616044820152626e636560e81b60648201526084016103c8565b6001600160a01b0381166000818152600160208190526040808320838155918201839055436002830155519092917f72720a31deb222f77bbf95b88a540154648466770e5f41328ee1e25e5050737791a25050565b6060826001600160401b03811115610f9e57610f9e611554565b604051908082528060200260200182016040528015610fc7578160200160208202803683370190505b50905060005b8381101561103957611005858583818110610fea57610fea61171c565b9050602002016020810190610fff91906112e0565b846102b6565b8282815181106110175761101761171c565b911515602092830291909101909101528061103181611732565b915050610fcd565b509392505050565b6001600160a01b0383166000908152600160208190526040822080549181015490916110709186918691611254565b95945050505050565b60008383111580156102ae57505090911115919050565b600080546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906110db908390611359565b60405180910390a150565b84861061113d5760405162461bcd60e51b815260206004820152603160248201526000805160206117ae833981519152604482015270206475726174696f6e20636f6e6669677360781b60648201526084016103c8565b8284106111aa5760405162461bcd60e51b815260206004820152603560248201527f4d61696e74656e616e63653a20696e76616c6964206f666673657420746f207360448201527474617274207363686564756c6520636f6e6669677360581b60648201526084016103c8565b6002869055600385905560048490556005839055600682905560078190556040805187815260208101879052908101859052606081018490526080810183905260a081018290527f4edb6adef66a4b8e1ffbc8c67640d4f244ce904193fd65e5cc316bbb74b2e59b9060c00160405180910390a1505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b6000818511158015611070575050501115919050565b6001600160a01b0381168114610d3057600080fd5b60008060006060848603121561129457600080fd5b833561129f8161126a565b95602085013595506040909401359392505050565b600080604083850312156112c757600080fd5b82356112d28161126a565b946020939093013593505050565b6000602082840312156112f257600080fd5b81356112fd8161126a565b9392505050565b600080600080600080600060e0888a03121561131f57600080fd5b873561132a8161126a565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b6001600160a01b0391909116815260200190565b60008083601f84011261137f57600080fd5b5081356001600160401b0381111561139657600080fd5b6020830191508360208260051b85010111156113b157600080fd5b9250929050565b600080600080606085870312156113ce57600080fd5b84356001600160401b038111156113e457600080fd5b6113f08782880161136d565b90989097506020870135966040013595509350505050565b6020808252825182820181905260009190848201906040850190845b81811015611442578351151583529284019291840191600101611424565b50909695505050505050565b60008060008060008060c0878903121561146757600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6000806000604084860312156114a657600080fd5b83356001600160401b038111156114bc57600080fd5b6114c88682870161136d565b909790965060209590950135949350505050565b6000602082840312156114ee57600080fd5b815180151581146112fd57600080fd5b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611518565b818103818111156102e7576102e7611518565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561159257611592611554565b604052919050565b60006001600160401b038211156115b3576115b3611554565b5060051b60200190565b600082601f8301126115ce57600080fd5b815160206115e36115de8361159a565b61156a565b82815260059290921b8401810191818101908684111561160257600080fd5b8286015b848110156116265780516116198161126a565b8352918301918301611606565b509695505050505050565b60008060006060848603121561164657600080fd5b83516001600160401b038082111561165d57600080fd5b611669878388016115bd565b945060209150818601518181111561168057600080fd5b61168c888289016115bd565b9450506040860151818111156116a157600080fd5b86019050601f810187136116b457600080fd5b80516116c26115de8261159a565b81815260059190911b820183019083810190898311156116e157600080fd5b928401925b8284101561170d578351600481106116fe5760008081fd5b825292840192908401906116e6565b80955050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b60006001820161174457611744611518565b5060010190565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b60608201526080019056fe4d61696e74656e616e63653a206d6574686f642063616c6c6572206d757374204d61696e74656e616e63653a20696e76616c6964206d61696e74656e616e6365a2646970667358221220ba70425233da8df83eeda8288af90274d56c5a12aa1b09429fc9395200f148d864736f6c63430008110033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100fc5760003560e01c8063088e8de71461010157806309e34c38146101295780630fbeb37f146101405780632d538c2c146101535780632ddc08a2146101685780637a50802d1461017b5780638142951a14610184578063965720af14610197578063994390891461019f578063b59f403e146101b8578063ba303755146101cb578063bc1710e9146101eb578063bfa89b9b146101f4578063c09fe460146101fd578063c44cb23314610210578063cdf64a7614610219578063d39fee341461022c578063dec3628414610272578063f0caaafb1461027b578063fdadda811461028e575b600080fd5b61011461010f36600461127f565b6102a1565b60405190151581526020015b60405180910390f35b61013260025481565b604051908152602001610120565b61011461014e3660046112b4565b6102b6565b61016661016136600461127f565b6102ed565b005b6101146101763660046112e0565b610954565b61013260055481565b610166610192366004611304565b610976565b610132610ab8565b6000546001600160a01b03166040516101209190611359565b6101146101c63660046112e0565b610b85565b6101de6101d93660046113b8565b610bb7565b6040516101209190611408565b61013260045481565b61013260035481565b61016661020b36600461144e565b610c76565b61013260065481565b6101666102273660046112e0565b610cc4565b61023f61023a3660046112e0565b610d33565b60405161012091908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b61013260075481565b6101666102893660046112e0565b610dab565b6101de61029c366004611491565b610f84565b60006102ae848484611041565b949350505050565b6001600160a01b0382166000908152600160205260408120805483108015906102e3575080600101548311155b9150505b92915050565b600054604051633292276760e11b81526001600160a01b039091169081906365244ece9061031f908790600401611359565b602060405180830381865afa15801561033c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036091906114dc565b6103d15760405162461bcd60e51b815260206004820152603760248201527f4d61696e74656e616e63653a20636f6e73656e7375732061646472657373206d6044820152763ab9ba103132903090313637b1b590383937b23ab1b2b960491b60648201526084015b60405180910390fd5b6040516304d971ab60e01b81526001600160a01b038216906304d971ab906103ff90879033906004016114fe565b602060405180830381865afa15801561041c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044091906114dc565b6104975760405162461bcd60e51b8152602060048201526034602482015260008051602061178e833981519152604482015273313290309031b0b73234b230ba329030b236b4b760611b60648201526084016103c8565b6104a084610954565b156104ed5760405162461bcd60e51b815260206004820152601e60248201527f4d61696e74656e616e63653a20616c7265616479207363686564756c6564000060448201526064016103c8565b6104f684610b85565b61054e5760405162461bcd60e51b815260206004820152602360248201527f4d61696e7461696e616e63653a20636f6f6c646f776e2074696d65206e6f7420604482015262195b9960ea1b60648201526084016103c8565b600654610559610ab8565b106105b65760405162461bcd60e51b815260206004820152602760248201527f4d61696e74656e616e63653a206578636565647320746f74616c206f66207363604482015266686564756c657360c81b60648201526084016103c8565b6105dc600454436105c7919061152e565b6005546105d4904361152e565b859190611079565b61063a5760405162461bcd60e51b815260206004820152602960248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206f7574206044820152681bd9881bd9999cd95d60ba1b60648201526084016103c8565b8183106106a65760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20737461727420626c6f636b206d757374206265604482015273206c657373207468616e20656e6420626c6f636b60601b60648201526084016103c8565b60006106b28484611541565b90506106cd600254600354836110799092919063ffffffff16565b6107195760405162461bcd60e51b815260206004820152602960248201526000805160206117ae83398151915260448201526810323ab930ba34b7b760b91b60648201526084016103c8565b6001600160a01b038216637593ff71610733600187611541565b6040518263ffffffff1660e01b815260040161075191815260200190565b602060405180830381865afa15801561076e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079291906114dc565b6107ff5760405162461bcd60e51b815260206004820152603860248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206e6f74206044820152770c2e840e8d0ca40e6e8c2e4e840decc40c2dc40cae0dec6d60431b60648201526084016103c8565b604051637593ff7160e01b8152600481018490526001600160a01b03831690637593ff7190602401602060405180830381865afa158015610844573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061086891906114dc565b6108d15760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20656e6420626c6f636b206973206e6f74206174604482015273040e8d0ca40cadcc840decc40c2dc40cae0dec6d60631b60648201526084016103c8565b6001600160a01b0385166000818152600160208181526040928390208881559182018790554360028301819055426003840181905584518a815292830189905293820152606081019290925291907f48e8b2f7348b1ec693bbb999258a8d6bd514732a19c6057b6e2a56a4c405253b9060800160405180910390a2505050505050565b6001600160a01b03166000908152600160208190526040909120015443111590565b600054600160a81b900460ff161580801561099e57506000546001600160a01b90910460ff16105b806109bf5750303b1580156109bf5750600054600160a01b900460ff166001145b610a225760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103c8565b6000805460ff60a01b1916600160a01b1790558015610a4f576000805460ff60a81b1916600160a81b1790555b610a5888611090565b610a668787878787876110e6565b8015610aae576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600080546040805163b7ab4db560e01b8152905183926001600160a01b03169163b7ab4db591600480830192869291908290030181865afa158015610b01573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b299190810190611631565b5050905060005b8151811015610b8057610b5b828281518110610b4e57610b4e61171c565b6020026020010151610954565b15610b6e5782610b6a81611732565b9350505b80610b7881611732565b915050610b30565b505090565b6007546001600160a01b0382166000908152600160205260408120600301549091610baf9161152e565b421192915050565b6060836001600160401b03811115610bd157610bd1611554565b604051908082528060200260200182016040528015610bfa578160200160208202803683370190505b50905060005b84811015610c6d57610c39868683818110610c1d57610c1d61171c565b9050602002016020810190610c3291906112e0565b8585611041565b828281518110610c4b57610c4b61171c565b9115156020928302919091019091015280610c6581611732565b915050610c00565b50949350505050565b610c7e611226565b6001600160a01b0316336001600160a01b031614610cae5760405162461bcd60e51b81526004016103c89061174b565b610cbc8686868686866110e6565b505050505050565b610ccc611226565b6001600160a01b0316336001600160a01b031614610cfc5760405162461bcd60e51b81526004016103c89061174b565b806001600160a01b03163b600003610d2757604051637bcd509160e01b815260040160405180910390fd5b610d3081611090565b50565b610d5e6040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b03166000908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b6000546040516304d971ab60e01b81526001600160a01b03909116906304d971ab90610ddd90849033906004016114fe565b602060405180830381865afa158015610dfa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e1e91906114dc565b610e775760405162461bcd60e51b8152602060048201526036602482015260008051602061178e8339815191526044820152753132903a34329031b0b73234b230ba329030b236b4b760511b60648201526084016103c8565b610e8081610954565b610ecc5760405162461bcd60e51b815260206004820152601f60248201527f4d61696e74656e616e63653a206e6f207363686564756c65206578697374730060448201526064016103c8565b610ed681436102b6565b15610f2f5760405162461bcd60e51b815260206004820152602360248201527f4d61696e74656e616e63653a20616c7265616479206f6e206d61696e74656e616044820152626e636560e81b60648201526084016103c8565b6001600160a01b0381166000818152600160208190526040808320838155918201839055436002830155519092917f72720a31deb222f77bbf95b88a540154648466770e5f41328ee1e25e5050737791a25050565b6060826001600160401b03811115610f9e57610f9e611554565b604051908082528060200260200182016040528015610fc7578160200160208202803683370190505b50905060005b8381101561103957611005858583818110610fea57610fea61171c565b9050602002016020810190610fff91906112e0565b846102b6565b8282815181106110175761101761171c565b911515602092830291909101909101528061103181611732565b915050610fcd565b509392505050565b6001600160a01b0383166000908152600160208190526040822080549181015490916110709186918691611254565b95945050505050565b60008383111580156102ae57505090911115919050565b600080546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906110db908390611359565b60405180910390a150565b84861061113d5760405162461bcd60e51b815260206004820152603160248201526000805160206117ae833981519152604482015270206475726174696f6e20636f6e6669677360781b60648201526084016103c8565b8284106111aa5760405162461bcd60e51b815260206004820152603560248201527f4d61696e74656e616e63653a20696e76616c6964206f666673657420746f207360448201527474617274207363686564756c6520636f6e6669677360581b60648201526084016103c8565b6002869055600385905560048490556005839055600682905560078190556040805187815260208101879052908101859052606081018490526080810183905260a081018290527f4edb6adef66a4b8e1ffbc8c67640d4f244ce904193fd65e5cc316bbb74b2e59b9060c00160405180910390a1505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b6000818511158015611070575050501115919050565b6001600160a01b0381168114610d3057600080fd5b60008060006060848603121561129457600080fd5b833561129f8161126a565b95602085013595506040909401359392505050565b600080604083850312156112c757600080fd5b82356112d28161126a565b946020939093013593505050565b6000602082840312156112f257600080fd5b81356112fd8161126a565b9392505050565b600080600080600080600060e0888a03121561131f57600080fd5b873561132a8161126a565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b6001600160a01b0391909116815260200190565b60008083601f84011261137f57600080fd5b5081356001600160401b0381111561139657600080fd5b6020830191508360208260051b85010111156113b157600080fd5b9250929050565b600080600080606085870312156113ce57600080fd5b84356001600160401b038111156113e457600080fd5b6113f08782880161136d565b90989097506020870135966040013595509350505050565b6020808252825182820181905260009190848201906040850190845b81811015611442578351151583529284019291840191600101611424565b50909695505050505050565b60008060008060008060c0878903121561146757600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6000806000604084860312156114a657600080fd5b83356001600160401b038111156114bc57600080fd5b6114c88682870161136d565b909790965060209590950135949350505050565b6000602082840312156114ee57600080fd5b815180151581146112fd57600080fd5b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611518565b818103818111156102e7576102e7611518565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561159257611592611554565b604052919050565b60006001600160401b038211156115b3576115b3611554565b5060051b60200190565b600082601f8301126115ce57600080fd5b815160206115e36115de8361159a565b61156a565b82815260059290921b8401810191818101908684111561160257600080fd5b8286015b848110156116265780516116198161126a565b8352918301918301611606565b509695505050505050565b60008060006060848603121561164657600080fd5b83516001600160401b038082111561165d57600080fd5b611669878388016115bd565b945060209150818601518181111561168057600080fd5b61168c888289016115bd565b9450506040860151818111156116a157600080fd5b86019050601f810187136116b457600080fd5b80516116c26115de8261159a565b81815260059190911b820183019083810190898311156116e157600080fd5b928401925b8284101561170d578351600481106116fe5760008081fd5b825292840192908401906116e6565b80955050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b60006001820161174457611744611518565b5060010190565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b60608201526080019056fe4d61696e74656e616e63653a206d6574686f642063616c6c6572206d757374204d61696e74656e616e63653a20696e76616c6964206d61696e74656e616e6365a2646970667358221220ba70425233da8df83eeda8288af90274d56c5a12aa1b09429fc9395200f148d864736f6c63430008110033", + "numDeployments": 2, + "solcInputHash": "85b953b22882c536a643bf4b61b3153b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxSchedules\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"MaintenanceConfigUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"}],\"name\":\"MaintenanceScheduleCancelled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"components\":[{\"internalType\":\"uint256\",\"name\":\"from\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"to\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdatedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestTimestamp\",\"type\":\"uint256\"}],\"indexed\":false,\"internalType\":\"struct IMaintenance.Schedule\",\"name\":\"\",\"type\":\"tuple\"}],\"name\":\"MaintenanceScheduled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"cancelSchedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkCooldownEnds\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"checkMaintained\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_toBlock\",\"type\":\"uint256\"}],\"name\":\"checkMaintainedInBlockRange\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintained\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_resList\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_fromBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_toBlock\",\"type\":\"uint256\"}],\"name\":\"checkManyMaintainedInBlockRange\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_resList\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkScheduled\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownSecsToMaintain\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getSchedule\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"from\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"to\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"lastUpdatedBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"requestTimestamp\",\"type\":\"uint256\"}],\"internalType\":\"struct IMaintenance.Schedule\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxSchedules\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxMaintenanceDurationInBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxOffsetToStartSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxSchedules\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minMaintenanceDurationInBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minOffsetToStartSchedule\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_startedAtBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_endedAtBlock\",\"type\":\"uint256\"}],\"name\":\"schedule\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxMaintenanceDurationInBlock\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_minOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxOffsetToStartSchedule\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxSchedules\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_cooldownSecsToMaintain\",\"type\":\"uint256\"}],\"name\":\"setMaintenanceConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalSchedules\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_count\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"errors\":{\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}]},\"kind\":\"dev\",\"methods\":{\"cancelSchedule(address)\":{\"details\":\"Cancel the schedule of maintenance for the `_consensusAddr`. Requirements: - The candidate `_consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `_consensusAddr`. - A schedule for the `_consensusAddr` must be existent and not executed yet. Emits the event `MaintenanceScheduleCancelled`.\"},\"checkCooldownEnds(address)\":{\"details\":\"Returns whether the validator `_consensusAddr`\"},\"checkMaintained(address,uint256)\":{\"details\":\"Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\"},\"checkMaintainedInBlockRange(address,uint256,uint256)\":{\"details\":\"Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\"},\"checkManyMaintained(address[],uint256)\":{\"details\":\"Returns the bool array indicating the validators maintained at block number `_block` or not.\"},\"checkManyMaintainedInBlockRange(address[],uint256,uint256)\":{\"details\":\"Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\"},\"checkScheduled(address)\":{\"details\":\"Returns whether the validator `_consensusAddr` has scheduled.\"},\"getSchedule(address)\":{\"details\":\"Returns the detailed schedule of the validator `_consensusAddr`.\"},\"initialize(address,uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"schedule(address,uint256,uint256)\":{\"details\":\"Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`. Requirements: - The candidate `_consensusAddr` is the block producer. - The method caller is candidate admin of the candidate `_consensusAddr`. - The candidate `_consensusAddr` has no schedule yet or the previous is done. - The total number of schedules is not larger than `maxSchedules()`. - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block. - The end block is larger than the start block. - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`. - The start block is at the start of an epoch. - The end block is at the end of an epoch. Emits the event `MaintenanceScheduled`.\"},\"setMaintenanceConfig(uint256,uint256,uint256,uint256,uint256,uint256)\":{\"details\":\"Sets the duration restriction, start time restriction, and max allowed for maintenance. Requirements: - The method caller is admin. - The max duration is larger than the min duration. - The max offset is larger than the min offset. Emits the event `MaintenanceConfigUpdated`.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"totalSchedules()\":{\"details\":\"Returns the total of current schedules.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"}},\"stateVariables\":{\"_schedule\":{\"details\":\"Mapping from consensus address => maintenance schedule.\"},\"cooldownSecsToMaintain\":{\"details\":\"The cooldown time to request new schedule.\"},\"maxMaintenanceDurationInBlock\":{\"details\":\"The max duration to maintenance in blocks.\"},\"maxOffsetToStartSchedule\":{\"details\":\"The offset to the max block number that the schedule can start.\"},\"maxSchedules\":{\"details\":\"The max number of scheduled maintenances.\"},\"minMaintenanceDurationInBlock\":{\"details\":\"The min duration to maintenance in blocks.\"},\"minOffsetToStartSchedule\":{\"details\":\"The offset to the min block number that the schedule can start.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/Maintenance.sol\":\"Maintenance\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IMaintenance {\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\\n */\\n function checkScheduled(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr`\\n */\\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\\n */\\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedules() external view returns (uint256 _count);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedules() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4f06c8f3ad7ec8b863882c655ddf443675d557272445e51d8a1e1f3454089d09\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xf719e74bc39be7aceb4e5cc455260f81b2b21e83aa693e0b50c390c9909e08c4\",\"license\":\"UNLICENSED\"},\"contracts/ronin/Maintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../interfaces/IMaintenance.sol\\\";\\nimport \\\"../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../libraries/Math.sol\\\";\\n\\ncontract Maintenance is IMaintenance, HasValidatorContract, Initializable {\\n using Math for uint256;\\n\\n /// @dev Mapping from consensus address => maintenance schedule.\\n mapping(address => Schedule) internal _schedule;\\n\\n /// @dev The min duration to maintenance in blocks.\\n uint256 public minMaintenanceDurationInBlock;\\n /// @dev The max duration to maintenance in blocks.\\n uint256 public maxMaintenanceDurationInBlock;\\n /// @dev The offset to the min block number that the schedule can start.\\n uint256 public minOffsetToStartSchedule;\\n /// @dev The offset to the max block number that the schedule can start.\\n uint256 public maxOffsetToStartSchedule;\\n /// @dev The max number of scheduled maintenances.\\n uint256 public maxSchedules;\\n /// @dev The cooldown time to request new schedule.\\n uint256 public cooldownSecsToMaintain;\\n\\n constructor() {\\n _disableInitializers();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external initializer {\\n _setValidatorContract(__validatorContract);\\n _setMaintenanceConfig(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external onlyAdmin {\\n _setMaintenanceConfig(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external override {\\n IRoninValidatorSet _validator = _validatorContract;\\n\\n require(_validator.isBlockProducer(_consensusAddr), \\\"Maintenance: consensus address must be a block producer\\\");\\n require(\\n _validator.isCandidateAdmin(_consensusAddr, msg.sender),\\n \\\"Maintenance: method caller must be a candidate admin\\\"\\n );\\n require(!checkScheduled(_consensusAddr), \\\"Maintenance: already scheduled\\\");\\n require(checkCooldownEnds(_consensusAddr), \\\"Maintainance: cooldown time not end\\\");\\n require(totalSchedules() < maxSchedules, \\\"Maintenance: exceeds total of schedules\\\");\\n require(\\n _startedAtBlock.inRange(block.number + minOffsetToStartSchedule, block.number + maxOffsetToStartSchedule),\\n \\\"Maintenance: start block is out of offset\\\"\\n );\\n require(_startedAtBlock < _endedAtBlock, \\\"Maintenance: start block must be less than end block\\\");\\n uint256 _maintenanceElapsed = _endedAtBlock - _startedAtBlock + 1;\\n require(\\n _maintenanceElapsed.inRange(minMaintenanceDurationInBlock, maxMaintenanceDurationInBlock),\\n \\\"Maintenance: invalid maintenance duration\\\"\\n );\\n require(_validator.epochEndingAt(_startedAtBlock - 1), \\\"Maintenance: start block is not at the start of an epoch\\\");\\n require(_validator.epochEndingAt(_endedAtBlock), \\\"Maintenance: end block is not at the end of an epoch\\\");\\n\\n Schedule storage _sSchedule = _schedule[_consensusAddr];\\n _sSchedule.from = _startedAtBlock;\\n _sSchedule.to = _endedAtBlock;\\n _sSchedule.lastUpdatedBlock = block.number;\\n _sSchedule.requestTimestamp = block.timestamp;\\n emit MaintenanceScheduled(_consensusAddr, _sSchedule);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function cancelSchedule(address _consensusAddr) external override {\\n require(\\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\\n \\\"Maintenance: method caller must be the candidate admin\\\"\\n );\\n require(checkScheduled(_consensusAddr), \\\"Maintenance: no schedule exists\\\");\\n require(!checkMaintained(_consensusAddr, block.number), \\\"Maintenance: already on maintenance\\\");\\n Schedule storage _sSchedule = _schedule[_consensusAddr];\\n delete _sSchedule.from;\\n delete _sSchedule.to;\\n _sSchedule.lastUpdatedBlock = block.number;\\n emit MaintenanceScheduleCancelled(_consensusAddr);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function getSchedule(address _consensusAddr) external view override returns (Schedule memory) {\\n return _schedule[_consensusAddr];\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block)\\n external\\n view\\n override\\n returns (bool[] memory _resList)\\n {\\n _resList = new bool[](_addrList.length);\\n for (uint _i = 0; _i < _addrList.length; _i++) {\\n _resList[_i] = checkMaintained(_addrList[_i], _block);\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view override returns (bool[] memory _resList) {\\n _resList = new bool[](_addrList.length);\\n for (uint _i = 0; _i < _addrList.length; _i++) {\\n _resList[_i] = _maintainingInBlockRange(_addrList[_i], _fromBlock, _toBlock);\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function totalSchedules() public view override returns (uint256 _count) {\\n (address[] memory _validators, , ) = _validatorContract.getValidators();\\n for (uint _i = 0; _i < _validators.length; _i++) {\\n if (checkScheduled(_validators[_i])) {\\n _count++;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) public view override returns (bool) {\\n Schedule storage _s = _schedule[_consensusAddr];\\n return _s.from <= _block && _block <= _s.to;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) public view override returns (bool) {\\n return _maintainingInBlockRange(_consensusAddr, _fromBlock, _toBlock);\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkScheduled(address _consensusAddr) public view override returns (bool) {\\n return block.number <= _schedule[_consensusAddr].to;\\n }\\n\\n /**\\n * @inheritdoc IMaintenance\\n */\\n function checkCooldownEnds(address _consensusAddr) public view override returns (bool) {\\n return block.timestamp > _schedule[_consensusAddr].requestTimestamp + cooldownSecsToMaintain;\\n }\\n\\n /**\\n * @dev Sets the min block period and max block period to maintenance.\\n *\\n * Requirements:\\n * - The max period is larger than the min period.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function _setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) internal {\\n require(\\n _minMaintenanceDurationInBlock < _maxMaintenanceDurationInBlock,\\n \\\"Maintenance: invalid maintenance duration configs\\\"\\n );\\n require(\\n _minOffsetToStartSchedule < _maxOffsetToStartSchedule,\\n \\\"Maintenance: invalid offset to start schedule configs\\\"\\n );\\n minMaintenanceDurationInBlock = _minMaintenanceDurationInBlock;\\n maxMaintenanceDurationInBlock = _maxMaintenanceDurationInBlock;\\n minOffsetToStartSchedule = _minOffsetToStartSchedule;\\n maxOffsetToStartSchedule = _maxOffsetToStartSchedule;\\n maxSchedules = _maxSchedules;\\n cooldownSecsToMaintain = _cooldownSecsToMaintain;\\n emit MaintenanceConfigUpdated(\\n _minMaintenanceDurationInBlock,\\n _maxMaintenanceDurationInBlock,\\n _minOffsetToStartSchedule,\\n _maxOffsetToStartSchedule,\\n _maxSchedules,\\n _cooldownSecsToMaintain\\n );\\n }\\n\\n /**\\n * @dev Check if the validator was maintaining in the current period.\\n *\\n * Note: This method should be called at the end of the period.\\n */\\n function _maintainingInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) private view returns (bool) {\\n Schedule storage _s = _schedule[_consensusAddr];\\n return Math.twoRangeOverlap(_fromBlock, _toBlock, _s.from, _s.to);\\n }\\n}\\n\",\"keccak256\":\"0xc7fc2e02a52063b981007e05eeb4db953b2e35fe4a6497f351a6e86dc38878c2\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x608060405234801561001057600080fd5b5061001961001e565b6100eb565b600054600160a81b900460ff161561008c5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff600160a01b909104811610156100e9576000805460ff60a01b191660ff60a01b17905560405160ff81527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b61180e806100fa6000396000f3fe608060405234801561001057600080fd5b50600436106100fc5760003560e01c8063088e8de71461010157806309e34c38146101295780630fbeb37f146101405780632d538c2c146101535780632ddc08a2146101685780637a50802d1461017b5780638142951a14610184578063965720af14610197578063994390891461019f578063b59f403e146101b8578063ba303755146101cb578063bc1710e9146101eb578063bfa89b9b146101f4578063c09fe460146101fd578063c44cb23314610210578063cdf64a7614610219578063d39fee341461022c578063dec3628414610272578063f0caaafb1461027b578063fdadda811461028e575b600080fd5b61011461010f36600461128a565b6102a1565b60405190151581526020015b60405180910390f35b61013260025481565b604051908152602001610120565b61011461014e3660046112bf565b6102b6565b61016661016136600461128a565b6102ed565b005b6101146101763660046112eb565b61095f565b61013260055481565b61016661019236600461130f565b610981565b610132610ac3565b6000546001600160a01b03166040516101209190611364565b6101146101c63660046112eb565b610b90565b6101de6101d93660046113c3565b610bc2565b6040516101209190611413565b61013260045481565b61013260035481565b61016661020b366004611459565b610c81565b61013260065481565b6101666102273660046112eb565b610ccf565b61023f61023a3660046112eb565b610d3e565b60405161012091908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b61013260075481565b6101666102893660046112eb565b610db6565b6101de61029c36600461149c565b610f8f565b60006102ae84848461104c565b949350505050565b6001600160a01b0382166000908152600160205260408120805483108015906102e3575080600101548311155b9150505b92915050565b600054604051633292276760e11b81526001600160a01b039091169081906365244ece9061031f908790600401611364565b602060405180830381865afa15801561033c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036091906114e7565b6103d15760405162461bcd60e51b815260206004820152603760248201527f4d61696e74656e616e63653a20636f6e73656e7375732061646472657373206d6044820152763ab9ba103132903090313637b1b590383937b23ab1b2b960491b60648201526084015b60405180910390fd5b6040516304d971ab60e01b81526001600160a01b038216906304d971ab906103ff9087903390600401611509565b602060405180830381865afa15801561041c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044091906114e7565b6104975760405162461bcd60e51b81526020600482015260346024820152600080516020611799833981519152604482015273313290309031b0b73234b230ba329030b236b4b760611b60648201526084016103c8565b6104a08461095f565b156104ed5760405162461bcd60e51b815260206004820152601e60248201527f4d61696e74656e616e63653a20616c7265616479207363686564756c6564000060448201526064016103c8565b6104f684610b90565b61054e5760405162461bcd60e51b815260206004820152602360248201527f4d61696e7461696e616e63653a20636f6f6c646f776e2074696d65206e6f7420604482015262195b9960ea1b60648201526084016103c8565b600654610559610ac3565b106105b65760405162461bcd60e51b815260206004820152602760248201527f4d61696e74656e616e63653a206578636565647320746f74616c206f66207363604482015266686564756c657360c81b60648201526084016103c8565b6105dc600454436105c79190611539565b6005546105d49043611539565b859190611084565b61063a5760405162461bcd60e51b815260206004820152602960248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206f7574206044820152681bd9881bd9999cd95d60ba1b60648201526084016103c8565b8183106106a65760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20737461727420626c6f636b206d757374206265604482015273206c657373207468616e20656e6420626c6f636b60601b60648201526084016103c8565b60006106b2848461154c565b6106bd906001611539565b90506106d8600254600354836110849092919063ffffffff16565b6107245760405162461bcd60e51b815260206004820152602960248201526000805160206117b983398151915260448201526810323ab930ba34b7b760b91b60648201526084016103c8565b6001600160a01b038216637593ff7161073e60018761154c565b6040518263ffffffff1660e01b815260040161075c91815260200190565b602060405180830381865afa158015610779573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079d91906114e7565b61080a5760405162461bcd60e51b815260206004820152603860248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206e6f74206044820152770c2e840e8d0ca40e6e8c2e4e840decc40c2dc40cae0dec6d60431b60648201526084016103c8565b604051637593ff7160e01b8152600481018490526001600160a01b03831690637593ff7190602401602060405180830381865afa15801561084f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087391906114e7565b6108dc5760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20656e6420626c6f636b206973206e6f74206174604482015273040e8d0ca40cadcc840decc40c2dc40cae0dec6d60631b60648201526084016103c8565b6001600160a01b0385166000818152600160208181526040928390208881559182018790554360028301819055426003840181905584518a815292830189905293820152606081019290925291907f48e8b2f7348b1ec693bbb999258a8d6bd514732a19c6057b6e2a56a4c405253b9060800160405180910390a2505050505050565b6001600160a01b03166000908152600160208190526040909120015443111590565b600054600160a81b900460ff16158080156109a957506000546001600160a01b90910460ff16105b806109ca5750303b1580156109ca5750600054600160a01b900460ff166001145b610a2d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103c8565b6000805460ff60a01b1916600160a01b1790558015610a5a576000805460ff60a81b1916600160a81b1790555b610a638861109b565b610a718787878787876110f1565b8015610ab9576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600080546040805163b7ab4db560e01b8152905183926001600160a01b03169163b7ab4db591600480830192869291908290030181865afa158015610b0c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b34919081019061163c565b5050905060005b8151811015610b8b57610b66828281518110610b5957610b59611727565b602002602001015161095f565b15610b795782610b758161173d565b9350505b80610b838161173d565b915050610b3b565b505090565b6007546001600160a01b0382166000908152600160205260408120600301549091610bba91611539565b421192915050565b6060836001600160401b03811115610bdc57610bdc61155f565b604051908082528060200260200182016040528015610c05578160200160208202803683370190505b50905060005b84811015610c7857610c44868683818110610c2857610c28611727565b9050602002016020810190610c3d91906112eb565b858561104c565b828281518110610c5657610c56611727565b9115156020928302919091019091015280610c708161173d565b915050610c0b565b50949350505050565b610c89611231565b6001600160a01b0316336001600160a01b031614610cb95760405162461bcd60e51b81526004016103c890611756565b610cc78686868686866110f1565b505050505050565b610cd7611231565b6001600160a01b0316336001600160a01b031614610d075760405162461bcd60e51b81526004016103c890611756565b806001600160a01b03163b600003610d3257604051637bcd509160e01b815260040160405180910390fd5b610d3b8161109b565b50565b610d696040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b03166000908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b6000546040516304d971ab60e01b81526001600160a01b03909116906304d971ab90610de89084903390600401611509565b602060405180830381865afa158015610e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2991906114e7565b610e825760405162461bcd60e51b815260206004820152603660248201526000805160206117998339815191526044820152753132903a34329031b0b73234b230ba329030b236b4b760511b60648201526084016103c8565b610e8b8161095f565b610ed75760405162461bcd60e51b815260206004820152601f60248201527f4d61696e74656e616e63653a206e6f207363686564756c65206578697374730060448201526064016103c8565b610ee181436102b6565b15610f3a5760405162461bcd60e51b815260206004820152602360248201527f4d61696e74656e616e63653a20616c7265616479206f6e206d61696e74656e616044820152626e636560e81b60648201526084016103c8565b6001600160a01b0381166000818152600160208190526040808320838155918201839055436002830155519092917f72720a31deb222f77bbf95b88a540154648466770e5f41328ee1e25e5050737791a25050565b6060826001600160401b03811115610fa957610fa961155f565b604051908082528060200260200182016040528015610fd2578160200160208202803683370190505b50905060005b8381101561104457611010858583818110610ff557610ff5611727565b905060200201602081019061100a91906112eb565b846102b6565b82828151811061102257611022611727565b911515602092830291909101909101528061103c8161173d565b915050610fd8565b509392505050565b6001600160a01b03831660009081526001602081905260408220805491810154909161107b918691869161125f565b95945050505050565b60008383111580156102ae57505090911115919050565b600080546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906110e6908390611364565b60405180910390a150565b8486106111485760405162461bcd60e51b815260206004820152603160248201526000805160206117b9833981519152604482015270206475726174696f6e20636f6e6669677360781b60648201526084016103c8565b8284106111b55760405162461bcd60e51b815260206004820152603560248201527f4d61696e74656e616e63653a20696e76616c6964206f666673657420746f207360448201527474617274207363686564756c6520636f6e6669677360581b60648201526084016103c8565b6002869055600385905560048490556005839055600682905560078190556040805187815260208101879052908101859052606081018490526080810183905260a081018290527f4edb6adef66a4b8e1ffbc8c67640d4f244ce904193fd65e5cc316bbb74b2e59b9060c00160405180910390a1505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b600081851115801561107b575050501115919050565b6001600160a01b0381168114610d3b57600080fd5b60008060006060848603121561129f57600080fd5b83356112aa81611275565b95602085013595506040909401359392505050565b600080604083850312156112d257600080fd5b82356112dd81611275565b946020939093013593505050565b6000602082840312156112fd57600080fd5b813561130881611275565b9392505050565b600080600080600080600060e0888a03121561132a57600080fd5b873561133581611275565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b6001600160a01b0391909116815260200190565b60008083601f84011261138a57600080fd5b5081356001600160401b038111156113a157600080fd5b6020830191508360208260051b85010111156113bc57600080fd5b9250929050565b600080600080606085870312156113d957600080fd5b84356001600160401b038111156113ef57600080fd5b6113fb87828801611378565b90989097506020870135966040013595509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561144d57835115158352928401929184019160010161142f565b50909695505050505050565b60008060008060008060c0878903121561147257600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6000806000604084860312156114b157600080fd5b83356001600160401b038111156114c757600080fd5b6114d386828701611378565b909790965060209590950135949350505050565b6000602082840312156114f957600080fd5b8151801515811461130857600080fd5b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611523565b818103818111156102e7576102e7611523565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561159d5761159d61155f565b604052919050565b60006001600160401b038211156115be576115be61155f565b5060051b60200190565b600082601f8301126115d957600080fd5b815160206115ee6115e9836115a5565b611575565b82815260059290921b8401810191818101908684111561160d57600080fd5b8286015b8481101561163157805161162481611275565b8352918301918301611611565b509695505050505050565b60008060006060848603121561165157600080fd5b83516001600160401b038082111561166857600080fd5b611674878388016115c8565b945060209150818601518181111561168b57600080fd5b611697888289016115c8565b9450506040860151818111156116ac57600080fd5b86019050601f810187136116bf57600080fd5b80516116cd6115e9826115a5565b81815260059190911b820183019083810190898311156116ec57600080fd5b928401925b82841015611718578351600481106117095760008081fd5b825292840192908401906116f1565b80955050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b60006001820161174f5761174f611523565b5060010190565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b60608201526080019056fe4d61696e74656e616e63653a206d6574686f642063616c6c6572206d757374204d61696e74656e616e63653a20696e76616c6964206d61696e74656e616e6365a264697066735822122020d6e85a401c7371df2c8089f2290dbc1b507fb37b62e12da5f11aacfead033d64736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100fc5760003560e01c8063088e8de71461010157806309e34c38146101295780630fbeb37f146101405780632d538c2c146101535780632ddc08a2146101685780637a50802d1461017b5780638142951a14610184578063965720af14610197578063994390891461019f578063b59f403e146101b8578063ba303755146101cb578063bc1710e9146101eb578063bfa89b9b146101f4578063c09fe460146101fd578063c44cb23314610210578063cdf64a7614610219578063d39fee341461022c578063dec3628414610272578063f0caaafb1461027b578063fdadda811461028e575b600080fd5b61011461010f36600461128a565b6102a1565b60405190151581526020015b60405180910390f35b61013260025481565b604051908152602001610120565b61011461014e3660046112bf565b6102b6565b61016661016136600461128a565b6102ed565b005b6101146101763660046112eb565b61095f565b61013260055481565b61016661019236600461130f565b610981565b610132610ac3565b6000546001600160a01b03166040516101209190611364565b6101146101c63660046112eb565b610b90565b6101de6101d93660046113c3565b610bc2565b6040516101209190611413565b61013260045481565b61013260035481565b61016661020b366004611459565b610c81565b61013260065481565b6101666102273660046112eb565b610ccf565b61023f61023a3660046112eb565b610d3e565b60405161012091908151815260208083015190820152604080830151908201526060918201519181019190915260800190565b61013260075481565b6101666102893660046112eb565b610db6565b6101de61029c36600461149c565b610f8f565b60006102ae84848461104c565b949350505050565b6001600160a01b0382166000908152600160205260408120805483108015906102e3575080600101548311155b9150505b92915050565b600054604051633292276760e11b81526001600160a01b039091169081906365244ece9061031f908790600401611364565b602060405180830381865afa15801561033c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061036091906114e7565b6103d15760405162461bcd60e51b815260206004820152603760248201527f4d61696e74656e616e63653a20636f6e73656e7375732061646472657373206d6044820152763ab9ba103132903090313637b1b590383937b23ab1b2b960491b60648201526084015b60405180910390fd5b6040516304d971ab60e01b81526001600160a01b038216906304d971ab906103ff9087903390600401611509565b602060405180830381865afa15801561041c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061044091906114e7565b6104975760405162461bcd60e51b81526020600482015260346024820152600080516020611799833981519152604482015273313290309031b0b73234b230ba329030b236b4b760611b60648201526084016103c8565b6104a08461095f565b156104ed5760405162461bcd60e51b815260206004820152601e60248201527f4d61696e74656e616e63653a20616c7265616479207363686564756c6564000060448201526064016103c8565b6104f684610b90565b61054e5760405162461bcd60e51b815260206004820152602360248201527f4d61696e7461696e616e63653a20636f6f6c646f776e2074696d65206e6f7420604482015262195b9960ea1b60648201526084016103c8565b600654610559610ac3565b106105b65760405162461bcd60e51b815260206004820152602760248201527f4d61696e74656e616e63653a206578636565647320746f74616c206f66207363604482015266686564756c657360c81b60648201526084016103c8565b6105dc600454436105c79190611539565b6005546105d49043611539565b859190611084565b61063a5760405162461bcd60e51b815260206004820152602960248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206f7574206044820152681bd9881bd9999cd95d60ba1b60648201526084016103c8565b8183106106a65760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20737461727420626c6f636b206d757374206265604482015273206c657373207468616e20656e6420626c6f636b60601b60648201526084016103c8565b60006106b2848461154c565b6106bd906001611539565b90506106d8600254600354836110849092919063ffffffff16565b6107245760405162461bcd60e51b815260206004820152602960248201526000805160206117b983398151915260448201526810323ab930ba34b7b760b91b60648201526084016103c8565b6001600160a01b038216637593ff7161073e60018761154c565b6040518263ffffffff1660e01b815260040161075c91815260200190565b602060405180830381865afa158015610779573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061079d91906114e7565b61080a5760405162461bcd60e51b815260206004820152603860248201527f4d61696e74656e616e63653a20737461727420626c6f636b206973206e6f74206044820152770c2e840e8d0ca40e6e8c2e4e840decc40c2dc40cae0dec6d60431b60648201526084016103c8565b604051637593ff7160e01b8152600481018490526001600160a01b03831690637593ff7190602401602060405180830381865afa15801561084f573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061087391906114e7565b6108dc5760405162461bcd60e51b815260206004820152603460248201527f4d61696e74656e616e63653a20656e6420626c6f636b206973206e6f74206174604482015273040e8d0ca40cadcc840decc40c2dc40cae0dec6d60631b60648201526084016103c8565b6001600160a01b0385166000818152600160208181526040928390208881559182018790554360028301819055426003840181905584518a815292830189905293820152606081019290925291907f48e8b2f7348b1ec693bbb999258a8d6bd514732a19c6057b6e2a56a4c405253b9060800160405180910390a2505050505050565b6001600160a01b03166000908152600160208190526040909120015443111590565b600054600160a81b900460ff16158080156109a957506000546001600160a01b90910460ff16105b806109ca5750303b1580156109ca5750600054600160a01b900460ff166001145b610a2d5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084016103c8565b6000805460ff60a01b1916600160a01b1790558015610a5a576000805460ff60a81b1916600160a81b1790555b610a638861109b565b610a718787878787876110f1565b8015610ab9576000805460ff60a81b19169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b5050505050505050565b600080546040805163b7ab4db560e01b8152905183926001600160a01b03169163b7ab4db591600480830192869291908290030181865afa158015610b0c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610b34919081019061163c565b5050905060005b8151811015610b8b57610b66828281518110610b5957610b59611727565b602002602001015161095f565b15610b795782610b758161173d565b9350505b80610b838161173d565b915050610b3b565b505090565b6007546001600160a01b0382166000908152600160205260408120600301549091610bba91611539565b421192915050565b6060836001600160401b03811115610bdc57610bdc61155f565b604051908082528060200260200182016040528015610c05578160200160208202803683370190505b50905060005b84811015610c7857610c44868683818110610c2857610c28611727565b9050602002016020810190610c3d91906112eb565b858561104c565b828281518110610c5657610c56611727565b9115156020928302919091019091015280610c708161173d565b915050610c0b565b50949350505050565b610c89611231565b6001600160a01b0316336001600160a01b031614610cb95760405162461bcd60e51b81526004016103c890611756565b610cc78686868686866110f1565b505050505050565b610cd7611231565b6001600160a01b0316336001600160a01b031614610d075760405162461bcd60e51b81526004016103c890611756565b806001600160a01b03163b600003610d3257604051637bcd509160e01b815260040160405180910390fd5b610d3b8161109b565b50565b610d696040518060800160405280600081526020016000815260200160008152602001600081525090565b506001600160a01b03166000908152600160208181526040928390208351608081018552815481529281015491830191909152600281015492820192909252600390910154606082015290565b6000546040516304d971ab60e01b81526001600160a01b03909116906304d971ab90610de89084903390600401611509565b602060405180830381865afa158015610e05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2991906114e7565b610e825760405162461bcd60e51b815260206004820152603660248201526000805160206117998339815191526044820152753132903a34329031b0b73234b230ba329030b236b4b760511b60648201526084016103c8565b610e8b8161095f565b610ed75760405162461bcd60e51b815260206004820152601f60248201527f4d61696e74656e616e63653a206e6f207363686564756c65206578697374730060448201526064016103c8565b610ee181436102b6565b15610f3a5760405162461bcd60e51b815260206004820152602360248201527f4d61696e74656e616e63653a20616c7265616479206f6e206d61696e74656e616044820152626e636560e81b60648201526084016103c8565b6001600160a01b0381166000818152600160208190526040808320838155918201839055436002830155519092917f72720a31deb222f77bbf95b88a540154648466770e5f41328ee1e25e5050737791a25050565b6060826001600160401b03811115610fa957610fa961155f565b604051908082528060200260200182016040528015610fd2578160200160208202803683370190505b50905060005b8381101561104457611010858583818110610ff557610ff5611727565b905060200201602081019061100a91906112eb565b846102b6565b82828151811061102257611022611727565b911515602092830291909101909101528061103c8161173d565b915050610fd8565b509392505050565b6001600160a01b03831660009081526001602081905260408220805491810154909161107b918691869161125f565b95945050505050565b60008383111580156102ae57505090911115919050565b600080546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906110e6908390611364565b60405180910390a150565b8486106111485760405162461bcd60e51b815260206004820152603160248201526000805160206117b9833981519152604482015270206475726174696f6e20636f6e6669677360781b60648201526084016103c8565b8284106111b55760405162461bcd60e51b815260206004820152603560248201527f4d61696e74656e616e63653a20696e76616c6964206f666673657420746f207360448201527474617274207363686564756c6520636f6e6669677360581b60648201526084016103c8565b6002869055600385905560048490556005839055600682905560078190556040805187815260208101879052908101859052606081018490526080810183905260a081018290527f4edb6adef66a4b8e1ffbc8c67640d4f244ce904193fd65e5cc316bbb74b2e59b9060c00160405180910390a1505050505050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b600081851115801561107b575050501115919050565b6001600160a01b0381168114610d3b57600080fd5b60008060006060848603121561129f57600080fd5b83356112aa81611275565b95602085013595506040909401359392505050565b600080604083850312156112d257600080fd5b82356112dd81611275565b946020939093013593505050565b6000602082840312156112fd57600080fd5b813561130881611275565b9392505050565b600080600080600080600060e0888a03121561132a57600080fd5b873561133581611275565b9960208901359950604089013598606081013598506080810135975060a0810135965060c00135945092505050565b6001600160a01b0391909116815260200190565b60008083601f84011261138a57600080fd5b5081356001600160401b038111156113a157600080fd5b6020830191508360208260051b85010111156113bc57600080fd5b9250929050565b600080600080606085870312156113d957600080fd5b84356001600160401b038111156113ef57600080fd5b6113fb87828801611378565b90989097506020870135966040013595509350505050565b6020808252825182820181905260009190848201906040850190845b8181101561144d57835115158352928401929184019160010161142f565b50909695505050505050565b60008060008060008060c0878903121561147257600080fd5b505084359660208601359650604086013595606081013595506080810135945060a0013592509050565b6000806000604084860312156114b157600080fd5b83356001600160401b038111156114c757600080fd5b6114d386828701611378565b909790965060209590950135949350505050565b6000602082840312156114f957600080fd5b8151801515811461130857600080fd5b6001600160a01b0392831681529116602082015260400190565b634e487b7160e01b600052601160045260246000fd5b808201808211156102e7576102e7611523565b818103818111156102e7576102e7611523565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561159d5761159d61155f565b604052919050565b60006001600160401b038211156115be576115be61155f565b5060051b60200190565b600082601f8301126115d957600080fd5b815160206115ee6115e9836115a5565b611575565b82815260059290921b8401810191818101908684111561160d57600080fd5b8286015b8481101561163157805161162481611275565b8352918301918301611611565b509695505050505050565b60008060006060848603121561165157600080fd5b83516001600160401b038082111561166857600080fd5b611674878388016115c8565b945060209150818601518181111561168b57600080fd5b611697888289016115c8565b9450506040860151818111156116ac57600080fd5b86019050601f810187136116bf57600080fd5b80516116cd6115e9826115a5565b81815260059190911b820183019083810190898311156116ec57600080fd5b928401925b82841015611718578351600481106117095760008081fd5b825292840192908401906116f1565b80955050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b60006001820161174f5761174f611523565b5060010190565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b60608201526080019056fe4d61696e74656e616e63653a206d6574686f642063616c6c6572206d757374204d61696e74656e616e63653a20696e76616c6964206d61696e74656e616e6365a264697066735822122020d6e85a401c7371df2c8089f2290dbc1b507fb37b62e12da5f11aacfead033d64736f6c63430008110033", "devdoc": { "errors": { "ErrCallerMustBeValidatorContract()": [ @@ -690,7 +690,7 @@ "label": "_validatorContract", "offset": 0, "slot": "0", - "type": "t_contract(IRoninValidatorSet)11967" + "type": "t_contract(IRoninValidatorSet)11973" }, { "astId": 1373, @@ -709,7 +709,7 @@ "type": "t_bool" }, { - "astId": 20825, + "astId": 20853, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "_schedule", "offset": 0, @@ -717,7 +717,7 @@ "type": "t_mapping(t_address,t_struct(Schedule)9487_storage)" }, { - "astId": 20828, + "astId": 20856, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "minMaintenanceDurationInBlock", "offset": 0, @@ -725,7 +725,7 @@ "type": "t_uint256" }, { - "astId": 20831, + "astId": 20859, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "maxMaintenanceDurationInBlock", "offset": 0, @@ -733,7 +733,7 @@ "type": "t_uint256" }, { - "astId": 20834, + "astId": 20862, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "minOffsetToStartSchedule", "offset": 0, @@ -741,7 +741,7 @@ "type": "t_uint256" }, { - "astId": 20837, + "astId": 20865, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "maxOffsetToStartSchedule", "offset": 0, @@ -749,7 +749,7 @@ "type": "t_uint256" }, { - "astId": 20840, + "astId": 20868, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "maxSchedules", "offset": 0, @@ -757,7 +757,7 @@ "type": "t_uint256" }, { - "astId": 20843, + "astId": 20871, "contract": "contracts/ronin/Maintenance.sol:Maintenance", "label": "cooldownSecsToMaintain", "offset": 0, @@ -776,7 +776,7 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(IRoninValidatorSet)11967": { + "t_contract(IRoninValidatorSet)11973": { "encoding": "inplace", "label": "contract IRoninValidatorSet", "numberOfBytes": "20" diff --git a/deployments/ronin-mainnet/RoninGatewayPauseEnforcer.json b/deployments/ronin-mainnet/RoninGatewayPauseEnforcer.json index bbd3b8980..afe56861d 100644 --- a/deployments/ronin-mainnet/RoninGatewayPauseEnforcer.json +++ b/deployments/ronin-mainnet/RoninGatewayPauseEnforcer.json @@ -1,5 +1,5 @@ { - "address": "0x09E575648220783fC30e8D78919037E7dc99E83E", + "address": "0x2367cD5468c2b3cD18aA74AdB7e14E43426aF837", "abi": [ { "inputs": [ @@ -323,13 +323,6 @@ "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "resetEmergency", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, { "inputs": [ { @@ -408,62 +401,62 @@ "type": "function" } ], - "transactionHash": "0x09aed2fcf668841a0ec2b7b8e31b930ed6925bd2a4891df58d43080dff1c2382", + "transactionHash": "0xc2068866d8ad83c00810606cde71575e6eda2c3f2fed826160e71fb19fed5892", "receipt": { "to": null, - "from": "0x0F68eDBE14C8f68481771016d7E2871d6a35DE11", - "contractAddress": "0x09E575648220783fC30e8D78919037E7dc99E83E", + "from": "0x4d58Ea7231c394d5804e8B06B1365915f906E27F", + "contractAddress": "0x2367cD5468c2b3cD18aA74AdB7e14E43426aF837", "transactionIndex": 0, - "gasUsed": "1163003", - "logsBloom": "0x00000004000000000040000000000004000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000800000000000008020000000000000000200800000000002000000000000000000000000000000000000000000000000000000000000000000000004000000000000001000000000000000000000000000000000000000000000000001000000008000000000000000000000000000080000000000000000000000100000800000020400000000000000000000001000000002000000004020000000000000000000000", - "blockHash": "0xeb117997e2ee71ed6fcf5c518839a0a0c7ec694c5b71bf77902c5b25bfd31c0c", - "transactionHash": "0x09aed2fcf668841a0ec2b7b8e31b930ed6925bd2a4891df58d43080dff1c2382", + "gasUsed": "1128194", + "logsBloom": "0x00000004000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000008020000000000000000200800000000002000000000000000008000000000000000000000200000000000000020000000000000004000000000000001000000000000000000000000000000000000000000000000001000000008000000000000000000000000000080000000000000080000000100000000000020400000000000000000000000000000002000000000020000000000000000100000", + "blockHash": "0x76496512c2d115e3304ce7217c66a0c535cbdd6180a6cb6e0124f6610584bb94", + "transactionHash": "0xc2068866d8ad83c00810606cde71575e6eda2c3f2fed826160e71fb19fed5892", "logs": [ { "transactionIndex": 0, - "blockNumber": 22977114, - "transactionHash": "0x09aed2fcf668841a0ec2b7b8e31b930ed6925bd2a4891df58d43080dff1c2382", - "address": "0x09E575648220783fC30e8D78919037E7dc99E83E", + "blockNumber": 24127895, + "transactionHash": "0xc2068866d8ad83c00810606cde71575e6eda2c3f2fed826160e71fb19fed5892", + "address": "0x2367cD5468c2b3cD18aA74AdB7e14E43426aF837", "topics": [ "0x7f8cffd58ac96898bdd25ab64868bd933141d15ad1cd4a0df228fd3fcba2a26d" ], "data": "0x0000000000000000000000000cf8ff40a508bdbc39fbe1bb679dcba64e65c7df", "logIndex": 0, - "blockHash": "0xeb117997e2ee71ed6fcf5c518839a0a0c7ec694c5b71bf77902c5b25bfd31c0c" + "blockHash": "0x76496512c2d115e3304ce7217c66a0c535cbdd6180a6cb6e0124f6610584bb94" }, { "transactionIndex": 0, - "blockNumber": 22977114, - "transactionHash": "0x09aed2fcf668841a0ec2b7b8e31b930ed6925bd2a4891df58d43080dff1c2382", - "address": "0x09E575648220783fC30e8D78919037E7dc99E83E", + "blockNumber": 24127895, + "transactionHash": "0xc2068866d8ad83c00810606cde71575e6eda2c3f2fed826160e71fb19fed5892", + "address": "0x2367cD5468c2b3cD18aA74AdB7e14E43426aF837", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x0000000000000000000000000000000000000000000000000000000000000000", "0x0000000000000000000000008417ac6838be147ab0e201496b2e5edf90a48cc5", - "0x0000000000000000000000000f68edbe14c8f68481771016d7e2871d6a35de11" + "0x0000000000000000000000004d58ea7231c394d5804e8b06b1365915f906e27f" ], "data": "0x", "logIndex": 1, - "blockHash": "0xeb117997e2ee71ed6fcf5c518839a0a0c7ec694c5b71bf77902c5b25bfd31c0c" + "blockHash": "0x76496512c2d115e3304ce7217c66a0c535cbdd6180a6cb6e0124f6610584bb94" }, { "transactionIndex": 0, - "blockNumber": 22977114, - "transactionHash": "0x09aed2fcf668841a0ec2b7b8e31b930ed6925bd2a4891df58d43080dff1c2382", - "address": "0x09E575648220783fC30e8D78919037E7dc99E83E", + "blockNumber": 24127895, + "transactionHash": "0xc2068866d8ad83c00810606cde71575e6eda2c3f2fed826160e71fb19fed5892", + "address": "0x2367cD5468c2b3cD18aA74AdB7e14E43426aF837", "topics": [ "0x2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d", "0x5bea60102f2a7acc9e82b1af0e3bd4069661102bb5dd143a6051cd1980dded1c", "0x0000000000000000000000008b35c5e273525a4ca61025812f29c17727948f57", - "0x0000000000000000000000000f68edbe14c8f68481771016d7e2871d6a35de11" + "0x0000000000000000000000004d58ea7231c394d5804e8b06b1365915f906e27f" ], "data": "0x", "logIndex": 2, - "blockHash": "0xeb117997e2ee71ed6fcf5c518839a0a0c7ec694c5b71bf77902c5b25bfd31c0c" + "blockHash": "0x76496512c2d115e3304ce7217c66a0c535cbdd6180a6cb6e0124f6610584bb94" } ], - "blockNumber": 22977114, - "cumulativeGasUsed": "1163003", + "blockNumber": 24127895, + "cumulativeGasUsed": "1128194", "status": 1, "byzantium": true }, @@ -474,11 +467,11 @@ "0x8B35C5E273525a4Ca61025812f29C17727948f57" ] ], - "numDeployments": 2, - "solcInputHash": "03f80198b6fb66d528e408eabca5a782", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IPauseTarget\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_sentries\",\"type\":\"address[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"EmergencyPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"EmergencyUnpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IPauseTarget\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"TargetChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SENTRY_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IPauseTarget\",\"name\":\"_target\",\"type\":\"address\"}],\"name\":\"changeTarget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergency\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sentry\",\"type\":\"address\"}],\"name\":\"grantSentry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"resetEmergency\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sentry\",\"type\":\"address\"}],\"name\":\"revokeSentry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"target\",\"outputs\":[{\"internalType\":\"contract IPauseTarget\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"triggerPause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"triggerUnpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"EmergencyPaused(address)\":{\"details\":\"Emitted when the emergency ppause is triggered by `account`.\"},\"EmergencyUnpaused(address)\":{\"details\":\"Emitted when the emergency unpause is triggered by `account`.\"},\"TargetChanged(address)\":{\"details\":\"Emitted when the target is changed.\"}},\"kind\":\"dev\",\"methods\":{\"changeTarget(address)\":{\"details\":\"Setter for `target`. Requirements: - Only admin can call this method.\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"grantSentry(address)\":{\"details\":\"Grants the SENTRY_ROLE to the specified address.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"resetEmergency()\":{\"details\":\"Helper function to reset emergency status.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"revokeSentry(address)\":{\"details\":\"Revokes the SENTRY_ROLE from the specified address.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"triggerPause()\":{\"details\":\"Triggers a pause on the target contract. Requirements: - Only be called by accounts with the SENTRY_ROLE, - The target contract is not already paused.\"},\"triggerUnpause()\":{\"details\":\"Triggers an unpause on the target contract. Requirements: - Only be called by accounts with the SENTRY_ROLE, - The target contract is already paused. - The target contract is paused in emergency mode.\"}},\"stateVariables\":{\"emergency\":{\"details\":\"Indicating whether or not the target contract is paused in emergency mode.\"},\"target\":{\"details\":\"The contract that can be paused or unpaused by the SENTRY_ROLE.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/gateway/PauseEnforcer.sol\":\"PauseEnforcer\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(uint160(account), 20),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5b35d8e68aeaccc685239bd9dd79b9ba01a0357930f8a3307ab85511733d9724\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/AccessControlEnumerable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlEnumerable.sol\\\";\\nimport \\\"./AccessControl.sol\\\";\\nimport \\\"../utils/structs/EnumerableSet.sol\\\";\\n\\n/**\\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\\n */\\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\\n return _roleMembers[role].at(index);\\n }\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\\n return _roleMembers[role].length();\\n }\\n\\n /**\\n * @dev Overload {_grantRole} to track enumerable memberships\\n */\\n function _grantRole(bytes32 role, address account) internal virtual override {\\n super._grantRole(role, account);\\n _roleMembers[role].add(account);\\n }\\n\\n /**\\n * @dev Overload {_revokeRole} to track enumerable memberships\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual override {\\n super._revokeRole(role, account);\\n _roleMembers[role].remove(account);\\n }\\n}\\n\",\"keccak256\":\"0x13f5e15f2a0650c0b6aaee2ef19e89eaf4870d6e79662d572a393334c1397247\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControlEnumerable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\n\\n/**\\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\\n */\\ninterface IAccessControlEnumerable is IAccessControl {\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xba4459ab871dfa300f5212c6c30178b63898c03533a1ede28436f11546626676\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n return _values(set._inner);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x5050943b32b6a8f282573d166b2e9d87ab7eb4dbba4ab6acf36ecb54fe6995e4\",\"license\":\"MIT\"},\"contracts/interfaces/IPauseTarget.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IPauseTarget {\\n function pause() external;\\n\\n function unpause() external;\\n\\n function paused() external returns (bool);\\n}\\n\",\"keccak256\":\"0xc91073e61da572de0087b41018fd30b03661d58e0c5061e7b9d1c9235cd7c1c3\",\"license\":\"MIT\"},\"contracts/ronin/gateway/PauseEnforcer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/access/AccessControlEnumerable.sol\\\";\\nimport \\\"../../interfaces/IPauseTarget.sol\\\";\\n\\ncontract PauseEnforcer is AccessControlEnumerable {\\n bytes32 public constant SENTRY_ROLE = keccak256(\\\"SENTRY_ROLE\\\");\\n\\n /// @dev The contract that can be paused or unpaused by the SENTRY_ROLE.\\n IPauseTarget public target;\\n /// @dev Indicating whether or not the target contract is paused in emergency mode.\\n bool public emergency;\\n\\n /// @dev Emitted when the emergency ppause is triggered by `account`.\\n event EmergencyPaused(address account);\\n /// @dev Emitted when the emergency unpause is triggered by `account`.\\n event EmergencyUnpaused(address account);\\n /// @dev Emitted when the target is changed.\\n event TargetChanged(IPauseTarget target);\\n\\n modifier onEmergency() {\\n require(emergency, \\\"PauseEnforcer: not on emergency pause\\\");\\n _;\\n }\\n\\n modifier targetPaused() {\\n require(target.paused(), \\\"PauseEnforcer: target is on pause\\\");\\n _;\\n }\\n\\n modifier targetNotPaused() {\\n require(!target.paused(), \\\"PauseEnforcer: target is not on pause\\\");\\n _;\\n }\\n\\n constructor(\\n IPauseTarget _target,\\n address _admin,\\n address[] memory _sentries\\n ) {\\n _changeTarget(_target);\\n _setupRole(DEFAULT_ADMIN_ROLE, _admin);\\n for (uint _i; _i < _sentries.length; _i++) {\\n _grantRole(SENTRY_ROLE, _sentries[_i]);\\n }\\n }\\n\\n /**\\n * @dev Grants the SENTRY_ROLE to the specified address.\\n */\\n function grantSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _grantRole(SENTRY_ROLE, _sentry);\\n }\\n\\n /**\\n * @dev Revokes the SENTRY_ROLE from the specified address.\\n */\\n function revokeSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _revokeRole(SENTRY_ROLE, _sentry);\\n }\\n\\n /**\\n * @dev Triggers a pause on the target contract.\\n *\\n * Requirements:\\n * - Only be called by accounts with the SENTRY_ROLE,\\n * - The target contract is not already paused.\\n */\\n function triggerPause() external onlyRole(SENTRY_ROLE) targetNotPaused {\\n emergency = true;\\n target.pause();\\n emit EmergencyPaused(msg.sender);\\n }\\n\\n /**\\n * @dev Triggers an unpause on the target contract.\\n *\\n * Requirements:\\n * - Only be called by accounts with the SENTRY_ROLE,\\n * - The target contract is already paused.\\n * - The target contract is paused in emergency mode.\\n */\\n function triggerUnpause() external onlyRole(SENTRY_ROLE) onEmergency targetPaused {\\n emergency = false;\\n target.unpause();\\n emit EmergencyUnpaused(msg.sender);\\n }\\n\\n /**\\n * @dev Helper function to reset emergency status.\\n */\\n function resetEmergency() external {\\n require(\\n hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(SENTRY_ROLE, msg.sender),\\n \\\"PauseEnforcer: Unauthorized reset\\\"\\n );\\n emergency = false;\\n }\\n\\n /**\\n * @dev Setter for `target`.\\n *\\n * Requirements:\\n * - Only admin can call this method.\\n */\\n function changeTarget(IPauseTarget _target) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _changeTarget(_target);\\n }\\n\\n /**\\n * @dev Internal helper for setting value to `target`.\\n */\\n function _changeTarget(IPauseTarget _target) internal {\\n target = _target;\\n emit TargetChanged(_target);\\n }\\n}\\n\",\"keccak256\":\"0x6f56562b5203038650d28a7c81fa59b05931c2da81d6a4bc77c5f4f87cd21536\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b5060405162001446380380620014468339810160408190526200003491620002c0565b6200003f83620000c6565b6200004c6000836200011a565b60005b8151811015620000bc57620000a77f5bea60102f2a7acc9e82b1af0e3bd4069661102bb5dd143a6051cd1980dded1c838381518110620000935762000093620003c0565b60200260200101516200012a60201b60201c565b80620000b381620003d6565b9150506200004f565b50505050620003fe565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f7f8cffd58ac96898bdd25ab64868bd933141d15ad1cd4a0df228fd3fcba2a26d9060200160405180910390a150565b6200012682826200012a565b5050565b6200014182826200016d60201b6200080e1760201c565b600082815260016020908152604090912062000168918390620008926200020d821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000126576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001c93390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600062000224836001600160a01b0384166200022d565b90505b92915050565b6000818152600183016020526040812054620002765750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000227565b50600062000227565b6001600160a01b03811681146200029557600080fd5b50565b8051620002a5816200027f565b919050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620002d657600080fd5b8351620002e3816200027f565b80935050602080850151620002f8816200027f565b60408601519093506001600160401b03808211156200031657600080fd5b818701915087601f8301126200032b57600080fd5b815181811115620003405762000340620002aa565b8060051b604051601f19603f83011681018181108582111715620003685762000368620002aa565b60405291825284820192508381018501918a8311156200038757600080fd5b938501935b82851015620003b057620003a08562000298565b845293850193928501926200038c565b8096505050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b600060018201620003f757634e487b7160e01b600052601160045260246000fd5b5060010190565b611038806200040e6000396000f3fe608060405234801561001057600080fd5b50600436106100e65760003560e01c806301ffc9a7146100eb578063248a9ca3146101135780632f2ff15d1461013457806336568abe146101495780636833f60d1461015c57806371dd4b64146101645780637a9ad0191461016c5780637d4f7fc9146101815780639010d07c1461019457806391d14854146101b4578063a217fddf146101c7578063b9f3163b146101cf578063ca15c873146101d7578063caa6fea4146101ea578063d4b83992146101fe578063d547741f14610211578063dcf7bb5c14610224578063f82ec70b14610237575b600080fd5b6100fe6100f9366004610d73565b61024a565b60405190151581526020015b60405180910390f35b610126610121366004610d9d565b610275565b60405190815260200161010a565b610147610142366004610dcb565b61028a565b005b610147610157366004610dcb565b6102ab565b61014761032e565b6101476104c4565b610126600080516020610fe383398151915281565b61014761018f366004610dfb565b610552565b6101a76101a2366004610e18565b610575565b60405161010a9190610e3a565b6100fe6101c2366004610dcb565b610594565b610126600081565b6101476105bd565b6101266101e5366004610d9d565b6107a4565b6002546100fe90600160a01b900460ff1681565b6002546101a7906001600160a01b031681565b61014761021f366004610dcb565b6107bb565b610147610232366004610dfb565b6107d7565b610147610245366004610dfb565b6107eb565b60006001600160e01b03198216635a05180f60e01b148061026f575061026f826108a7565b92915050565b60009081526020819052604090206001015490565b61029382610275565b61029c816108dc565b6102a683836108e9565b505050565b6001600160a01b03811633146103205760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61032a828261090b565b5050565b600080516020610fe3833981519152610346816108dc565b600260009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561039b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103bf9190610e4e565b1561041a5760405162461bcd60e51b815260206004820152602560248201527f5061757365456e666f726365723a20746172676574206973206e6f74206f6e20604482015264706175736560d81b6064820152608401610317565b6002805460ff60a01b198116600160a01b1790915560408051638456cb5960e01b815290516001600160a01b0390921691638456cb599160048082019260009290919082900301818387803b15801561047257600080fd5b505af1158015610486573d6000803e3d6000fd5b505050507fb8fad2fa0ed7a383e747c309ef2c4391d7b65592a48893e57ccc1fab70791456336040516104b99190610e3a565b60405180910390a150565b6104cf600033610594565b806104ed57506104ed600080516020610fe383398151915233610594565b6105435760405162461bcd60e51b815260206004820152602160248201527f5061757365456e666f726365723a20556e617574686f72697a656420726573656044820152601d60fa1b6064820152608401610317565b6002805460ff60a01b19169055565b600061055d816108dc565b61032a600080516020610fe3833981519152836108e9565b600082815260016020526040812061058d908361092d565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020610fe38339815191526105d5816108dc565b600254600160a01b900460ff1661063c5760405162461bcd60e51b815260206004820152602560248201527f5061757365456e666f726365723a206e6f74206f6e20656d657267656e637920604482015264706175736560d81b6064820152608401610317565b600260009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610691573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b59190610e4e565b61070b5760405162461bcd60e51b815260206004820152602160248201527f5061757365456e666f726365723a20746172676574206973206f6e20706175736044820152606560f81b6064820152608401610317565b6002805460ff60a01b19811690915560408051631fa5d41d60e11b815290516001600160a01b0390921691633f4ba83a9160048082019260009290919082900301818387803b15801561075d57600080fd5b505af1158015610771573d6000803e3d6000fd5b505050507ff5cbf596165cc457b2cd92e8d8450827ee314968160a5696402d75766fc52caf336040516104b99190610e3a565b600081815260016020526040812061026f90610939565b6107c482610275565b6107cd816108dc565b6102a6838361090b565b60006107e2816108dc565b61032a82610943565b60006107f6816108dc565b61032a600080516020610fe38339815191528361090b565b6108188282610594565b61032a576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561084e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061058d836001600160a01b03841661098e565b60006001600160e01b03198216637965db0b60e01b148061026f57506301ffc9a760e01b6001600160e01b031983161461026f565b6108e681336109dd565b50565b6108f3828261080e565b60008281526001602052604090206102a69082610892565b6109158282610a41565b60008281526001602052604090206102a69082610aa6565b600061058d8383610abb565b600061026f825490565b600280546001600160a01b0319166001600160a01b0383161790556040517f7f8cffd58ac96898bdd25ab64868bd933141d15ad1cd4a0df228fd3fcba2a26d906104b9908390610e3a565b60008181526001830160205260408120546109d55750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561026f565b50600061026f565b6109e78282610594565b61032a576109ff816001600160a01b03166014610ae5565b610a0a836020610ae5565b604051602001610a1b929190610e94565b60408051601f198184030181529082905262461bcd60e51b825261031791600401610f03565b610a4b8282610594565b1561032a576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061058d836001600160a01b038416610c80565b6000826000018281548110610ad257610ad2610f36565b9060005260206000200154905092915050565b60606000610af4836002610f62565b610aff906002610f79565b6001600160401b03811115610b1657610b16610f8c565b6040519080825280601f01601f191660200182016040528015610b40576020820181803683370190505b509050600360fc1b81600081518110610b5b57610b5b610f36565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610b8a57610b8a610f36565b60200101906001600160f81b031916908160001a9053506000610bae846002610f62565b610bb9906001610f79565b90505b6001811115610c31576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610bed57610bed610f36565b1a60f81b828281518110610c0357610c03610f36565b60200101906001600160f81b031916908160001a90535060049490941c93610c2a81610fa2565b9050610bbc565b50831561058d5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610317565b60008181526001830160205260408120548015610d69576000610ca4600183610fb9565b8554909150600090610cb890600190610fb9565b9050818114610d1d576000866000018281548110610cd857610cd8610f36565b9060005260206000200154905080876000018481548110610cfb57610cfb610f36565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610d2e57610d2e610fcc565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061026f565b600091505061026f565b600060208284031215610d8557600080fd5b81356001600160e01b03198116811461058d57600080fd5b600060208284031215610daf57600080fd5b5035919050565b6001600160a01b03811681146108e657600080fd5b60008060408385031215610dde57600080fd5b823591506020830135610df081610db6565b809150509250929050565b600060208284031215610e0d57600080fd5b813561058d81610db6565b60008060408385031215610e2b57600080fd5b50508035926020909101359150565b6001600160a01b0391909116815260200190565b600060208284031215610e6057600080fd5b8151801515811461058d57600080fd5b60005b83811015610e8b578181015183820152602001610e73565b50506000910152565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351610ec6816017850160208801610e70565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351610ef7816028840160208801610e70565b01602801949350505050565b6020815260008251806020840152610f22816040850160208701610e70565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761026f5761026f610f4c565b8082018082111561026f5761026f610f4c565b634e487b7160e01b600052604160045260246000fd5b600081610fb157610fb1610f4c565b506000190190565b8181038181111561026f5761026f610f4c565b634e487b7160e01b600052603160045260246000fdfe5bea60102f2a7acc9e82b1af0e3bd4069661102bb5dd143a6051cd1980dded1ca26469706673582212206d5d8cb95005ad5685b15e7a75702fa96c92501984a7ce983088c0e6b4ac65f164736f6c63430008110033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100e65760003560e01c806301ffc9a7146100eb578063248a9ca3146101135780632f2ff15d1461013457806336568abe146101495780636833f60d1461015c57806371dd4b64146101645780637a9ad0191461016c5780637d4f7fc9146101815780639010d07c1461019457806391d14854146101b4578063a217fddf146101c7578063b9f3163b146101cf578063ca15c873146101d7578063caa6fea4146101ea578063d4b83992146101fe578063d547741f14610211578063dcf7bb5c14610224578063f82ec70b14610237575b600080fd5b6100fe6100f9366004610d73565b61024a565b60405190151581526020015b60405180910390f35b610126610121366004610d9d565b610275565b60405190815260200161010a565b610147610142366004610dcb565b61028a565b005b610147610157366004610dcb565b6102ab565b61014761032e565b6101476104c4565b610126600080516020610fe383398151915281565b61014761018f366004610dfb565b610552565b6101a76101a2366004610e18565b610575565b60405161010a9190610e3a565b6100fe6101c2366004610dcb565b610594565b610126600081565b6101476105bd565b6101266101e5366004610d9d565b6107a4565b6002546100fe90600160a01b900460ff1681565b6002546101a7906001600160a01b031681565b61014761021f366004610dcb565b6107bb565b610147610232366004610dfb565b6107d7565b610147610245366004610dfb565b6107eb565b60006001600160e01b03198216635a05180f60e01b148061026f575061026f826108a7565b92915050565b60009081526020819052604090206001015490565b61029382610275565b61029c816108dc565b6102a683836108e9565b505050565b6001600160a01b03811633146103205760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61032a828261090b565b5050565b600080516020610fe3833981519152610346816108dc565b600260009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af115801561039b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103bf9190610e4e565b1561041a5760405162461bcd60e51b815260206004820152602560248201527f5061757365456e666f726365723a20746172676574206973206e6f74206f6e20604482015264706175736560d81b6064820152608401610317565b6002805460ff60a01b198116600160a01b1790915560408051638456cb5960e01b815290516001600160a01b0390921691638456cb599160048082019260009290919082900301818387803b15801561047257600080fd5b505af1158015610486573d6000803e3d6000fd5b505050507fb8fad2fa0ed7a383e747c309ef2c4391d7b65592a48893e57ccc1fab70791456336040516104b99190610e3a565b60405180910390a150565b6104cf600033610594565b806104ed57506104ed600080516020610fe383398151915233610594565b6105435760405162461bcd60e51b815260206004820152602160248201527f5061757365456e666f726365723a20556e617574686f72697a656420726573656044820152601d60fa1b6064820152608401610317565b6002805460ff60a01b19169055565b600061055d816108dc565b61032a600080516020610fe3833981519152836108e9565b600082815260016020526040812061058d908361092d565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020610fe38339815191526105d5816108dc565b600254600160a01b900460ff1661063c5760405162461bcd60e51b815260206004820152602560248201527f5061757365456e666f726365723a206e6f74206f6e20656d657267656e637920604482015264706175736560d81b6064820152608401610317565b600260009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610691573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106b59190610e4e565b61070b5760405162461bcd60e51b815260206004820152602160248201527f5061757365456e666f726365723a20746172676574206973206f6e20706175736044820152606560f81b6064820152608401610317565b6002805460ff60a01b19811690915560408051631fa5d41d60e11b815290516001600160a01b0390921691633f4ba83a9160048082019260009290919082900301818387803b15801561075d57600080fd5b505af1158015610771573d6000803e3d6000fd5b505050507ff5cbf596165cc457b2cd92e8d8450827ee314968160a5696402d75766fc52caf336040516104b99190610e3a565b600081815260016020526040812061026f90610939565b6107c482610275565b6107cd816108dc565b6102a6838361090b565b60006107e2816108dc565b61032a82610943565b60006107f6816108dc565b61032a600080516020610fe38339815191528361090b565b6108188282610594565b61032a576000828152602081815260408083206001600160a01b03851684529091529020805460ff1916600117905561084e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600061058d836001600160a01b03841661098e565b60006001600160e01b03198216637965db0b60e01b148061026f57506301ffc9a760e01b6001600160e01b031983161461026f565b6108e681336109dd565b50565b6108f3828261080e565b60008281526001602052604090206102a69082610892565b6109158282610a41565b60008281526001602052604090206102a69082610aa6565b600061058d8383610abb565b600061026f825490565b600280546001600160a01b0319166001600160a01b0383161790556040517f7f8cffd58ac96898bdd25ab64868bd933141d15ad1cd4a0df228fd3fcba2a26d906104b9908390610e3a565b60008181526001830160205260408120546109d55750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561026f565b50600061026f565b6109e78282610594565b61032a576109ff816001600160a01b03166014610ae5565b610a0a836020610ae5565b604051602001610a1b929190610e94565b60408051601f198184030181529082905262461bcd60e51b825261031791600401610f03565b610a4b8282610594565b1561032a576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600061058d836001600160a01b038416610c80565b6000826000018281548110610ad257610ad2610f36565b9060005260206000200154905092915050565b60606000610af4836002610f62565b610aff906002610f79565b6001600160401b03811115610b1657610b16610f8c565b6040519080825280601f01601f191660200182016040528015610b40576020820181803683370190505b509050600360fc1b81600081518110610b5b57610b5b610f36565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610b8a57610b8a610f36565b60200101906001600160f81b031916908160001a9053506000610bae846002610f62565b610bb9906001610f79565b90505b6001811115610c31576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610bed57610bed610f36565b1a60f81b828281518110610c0357610c03610f36565b60200101906001600160f81b031916908160001a90535060049490941c93610c2a81610fa2565b9050610bbc565b50831561058d5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610317565b60008181526001830160205260408120548015610d69576000610ca4600183610fb9565b8554909150600090610cb890600190610fb9565b9050818114610d1d576000866000018281548110610cd857610cd8610f36565b9060005260206000200154905080876000018481548110610cfb57610cfb610f36565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610d2e57610d2e610fcc565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061026f565b600091505061026f565b600060208284031215610d8557600080fd5b81356001600160e01b03198116811461058d57600080fd5b600060208284031215610daf57600080fd5b5035919050565b6001600160a01b03811681146108e657600080fd5b60008060408385031215610dde57600080fd5b823591506020830135610df081610db6565b809150509250929050565b600060208284031215610e0d57600080fd5b813561058d81610db6565b60008060408385031215610e2b57600080fd5b50508035926020909101359150565b6001600160a01b0391909116815260200190565b600060208284031215610e6057600080fd5b8151801515811461058d57600080fd5b60005b83811015610e8b578181015183820152602001610e73565b50506000910152565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351610ec6816017850160208801610e70565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351610ef7816028840160208801610e70565b01602801949350505050565b6020815260008251806020840152610f22816040850160208701610e70565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761026f5761026f610f4c565b8082018082111561026f5761026f610f4c565b634e487b7160e01b600052604160045260246000fd5b600081610fb157610fb1610f4c565b506000190190565b8181038181111561026f5761026f610f4c565b634e487b7160e01b600052603160045260246000fdfe5bea60102f2a7acc9e82b1af0e3bd4069661102bb5dd143a6051cd1980dded1ca26469706673582212206d5d8cb95005ad5685b15e7a75702fa96c92501984a7ce983088c0e6b4ac65f164736f6c63430008110033", + "numDeployments": 3, + "solcInputHash": "85b953b22882c536a643bf4b61b3153b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"contract IPauseTarget\",\"name\":\"_target\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_sentries\",\"type\":\"address[]\"}],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"EmergencyPaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"EmergencyUnpaused\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"previousAdminRole\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"newAdminRole\",\"type\":\"bytes32\"}],\"name\":\"RoleAdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"sender\",\"type\":\"address\"}],\"name\":\"RoleRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"contract IPauseTarget\",\"name\":\"target\",\"type\":\"address\"}],\"name\":\"TargetChanged\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"DEFAULT_ADMIN_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"SENTRY_ROLE\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IPauseTarget\",\"name\":\"_target\",\"type\":\"address\"}],\"name\":\"changeTarget\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergency\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleAdmin\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"index\",\"type\":\"uint256\"}],\"name\":\"getRoleMember\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"}],\"name\":\"getRoleMemberCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"grantRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sentry\",\"type\":\"address\"}],\"name\":\"grantSentry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasRole\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"role\",\"type\":\"bytes32\"},{\"internalType\":\"address\",\"name\":\"account\",\"type\":\"address\"}],\"name\":\"revokeRole\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_sentry\",\"type\":\"address\"}],\"name\":\"revokeSentry\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes4\",\"name\":\"interfaceId\",\"type\":\"bytes4\"}],\"name\":\"supportsInterface\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"target\",\"outputs\":[{\"internalType\":\"contract IPauseTarget\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"triggerPause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"triggerUnpause\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"events\":{\"EmergencyPaused(address)\":{\"details\":\"Emitted when the emergency ppause is triggered by `account`.\"},\"EmergencyUnpaused(address)\":{\"details\":\"Emitted when the emergency unpause is triggered by `account`.\"},\"TargetChanged(address)\":{\"details\":\"Emitted when the target is changed.\"}},\"kind\":\"dev\",\"methods\":{\"changeTarget(address)\":{\"details\":\"Setter for `target`. Requirements: - Only admin can call this method.\"},\"getRoleAdmin(bytes32)\":{\"details\":\"Returns the admin role that controls `role`. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.\"},\"getRoleMember(bytes32,uint256)\":{\"details\":\"Returns one of the accounts that have `role`. `index` must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.\"},\"getRoleMemberCount(bytes32)\":{\"details\":\"Returns the number of accounts that have `role`. Can be used together with {getRoleMember} to enumerate all bearers of a role.\"},\"grantRole(bytes32,address)\":{\"details\":\"Grants `role` to `account`. If `account` had not been already granted `role`, emits a {RoleGranted} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleGranted} event.\"},\"grantSentry(address)\":{\"details\":\"Grants the SENTRY_ROLE to the specified address.\"},\"hasRole(bytes32,address)\":{\"details\":\"Returns `true` if `account` has been granted `role`.\"},\"renounceRole(bytes32,address)\":{\"details\":\"Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event.\"},\"revokeRole(bytes32,address)\":{\"details\":\"Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event.\"},\"revokeSentry(address)\":{\"details\":\"Revokes the SENTRY_ROLE from the specified address.\"},\"supportsInterface(bytes4)\":{\"details\":\"See {IERC165-supportsInterface}.\"},\"triggerPause()\":{\"details\":\"Triggers a pause on the target contract. Requirements: - Only be called by accounts with the SENTRY_ROLE, - The target contract is not already paused.\"},\"triggerUnpause()\":{\"details\":\"Triggers an unpause on the target contract. Requirements: - Only be called by accounts with the SENTRY_ROLE, - The target contract is already paused. - The target contract is paused in emergency mode.\"}},\"stateVariables\":{\"emergency\":{\"details\":\"Indicating whether or not the target contract is paused in emergency mode.\"},\"target\":{\"details\":\"The contract that can be paused or unpaused by the SENTRY_ROLE.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/gateway/PauseEnforcer.sol\":\"PauseEnforcer\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/access/AccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\nimport \\\"../utils/Context.sol\\\";\\nimport \\\"../utils/Strings.sol\\\";\\nimport \\\"../utils/introspection/ERC165.sol\\\";\\n\\n/**\\n * @dev Contract module that allows children to implement role-based access\\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\\n * members except through off-chain means by accessing the contract event logs. Some\\n * applications may benefit from on-chain enumerability, for those cases see\\n * {AccessControlEnumerable}.\\n *\\n * Roles are referred to by their `bytes32` identifier. These should be exposed\\n * in the external API and be unique. The best way to achieve this is by\\n * using `public constant` hash digests:\\n *\\n * ```\\n * bytes32 public constant MY_ROLE = keccak256(\\\"MY_ROLE\\\");\\n * ```\\n *\\n * Roles can be used to represent a set of permissions. To restrict access to a\\n * function call, use {hasRole}:\\n *\\n * ```\\n * function foo() public {\\n * require(hasRole(MY_ROLE, msg.sender));\\n * ...\\n * }\\n * ```\\n *\\n * Roles can be granted and revoked dynamically via the {grantRole} and\\n * {revokeRole} functions. Each role has an associated admin role, and only\\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\\n *\\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\\n * that only accounts with this role will be able to grant or revoke other\\n * roles. More complex role relationships can be created by using\\n * {_setRoleAdmin}.\\n *\\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\\n * grant and revoke this role. Extra precautions should be taken to secure\\n * accounts that have been granted it.\\n */\\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\\n struct RoleData {\\n mapping(address => bool) members;\\n bytes32 adminRole;\\n }\\n\\n mapping(bytes32 => RoleData) private _roles;\\n\\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\\n\\n /**\\n * @dev Modifier that checks that an account has a specific role. Reverts\\n * with a standardized message including the required role.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n *\\n * _Available since v4.1._\\n */\\n modifier onlyRole(bytes32 role) {\\n _checkRole(role);\\n _;\\n }\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\\n return _roles[role].members[account];\\n }\\n\\n /**\\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\\n * Overriding this function changes the behavior of the {onlyRole} modifier.\\n *\\n * Format of the revert message is described in {_checkRole}.\\n *\\n * _Available since v4.6._\\n */\\n function _checkRole(bytes32 role) internal view virtual {\\n _checkRole(role, _msgSender());\\n }\\n\\n /**\\n * @dev Revert with a standard message if `account` is missing `role`.\\n *\\n * The format of the revert reason is given by the following regular expression:\\n *\\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\\n */\\n function _checkRole(bytes32 role, address account) internal view virtual {\\n if (!hasRole(role, account)) {\\n revert(\\n string(\\n abi.encodePacked(\\n \\\"AccessControl: account \\\",\\n Strings.toHexString(uint160(account), 20),\\n \\\" is missing role \\\",\\n Strings.toHexString(uint256(role), 32)\\n )\\n )\\n );\\n }\\n }\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\\n return _roles[role].adminRole;\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function renounceRole(bytes32 role, address account) public virtual override {\\n require(account == _msgSender(), \\\"AccessControl: can only renounce roles for self\\\");\\n\\n _revokeRole(role, account);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event. Note that unlike {grantRole}, this function doesn't perform any\\n * checks on the calling account.\\n *\\n * May emit a {RoleGranted} event.\\n *\\n * [WARNING]\\n * ====\\n * This function should only be called from the constructor when setting\\n * up the initial roles for the system.\\n *\\n * Using this function in any other way is effectively circumventing the admin\\n * system imposed by {AccessControl}.\\n * ====\\n *\\n * NOTE: This function is deprecated in favor of {_grantRole}.\\n */\\n function _setupRole(bytes32 role, address account) internal virtual {\\n _grantRole(role, account);\\n }\\n\\n /**\\n * @dev Sets `adminRole` as ``role``'s admin role.\\n *\\n * Emits a {RoleAdminChanged} event.\\n */\\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\\n bytes32 previousAdminRole = getRoleAdmin(role);\\n _roles[role].adminRole = adminRole;\\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\\n }\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleGranted} event.\\n */\\n function _grantRole(bytes32 role, address account) internal virtual {\\n if (!hasRole(role, account)) {\\n _roles[role].members[account] = true;\\n emit RoleGranted(role, account, _msgSender());\\n }\\n }\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * Internal function without access restriction.\\n *\\n * May emit a {RoleRevoked} event.\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual {\\n if (hasRole(role, account)) {\\n _roles[role].members[account] = false;\\n emit RoleRevoked(role, account, _msgSender());\\n }\\n }\\n}\\n\",\"keccak256\":\"0x5b35d8e68aeaccc685239bd9dd79b9ba01a0357930f8a3307ab85511733d9724\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/AccessControlEnumerable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControlEnumerable.sol\\\";\\nimport \\\"./AccessControl.sol\\\";\\nimport \\\"../utils/structs/EnumerableSet.sol\\\";\\n\\n/**\\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\\n */\\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\\n using EnumerableSet for EnumerableSet.AddressSet;\\n\\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\\n\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\\n }\\n\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\\n return _roleMembers[role].at(index);\\n }\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\\n return _roleMembers[role].length();\\n }\\n\\n /**\\n * @dev Overload {_grantRole} to track enumerable memberships\\n */\\n function _grantRole(bytes32 role, address account) internal virtual override {\\n super._grantRole(role, account);\\n _roleMembers[role].add(account);\\n }\\n\\n /**\\n * @dev Overload {_revokeRole} to track enumerable memberships\\n */\\n function _revokeRole(bytes32 role, address account) internal virtual override {\\n super._revokeRole(role, account);\\n _roleMembers[role].remove(account);\\n }\\n}\\n\",\"keccak256\":\"0x13f5e15f2a0650c0b6aaee2ef19e89eaf4870d6e79662d572a393334c1397247\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControl.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev External interface of AccessControl declared to support ERC165 detection.\\n */\\ninterface IAccessControl {\\n /**\\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\\n *\\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\\n * {RoleAdminChanged} not being emitted signaling this.\\n *\\n * _Available since v3.1._\\n */\\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\\n\\n /**\\n * @dev Emitted when `account` is granted `role`.\\n *\\n * `sender` is the account that originated the contract call, an admin role\\n * bearer except when using {AccessControl-_setupRole}.\\n */\\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Emitted when `account` is revoked `role`.\\n *\\n * `sender` is the account that originated the contract call:\\n * - if using `revokeRole`, it is the admin role bearer\\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\\n */\\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\\n\\n /**\\n * @dev Returns `true` if `account` has been granted `role`.\\n */\\n function hasRole(bytes32 role, address account) external view returns (bool);\\n\\n /**\\n * @dev Returns the admin role that controls `role`. See {grantRole} and\\n * {revokeRole}.\\n *\\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\\n */\\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\\n\\n /**\\n * @dev Grants `role` to `account`.\\n *\\n * If `account` had not been already granted `role`, emits a {RoleGranted}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function grantRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from `account`.\\n *\\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\\n *\\n * Requirements:\\n *\\n * - the caller must have ``role``'s admin role.\\n */\\n function revokeRole(bytes32 role, address account) external;\\n\\n /**\\n * @dev Revokes `role` from the calling account.\\n *\\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\\n * purpose is to provide a mechanism for accounts to lose their privileges\\n * if they are compromised (such as when a trusted device is misplaced).\\n *\\n * If the calling account had been granted `role`, emits a {RoleRevoked}\\n * event.\\n *\\n * Requirements:\\n *\\n * - the caller must be `account`.\\n */\\n function renounceRole(bytes32 role, address account) external;\\n}\\n\",\"keccak256\":\"0x59ce320a585d7e1f163cd70390a0ef2ff9cec832e2aa544293a00692465a7a57\",\"license\":\"MIT\"},\"@openzeppelin/contracts/access/IAccessControlEnumerable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IAccessControl.sol\\\";\\n\\n/**\\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\\n */\\ninterface IAccessControlEnumerable is IAccessControl {\\n /**\\n * @dev Returns one of the accounts that have `role`. `index` must be a\\n * value between 0 and {getRoleMemberCount}, non-inclusive.\\n *\\n * Role bearers are not sorted in any particular way, and their ordering may\\n * change at any point.\\n *\\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\\n * you perform all queries on the same block. See the following\\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\\n * for more information.\\n */\\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\\n\\n /**\\n * @dev Returns the number of accounts that have `role`. Can be used\\n * together with {getRoleMember} to enumerate all bearers of a role.\\n */\\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\\n}\\n\",\"keccak256\":\"0xba4459ab871dfa300f5212c6c30178b63898c03533a1ede28436f11546626676\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Context.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract Context {\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n}\\n\",\"keccak256\":\"0xe2e337e6dde9ef6b680e07338c493ebea1b5fd09b43424112868e9cc1706bca7\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/ERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"./IERC165.sol\\\";\\n\\n/**\\n * @dev Implementation of the {IERC165} interface.\\n *\\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\\n * for the additional interface id that will be supported. For example:\\n *\\n * ```solidity\\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\\n * }\\n * ```\\n *\\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\\n */\\nabstract contract ERC165 is IERC165 {\\n /**\\n * @dev See {IERC165-supportsInterface}.\\n */\\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\\n return interfaceId == type(IERC165).interfaceId;\\n }\\n}\\n\",\"keccak256\":\"0xd10975de010d89fd1c78dc5e8a9a7e7f496198085c151648f20cba166b32582b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/introspection/IERC165.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC165 standard, as defined in the\\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\\n *\\n * Implementers can declare support of contract interfaces, which can then be\\n * queried by others ({ERC165Checker}).\\n *\\n * For an implementation, see {ERC165}.\\n */\\ninterface IERC165 {\\n /**\\n * @dev Returns true if this contract implements the interface defined by\\n * `interfaceId`. See the corresponding\\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\\n * to learn more about how these ids are created.\\n *\\n * This function call must use less than 30 000 gas.\\n */\\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x447a5f3ddc18419d41ff92b3773fb86471b1db25773e07f877f548918a185bf1\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/structs/EnumerableSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for managing\\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\\n * types.\\n *\\n * Sets have the following properties:\\n *\\n * - Elements are added, removed, and checked for existence in constant time\\n * (O(1)).\\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\\n *\\n * ```\\n * contract Example {\\n * // Add the library methods\\n * using EnumerableSet for EnumerableSet.AddressSet;\\n *\\n * // Declare a set state variable\\n * EnumerableSet.AddressSet private mySet;\\n * }\\n * ```\\n *\\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\\n * and `uint256` (`UintSet`) are supported.\\n *\\n * [WARNING]\\n * ====\\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\\n *\\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\\n * ====\\n */\\nlibrary EnumerableSet {\\n // To implement this library for multiple types with as little code\\n // repetition as possible, we write it in terms of a generic Set type with\\n // bytes32 values.\\n // The Set implementation uses private functions, and user-facing\\n // implementations (such as AddressSet) are just wrappers around the\\n // underlying Set.\\n // This means that we can only create new EnumerableSets for types that fit\\n // in bytes32.\\n\\n struct Set {\\n // Storage of set values\\n bytes32[] _values;\\n // Position of the value in the `values` array, plus 1 because index 0\\n // means a value is not in the set.\\n mapping(bytes32 => uint256) _indexes;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function _add(Set storage set, bytes32 value) private returns (bool) {\\n if (!_contains(set, value)) {\\n set._values.push(value);\\n // The value is stored at length-1, but we add 1 to all indexes\\n // and use 0 as a sentinel value\\n set._indexes[value] = set._values.length;\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function _remove(Set storage set, bytes32 value) private returns (bool) {\\n // We read and store the value's index to prevent multiple reads from the same storage slot\\n uint256 valueIndex = set._indexes[value];\\n\\n if (valueIndex != 0) {\\n // Equivalent to contains(set, value)\\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\\n // the array, and then remove the last element (sometimes called as 'swap and pop').\\n // This modifies the order of the array, as noted in {at}.\\n\\n uint256 toDeleteIndex = valueIndex - 1;\\n uint256 lastIndex = set._values.length - 1;\\n\\n if (lastIndex != toDeleteIndex) {\\n bytes32 lastValue = set._values[lastIndex];\\n\\n // Move the last value to the index where the value to delete is\\n set._values[toDeleteIndex] = lastValue;\\n // Update the index for the moved value\\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\\n }\\n\\n // Delete the slot where the moved value was stored\\n set._values.pop();\\n\\n // Delete the index for the deleted slot\\n delete set._indexes[value];\\n\\n return true;\\n } else {\\n return false;\\n }\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\\n return set._indexes[value] != 0;\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function _length(Set storage set) private view returns (uint256) {\\n return set._values.length;\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\\n return set._values[index];\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function _values(Set storage set) private view returns (bytes32[] memory) {\\n return set._values;\\n }\\n\\n // Bytes32Set\\n\\n struct Bytes32Set {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _add(set._inner, value);\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\\n return _remove(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\\n return _contains(set._inner, value);\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(Bytes32Set storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\\n return _at(set._inner, index);\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\\n return _values(set._inner);\\n }\\n\\n // AddressSet\\n\\n struct AddressSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(AddressSet storage set, address value) internal returns (bool) {\\n return _add(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(AddressSet storage set, address value) internal returns (bool) {\\n return _remove(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(AddressSet storage set, address value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(uint256(uint160(value))));\\n }\\n\\n /**\\n * @dev Returns the number of values in the set. O(1).\\n */\\n function length(AddressSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\\n return address(uint160(uint256(_at(set._inner, index))));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(AddressSet storage set) internal view returns (address[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n address[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n\\n // UintSet\\n\\n struct UintSet {\\n Set _inner;\\n }\\n\\n /**\\n * @dev Add a value to a set. O(1).\\n *\\n * Returns true if the value was added to the set, that is if it was not\\n * already present.\\n */\\n function add(UintSet storage set, uint256 value) internal returns (bool) {\\n return _add(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Removes a value from a set. O(1).\\n *\\n * Returns true if the value was removed from the set, that is if it was\\n * present.\\n */\\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\\n return _remove(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns true if the value is in the set. O(1).\\n */\\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\\n return _contains(set._inner, bytes32(value));\\n }\\n\\n /**\\n * @dev Returns the number of values on the set. O(1).\\n */\\n function length(UintSet storage set) internal view returns (uint256) {\\n return _length(set._inner);\\n }\\n\\n /**\\n * @dev Returns the value stored at position `index` in the set. O(1).\\n *\\n * Note that there are no guarantees on the ordering of values inside the\\n * array, and it may change when more values are added or removed.\\n *\\n * Requirements:\\n *\\n * - `index` must be strictly less than {length}.\\n */\\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\\n return uint256(_at(set._inner, index));\\n }\\n\\n /**\\n * @dev Return the entire set in an array\\n *\\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\\n */\\n function values(UintSet storage set) internal view returns (uint256[] memory) {\\n bytes32[] memory store = _values(set._inner);\\n uint256[] memory result;\\n\\n /// @solidity memory-safe-assembly\\n assembly {\\n result := store\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x5050943b32b6a8f282573d166b2e9d87ab7eb4dbba4ab6acf36ecb54fe6995e4\",\"license\":\"MIT\"},\"contracts/interfaces/IPauseTarget.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IPauseTarget {\\n function pause() external;\\n\\n function unpause() external;\\n\\n function paused() external returns (bool);\\n}\\n\",\"keccak256\":\"0xc91073e61da572de0087b41018fd30b03661d58e0c5061e7b9d1c9235cd7c1c3\",\"license\":\"MIT\"},\"contracts/ronin/gateway/PauseEnforcer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/access/AccessControlEnumerable.sol\\\";\\nimport \\\"../../interfaces/IPauseTarget.sol\\\";\\n\\ncontract PauseEnforcer is AccessControlEnumerable {\\n bytes32 public constant SENTRY_ROLE = keccak256(\\\"SENTRY_ROLE\\\");\\n\\n /// @dev The contract that can be paused or unpaused by the SENTRY_ROLE.\\n IPauseTarget public target;\\n /// @dev Indicating whether or not the target contract is paused in emergency mode.\\n bool public emergency;\\n\\n /// @dev Emitted when the emergency ppause is triggered by `account`.\\n event EmergencyPaused(address account);\\n /// @dev Emitted when the emergency unpause is triggered by `account`.\\n event EmergencyUnpaused(address account);\\n /// @dev Emitted when the target is changed.\\n event TargetChanged(IPauseTarget target);\\n\\n modifier onEmergency() {\\n require(emergency, \\\"PauseEnforcer: not on emergency pause\\\");\\n _;\\n }\\n\\n modifier targetPaused() {\\n require(target.paused(), \\\"PauseEnforcer: target is on pause\\\");\\n _;\\n }\\n\\n modifier targetNotPaused() {\\n require(!target.paused(), \\\"PauseEnforcer: target is not on pause\\\");\\n _;\\n }\\n\\n constructor(\\n IPauseTarget _target,\\n address _admin,\\n address[] memory _sentries\\n ) {\\n _changeTarget(_target);\\n _setupRole(DEFAULT_ADMIN_ROLE, _admin);\\n for (uint _i; _i < _sentries.length; _i++) {\\n _grantRole(SENTRY_ROLE, _sentries[_i]);\\n }\\n }\\n\\n /**\\n * @dev Grants the SENTRY_ROLE to the specified address.\\n */\\n function grantSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _grantRole(SENTRY_ROLE, _sentry);\\n }\\n\\n /**\\n * @dev Revokes the SENTRY_ROLE from the specified address.\\n */\\n function revokeSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _revokeRole(SENTRY_ROLE, _sentry);\\n }\\n\\n /**\\n * @dev Triggers a pause on the target contract.\\n *\\n * Requirements:\\n * - Only be called by accounts with the SENTRY_ROLE,\\n * - The target contract is not already paused.\\n */\\n function triggerPause() external onlyRole(SENTRY_ROLE) targetNotPaused {\\n emergency = true;\\n target.pause();\\n emit EmergencyPaused(msg.sender);\\n }\\n\\n /**\\n * @dev Triggers an unpause on the target contract.\\n *\\n * Requirements:\\n * - Only be called by accounts with the SENTRY_ROLE,\\n * - The target contract is already paused.\\n * - The target contract is paused in emergency mode.\\n */\\n function triggerUnpause() external onlyRole(SENTRY_ROLE) onEmergency targetPaused {\\n emergency = false;\\n target.unpause();\\n emit EmergencyUnpaused(msg.sender);\\n }\\n\\n /**\\n * @dev Setter for `target`.\\n *\\n * Requirements:\\n * - Only admin can call this method.\\n */\\n function changeTarget(IPauseTarget _target) external onlyRole(DEFAULT_ADMIN_ROLE) {\\n _changeTarget(_target);\\n }\\n\\n /**\\n * @dev Internal helper for setting value to `target`.\\n */\\n function _changeTarget(IPauseTarget _target) internal {\\n target = _target;\\n emit TargetChanged(_target);\\n }\\n}\\n\",\"keccak256\":\"0x8ad7dac2cd63bb93695413825d318974511cbd8d840c0c80d98b38c3d66a9f2d\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50604051620013a5380380620013a58339810160408190526200003491620002c0565b6200003f83620000c6565b6200004c6000836200011a565b60005b8151811015620000bc57620000a77f5bea60102f2a7acc9e82b1af0e3bd4069661102bb5dd143a6051cd1980dded1c838381518110620000935762000093620003c0565b60200260200101516200012a60201b60201c565b80620000b381620003d6565b9150506200004f565b50505050620003fe565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f7f8cffd58ac96898bdd25ab64868bd933141d15ad1cd4a0df228fd3fcba2a26d9060200160405180910390a150565b6200012682826200012a565b5050565b6200014182826200016d60201b6200076d1760201c565b600082815260016020908152604090912062000168918390620007f16200020d821b17901c565b505050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1662000126576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620001c93390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b600062000224836001600160a01b0384166200022d565b90505b92915050565b6000818152600183016020526040812054620002765750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915562000227565b50600062000227565b6001600160a01b03811681146200029557600080fd5b50565b8051620002a5816200027f565b919050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620002d657600080fd5b8351620002e3816200027f565b80935050602080850151620002f8816200027f565b60408601519093506001600160401b03808211156200031657600080fd5b818701915087601f8301126200032b57600080fd5b815181811115620003405762000340620002aa565b8060051b604051601f19603f83011681018181108582111715620003685762000368620002aa565b60405291825284820192508381018501918a8311156200038757600080fd5b938501935b82851015620003b057620003a08562000298565b845293850193928501926200038c565b8096505050505050509250925092565b634e487b7160e01b600052603260045260246000fd5b600060018201620003f757634e487b7160e01b600052601160045260246000fd5b5060010190565b610f97806200040e6000396000f3fe608060405234801561001057600080fd5b50600436106100db5760003560e01c806301ffc9a7146100e0578063248a9ca3146101085780632f2ff15d1461012957806336568abe1461013e5780636833f60d146101515780637a9ad019146101595780637d4f7fc91461016e5780639010d07c1461018157806391d14854146101a1578063a217fddf146101b4578063b9f3163b146101bc578063ca15c873146101c4578063caa6fea4146101d7578063d4b83992146101eb578063d547741f146101fe578063dcf7bb5c14610211578063f82ec70b14610224575b600080fd5b6100f36100ee366004610cd2565b610237565b60405190151581526020015b60405180910390f35b61011b610116366004610cfc565b610262565b6040519081526020016100ff565b61013c610137366004610d2a565b610277565b005b61013c61014c366004610d2a565b610298565b61013c61031b565b61011b600080516020610f4283398151915281565b61013c61017c366004610d5a565b6104b1565b61019461018f366004610d77565b6104d4565b6040516100ff9190610d99565b6100f36101af366004610d2a565b6104f3565b61011b600081565b61013c61051c565b61011b6101d2366004610cfc565b610703565b6002546100f390600160a01b900460ff1681565b600254610194906001600160a01b031681565b61013c61020c366004610d2a565b61071a565b61013c61021f366004610d5a565b610736565b61013c610232366004610d5a565b61074a565b60006001600160e01b03198216635a05180f60e01b148061025c575061025c82610806565b92915050565b60009081526020819052604090206001015490565b61028082610262565b6102898161083b565b6102938383610848565b505050565b6001600160a01b038116331461030d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610317828261086a565b5050565b600080516020610f428339815191526103338161083b565b600260009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610388573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ac9190610dad565b156104075760405162461bcd60e51b815260206004820152602560248201527f5061757365456e666f726365723a20746172676574206973206e6f74206f6e20604482015264706175736560d81b6064820152608401610304565b6002805460ff60a01b198116600160a01b1790915560408051638456cb5960e01b815290516001600160a01b0390921691638456cb599160048082019260009290919082900301818387803b15801561045f57600080fd5b505af1158015610473573d6000803e3d6000fd5b505050507fb8fad2fa0ed7a383e747c309ef2c4391d7b65592a48893e57ccc1fab70791456336040516104a69190610d99565b60405180910390a150565b60006104bc8161083b565b610317600080516020610f4283398151915283610848565b60008281526001602052604081206104ec908361088c565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020610f428339815191526105348161083b565b600254600160a01b900460ff1661059b5760405162461bcd60e51b815260206004820152602560248201527f5061757365456e666f726365723a206e6f74206f6e20656d657267656e637920604482015264706175736560d81b6064820152608401610304565b600260009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156105f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106149190610dad565b61066a5760405162461bcd60e51b815260206004820152602160248201527f5061757365456e666f726365723a20746172676574206973206f6e20706175736044820152606560f81b6064820152608401610304565b6002805460ff60a01b19811690915560408051631fa5d41d60e11b815290516001600160a01b0390921691633f4ba83a9160048082019260009290919082900301818387803b1580156106bc57600080fd5b505af11580156106d0573d6000803e3d6000fd5b505050507ff5cbf596165cc457b2cd92e8d8450827ee314968160a5696402d75766fc52caf336040516104a69190610d99565b600081815260016020526040812061025c90610898565b61072382610262565b61072c8161083b565b610293838361086a565b60006107418161083b565b610317826108a2565b60006107558161083b565b610317600080516020610f428339815191528361086a565b61077782826104f3565b610317576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556107ad3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006104ec836001600160a01b0384166108ed565b60006001600160e01b03198216637965db0b60e01b148061025c57506301ffc9a760e01b6001600160e01b031983161461025c565b610845813361093c565b50565b610852828261076d565b600082815260016020526040902061029390826107f1565b61087482826109a0565b60008281526001602052604090206102939082610a05565b60006104ec8383610a1a565b600061025c825490565b600280546001600160a01b0319166001600160a01b0383161790556040517f7f8cffd58ac96898bdd25ab64868bd933141d15ad1cd4a0df228fd3fcba2a26d906104a6908390610d99565b60008181526001830160205260408120546109345750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561025c565b50600061025c565b61094682826104f3565b6103175761095e816001600160a01b03166014610a44565b610969836020610a44565b60405160200161097a929190610df3565b60408051601f198184030181529082905262461bcd60e51b825261030491600401610e62565b6109aa82826104f3565b15610317576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006104ec836001600160a01b038416610bdf565b6000826000018281548110610a3157610a31610e95565b9060005260206000200154905092915050565b60606000610a53836002610ec1565b610a5e906002610ed8565b6001600160401b03811115610a7557610a75610eeb565b6040519080825280601f01601f191660200182016040528015610a9f576020820181803683370190505b509050600360fc1b81600081518110610aba57610aba610e95565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610ae957610ae9610e95565b60200101906001600160f81b031916908160001a9053506000610b0d846002610ec1565b610b18906001610ed8565b90505b6001811115610b90576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610b4c57610b4c610e95565b1a60f81b828281518110610b6257610b62610e95565b60200101906001600160f81b031916908160001a90535060049490941c93610b8981610f01565b9050610b1b565b5083156104ec5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610304565b60008181526001830160205260408120548015610cc8576000610c03600183610f18565b8554909150600090610c1790600190610f18565b9050818114610c7c576000866000018281548110610c3757610c37610e95565b9060005260206000200154905080876000018481548110610c5a57610c5a610e95565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610c8d57610c8d610f2b565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061025c565b600091505061025c565b600060208284031215610ce457600080fd5b81356001600160e01b0319811681146104ec57600080fd5b600060208284031215610d0e57600080fd5b5035919050565b6001600160a01b038116811461084557600080fd5b60008060408385031215610d3d57600080fd5b823591506020830135610d4f81610d15565b809150509250929050565b600060208284031215610d6c57600080fd5b81356104ec81610d15565b60008060408385031215610d8a57600080fd5b50508035926020909101359150565b6001600160a01b0391909116815260200190565b600060208284031215610dbf57600080fd5b815180151581146104ec57600080fd5b60005b83811015610dea578181015183820152602001610dd2565b50506000910152565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351610e25816017850160208801610dcf565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351610e56816028840160208801610dcf565b01602801949350505050565b6020815260008251806020840152610e81816040850160208701610dcf565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761025c5761025c610eab565b8082018082111561025c5761025c610eab565b634e487b7160e01b600052604160045260246000fd5b600081610f1057610f10610eab565b506000190190565b8181038181111561025c5761025c610eab565b634e487b7160e01b600052603160045260246000fdfe5bea60102f2a7acc9e82b1af0e3bd4069661102bb5dd143a6051cd1980dded1ca2646970667358221220d7cda1774ab5f67a7fa38fb1cdf0a94a16b6f23ab5987705c19f73349817c1c964736f6c63430008110033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100db5760003560e01c806301ffc9a7146100e0578063248a9ca3146101085780632f2ff15d1461012957806336568abe1461013e5780636833f60d146101515780637a9ad019146101595780637d4f7fc91461016e5780639010d07c1461018157806391d14854146101a1578063a217fddf146101b4578063b9f3163b146101bc578063ca15c873146101c4578063caa6fea4146101d7578063d4b83992146101eb578063d547741f146101fe578063dcf7bb5c14610211578063f82ec70b14610224575b600080fd5b6100f36100ee366004610cd2565b610237565b60405190151581526020015b60405180910390f35b61011b610116366004610cfc565b610262565b6040519081526020016100ff565b61013c610137366004610d2a565b610277565b005b61013c61014c366004610d2a565b610298565b61013c61031b565b61011b600080516020610f4283398151915281565b61013c61017c366004610d5a565b6104b1565b61019461018f366004610d77565b6104d4565b6040516100ff9190610d99565b6100f36101af366004610d2a565b6104f3565b61011b600081565b61013c61051c565b61011b6101d2366004610cfc565b610703565b6002546100f390600160a01b900460ff1681565b600254610194906001600160a01b031681565b61013c61020c366004610d2a565b61071a565b61013c61021f366004610d5a565b610736565b61013c610232366004610d5a565b61074a565b60006001600160e01b03198216635a05180f60e01b148061025c575061025c82610806565b92915050565b60009081526020819052604090206001015490565b61028082610262565b6102898161083b565b6102938383610848565b505050565b6001600160a01b038116331461030d5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b610317828261086a565b5050565b600080516020610f428339815191526103338161083b565b600260009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015610388573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ac9190610dad565b156104075760405162461bcd60e51b815260206004820152602560248201527f5061757365456e666f726365723a20746172676574206973206e6f74206f6e20604482015264706175736560d81b6064820152608401610304565b6002805460ff60a01b198116600160a01b1790915560408051638456cb5960e01b815290516001600160a01b0390921691638456cb599160048082019260009290919082900301818387803b15801561045f57600080fd5b505af1158015610473573d6000803e3d6000fd5b505050507fb8fad2fa0ed7a383e747c309ef2c4391d7b65592a48893e57ccc1fab70791456336040516104a69190610d99565b60405180910390a150565b60006104bc8161083b565b610317600080516020610f4283398151915283610848565b60008281526001602052604081206104ec908361088c565b9392505050565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b600080516020610f428339815191526105348161083b565b600254600160a01b900460ff1661059b5760405162461bcd60e51b815260206004820152602560248201527f5061757365456e666f726365723a206e6f74206f6e20656d657267656e637920604482015264706175736560d81b6064820152608401610304565b600260009054906101000a90046001600160a01b03166001600160a01b0316635c975abb6040518163ffffffff1660e01b81526004016020604051808303816000875af11580156105f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106149190610dad565b61066a5760405162461bcd60e51b815260206004820152602160248201527f5061757365456e666f726365723a20746172676574206973206f6e20706175736044820152606560f81b6064820152608401610304565b6002805460ff60a01b19811690915560408051631fa5d41d60e11b815290516001600160a01b0390921691633f4ba83a9160048082019260009290919082900301818387803b1580156106bc57600080fd5b505af11580156106d0573d6000803e3d6000fd5b505050507ff5cbf596165cc457b2cd92e8d8450827ee314968160a5696402d75766fc52caf336040516104a69190610d99565b600081815260016020526040812061025c90610898565b61072382610262565b61072c8161083b565b610293838361086a565b60006107418161083b565b610317826108a2565b60006107558161083b565b610317600080516020610f428339815191528361086a565b61077782826104f3565b610317576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556107ad3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b60006104ec836001600160a01b0384166108ed565b60006001600160e01b03198216637965db0b60e01b148061025c57506301ffc9a760e01b6001600160e01b031983161461025c565b610845813361093c565b50565b610852828261076d565b600082815260016020526040902061029390826107f1565b61087482826109a0565b60008281526001602052604090206102939082610a05565b60006104ec8383610a1a565b600061025c825490565b600280546001600160a01b0319166001600160a01b0383161790556040517f7f8cffd58ac96898bdd25ab64868bd933141d15ad1cd4a0df228fd3fcba2a26d906104a6908390610d99565b60008181526001830160205260408120546109345750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561025c565b50600061025c565b61094682826104f3565b6103175761095e816001600160a01b03166014610a44565b610969836020610a44565b60405160200161097a929190610df3565b60408051601f198184030181529082905262461bcd60e51b825261030491600401610e62565b6109aa82826104f3565b15610317576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60006104ec836001600160a01b038416610bdf565b6000826000018281548110610a3157610a31610e95565b9060005260206000200154905092915050565b60606000610a53836002610ec1565b610a5e906002610ed8565b6001600160401b03811115610a7557610a75610eeb565b6040519080825280601f01601f191660200182016040528015610a9f576020820181803683370190505b509050600360fc1b81600081518110610aba57610aba610e95565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610ae957610ae9610e95565b60200101906001600160f81b031916908160001a9053506000610b0d846002610ec1565b610b18906001610ed8565b90505b6001811115610b90576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610b4c57610b4c610e95565b1a60f81b828281518110610b6257610b62610e95565b60200101906001600160f81b031916908160001a90535060049490941c93610b8981610f01565b9050610b1b565b5083156104ec5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610304565b60008181526001830160205260408120548015610cc8576000610c03600183610f18565b8554909150600090610c1790600190610f18565b9050818114610c7c576000866000018281548110610c3757610c37610e95565b9060005260206000200154905080876000018481548110610c5a57610c5a610e95565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080610c8d57610c8d610f2b565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061025c565b600091505061025c565b600060208284031215610ce457600080fd5b81356001600160e01b0319811681146104ec57600080fd5b600060208284031215610d0e57600080fd5b5035919050565b6001600160a01b038116811461084557600080fd5b60008060408385031215610d3d57600080fd5b823591506020830135610d4f81610d15565b809150509250929050565b600060208284031215610d6c57600080fd5b81356104ec81610d15565b60008060408385031215610d8a57600080fd5b50508035926020909101359150565b6001600160a01b0391909116815260200190565b600060208284031215610dbf57600080fd5b815180151581146104ec57600080fd5b60005b83811015610dea578181015183820152602001610dd2565b50506000910152565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351610e25816017850160208801610dcf565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351610e56816028840160208801610dcf565b01602801949350505050565b6020815260008251806020840152610e81816040850160208701610dcf565b601f01601f19169190910160400192915050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b808202811582820484141761025c5761025c610eab565b8082018082111561025c5761025c610eab565b634e487b7160e01b600052604160045260246000fd5b600081610f1057610f10610eab565b506000190190565b8181038181111561025c5761025c610eab565b634e487b7160e01b600052603160045260246000fdfe5bea60102f2a7acc9e82b1af0e3bd4069661102bb5dd143a6051cd1980dded1ca2646970667358221220d7cda1774ab5f67a7fa38fb1cdf0a94a16b6f23ab5987705c19f73349817c1c964736f6c63430008110033", "devdoc": { "events": { "EmergencyPaused(address)": { @@ -517,9 +510,6 @@ "renounceRole(bytes32,address)": { "details": "Revokes `role` from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked `role`, emits a {RoleRevoked} event. Requirements: - the caller must be `account`. May emit a {RoleRevoked} event." }, - "resetEmergency()": { - "details": "Helper function to reset emergency status." - }, "revokeRole(bytes32,address)": { "details": "Revokes `role` from `account`. If `account` had been granted `role`, emits a {RoleRevoked} event. Requirements: - the caller must have ``role``'s admin role. May emit a {RoleRevoked} event." }, @@ -570,7 +560,7 @@ "type": "t_mapping(t_bytes32,t_struct(AddressSet)4026_storage)" }, { - "astId": 23767, + "astId": 23797, "contract": "contracts/ronin/gateway/PauseEnforcer.sol:PauseEnforcer", "label": "target", "offset": 0, @@ -578,7 +568,7 @@ "type": "t_contract(IPauseTarget)9671" }, { - "astId": 23770, + "astId": 23800, "contract": "contracts/ronin/gateway/PauseEnforcer.sol:PauseEnforcer", "label": "emergency", "offset": 20, diff --git a/deployments/ronin-mainnet/RoninValidatorSetLogic.json b/deployments/ronin-mainnet/RoninValidatorSetLogic.json index a4e8e368b..4f38380b6 100644 --- a/deployments/ronin-mainnet/RoninValidatorSetLogic.json +++ b/deployments/ronin-mainnet/RoninValidatorSetLogic.json @@ -1,5 +1,5 @@ { - "address": "0x112119F52eC8760Dacc84907953F2baC6FE5107B", + "address": "0xaB2985fa821CAae0524f6C5657aE40DaBDf2Eae0", "abi": [ { "inputs": [], @@ -2355,41 +2355,41 @@ "type": "receive" } ], - "transactionHash": "0x1bbb7b1a43d020aef3b34223a69f45631c4113ef73d736c01e50531c46b8143a", + "transactionHash": "0x333816480bb4ae5987a01fa77dd356147797438e0d69e7598d641db47f7a9f55", "receipt": { "to": null, - "from": "0x0F68eDBE14C8f68481771016d7E2871d6a35DE11", - "contractAddress": "0x112119F52eC8760Dacc84907953F2baC6FE5107B", - "transactionIndex": 1, - "gasUsed": "5382171", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000400000000000000000000000040000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000", - "blockHash": "0x0c7b62de9b610d93b840eee88d866780de0325813d9d818522629834ab31b8fa", - "transactionHash": "0x1bbb7b1a43d020aef3b34223a69f45631c4113ef73d736c01e50531c46b8143a", + "from": "0x4d58Ea7231c394d5804e8B06B1365915f906E27F", + "contractAddress": "0xaB2985fa821CAae0524f6C5657aE40DaBDf2Eae0", + "transactionIndex": 2, + "gasUsed": "5386803", + "logsBloom": "0x00000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x66e203819c58755a7ace185e09acc05c0172443a528358c38e13e6e77f6d1334", + "transactionHash": "0x333816480bb4ae5987a01fa77dd356147797438e0d69e7598d641db47f7a9f55", "logs": [ { - "transactionIndex": 1, - "blockNumber": 22984613, - "transactionHash": "0x1bbb7b1a43d020aef3b34223a69f45631c4113ef73d736c01e50531c46b8143a", - "address": "0x112119F52eC8760Dacc84907953F2baC6FE5107B", + "transactionIndex": 2, + "blockNumber": 24127506, + "transactionHash": "0x333816480bb4ae5987a01fa77dd356147797438e0d69e7598d641db47f7a9f55", + "address": "0xaB2985fa821CAae0524f6C5657aE40DaBDf2Eae0", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", - "logIndex": 3, - "blockHash": "0x0c7b62de9b610d93b840eee88d866780de0325813d9d818522629834ab31b8fa" + "logIndex": 12, + "blockHash": "0x66e203819c58755a7ace185e09acc05c0172443a528358c38e13e6e77f6d1334" } ], - "blockNumber": 22984613, - "cumulativeGasUsed": "5491531", + "blockNumber": 24127506, + "cumulativeGasUsed": "5830410", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 2, - "solcInputHash": "cee8587b26e080f856978a2f78dd6e87", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedEmergencyExit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedRevokingCandidate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedUpdatingCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyWrappedEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAtEndOfEpochOnly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallPrecompiled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeBridgeTrackingContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeCoinbase\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeMaintenanceContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeRoninTrustedOrgContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeSlashIndicatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeStakingContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeStakingVestingContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"ErrCannotBailout\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExceedsMaxNumberOfCandidate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentBridgeOperator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExistentCandidate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdminAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentCandidateAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_treasuryAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidEffectiveDaysOnwards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMaxPrioritizedValidatorNumber\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMinEffectiveDaysOnwards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrNonExistentCandidate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrTrustedOrgCannotRenounce\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnauthorizedReceiveRON\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonExistentRecyclingInfo\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"BlockProducerSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coinbaseAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum ICoinbaseExecution.BlockRewardDeprecatedType\",\"name\":\"deprecatedType\",\"type\":\"uint8\"}],\"name\":\"BlockRewardDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coinbaseAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"submittedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bonusAmount\",\"type\":\"uint256\"}],\"name\":\"BlockRewardSubmitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"bridgeOperators\",\"type\":\"address[]\"}],\"name\":\"BridgeOperatorSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"BridgeTrackingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"BridgeTrackingIncorrectlyResponded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"}],\"name\":\"CandidateGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"}],\"name\":\"CandidateRevokingTimestampUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"name\":\"CandidateTopupDeadlineUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"CandidatesRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"effectiveTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateUpdateScheduled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"name\":\"DeprecatedRewardRecycleFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DeprecatedRewardRecycled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockedAmount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedFundReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedFundReleasingFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lockedAmount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExpiryDurationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"MaintenanceContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MaxPrioritizedValidatorNumberUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"MaxValidatorCandidateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MaxValidatorNumberUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"numOfDays\",\"type\":\"uint256\"}],\"name\":\"MinEffectiveDaysOnwardsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MiningRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"MiningRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"RoninTrustedOrganizationContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SlashIndicatorContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"StakingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"StakingRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"StakingVestingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailedUntil\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"deductedStakingAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"blockProducerRewardDeprecated\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"bridgeOperatorRewardDeprecated\",\"type\":\"bool\"}],\"name\":\"ValidatorPunished\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"ValidatorSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"ValidatorUnjailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"periodNumber\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochNumber\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"periodEnding\",\"type\":\"bool\"}],\"name\":\"WrappedUpEpoch\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADDITION_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERIOD_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bridgeTrackingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkBridgeRewardDeprecatedAtLatestPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"checkBridgeRewardDeprecatedAtPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"checkJailed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_blockNum\",\"type\":\"uint256\"}],\"name\":\"checkJailedAtBlock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"}],\"name\":\"checkManyJailed\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_result\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_blockProducer\",\"type\":\"address\"}],\"name\":\"checkMiningRewardDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_blockProducer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"checkMiningRewardDeprecatedAtPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentPeriodStartAtBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyExitLockedAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyExpiryDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"epochEndingAt\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"epochOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"execApplyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"execBailOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_secLeftToRevoke\",\"type\":\"uint256\"}],\"name\":\"execEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_recipient\",\"type\":\"address\"}],\"name\":\"execReleaseLockedFundForEmergencyExitRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_secsLeft\",\"type\":\"uint256\"}],\"name\":\"execRequestRenounceCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_effectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"execRequestUpdateCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_newJailedUntil\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"_cannotBailout\",\"type\":\"bool\"}],\"name\":\"execSlash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBlockProducers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBridgeOperators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validatorAddrs\",\"type\":\"address[]\"}],\"name\":\"getBridgeOperatorsOf\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCandidateInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.ValidatorCandidate\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCandidateInfos\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.ValidatorCandidate[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCommissionChangeSchedule\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"effectiveTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.CommissionSchedule\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getEmergencyExitInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"lockedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"recyclingAt\",\"type\":\"uint256\"}],\"internalType\":\"struct ICommonInfo.EmergencyExitInfo\",\"name\":\"_info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"getJailedTimeLeft\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isJailed_\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"blockLeft_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochLeft_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_blockNum\",\"type\":\"uint256\"}],\"name\":\"getJailedTimeLeftAtBlock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isJailed_\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"blockLeft_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochLeft_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastUpdatedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorCandidates\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_validatorList\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_bridgeOperators\",\"type\":\"address[]\"},{\"internalType\":\"enum EnumFlags.ValidatorFlag[]\",\"name\":\"_flags\",\"type\":\"uint8[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__slashIndicatorContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__stakingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__stakingVestingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__maintenanceContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninTrustedOrganizationContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__bridgeTrackingContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__maxValidatorNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxValidatorCandidate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxPrioritizedValidatorNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__minEffectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__numberOfBlocksInEpoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256[2]\",\"name\":\"__emergencyExitConfigs\",\"type\":\"uint256[2]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isBlockProducer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"}],\"name\":\"isBridgeOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isOperator\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"}],\"name\":\"isCandidateAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"isOperatingBridge\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isPeriodEnding\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isValidator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isValidatorCandidate\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maintenanceContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxPrioritizedValidatorNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maximumPrioritizedValidatorNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorCandidate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maximumValidatorNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minEffectiveDaysOnwards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfBlocksInEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfBlocks\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompilePickValidatorSetAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompileSortValidatorsAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninTrustedOrganizationContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setBridgeTrackingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_emergencyExitLockedAmount\",\"type\":\"uint256\"}],\"name\":\"setEmergencyExitLockedAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_emergencyExpiryDuration\",\"type\":\"uint256\"}],\"name\":\"setEmergencyExpiryDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setMaintenanceContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"name\":\"setMaxPrioritizedValidatorNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"name\":\"setMaxValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_max\",\"type\":\"uint256\"}],\"name\":\"setMaxValidatorNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numOfDays\",\"type\":\"uint256\"}],\"name\":\"setMinEffectiveDaysOnwards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setRoninTrustedOrganizationContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setSlashIndicatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setStakingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setStakingVestingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"slashIndicatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingVestingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"submitBlockReward\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBlockProducers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBridgeOperators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalDeprecatedReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"tryGetPeriodOfEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_filled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_periodNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wrapUpEpoch\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrAlreadyRequestedEmergencyExit()\":[{\"details\":\"Error of already requested emergency exit before.\"}],\"ErrAlreadyRequestedRevokingCandidate()\":[{\"details\":\"Error of already requested revoking candidate before.\"}],\"ErrAlreadyRequestedUpdatingCommissionRate()\":[{\"details\":\"Error of commission change schedule exists.\"}],\"ErrAlreadyWrappedEpoch()\":[{\"details\":\"Error of query for already wrapped up epoch\"}],\"ErrAtEndOfEpochOnly()\":[{\"details\":\"Error of only allowed at the end of epoch\"}],\"ErrCallPrecompiled()\":[{\"details\":\"Error of call to precompile fails.\"}],\"ErrCallerMustBeBridgeTrackingContract()\":[{\"details\":\"Error of method caller must be bridge tracking contract.\"}],\"ErrCallerMustBeCoinbase()\":[{\"details\":\"Error of method caller must be coinbase\"}],\"ErrCallerMustBeMaintenanceContract()\":[{\"details\":\"Error of method caller must be maintenance contract.\"}],\"ErrCallerMustBeRoninTrustedOrgContract()\":[{\"details\":\"Error of method caller must be Ronin trusted org contract.\"}],\"ErrCallerMustBeSlashIndicatorContract()\":[{\"details\":\"Error of method caller must be slash indicator contract.\"}],\"ErrCallerMustBeStakingContract()\":[{\"details\":\"Error of method caller must be staking contract.\"}],\"ErrCallerMustBeStakingVestingContract()\":[{\"details\":\"Error of method caller must be staking vesting contract.\"}],\"ErrCannotBailout(address)\":[{\"details\":\"Error of cannot bailout due to high tier slash.\"}],\"ErrExceedsMaxNumberOfCandidate()\":[{\"details\":\"Error of exceeding maximum number of candidates.\"}],\"ErrExistentBridgeOperator(address)\":[{\"details\":\"Error of bridge operator already exists.\"}],\"ErrExistentCandidate()\":[{\"details\":\"Error of querying for already existent candidate.\"}],\"ErrExistentCandidateAdmin(address)\":[{\"details\":\"Error of candidate admin already exists.\"}],\"ErrExistentTreasury(address)\":[{\"details\":\"Error of treasury already exists.\"}],\"ErrInsufficientBalance()\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrInvalidCommissionRate()\":[{\"details\":\"Error of invalid commission rate.\"}],\"ErrInvalidEffectiveDaysOnwards()\":[{\"details\":\"Error of invalid effective days onwards.\"}],\"ErrInvalidMaxPrioritizedValidatorNumber()\":[{\"details\":\"Error of number of prioritized greater than number of max validators.\"}],\"ErrInvalidMinEffectiveDaysOnwards()\":[{\"details\":\"Error of invalid min effective days onwards.\"}],\"ErrNonExistentCandidate()\":[{\"details\":\"Error of querying for non-existent candidate.\"}],\"ErrRecipientRevert()\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrTrustedOrgCannotRenounce()\":[{\"details\":\"Error of trusted org cannot renounce.\"}],\"ErrUnauthorizedReceiveRON()\":[{\"details\":\"Error thrown when receives RON from neither staking vesting contract nor staking contract\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}],\"NonExistentRecyclingInfo()\":[{\"details\":\"Error thrown when queries for a non existent info.\"}]},\"kind\":\"dev\",\"methods\":{\"bridgeTrackingContract()\":{\"details\":\"Returns the bridge tracking contract.\"},\"checkBridgeRewardDeprecatedAtLatestPeriod(address)\":{\"details\":\"Because the information of deprecating bridge reward of a period is only determined at the end of that period, this method will return the deprecating info of the latest period. A method for querying that info of current period is no need.\"},\"checkBridgeRewardDeprecatedAtPeriod(address,uint256)\":{\"details\":\"Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\"},\"checkJailed(address)\":{\"details\":\"Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\"},\"checkJailedAtBlock(address,uint256)\":{\"details\":\"Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\"},\"checkManyJailed(address[])\":{\"details\":\"Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\"},\"checkMiningRewardDeprecated(address)\":{\"details\":\"Returns whether the incoming reward of the block producer is deprecated during the current period.\"},\"checkMiningRewardDeprecatedAtPeriod(address,uint256)\":{\"details\":\"Returns whether the incoming reward of the block producer is deprecated during a specific period.\"},\"currentPeriod()\":{\"details\":\"Returns the period index from the current block.\"},\"currentPeriodStartAtBlock()\":{\"details\":\"Returns the block number that the current period starts at.\"},\"emergencyExitLockedAmount()\":{\"details\":\"Returns the amount of RON to lock from a consensus address.\"},\"emergencyExpiryDuration()\":{\"details\":\"Returns the duration that an emergency request is expired and the fund will be recycled.\"},\"epochEndingAt(uint256)\":{\"details\":\"Returns whether the epoch ending is at the block number `_block`.\"},\"epochOf(uint256)\":{\"details\":\"Returns the epoch index from the block number.\"},\"execApplyValidatorCandidate(address,address,address,address,uint256)\":{\"details\":\"Grants a validator candidate. Requirements: - The method caller is staking contract. Emits the event `CandidateGranted`.\"},\"execBailOut(address,uint256)\":{\"details\":\"Finalize the bailout request from slash indicator contract. Requirements: - The method caller is slash indicator contract. Emits the event `ValidatorUnjailed`.\"},\"execEmergencyExit(address,uint256)\":{\"details\":\"Fallback function of `IStaking-requestEmergencyExit`. Requirements: - The method caller is staking contract.\"},\"execReleaseLockedFundForEmergencyExitRequest(address,address)\":{\"details\":\"Unlocks fund for emergency exit request. Requirements: - The method caller is admin. Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked. Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\"},\"execRequestRenounceCandidate(address,uint256)\":{\"details\":\"Requests to revoke a validator candidate in next `_secsLeft` seconds. Requirements: - The method caller is staking contract. Emits the event `CandidateRevokingTimestampUpdated`.\"},\"execRequestUpdateCommissionRate(address,uint256,uint256)\":{\"details\":\"Fallback function of `CandidateStaking-requestUpdateCommissionRate`. Requirements: - The method caller is the staking contract. - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdateScheduled`.\"},\"execSlash(address,uint256,uint256,bool)\":{\"details\":\"Finalize the slash request from slash indicator contract. Requirements: - The method caller is slash indicator contract. Emits the event `ValidatorPunished`.\"},\"getBlockProducers()\":{\"details\":\"Returns the current block producer list.\"},\"getBridgeOperators()\":{\"details\":\"Returns the current bridge operator list.\"},\"getBridgeOperatorsOf(address[])\":{\"details\":\"Returns the bridge operator list corresponding to validator address list.\"},\"getCandidateInfo(address)\":{\"details\":\"Returns the info of a candidate.\"},\"getCandidateInfos()\":{\"details\":\"Returns all candidate info.\"},\"getCommissionChangeSchedule(address)\":{\"details\":\"Returns the schedule of changing commission rate of a candidate address.\"},\"getEmergencyExitInfo(address)\":{\"details\":\"Returns the emergency exit request.\"},\"getJailedTimeLeft(address)\":{\"details\":\"Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\"},\"getJailedTimeLeftAtBlock(address,uint256)\":{\"details\":\"Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\"},\"getLastUpdatedBlock()\":{\"details\":\"Returns the block that validator set was updated.\"},\"getValidatorCandidates()\":{\"details\":\"Returns the validator candidate.\"},\"getValidators()\":{\"details\":\"Returns the current validator list.\"},\"initialize(address,address,address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256[2])\":{\"details\":\"Initializes the contract storage.\"},\"isBlockProducer(address)\":{\"details\":\"Returns whether the address is block producer or not.\"},\"isBridgeOperator(address)\":{\"details\":\"Returns whether the address is bridge operator.\"},\"isCandidateAdmin(address,address)\":{\"details\":\"Returns whether the address is the candidate admin.\"},\"isOperatingBridge(address)\":{\"details\":\"Returns whether the consensus address is operating the bridge or not.\"},\"isPeriodEnding()\":{\"details\":\"Returns whether the period ending at the current block number.\"},\"isValidator(address)\":{\"details\":\"Returns whether the address is either a bridge operator or a block producer.\"},\"isValidatorCandidate(address)\":{\"details\":\"Returns whether the address is a validator (candidate).\"},\"maintenanceContract()\":{\"details\":\"Returns the maintenance contract.\"},\"maxPrioritizedValidatorNumber()\":{\"details\":\"Returns the number of reserved slots for prioritized validators.\"},\"maxValidatorCandidate()\":{\"details\":\"Returns the maximum number of validator candidate.\"},\"maxValidatorNumber()\":{\"details\":\"Returns the maximum number of validators in the epoch.\"},\"minEffectiveDaysOnwards()\":{\"details\":\"Returns the minimum number of days to the effective date of commission rate change.\"},\"numberOfBlocksInEpoch()\":{\"details\":\"Returns the number of blocks in a epoch.\"},\"precompilePickValidatorSetAddress()\":{\"details\":\"Gets the address of the precompile of picking validator set\"},\"precompileSortValidatorsAddress()\":{\"details\":\"Gets the address of the precompile of sorting validators\"},\"roninTrustedOrganizationContract()\":{\"details\":\"Returns the ronin trusted organization contract.\"},\"setBridgeTrackingContract(address)\":{\"details\":\"Sets the bridge tracking contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `BridgeTrackingContractUpdated`.\"},\"setEmergencyExitLockedAmount(uint256)\":{\"details\":\"Sets the amount of RON to lock from a consensus address. Requirements: - The method caller is admin. Emits the event `EmergencyExitLockedAmountUpdated`.\"},\"setEmergencyExpiryDuration(uint256)\":{\"details\":\"Sets the duration that an emergency request is expired and the fund will be recycled. Requirements: - The method caller is admin. Emits the event `EmergencyExpiryDurationUpdated`.\"},\"setMaintenanceContract(address)\":{\"details\":\"Sets the maintenance contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `MaintenanceContractUpdated`.\"},\"setMaxPrioritizedValidatorNumber(uint256)\":{\"details\":\"Updates the number of reserved slots for prioritized validators Requirements: - The method caller is admin Emits the event `MaxPrioritizedValidatorNumberUpdated`\"},\"setMaxValidatorCandidate(uint256)\":{\"details\":\"Sets the maximum number of validator candidate. Requirements: - The method caller is admin. Emits the `MaxValidatorCandidateUpdated` event.\"},\"setMaxValidatorNumber(uint256)\":{\"details\":\"Updates the max validator number Requirements: - The method caller is admin Emits the event `MaxValidatorNumberUpdated`\"},\"setMinEffectiveDaysOnwards(uint256)\":{\"details\":\"Sets the minimum number of days to the effective date of commision rate change. Requirements: - The method caller is admin. Emits the `MinEffectiveDaysOnwardsUpdated` event.\"},\"setRoninTrustedOrganizationContract(address)\":{\"details\":\"Sets the ronin trusted organization contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `RoninTrustedOrganizationContractUpdated`.\"},\"setSlashIndicatorContract(address)\":{\"details\":\"Sets the slash indicator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `SlashIndicatorContractUpdated`.\"},\"setStakingContract(address)\":{\"details\":\"Sets the staking contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `StakingContractUpdated`.\"},\"setStakingVestingContract(address)\":{\"details\":\"Sets the staking vesting contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `StakingVestingContractUpdated`.\"},\"slashIndicatorContract()\":{\"details\":\"Returns the slash indicator contract.\"},\"stakingContract()\":{\"details\":\"Returns the staking contract.\"},\"stakingVestingContract()\":{\"details\":\"Returns the staking vesting contract.\"},\"submitBlockReward()\":{\"details\":\"Submits reward of the current block. Requirements: - The method caller is coinbase. Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer. Emits the event `BlockRewardSubmitted` for the valid call.\"},\"totalBlockProducers()\":{\"details\":\"Returns total numbers of the block producers.\"},\"totalBridgeOperators()\":{\"details\":\"Returns total numbers of the bridge operators.\"},\"totalDeprecatedReward()\":{\"details\":\"Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\"},\"tryGetPeriodOfEpoch(uint256)\":{\"details\":\"Tries to get the period index from the epoch number.\"},\"wrapUpEpoch()\":{\"details\":\"Wraps up the current epoch. Requirements: - The method must be called when the current epoch is ending. - The epoch is not wrapped yet. - The method caller is coinbase. Emits the event `MiningRewardDistributed` when some validator has reward distributed. Emits the event `StakingRewardDistributed` when some staking pool has reward distributed. Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up. Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending. Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated. Emits the event `WrappedUpEpoch`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/validator/RoninValidatorSet.sol\":\"RoninValidatorSet\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xdb7f5c28fc61cda0bd8ab60ce288e206b791643bcd3ba464a70cbec18895a2f5\",\"license\":\"MIT\"},\"contracts/extensions/RONTransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract RONTransferHelper {\\n /// @dev Error of recipient not accepting RON when transfer RON.\\n error ErrRecipientRevert();\\n /// @dev Error of sender has insufficient balance.\\n error ErrInsufficientBalance();\\n\\n /**\\n * @dev See `_sendRON`.\\n * Reverts if the recipient does not receive RON.\\n */\\n function _transferRON(address payable _recipient, uint256 _amount) internal {\\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\\n }\\n\\n /**\\n * @dev Send `_amount` RON to the address `_recipient`.\\n * Returns whether the recipient receives RON or not.\\n * Reverts once the contract balance is insufficient.\\n *\\n * Note: consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\\n return _unsafeSendRON(_recipient, _amount);\\n }\\n\\n /**\\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\\n * the call does not revert.\\n *\\n * Note:\\n * - Does not assert whether the balance of sender is sufficient.\\n * - Does not assert whether the recipient accepts RON.\\n * - Consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount }(\\\"\\\");\\n }\\n\\n /**\\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\\n */\\n function _unsafeSendRON(\\n address payable _recipient,\\n uint256 _amount,\\n uint256 _gas\\n ) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbf47d40b2431cf190fa737b803e4cb6fb55aee3f8804470da57a9e340f7914f8\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasBridgeTrackingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasBridgeTrackingContract.sol\\\";\\nimport \\\"../../interfaces/IBridgeTracking.sol\\\";\\n\\ncontract HasBridgeTrackingContract is IHasBridgeTrackingContract, HasProxyAdmin {\\n IBridgeTracking internal _bridgeTrackingContract;\\n\\n modifier onlyBridgeTrackingContract() {\\n if (bridgeTrackingContract() != msg.sender) revert ErrCallerMustBeBridgeTrackingContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeTrackingContract\\n */\\n function bridgeTrackingContract() public view override returns (address) {\\n return address(_bridgeTrackingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeTrackingContract\\n */\\n function setBridgeTrackingContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setBridgeTrackingContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the bridge tracking contract.\\n *\\n * Emits the event `BridgeTrackingContractUpdated`.\\n *\\n */\\n function _setBridgeTrackingContract(address _addr) internal {\\n _bridgeTrackingContract = IBridgeTracking(_addr);\\n emit BridgeTrackingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x195b0d3fc2305aa4620f5091ba161f3e983b4cef2272d80f5f5b180a8ab98a34\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasMaintenanceContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasMaintenanceContract.sol\\\";\\nimport \\\"../../interfaces/IMaintenance.sol\\\";\\n\\ncontract HasMaintenanceContract is IHasMaintenanceContract, HasProxyAdmin {\\n IMaintenance internal _maintenanceContract;\\n\\n modifier onlyMaintenanceContract() {\\n if (maintenanceContract() != msg.sender) revert ErrCallerMustBeMaintenanceContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasMaintenanceContract\\n */\\n function maintenanceContract() public view override returns (address) {\\n return address(_maintenanceContract);\\n }\\n\\n /**\\n * @inheritdoc IHasMaintenanceContract\\n */\\n function setMaintenanceContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setMaintenanceContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the scheduled maintenance contract.\\n *\\n * Emits the event `MaintenanceContractUpdated`.\\n *\\n */\\n function _setMaintenanceContract(address _addr) internal {\\n _maintenanceContract = IMaintenance(_addr);\\n emit MaintenanceContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x117a29d878d44a20350df8ab539d34335713ba0f3b2c768a58124f61efb74357\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\n\\ncontract HasRoninTrustedOrganizationContract is IHasRoninTrustedOrganizationContract, HasProxyAdmin {\\n IRoninTrustedOrganization internal _roninTrustedOrganizationContract;\\n\\n modifier onlyRoninTrustedOrganizationContract() {\\n if (roninTrustedOrganizationContract() != msg.sender) revert ErrCallerMustBeRoninTrustedOrgContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function roninTrustedOrganizationContract() public view override returns (address) {\\n return address(_roninTrustedOrganizationContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function setRoninTrustedOrganizationContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setRoninTrustedOrganizationContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function _setRoninTrustedOrganizationContract(address _addr) internal {\\n _roninTrustedOrganizationContract = IRoninTrustedOrganization(_addr);\\n emit RoninTrustedOrganizationContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x951fd730f4853d8c932da5484ea093f3094c8186735b603d31fb53035c395751\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasSlashIndicatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasSlashIndicatorContract.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashIndicator.sol\\\";\\n\\ncontract HasSlashIndicatorContract is IHasSlashIndicatorContract, HasProxyAdmin {\\n ISlashIndicator internal _slashIndicatorContract;\\n\\n modifier onlySlashIndicatorContract() {\\n if (slashIndicatorContract() != msg.sender) revert ErrCallerMustBeSlashIndicatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasSlashIndicatorContract\\n */\\n function slashIndicatorContract() public view override returns (address) {\\n return address(_slashIndicatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasSlashIndicatorContract\\n */\\n function setSlashIndicatorContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setSlashIndicatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the slash indicator contract.\\n *\\n * Emits the event `SlashIndicatorContractUpdated`.\\n *\\n */\\n function _setSlashIndicatorContract(address _addr) internal {\\n _slashIndicatorContract = ISlashIndicator(_addr);\\n emit SlashIndicatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x280c56e53c53bf1438cf7d3e71026baf383d24332359bce59282074c94abe5bb\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasStakingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasStakingContract.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\n\\ncontract HasStakingContract is IHasStakingContract, HasProxyAdmin {\\n IStaking internal _stakingContract;\\n\\n modifier onlyStakingContract() {\\n if (stakingContract() != msg.sender) revert ErrCallerMustBeStakingContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasStakingContract\\n */\\n function stakingContract() public view override returns (address) {\\n return address(_stakingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasStakingContract\\n */\\n function setStakingContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setStakingContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the staking contract.\\n *\\n * Emits the event `StakingContractUpdated`.\\n *\\n */\\n function _setStakingContract(address _addr) internal {\\n _stakingContract = IStaking(_addr);\\n emit StakingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x54d2a4608e0a8819ebd7fdb4ae784d3c709285e93f002034f9e2e787a6607923\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasStakingVestingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasStakingVestingContract.sol\\\";\\nimport \\\"../../interfaces/IStakingVesting.sol\\\";\\n\\ncontract HasStakingVestingContract is IHasStakingVestingContract, HasProxyAdmin {\\n IStakingVesting internal _stakingVestingContract;\\n\\n modifier onlyStakingVestingContract() {\\n if (stakingVestingContract() != msg.sender) revert ErrCallerMustBeStakingVestingContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasStakingVestingContract\\n */\\n function stakingVestingContract() public view override returns (address) {\\n return address(_stakingVestingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasStakingVestingContract\\n */\\n function setStakingVestingContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setStakingVestingContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the staking vesting contract.\\n *\\n * Emits the event `StakingVestingContractUpdated`.\\n *\\n */\\n function _setStakingVestingContract(address _addr) internal {\\n _stakingVestingContract = IStakingVesting(_addr);\\n emit StakingVestingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x1893fae5d612b0d78f6d66695194aa6b03817a3b92be602887918781fba29e37\",\"license\":\"MIT\"},\"contracts/extensions/consumers/GlobalConfigConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract GlobalConfigConsumer {\\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\\n /// @dev The length of a period in second.\\n uint256 public constant PERIOD_DURATION = 1 days;\\n}\\n\",\"keccak256\":\"0x96d6b1ea4c8e126a8c2468683e7513d195f8e05456d85dd8f259ab049347b527\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/IBridgeTracking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBridgeTracking {\\n struct Request {\\n VoteKind kind;\\n uint256 id;\\n }\\n\\n enum VoteKind {\\n Deposit,\\n Withdrawal,\\n MainchainWithdrawal\\n }\\n\\n /**\\n * @dev Returns the total number of votes at the specific period `_period`.\\n */\\n function totalVotes(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots at the specific period `_period`.\\n */\\n function totalBallots(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\\n */\\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\\n */\\n function totalBallotsOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\\n\\n /**\\n * @dev Handles the request once it is approved.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\\n\\n /**\\n * @dev Records vote for a receipt and a operator.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function recordVote(\\n VoteKind _kind,\\n uint256 _requestId,\\n address _operator\\n ) external;\\n}\\n\",\"keccak256\":\"0x6066ff36c2ad0494a676dfeb4289c3cbe48d0d70266e8ec0930014a41f2a39a3\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IMaintenance {\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\\n */\\n function checkScheduled(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr`\\n */\\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\\n */\\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedules() external view returns (uint256 _count);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedules() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4f06c8f3ad7ec8b863882c655ddf443675d557272445e51d8a1e1f3454089d09\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x10f3b360430e6d03773c9959f54cbed6fb0346069645c05b05ef50cfb19f3753\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninGovernanceAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../libraries/BridgeOperatorsBallot.sol\\\";\\n\\ninterface IRoninGovernanceAdmin {\\n /// @dev Emitted when the bridge operators are approved.\\n event BridgeOperatorsApproved(uint256 _period, uint256 _epoch, address[] _operators);\\n /// @dev Emitted when an emergency exit poll is created.\\n event EmergencyExitPollCreated(\\n bytes32 _voteHash,\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n );\\n /// @dev Emitted when an emergency exit poll is approved.\\n event EmergencyExitPollApproved(bytes32 _voteHash);\\n /// @dev Emitted when an emergency exit poll is expired.\\n event EmergencyExitPollExpired(bytes32 _voteHash);\\n\\n /**\\n * @dev Returns the last voted block of the bridge voter.\\n */\\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256);\\n\\n /**\\n * @dev Returns the synced bridge operator set info.\\n */\\n function lastSyncedBridgeOperatorSetInfo()\\n external\\n view\\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory _bridgeOperatorSetInfo);\\n\\n /**\\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n */\\n function createEmergencyExitPoll(\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) external;\\n}\\n\",\"keccak256\":\"0x1aa218f9a8cad8fa9f865c179b257aa8f2614e034100dedebdd352da9a7d96d9\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeights() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganizations() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x1edb7a3f5d340e7efc141cb8d94c5499954dec869f026d3998ad92cbc714d604\",\"license\":\"MIT\"},\"contracts/interfaces/IStakingVesting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IStakingVesting {\\n /// @dev Emitted when the block bonus for block producer is transferred.\\n event BonusTransferred(\\n uint256 indexed blockNumber,\\n address indexed recipient,\\n uint256 blockProducerAmount,\\n uint256 bridgeOperatorAmount\\n );\\n /// @dev Emitted when the transfer of block bonus for block producer is failed.\\n event BonusTransferFailed(\\n uint256 indexed blockNumber,\\n address indexed recipient,\\n uint256 blockProducerAmount,\\n uint256 bridgeOperatorAmount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the block bonus for block producer is updated\\n event BlockProducerBonusPerBlockUpdated(uint256);\\n /// @dev Emitted when the block bonus for bridge operator is updated\\n event BridgeOperatorBonusPerBlockUpdated(uint256);\\n\\n /**\\n * @dev Returns the bonus amount for the block producer at `_block`.\\n */\\n function blockProducerBlockBonus(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns the bonus amount for the bridge validator at `_block`.\\n */\\n function bridgeOperatorBlockBonus(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Receives RON from any address.\\n */\\n function receiveRON() external payable;\\n\\n /**\\n * @dev Returns the last block number that the staking vesting is sent.\\n */\\n function lastBlockSendingBonus() external view returns (uint256);\\n\\n /**\\n * @dev Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n * - The method must be called only once per block.\\n *\\n * Emits the event `BonusTransferred` or `BonusTransferFailed`.\\n *\\n * Notes:\\n * - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method\\n * will not be reverted, and the underlying nodes does not hang.\\n *\\n * @param _forBlockProducer Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\\n * @param _forBridgeOperator Indicates whether requesting the bonus for the bridge operator.\\n *\\n * @return _success Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\\n * @return _blockProducerBonus The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\\n * @return _bridgeOperatorBonus The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\\n *\\n */\\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\\n external\\n returns (\\n bool _success,\\n uint256 _blockProducerBonus,\\n uint256 _bridgeOperatorBonus\\n );\\n\\n /**\\n * @dev Sets the bonus amount per block for block producer.\\n *\\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n */\\n function setBlockProducerBonusPerBlock(uint256 _amount) external;\\n\\n /**\\n * @dev Sets the bonus amount per block for bridge operator.\\n *\\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n */\\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0x6705fdccf03c4acd34ceb1034c2ab556c901781d6d5597e63f257eafe75cf1ae\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasBridgeTrackingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasBridgeTrackingContract is IHasContract {\\n /// @dev Emitted when the bridge tracking contract is updated.\\n event BridgeTrackingContractUpdated(address);\\n\\n /// @dev Error of method caller must be bridge tracking contract.\\n error ErrCallerMustBeBridgeTrackingContract();\\n\\n /**\\n * @dev Returns the bridge tracking contract.\\n */\\n function bridgeTrackingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the bridge tracking contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `BridgeTrackingContractUpdated`.\\n *\\n */\\n function setBridgeTrackingContract(address) external;\\n}\\n\",\"keccak256\":\"0x2d1b7e356826bfe1c2a3348137d828f46ca931f7c2f48197379ad987e713714b\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasMaintenanceContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasMaintenanceContract is IHasContract {\\n /// @dev Emitted when the maintenance contract is updated.\\n event MaintenanceContractUpdated(address);\\n\\n /// @dev Error of method caller must be maintenance contract.\\n error ErrCallerMustBeMaintenanceContract();\\n\\n /**\\n * @dev Returns the maintenance contract.\\n */\\n function maintenanceContract() external view returns (address);\\n\\n /**\\n * @dev Sets the maintenance contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `MaintenanceContractUpdated`.\\n *\\n */\\n function setMaintenanceContract(address) external;\\n}\\n\",\"keccak256\":\"0x0a0ef6ba14e2929c7c8dda0642a7a831c9997d1b0d049eb83f64dfc21ff0e72e\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\\n /// @dev Emitted when the ronin trusted organization contract is updated.\\n event RoninTrustedOrganizationContractUpdated(address);\\n\\n /// @dev Error of method caller must be Ronin trusted org contract.\\n error ErrCallerMustBeRoninTrustedOrgContract();\\n\\n /**\\n * @dev Returns the ronin trusted organization contract.\\n */\\n function roninTrustedOrganizationContract() external view returns (address);\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function setRoninTrustedOrganizationContract(address) external;\\n}\\n\",\"keccak256\":\"0x7d0a0b1d658e9cf4d69f4934748e0a5c1d22183024d26927f5d621fc61aff0b2\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasSlashIndicatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasSlashIndicatorContract is IHasContract {\\n /// @dev Emitted when the slash indicator contract is updated.\\n event SlashIndicatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be slash indicator contract.\\n error ErrCallerMustBeSlashIndicatorContract();\\n\\n /**\\n * @dev Returns the slash indicator contract.\\n */\\n function slashIndicatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `SlashIndicatorContractUpdated`.\\n *\\n */\\n function setSlashIndicatorContract(address) external;\\n}\\n\",\"keccak256\":\"0xfaaeec87f74039a55fe451c07c341b88794e62a8a331c878a8d9e91f55f1ff45\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasStakingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasStakingContract is IHasContract {\\n /// @dev Emitted when the staking contract is updated.\\n event StakingContractUpdated(address);\\n\\n /// @dev Error of method caller must be staking contract.\\n error ErrCallerMustBeStakingContract();\\n\\n /**\\n * @dev Returns the staking contract.\\n */\\n function stakingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the staking contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `StakingContractUpdated`.\\n *\\n */\\n function setStakingContract(address) external;\\n}\\n\",\"keccak256\":\"0xd5e9b017f7ba0157fa41152a8bb166edbc6ef54a97fa3bb71a2a9b333d846c0b\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasStakingVestingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasStakingVestingContract is IHasContract {\\n /// @dev Emitted when the staking vesting contract is updated.\\n event StakingVestingContractUpdated(address);\\n\\n /// @dev Error of method caller must be staking vesting contract.\\n error ErrCallerMustBeStakingVestingContract();\\n\\n /**\\n * @dev Returns the staking vesting contract.\\n */\\n function stakingVestingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the staking vesting contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `StakingVestingContractUpdated`.\\n *\\n */\\n function setStakingVestingContract(address) external;\\n}\\n\",\"keccak256\":\"0xfc5f14854b15f81d5b535e4baaeca7cedca69b26813bfc6ade75fdabc4eaffcf\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface PeriodWrapperConsumer {\\n struct PeriodWrapper {\\n // Inner value.\\n uint256 inner;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n}\\n\",\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/IBaseSlash.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseSlash {\\n enum SlashType {\\n UNKNOWN,\\n UNAVAILABILITY_TIER_1,\\n UNAVAILABILITY_TIER_2,\\n DOUBLE_SIGNING,\\n BRIDGE_VOTING,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\\n UNAVAILABILITY_TIER_3\\n }\\n\\n /// @dev Emitted when the validator is slashed.\\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\\n}\\n\",\"keccak256\":\"0x04d449f2852840566dfff4e3673929f6e9b8d9b5fc5b29744bf4f344dc7f9bc0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ICreditScore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICreditScore {\\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\\n event CreditScoreConfigsUpdated(\\n uint256 gainCreditScore,\\n uint256 maxCreditScore,\\n uint256 bailOutCostMultiplier,\\n uint256 cutOffPercentageAfterBailout\\n );\\n /// @dev Emitted the credit score of validators is updated.\\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\\n /// @dev Emitted when a validator bailed out of jail.\\n event BailedOut(address indexed validator, uint256 period, uint256 usedCreditScore);\\n\\n /**\\n * @dev Updates the credit score for the validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function updateCreditScores(address[] calldata _validators, uint256 _period) external;\\n\\n /**\\n * @dev Resets the credit score for the revoked validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function execResetCreditScores(address[] calldata _validators) external;\\n\\n /**\\n * @dev A slashed validator use this method to get out of jail.\\n *\\n * Requirements:\\n * - The `_consensusAddr` must be a validator.\\n * - Only validator's admin can call this method.\\n *\\n * Emits the event `BailedOut`.\\n *\\n */\\n function bailOut(address _consensusAddr) external;\\n\\n /**\\n * @dev Sets the configs to credit score.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CreditScoreConfigsUpdated`.\\n *\\n * @param _gainScore The score to gain per period.\\n * @param _maxScore The max number of credit score that a validator can hold.\\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to credit score.\\n *\\n * @return _gainCreditScore The score to gain per period.\\n * @return _maxCreditScore The max number of credit score that a validator can hold.\\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function getCreditScoreConfigs()\\n external\\n view\\n returns (\\n uint256 _gainCreditScore,\\n uint256 _maxCreditScore,\\n uint256 _bailOutCostMultiplier,\\n uint256 _cutOffPercentageAfterBailout\\n );\\n\\n /**\\n * @dev Returns the current credit score of the validator.\\n */\\n function getCreditScore(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the current credit score of a list of validators.\\n */\\n function getManyCreditScores(address[] calldata _validators) external view returns (uint256[] memory _resultList);\\n\\n /**\\n * @dev Returns the whether the `_validator` has been bailed out at the `_period`.\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5364db88efb971f73aac569e27e5604758a123f28567af757b9933fdddd14f8\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeOperator is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method\\n * `getBridgeOperatorSlashingConfigs` for param details.\\n */\\n event BridgeOperatorSlashingConfigsUpdated(\\n uint256 missingVotesRatioTier1,\\n uint256 missingVotesRatioTier2,\\n uint256 jailDurationForMissingVotesRatioTier2,\\n uint256 skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\\n * @param _tier The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1`\\n * and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2`\\n *\\n * Requirements:\\n * - Only validator contract can invoke this method.\\n * - Should be called only at the end of period.\\n * - Should be called only when there is slash of bridge operator.\\n *\\n * Emits the event `Slashed`.\\n */\\n function execSlashBridgeOperator(\\n address _consensusAddr,\\n uint256 _tier,\\n uint256 _period\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to bridge operator slashing.\\n *\\n * @return _missingVotesRatioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio.\\n * @return _missingVotesRatioTier2 The bridge reward and mining reward will be deprecated and the corresponding\\n * block producer will be put in jail if (s)he misses more than this ratio.\\n * @return _jailDurationForMissingVotesRatioTier2 The number of blocks to jail the corresponding block producer when\\n * its bridge operator is slashed tier-2.\\n * @return _skipBridgeOperatorSlashingThreshold The threshold to skip slashing the bridge operator in case the total\\n * number of votes in the bridge is too small.\\n *\\n */\\n function getBridgeOperatorSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _missingVotesRatioTier1,\\n uint256 _missingVotesRatioTier2,\\n uint256 _jailDurationForMissingVotesRatioTier2,\\n uint256 _skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash bridge operators.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _ratioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map\\n * to 0%-100%.\\n * @param _ratioTier2 The bridge reward and mining reward will be deprecated and the corresponding block producer will\\n * be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\\n * @param _jailDurationTier2 The number of blocks to jail the corresponding block producer when its bridge operator is\\n * slashed tier-2.\\n * @param _skipSlashingThreshold The threshold to skip slashing the bridge operator in case the total number of votes\\n * in the bridge is too small.\\n *\\n */\\n function setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x5c09ac11ead005bfa25ae58e970c441144849b14d58fd5f53fadc3b9be16e5d6\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeVoting is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge voting is updated. See the method `getBridgeVotingSlashingConfigs` for param\\n * details.\\n */\\n event BridgeVotingSlashingConfigsUpdated(uint256 bridgeVotingThreshold, uint256 bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Slashes for bridge voter governance.\\n *\\n * Emits the event `Slashed`.\\n */\\n function slashBridgeVoting(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the configs related to bridge voting slashing.\\n *\\n * @return _bridgeVotingThreshold The threshold to slash when a trusted organization does not vote for bridge\\n * operators.\\n * @return _bridgeVotingSlashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function getBridgeVotingSlashingConfigs()\\n external\\n view\\n returns (uint256 _bridgeVotingThreshold, uint256 _bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Sets the configs to slash bridge voting.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeVotingSlashingConfigsUpdated`.\\n *\\n * @param _threshold The threshold to slash when a trusted organization does not vote for bridge operators.\\n * @param _slashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external;\\n}\\n\",\"keccak256\":\"0x72c3bcfe3c49f946651caa3066bd5296d007871c9a56fa113e2d3c0f3db7eb99\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashDoubleSign is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\\n * for param details.\\n */\\n event DoubleSignSlashingConfigsUpdated(\\n uint256 slashDoubleSignAmount,\\n uint256 doubleSigningJailUntilBlock,\\n uint256 doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Slashes for double signing.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\\n */\\n function slashDoubleSign(\\n address _validatorAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\\n * double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function getDoubleSignSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _slashDoubleSignAmount,\\n uint256 _doubleSigningJailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\\n *\\n * @param _slashAmount The amount of RON to slash double sign.\\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n ) external;\\n}\\n\",\"keccak256\":\"0xe72708c42d468b0c40ffa0c72b3386899f11273e4149425aab490a78d5312222\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashIndicator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashDoubleSign.sol\\\";\\nimport \\\"./ISlashBridgeVoting.sol\\\";\\nimport \\\"./ISlashBridgeOperator.sol\\\";\\nimport \\\"./ISlashUnavailability.sol\\\";\\nimport \\\"./ICreditScore.sol\\\";\\n\\ninterface ISlashIndicator is\\n ISlashDoubleSign,\\n ISlashBridgeVoting,\\n ISlashBridgeOperator,\\n ISlashUnavailability,\\n ICreditScore\\n{}\\n\",\"keccak256\":\"0xe8b8fde3af614735cb304bc1eb82b05d65ede4df804b5d555787e5d5ecb95ec0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashUnavailability.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashUnavailability is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\\n * for param details.\\n */\\n event UnavailabilitySlashingConfigsUpdated(\\n uint256 unavailabilityTier1Threshold,\\n uint256 unavailabilityTier2Threshold,\\n uint256 slashAmountForUnavailabilityTier2Threshold,\\n uint256 jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Returns the last block that a block producer is slashed for unavailability.\\n */\\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Slashes for unavailability by increasing the counter of block producer `_consensusAddr`.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` when the threshold is reached.\\n *\\n */\\n function slashUnavailability(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the current unavailability indicator of a block producer.\\n */\\n function currentUnavailabilityIndicator(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the unavailability indicator in the period `_period` of a block producer.\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\\n * @return _unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\\n * @return _slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\\n * producer when (s)he is slashed with tier-2 or tier-3.\\n * @return _jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\\n * slashed with tier-2 or tier-3.\\n *\\n */\\n function getUnavailabilitySlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _unavailabilityTier1Threshold,\\n uint256 _unavailabilityTier2Threshold,\\n uint256 _slashAmountForUnavailabilityTier2Threshold,\\n uint256 _jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\\n * @param _tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\\n * self-staking if (s)he misses more than this threshold.\\n * @param _slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\\n * is slashed tier-2.\\n * @param _jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\\n *\\n */\\n function setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x92f7d8e9c6f80d4fedab80515c68db0a46cf4f8da143f8d766bf5f7582aa0a21\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseStaking {\\n struct PoolDetail {\\n // Address of the pool i.e. consensus address of the validator\\n address addr;\\n // Pool admin address\\n address admin;\\n // Self-staking amount\\n uint256 stakingAmount;\\n // Total number of RON staking for the pool\\n uint256 stakingTotal;\\n // Mapping from delegator => delegating amount\\n mapping(address => uint256) delegatingAmount;\\n // Mapping from delegator => the last timestamp that delegator staked\\n mapping(address => uint256) lastDelegatingTimestamp;\\n }\\n\\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\\n event WaitingSecsToRevokeUpdated(uint256 secs);\\n\\n /// @dev Error of cannot transfer RON.\\n error ErrCannotTransferRON();\\n /// @dev Error of receiving zero message value.\\n error ErrZeroValue();\\n /// @dev Error of pool admin is not allowed to call.\\n error ErrPoolAdminForbidden();\\n /// @dev Error of no one is allowed to call but the pool's admin.\\n error ErrOnlyPoolAdminAllowed();\\n /// @dev Error of admin of any active pool cannot delegate.\\n error ErrAdminOfAnyActivePoolForbidden(address admin);\\n /// @dev Error of querying inactive pool.\\n error ErrInactivePool(address poolAddr);\\n /// @dev Error of length of input arrays are not of the same.\\n error ErrInvalidArrays();\\n\\n /**\\n * @dev Returns whether the `_poolAdminAddr` is currently active.\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the consensus address corresponding to the pool admin.\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\\n\\n /**\\n * @dev Returns the staking pool detail.\\n */\\n function getPoolDetail(address)\\n external\\n view\\n returns (\\n address _admin,\\n uint256 _stakingAmount,\\n uint256 _stakingTotal\\n );\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\\n */\\n function waitingSecsToRevoke() external view returns (uint256);\\n\\n /**\\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external;\\n}\\n\",\"keccak256\":\"0x008b3d42a3104820de7b7edb5ea4b21c75d4417767fc0791f89f00ac9a2cce8d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface ICandidateStaking is IRewardPool {\\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\\n event MinValidatorStakingAmountUpdated(uint256 threshold);\\n /// @dev Emitted when the max commission rate is updated.\\n event MaxCommissionRateUpdated(uint256 maxRate);\\n\\n /// @dev Emitted when the pool admin staked for themself.\\n event Staked(address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\\n event Unstaked(address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Emitted when the validator pool is approved.\\n event PoolApproved(address indexed validator, address indexed admin);\\n /// @dev Emitted when the validator pool is deprecated.\\n event PoolsDeprecated(address[] validator);\\n /// @dev Emitted when the staking amount transfer failed.\\n event StakingAmountTransferFailed(\\n address indexed validator,\\n address indexed admin,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\\n event StakingAmountDeductFailed(\\n address indexed validator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Error of cannot transfer RON to specified target.\\n error ErrCannotInitTransferRON(address addr, string extraInfo);\\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\\n error ErrThreeInteractionAddrsNotEqual();\\n /// @dev Error of three operation addresses must be distinct in applying for validator candidate.\\n error ErrThreeOperationAddrsNotDistinct();\\n /// @dev Error of unstaking zero amount.\\n error ErrUnstakeZeroAmount();\\n /// @dev Error of invalid staking amount left after deducted.\\n error ErrStakingAmountLeft();\\n /// @dev Error of insufficient staking amount for unstaking.\\n error ErrInsufficientStakingAmount();\\n /// @dev Error of unstaking too early.\\n error ErrUnstakeTooEarly();\\n /// @dev Error of setting commission rate exceeds max allowed.\\n error ErrInvalidCommissionRate();\\n\\n /**\\n * @dev Returns the minimum threshold for being a validator candidate.\\n */\\n function minValidatorStakingAmount() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max commission rate that the candidate can set.\\n */\\n function maxCommissionRate() external view returns (uint256);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function setMinValidatorStakingAmount(uint256) external;\\n\\n /**\\n * @dev Sets the max commission rate that a candidate can set.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxCommissionRateUpdated` event.\\n *\\n */\\n function setMaxCommissionRate(uint256 _maxRate) external;\\n\\n /**\\n * @dev Proposes a candidate to become a validator.\\n *\\n * Requirements:\\n * - The method caller is able to receive RON.\\n * - The treasury is able to receive RON.\\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\\n *\\n * Emits the event `PoolApproved`.\\n *\\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\\n * to its candidate, e.g. scheduling maintenance.\\n *\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external payable;\\n\\n /**\\n * @dev Deprecates the pool.\\n * - Deduct self-staking amount of the pool admin to zero.\\n * - Transfer the deducted amount to the pool admin.\\n * - Deactivate the pool admin address in the mapping of active pool admins\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\\n *\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\\n\\n /**\\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `msg.value` is larger than 0.\\n *\\n * Emits the event `Staked`.\\n *\\n */\\n function stake(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function unstake(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdated`.\\n *\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestRenounce(address _consensusAddr) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestEmergencyExit(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4160e8b8dc00df59a35823589d69dcbf5655d7024f5d8e17e823e243ffb44b9d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface IDelegatorStaking is IRewardPool {\\n /// @dev Emitted when the delegator staked for a validator candidate.\\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the delegator unstaked from a validator candidate.\\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Error of undelegating zero amount.\\n error ErrUndelegateZeroAmount();\\n /// @dev Error of undelegating insufficient amount.\\n error ErrInsufficientDelegatingAmount();\\n /// @dev Error of undelegating too early.\\n error ErrUndelegateTooEarly();\\n\\n /**\\n * @dev Stakes for a validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n */\\n function delegate(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Undelegated` event.\\n *\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Bulk unstakes from a list of candidates.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the events `Undelegated`.\\n *\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\\n\\n /**\\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `Undelegated` event and the `Delegated` event.\\n *\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external;\\n\\n /**\\n * @dev Returns the claimable reward of the user `_user`.\\n */\\n function getRewards(address _user, address[] calldata _poolAddrList)\\n external\\n view\\n returns (uint256[] memory _rewards);\\n\\n /**\\n * @dev Claims the reward of method caller.\\n *\\n * Emits the `RewardClaimed` event.\\n *\\n */\\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `RewardClaimed` event and the `Delegated` event.\\n *\\n */\\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\\n external\\n returns (uint256 _amount);\\n}\\n\",\"keccak256\":\"0x5ce840a920ed06139f9e33d306c8ee50b2a81e4bd2ac6ed24b47297c348576b8\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IRewardPool.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/consumers/PeriodWrapperConsumer.sol\\\";\\n\\ninterface IRewardPool is PeriodWrapperConsumer {\\n struct UserRewardFields {\\n // Recorded reward amount.\\n uint256 debited;\\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\\n uint256 aRps;\\n // Lowest staking amount in the period.\\n uint256 lowestAmount;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n\\n struct PoolFields {\\n // Accumulated of the amount rewards per share (one unit staking).\\n uint256 aRps;\\n // The staking total to share reward of the current period.\\n PeriodWrapper shares;\\n }\\n\\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\\n /// @dev Emitted when the user claimed their reward\\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\\n\\n /// @dev Emitted when the pool shares are updated\\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\\n /// @dev Emitted when the pools are updated\\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\\n /// @dev Emitted when the contract fails when updating the pools\\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\\n /// @dev Emitted when the contract fails when updating the pools that already set\\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\\n\\n /// @dev Error of invalid pool share.\\n error ErrInvalidPoolShare();\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amount of an user.\\n */\\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amounts of the users.\\n */\\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total staking amount of all users for a pool.\\n */\\n function getStakingTotal(address _poolAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\\n */\\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\\n}\\n\",\"keccak256\":\"0x92315ca9d6d93f55a7752adf2567adb86745f708198bfcd74b9a626b6570208f\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseStaking.sol\\\";\\nimport \\\"./ICandidateStaking.sol\\\";\\nimport \\\"./IDelegatorStaking.sol\\\";\\n\\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable;\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\\n external\\n returns (uint256 _actualDeductingAmount);\\n}\\n\",\"keccak256\":\"0xb7942c5032c16ea567ac0bfc07ecacd84840d6de134735ea538aa22fc6da05a5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/BridgeOperatorsBallot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nlibrary BridgeOperatorsBallot {\\n struct BridgeOperatorSet {\\n uint256 period;\\n uint256 epoch;\\n address[] operators;\\n }\\n\\n // keccak256(\\\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\\\");\\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\\n\\n /**\\n * @dev Verifies whether the ballot is valid or not.\\n *\\n * Requirements:\\n * - The ballot is not for an empty operator set.\\n * - The operator address list is in order.\\n *\\n */\\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\\n require(_ballot.operators.length > 0, \\\"BridgeOperatorsBallot: invalid array length\\\");\\n address _addr = _ballot.operators[0];\\n for (uint _i = 1; _i < _ballot.operators.length; _i++) {\\n require(_addr < _ballot.operators[_i], \\\"BridgeOperatorsBallot: invalid order of bridge operators\\\");\\n _addr = _ballot.operators[_i];\\n }\\n }\\n\\n /**\\n * @dev Returns hash of the ballot.\\n */\\n function hash(BridgeOperatorSet calldata _ballot) internal pure returns (bytes32) {\\n bytes32 _operatorsHash;\\n address[] memory _operators = _ballot.operators;\\n\\n assembly {\\n _operatorsHash := keccak256(add(_operators, 32), mul(mload(_operators), 32))\\n }\\n\\n return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\\n }\\n}\\n\",\"keccak256\":\"0x986425ebae2dcfcfa266c9ca825232ff300ec8ce796e8975da6714d87e921793\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xf719e74bc39be7aceb4e5cc455260f81b2b21e83aa693e0b50c390c9909e08c4\",\"license\":\"UNLICENSED\"},\"contracts/precompile-usages/PCUPickValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUPickValidatorSet is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of picking validator set\\n function precompilePickValidatorSetAddress() public view virtual returns (address) {\\n return address(0x68);\\n }\\n\\n /**\\n * @dev Sorts and arranges to return a new validator set.\\n *\\n * Note: The recover process is done by pre-compiled contract. This function is marked as\\n * virtual for implementing mocking contract for testing purpose.\\n */\\n function _pcPickValidatorSet(\\n address[] memory _candidates,\\n uint256[] memory _weights,\\n uint256[] memory _trustedWeights,\\n uint256 _maxValidatorNumber,\\n uint256 _maxPrioritizedValidatorNumber\\n ) internal view virtual returns (address[] memory _result, uint256 _newValidatorCount) {\\n address _smc = precompilePickValidatorSetAddress();\\n bytes memory _payload = abi.encodeWithSignature(\\n \\\"pickValidatorSet(address[],uint256[],uint256[],uint256,uint256)\\\",\\n _candidates,\\n _weights,\\n _trustedWeights,\\n _maxValidatorNumber,\\n _maxPrioritizedValidatorNumber\\n );\\n bool _success = true;\\n\\n uint256 _payloadLength = _payload.length;\\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\\n\\n assembly {\\n let _payloadStart := add(_payload, 0x20)\\n\\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\\n _success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n _success := 0\\n }\\n\\n _result := add(_result, 0x20)\\n }\\n\\n if (!_success) revert ErrCallPrecompiled();\\n\\n _newValidatorCount = _result.length;\\n }\\n}\\n\",\"keccak256\":\"0xcb57a021897a773d11be9d98a195e0653f2124b7e95e84c4832b57d9d36d67e1\",\"license\":\"MIT\"},\"contracts/precompile-usages/PCUSortValidators.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUSortValidators is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of sorting validators\\n function precompileSortValidatorsAddress() public view virtual returns (address) {\\n return address(0x66);\\n }\\n\\n /**\\n * @dev Sorts candidates descending by their weights by calling precompile contract.\\n *\\n * Note: This function is marked as virtual for being wrapping in mock contract for testing purpose.\\n */\\n function _pcSortCandidates(address[] memory _candidates, uint256[] memory _weights)\\n internal\\n view\\n virtual\\n returns (address[] memory _result)\\n {\\n address _smc = precompileSortValidatorsAddress();\\n bool _success = true;\\n\\n bytes memory _payload = abi.encodeWithSignature(\\\"sortValidators(address[],uint256[])\\\", _candidates, _weights);\\n uint256 _payloadLength = _payload.length;\\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\\n\\n assembly {\\n let _payloadStart := add(_payload, 0x20)\\n\\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\\n _success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n _success := 0\\n }\\n\\n _result := add(_result, 0x20)\\n }\\n\\n if (!_success) revert ErrCallPrecompiled();\\n }\\n}\\n\",\"keccak256\":\"0xc779a5a5e29fb4416450b2eb6608a09e2cf63f6d9af5b2c1eec130dd16b0d22a\",\"license\":\"MIT\"},\"contracts/precompile-usages/PrecompiledUsage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PrecompiledUsage {\\n /// @dev Error of call to precompile fails.\\n error ErrCallPrecompiled();\\n}\\n\",\"keccak256\":\"0x76facc3f3a8dd573c826bbbfedaa5cd8ef30963fbabd8c163c0c72b6efea5551\",\"license\":\"MIT\"},\"contracts/ronin/validator/CandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasStakingContract.sol\\\";\\nimport \\\"../../extensions/consumers/GlobalConfigConsumer.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../interfaces/validator/ICandidateManager.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\n\\nabstract contract CandidateManager is ICandidateManager, PercentageConsumer, GlobalConfigConsumer, HasStakingContract {\\n /// @dev Maximum number of validator candidate\\n uint256 private _maxValidatorCandidate;\\n\\n /// @dev The validator candidate array\\n address[] internal _candidates;\\n /// @dev Mapping from candidate consensus address => bitwise negation of validator index in `_candidates`\\n mapping(address => uint256) internal _candidateIndex;\\n /// @dev Mapping from candidate consensus address => their info\\n mapping(address => ValidatorCandidate) internal _candidateInfo;\\n\\n /**\\n * @dev The minimum offset in day from current date to the effective date of a new commission schedule.\\n * Value of 1 means the change gets affected at the beginning of the following day.\\n **/\\n uint256 internal _minEffectiveDaysOnwards;\\n /// @dev Mapping from candidate consensus address => schedule commission change.\\n mapping(address => CommissionSchedule) internal _candidateCommissionChangeSchedule;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] private ______gap;\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function maxValidatorCandidate() public view override returns (uint256) {\\n return _maxValidatorCandidate;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function minEffectiveDaysOnwards() external view override returns (uint256) {\\n return _minEffectiveDaysOnwards;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function setMaxValidatorCandidate(uint256 _number) external override onlyAdmin {\\n _setMaxValidatorCandidate(_number);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external override onlyAdmin {\\n _setMinEffectiveDaysOnwards(_numOfDays);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function execApplyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external override onlyStakingContract {\\n uint256 _length = _candidates.length;\\n if (_length >= maxValidatorCandidate()) revert ErrExceedsMaxNumberOfCandidate();\\n if (isValidatorCandidate(_consensusAddr)) revert ErrExistentCandidate();\\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\\n\\n for (uint _i; _i < _candidates.length; _i++) {\\n ValidatorCandidate storage existentInfo = _candidateInfo[_candidates[_i]];\\n if (_candidateAdmin == existentInfo.admin) revert ErrExistentCandidateAdmin(_candidateAdmin);\\n if (_treasuryAddr == existentInfo.treasuryAddr) revert ErrExistentTreasury(_treasuryAddr);\\n if (_bridgeOperatorAddr == existentInfo.bridgeOperatorAddr) revert ErrExistentBridgeOperator(_bridgeOperatorAddr);\\n }\\n\\n _candidateIndex[_consensusAddr] = ~_length;\\n _candidates.push(_consensusAddr);\\n\\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\\n _info.admin = _candidateAdmin;\\n _info.consensusAddr = _consensusAddr;\\n _info.treasuryAddr = _treasuryAddr;\\n _info.bridgeOperatorAddr = _bridgeOperatorAddr;\\n _info.commissionRate = _commissionRate;\\n emit CandidateGranted(_consensusAddr, _treasuryAddr, _candidateAdmin, _bridgeOperatorAddr);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function execRequestRenounceCandidate(address _consensusAddr, uint256 _secsLeft)\\n external\\n override\\n onlyStakingContract\\n {\\n if (_isTrustedOrg(_consensusAddr)) revert ErrTrustedOrgCannotRenounce();\\n\\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\\n if (_info.revokingTimestamp != 0) revert ErrAlreadyRequestedRevokingCandidate();\\n _setRevokingTimestamp(_info, block.timestamp + _secsLeft);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external override onlyStakingContract {\\n if (_candidateCommissionChangeSchedule[_consensusAddr].effectiveTimestamp != 0) {\\n revert ErrAlreadyRequestedUpdatingCommissionRate();\\n }\\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\\n if (_effectiveDaysOnwards < _minEffectiveDaysOnwards) revert ErrInvalidEffectiveDaysOnwards();\\n\\n CommissionSchedule storage _schedule = _candidateCommissionChangeSchedule[_consensusAddr];\\n uint256 _effectiveTimestamp = ((block.timestamp / PERIOD_DURATION) + _effectiveDaysOnwards) * PERIOD_DURATION;\\n _schedule.effectiveTimestamp = _effectiveTimestamp;\\n _schedule.commissionRate = _commissionRate;\\n\\n emit CommissionRateUpdateScheduled(_consensusAddr, _effectiveTimestamp, _commissionRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function isValidatorCandidate(address _addr) public view override returns (bool) {\\n return _candidateIndex[_addr] != 0;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getCandidateInfos() external view override returns (ValidatorCandidate[] memory _list) {\\n _list = new ValidatorCandidate[](_candidates.length);\\n for (uint _i; _i < _list.length; _i++) {\\n _list[_i] = _candidateInfo[_candidates[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getCandidateInfo(address _candidate) external view override returns (ValidatorCandidate memory) {\\n if (!isValidatorCandidate(_candidate)) revert ErrNonExistentCandidate();\\n return _candidateInfo[_candidate];\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getValidatorCandidates() public view override returns (address[] memory) {\\n return _candidates;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getCommissionChangeSchedule(address _candidate) external view override returns (CommissionSchedule memory) {\\n return _candidateCommissionChangeSchedule[_candidate];\\n }\\n\\n /**\\n * @dev Removes unsastisfied candidates, the ones who have insufficient minimum candidate staking amount,\\n * or the ones who requested to renounce their candidate role.\\n *\\n * Emits the event `CandidatesRevoked` when a candidate is revoked.\\n *\\n */\\n function _syncCandidateSet(uint256 _nextPeriod) internal returns (address[] memory _unsatisfiedCandidates) {\\n IStaking _staking = _stakingContract;\\n uint256 _waitingSecsToRevoke = _staking.waitingSecsToRevoke();\\n uint256 _minStakingAmount = _staking.minValidatorStakingAmount();\\n uint256[] memory _selfStakings = _staking.getManySelfStakings(_candidates);\\n\\n uint256 _length = _candidates.length;\\n uint256 _unsatisfiedCount;\\n _unsatisfiedCandidates = new address[](_length);\\n\\n {\\n uint256 _i;\\n address _addr;\\n ValidatorCandidate storage _info;\\n while (_i < _length) {\\n _addr = _candidates[_i];\\n _info = _candidateInfo[_addr];\\n\\n // Checks for under-balance status of candidates\\n bool _hasTopupDeadline = _info.topupDeadline != 0;\\n if (_selfStakings[_i] < _minStakingAmount) {\\n // Updates deadline on the first time unsatisfied the staking amount condition\\n if (!_hasTopupDeadline) {\\n uint256 _topupDeadline = block.timestamp + _waitingSecsToRevoke;\\n _info.topupDeadline = _topupDeadline;\\n emit CandidateTopupDeadlineUpdated(_addr, _topupDeadline);\\n }\\n } else if (_hasTopupDeadline) {\\n // Removes the deadline if the staking amount condition is satisfied\\n delete _info.topupDeadline;\\n emit CandidateTopupDeadlineUpdated(_addr, 0);\\n }\\n\\n // Removes unsastisfied candidates\\n bool _revokingActivated = (_info.revokingTimestamp != 0 && _info.revokingTimestamp <= block.timestamp) ||\\n _emergencyExitLockedFundReleased(_addr);\\n bool _topupDeadlineMissed = _info.topupDeadline != 0 && _info.topupDeadline <= block.timestamp;\\n if (_revokingActivated || _topupDeadlineMissed) {\\n _selfStakings[_i] = _selfStakings[--_length];\\n _unsatisfiedCandidates[_unsatisfiedCount++] = _addr;\\n _removeCandidate(_addr);\\n continue;\\n }\\n\\n // Checks for schedule of commission change and updates commission rate\\n uint256 _scheduleTimestamp = _candidateCommissionChangeSchedule[_addr].effectiveTimestamp;\\n if (_scheduleTimestamp != 0 && _scheduleTimestamp <= block.timestamp) {\\n uint256 _commisionRate = _candidateCommissionChangeSchedule[_addr].commissionRate;\\n delete _candidateCommissionChangeSchedule[_addr];\\n _info.commissionRate = _commisionRate;\\n emit CommissionRateUpdated(_addr, _commisionRate);\\n }\\n\\n _i++;\\n }\\n }\\n\\n assembly {\\n mstore(_unsatisfiedCandidates, _unsatisfiedCount)\\n }\\n\\n if (_unsatisfiedCount > 0) {\\n emit CandidatesRevoked(_unsatisfiedCandidates);\\n _staking.execDeprecatePools(_unsatisfiedCandidates, _nextPeriod);\\n }\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view override returns (bool) {\\n return _candidateInfo[_candidate].admin == _admin;\\n }\\n\\n /**\\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\\n */\\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address) {\\n return _candidateInfo[_consensusAddr].bridgeOperatorAddr;\\n }\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function _setMaxValidatorCandidate(uint256 _threshold) internal {\\n _maxValidatorCandidate = _threshold;\\n emit MaxValidatorCandidateUpdated(_threshold);\\n }\\n\\n /**\\n * @dev Sets the minimum number of days onwards to the effective date of commission rate change.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function _setMinEffectiveDaysOnwards(uint256 _numOfDays) internal {\\n if (_numOfDays < 1) revert ErrInvalidMinEffectiveDaysOnwards();\\n _minEffectiveDaysOnwards = _numOfDays;\\n emit MinEffectiveDaysOnwardsUpdated(_numOfDays);\\n }\\n\\n /**\\n * @dev Removes the candidate.\\n */\\n function _removeCandidate(address _addr) internal virtual {\\n uint256 _idx = _candidateIndex[_addr];\\n if (_idx == 0) {\\n return;\\n }\\n\\n delete _candidateInfo[_addr];\\n delete _candidateIndex[_addr];\\n delete _candidateCommissionChangeSchedule[_addr];\\n\\n address _lastCandidate = _candidates[_candidates.length - 1];\\n if (_lastCandidate != _addr) {\\n _candidateIndex[_lastCandidate] = _idx;\\n _candidates[~_idx] = _lastCandidate;\\n }\\n\\n _candidates.pop();\\n }\\n\\n /**\\n * @dev Sets timestamp to revoke a candidate.\\n */\\n function _setRevokingTimestamp(ValidatorCandidate storage _candidate, uint256 _timestamp) internal {\\n if (!isValidatorCandidate(_candidate.consensusAddr)) revert ErrNonExistentCandidate();\\n _candidate.revokingTimestamp = _timestamp;\\n emit CandidateRevokingTimestampUpdated(_candidate.consensusAddr, _timestamp);\\n }\\n\\n /**\\n * @dev Returns a flag indicating whether the fund is unlocked.\\n */\\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual returns (bool);\\n\\n /**\\n * @dev Returns whether the consensus address is a trusted org or not.\\n */\\n function _isTrustedOrg(address _consensusAddr) internal virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x118e406abfbaba67fdb5a282740674f4e2442f55fe182fee6d0bd82ea8d7a8e7\",\"license\":\"MIT\"},\"contracts/ronin/validator/CoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasBridgeTrackingContract.sol\\\";\\nimport \\\"../../extensions/collections/HasMaintenanceContract.sol\\\";\\nimport \\\"../../extensions/collections/HasSlashIndicatorContract.sol\\\";\\nimport \\\"../../extensions/collections/HasStakingVestingContract.sol\\\";\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../interfaces/validator/ICoinbaseExecution.sol\\\";\\nimport \\\"../../libraries/EnumFlags.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"../../precompile-usages/PCUSortValidators.sol\\\";\\nimport \\\"../../precompile-usages/PCUPickValidatorSet.sol\\\";\\nimport \\\"./storage-fragments/CommonStorage.sol\\\";\\nimport \\\"./CandidateManager.sol\\\";\\nimport \\\"./EmergencyExit.sol\\\";\\n\\nabstract contract CoinbaseExecution is\\n ICoinbaseExecution,\\n RONTransferHelper,\\n PCUSortValidators,\\n PCUPickValidatorSet,\\n HasStakingVestingContract,\\n HasBridgeTrackingContract,\\n HasMaintenanceContract,\\n HasSlashIndicatorContract,\\n EmergencyExit\\n{\\n using EnumFlags for EnumFlags.ValidatorFlag;\\n\\n modifier onlyCoinbase() {\\n if (msg.sender != block.coinbase) revert ErrCallerMustBeCoinbase();\\n _;\\n }\\n\\n modifier whenEpochEnding() {\\n if (!epochEndingAt(block.number)) revert ErrAtEndOfEpochOnly();\\n _;\\n }\\n\\n modifier oncePerEpoch() {\\n if (epochOf(_lastUpdatedBlock) >= epochOf(block.number)) revert ErrAlreadyWrappedEpoch();\\n _lastUpdatedBlock = block.number;\\n _;\\n }\\n\\n /**\\n * @inheritdoc ICoinbaseExecution\\n */\\n function submitBlockReward() external payable override onlyCoinbase {\\n bool _requestForBlockProducer = isBlockProducer(msg.sender) &&\\n !_jailed(msg.sender) &&\\n !_miningRewardDeprecated(msg.sender, currentPeriod());\\n\\n (, uint256 _blockProducerBonus, uint256 _bridgeOperatorBonus) = _stakingVestingContract.requestBonus(\\n _requestForBlockProducer,\\n true // _requestForBridgeOperator\\n );\\n\\n _totalBridgeReward += _bridgeOperatorBonus;\\n\\n // Deprecates reward for non-validator or slashed validator\\n if (!_requestForBlockProducer) {\\n _totalDeprecatedReward += msg.value;\\n emit BlockRewardDeprecated(msg.sender, msg.value, BlockRewardDeprecatedType.UNAVAILABILITY);\\n return;\\n }\\n\\n emit BlockRewardSubmitted(msg.sender, msg.value, _blockProducerBonus);\\n\\n uint256 _period = currentPeriod();\\n uint256 _reward = msg.value + _blockProducerBonus;\\n uint256 _cutOffReward;\\n if (_miningRewardBailoutCutOffAtPeriod[msg.sender][_period]) {\\n (, , , uint256 _cutOffPercentage) = _slashIndicatorContract.getCreditScoreConfigs();\\n _cutOffReward = (_reward * _cutOffPercentage) / _MAX_PERCENTAGE;\\n _totalDeprecatedReward += _cutOffReward;\\n emit BlockRewardDeprecated(msg.sender, _cutOffReward, BlockRewardDeprecatedType.AFTER_BAILOUT);\\n }\\n\\n _reward -= _cutOffReward;\\n uint256 _maxRate = _stakingContract.maxCommissionRate();\\n uint256 _rate = Math.min(_candidateInfo[msg.sender].commissionRate, _maxRate);\\n uint256 _miningAmount = (_rate * _reward) / _MAX_PERCENTAGE;\\n _miningReward[msg.sender] += _miningAmount;\\n\\n uint256 _delegatingAmount = _reward - _miningAmount;\\n _delegatingReward[msg.sender] += _delegatingAmount;\\n }\\n\\n /**\\n * @inheritdoc ICoinbaseExecution\\n */\\n function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {\\n uint256 _newPeriod = _computePeriod(block.timestamp);\\n bool _periodEnding = _isPeriodEnding(_newPeriod);\\n\\n (address[] memory _currentValidators, , ) = getValidators();\\n address[] memory _revokedCandidates;\\n uint256 _epoch = epochOf(block.number);\\n uint256 _nextEpoch = _epoch + 1;\\n uint256 _lastPeriod = currentPeriod();\\n\\n if (_periodEnding) {\\n _syncBridgeOperatingReward(_lastPeriod, _currentValidators);\\n (\\n uint256 _totalDelegatingReward,\\n uint256[] memory _delegatingRewards\\n ) = _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(_lastPeriod, _currentValidators);\\n _settleAndTransferDelegatingRewards(_lastPeriod, _currentValidators, _totalDelegatingReward, _delegatingRewards);\\n _tryRecycleLockedFundsFromEmergencyExits();\\n _recycleDeprecatedRewards();\\n _slashIndicatorContract.updateCreditScores(_currentValidators, _lastPeriod);\\n (_currentValidators, _revokedCandidates) = _syncValidatorSet(_newPeriod);\\n if (_revokedCandidates.length > 0) {\\n _slashIndicatorContract.execResetCreditScores(_revokedCandidates);\\n }\\n _currentPeriodStartAtBlock = block.number + 1;\\n }\\n _revampRoles(_newPeriod, _nextEpoch, _currentValidators);\\n emit WrappedUpEpoch(_lastPeriod, _epoch, _periodEnding);\\n _periodOf[_nextEpoch] = _newPeriod;\\n _lastUpdatedPeriod = _newPeriod;\\n }\\n\\n /**\\n * @dev This loop over the all current validators to sync the bridge operating reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _syncBridgeOperatingReward(uint256 _lastPeriod, address[] memory _currentValidators) internal {\\n uint256 _totalBridgeBallots = _bridgeTrackingContract.totalBallots(_lastPeriod);\\n uint256 _totalBridgeVotes = _bridgeTrackingContract.totalVotes(_lastPeriod);\\n uint256[] memory _bridgeBallots = _bridgeTrackingContract.getManyTotalBallots(\\n _lastPeriod,\\n getBridgeOperatorsOf(_currentValidators)\\n );\\n\\n if (\\n !_validateBridgeTrackingResponse(_totalBridgeBallots, _totalBridgeVotes, _bridgeBallots) || _totalBridgeVotes == 0\\n ) {\\n // Shares equally in case the bridge has nothing to vote or bridge tracking response is incorrect\\n for (uint256 _i; _i < _currentValidators.length; _i++) {\\n _bridgeOperatingReward[_currentValidators[_i]] = _totalBridgeReward / _currentValidators.length;\\n }\\n return;\\n }\\n\\n (\\n uint256 _missingVotesRatioTier1,\\n uint256 _missingVotesRatioTier2,\\n uint256 _jailDurationForMissingVotesRatioTier2,\\n uint256 _skipBridgeOperatorSlashingThreshold\\n ) = _slashIndicatorContract.getBridgeOperatorSlashingConfigs();\\n\\n // Slashes the bridge reward if the total of votes exceeds the slashing threshold.\\n bool _shouldSlash = _totalBridgeVotes > _skipBridgeOperatorSlashingThreshold;\\n for (uint256 _i; _i < _currentValidators.length; _i++) {\\n // Shares the bridge operators reward proportionally.\\n _bridgeOperatingReward[_currentValidators[_i]] = (_totalBridgeReward * _bridgeBallots[_i]) / _totalBridgeBallots;\\n if (_shouldSlash) {\\n _slashBridgeOperatorBasedOnPerformance(\\n _lastPeriod,\\n _currentValidators[_i],\\n _MAX_PERCENTAGE - (_bridgeBallots[_i] * _MAX_PERCENTAGE) / _totalBridgeVotes,\\n _jailDurationForMissingVotesRatioTier2,\\n _missingVotesRatioTier1,\\n _missingVotesRatioTier2\\n );\\n }\\n }\\n }\\n\\n /**\\n * @dev Returns whether the responses from bridge tracking are correct.\\n */\\n function _validateBridgeTrackingResponse(\\n uint256 _totalBridgeBallots,\\n uint256 _totalBridgeVotes,\\n uint256[] memory _bridgeBallots\\n ) private returns (bool _valid) {\\n _valid = true;\\n uint256 _sumBallots;\\n for (uint _i; _i < _bridgeBallots.length; _i++) {\\n if (_bridgeBallots[_i] > _totalBridgeVotes) {\\n _valid = false;\\n break;\\n }\\n _sumBallots += _bridgeBallots[_i];\\n }\\n _valid = _valid && (_sumBallots <= _totalBridgeBallots);\\n if (!_valid) {\\n emit BridgeTrackingIncorrectlyResponded();\\n }\\n }\\n\\n /**\\n * @dev Slashes the validator on the corresponding bridge operator performance. Updates the status of the deprecated reward. Not update the reward amount.\\n *\\n * Consider validating the bridge tracking response by using the method `_validateBridgeTrackingResponse` before calling this function.\\n */\\n function _slashBridgeOperatorBasedOnPerformance(\\n uint256 _period,\\n address _validator,\\n uint256 _missedRatio,\\n uint256 _jailDurationTier2,\\n uint256 _ratioTier1,\\n uint256 _ratioTier2\\n ) internal {\\n if (_missedRatio >= _ratioTier2) {\\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\\n _miningRewardDeprecatedAtPeriod[_validator][_period] = true;\\n\\n uint256 _newJailUntilBlock = Math.addIfNonZero(block.number, _jailDurationTier2);\\n _blockProducerJailedBlock[_validator] = Math.max(_newJailUntilBlock, _blockProducerJailedBlock[_validator]);\\n _cannotBailoutUntilBlock[_validator] = Math.max(_newJailUntilBlock, _cannotBailoutUntilBlock[_validator]);\\n\\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 2, _period);\\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, true, true);\\n } else if (_missedRatio >= _ratioTier1) {\\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 1, _period);\\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, false, true);\\n }\\n }\\n\\n /**\\n * @dev This loops over all current validators to:\\n * - Update delegating reward for and calculate total delegating rewards to be sent to the staking contract,\\n * - Distribute the reward of block producers and bridge operators to their treasury addresses,\\n * - Update the total deprecated reward if the two previous conditions do not sastify.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(\\n uint256 _lastPeriod,\\n address[] memory _currentValidators\\n ) private returns (uint256 _totalDelegatingReward, uint256[] memory _delegatingRewards) {\\n address _consensusAddr;\\n address payable _treasury;\\n _delegatingRewards = new uint256[](_currentValidators.length);\\n for (uint _i; _i < _currentValidators.length; _i++) {\\n _consensusAddr = _currentValidators[_i];\\n _treasury = _candidateInfo[_consensusAddr].treasuryAddr;\\n\\n if (!_bridgeRewardDeprecated(_consensusAddr, _lastPeriod)) {\\n _distributeBridgeOperatingReward(_consensusAddr, _candidateInfo[_consensusAddr].bridgeOperatorAddr, _treasury);\\n } else {\\n _totalDeprecatedReward += _bridgeOperatingReward[_consensusAddr];\\n }\\n\\n if (!_jailed(_consensusAddr) && !_miningRewardDeprecated(_consensusAddr, _lastPeriod)) {\\n _totalDelegatingReward += _delegatingReward[_consensusAddr];\\n _delegatingRewards[_i] = _delegatingReward[_consensusAddr];\\n _distributeMiningReward(_consensusAddr, _treasury);\\n } else {\\n _totalDeprecatedReward += _miningReward[_consensusAddr] + _delegatingReward[_consensusAddr];\\n }\\n\\n delete _delegatingReward[_consensusAddr];\\n delete _miningReward[_consensusAddr];\\n delete _bridgeOperatingReward[_consensusAddr];\\n }\\n delete _totalBridgeReward;\\n }\\n\\n /**\\n * @dev Distributes bonus of staking vesting and mining fee for the block producer.\\n *\\n * Emits the `MiningRewardDistributed` once the reward is distributed successfully.\\n * Emits the `MiningRewardDistributionFailed` once the contract fails to distribute reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _distributeMiningReward(address _consensusAddr, address payable _treasury) private {\\n uint256 _amount = _miningReward[_consensusAddr];\\n if (_amount > 0) {\\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\\n emit MiningRewardDistributed(_consensusAddr, _treasury, _amount);\\n return;\\n }\\n\\n emit MiningRewardDistributionFailed(_consensusAddr, _treasury, _amount, address(this).balance);\\n }\\n }\\n\\n /**\\n * @dev Distribute bonus of staking vesting for the bridge operator.\\n *\\n * Emits the `BridgeOperatorRewardDistributed` once the reward is distributed successfully.\\n * Emits the `BridgeOperatorRewardDistributionFailed` once the contract fails to distribute reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _distributeBridgeOperatingReward(\\n address _consensusAddr,\\n address _bridgeOperator,\\n address payable _treasury\\n ) private {\\n uint256 _amount = _bridgeOperatingReward[_consensusAddr];\\n if (_amount > 0) {\\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\\n emit BridgeOperatorRewardDistributed(_consensusAddr, _bridgeOperator, _treasury, _amount);\\n return;\\n }\\n\\n emit BridgeOperatorRewardDistributionFailed(\\n _consensusAddr,\\n _bridgeOperator,\\n _treasury,\\n _amount,\\n address(this).balance\\n );\\n }\\n }\\n\\n /**\\n * @dev Helper function to settle rewards for delegators of `_currentValidators` at the end of each period,\\n * then transfer the rewards from this contract to the staking contract, in order to finalize a period.\\n *\\n * Emits the `StakingRewardDistributed` once the reward is distributed successfully.\\n * Emits the `StakingRewardDistributionFailed` once the contract fails to distribute reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _settleAndTransferDelegatingRewards(\\n uint256 _period,\\n address[] memory _currentValidators,\\n uint256 _totalDelegatingReward,\\n uint256[] memory _delegatingRewards\\n ) private {\\n IStaking _staking = _stakingContract;\\n if (_totalDelegatingReward > 0) {\\n if (_unsafeSendRON(payable(address(_staking)), _totalDelegatingReward)) {\\n _staking.execRecordRewards(_currentValidators, _delegatingRewards, _period);\\n emit StakingRewardDistributed(_totalDelegatingReward, _currentValidators, _delegatingRewards);\\n return;\\n }\\n\\n emit StakingRewardDistributionFailed(\\n _totalDelegatingReward,\\n _currentValidators,\\n _delegatingRewards,\\n address(this).balance\\n );\\n }\\n }\\n\\n /**\\n * @dev Transfer the deprecated rewards e.g. the rewards that get deprecated when validator is slashed/maintained,\\n * to the staking vesting contract\\n *\\n * Note: This method should be called once in the end of each period.\\n */\\n function _recycleDeprecatedRewards() private {\\n uint256 _withdrawAmount = _totalDeprecatedReward;\\n\\n if (_withdrawAmount != 0) {\\n address _withdrawTarget = stakingVestingContract();\\n\\n delete _totalDeprecatedReward;\\n\\n (bool _success, ) = _withdrawTarget.call{ value: _withdrawAmount }(\\n abi.encodeWithSelector(IStakingVesting.receiveRON.selector)\\n );\\n\\n if (_success) {\\n emit DeprecatedRewardRecycled(_withdrawTarget, _withdrawAmount);\\n } else {\\n emit DeprecatedRewardRecycleFailed(_withdrawTarget, _withdrawAmount, address(this).balance);\\n }\\n }\\n }\\n\\n /**\\n * @dev Updates the validator set based on the validator candidates from the Staking contract.\\n *\\n * Emits the `ValidatorSetUpdated` event.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _syncValidatorSet(uint256 _newPeriod)\\n private\\n returns (address[] memory _newValidators, address[] memory _unsastifiedCandidates)\\n {\\n _unsastifiedCandidates = _syncCandidateSet(_newPeriod);\\n uint256[] memory _weights = _stakingContract.getManyStakingTotals(_candidates);\\n uint256[] memory _trustedWeights = _roninTrustedOrganizationContract.getConsensusWeights(_candidates);\\n uint256 _newValidatorCount;\\n (_newValidators, _newValidatorCount) = _pcPickValidatorSet(\\n _candidates,\\n _weights,\\n _trustedWeights,\\n _maxValidatorNumber,\\n _maxPrioritizedValidatorNumber\\n );\\n _setNewValidatorSet(_newValidators, _newValidatorCount, _newPeriod);\\n }\\n\\n /**\\n * @dev Private helper function helps writing the new validator set into the contract storage.\\n *\\n * Emits the `ValidatorSetUpdated` event.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _setNewValidatorSet(\\n address[] memory _newValidators,\\n uint256 _newValidatorCount,\\n uint256 _newPeriod\\n ) private {\\n // Remove exceeding validators in the current set\\n for (uint256 _i = _newValidatorCount; _i < validatorCount; _i++) {\\n delete _validatorMap[_validators[_i]];\\n delete _validators[_i];\\n }\\n\\n // Remove flag for all validator in the current set\\n for (uint _i; _i < _newValidatorCount; _i++) {\\n delete _validatorMap[_validators[_i]];\\n }\\n\\n // Update new validator set and set flag correspondingly.\\n for (uint256 _i; _i < _newValidatorCount; _i++) {\\n address _newValidator = _newValidators[_i];\\n _validatorMap[_newValidator] = EnumFlags.ValidatorFlag.Both;\\n _validators[_i] = _newValidator;\\n }\\n\\n validatorCount = _newValidatorCount;\\n emit ValidatorSetUpdated(_newPeriod, _newValidators);\\n }\\n\\n /**\\n * @dev Activate/Deactivate the validators from producing blocks, based on their in jail status and maintenance status.\\n *\\n * Requirements:\\n * - This method is called at the end of each epoch\\n *\\n * Emits the `BlockProducerSetUpdated` event.\\n * Emits the `BridgeOperatorSetUpdated` event.\\n *\\n */\\n function _revampRoles(\\n uint256 _newPeriod,\\n uint256 _nextEpoch,\\n address[] memory _currentValidators\\n ) private {\\n bool[] memory _maintainedList = _maintenanceContract.checkManyMaintained(_currentValidators, block.number + 1);\\n\\n for (uint _i; _i < _currentValidators.length; _i++) {\\n address _validator = _currentValidators[_i];\\n bool _emergencyExitRequested = block.timestamp <= _emergencyExitJailedTimestamp[_validator];\\n bool _isProducerBefore = isBlockProducer(_validator);\\n bool _isProducerAfter = !(_jailedAtBlock(_validator, block.number + 1) ||\\n _maintainedList[_i] ||\\n _emergencyExitRequested);\\n\\n if (!_isProducerBefore && _isProducerAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BlockProducer);\\n } else if (_isProducerBefore && !_isProducerAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BlockProducer);\\n }\\n\\n bool _isBridgeOperatorBefore = isOperatingBridge(_validator);\\n bool _isBridgeOperatorAfter = !_emergencyExitRequested;\\n if (!_isBridgeOperatorBefore && _isBridgeOperatorAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BridgeOperator);\\n } else if (_isBridgeOperatorBefore && !_isBridgeOperatorAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BridgeOperator);\\n }\\n }\\n\\n emit BlockProducerSetUpdated(_newPeriod, _nextEpoch, getBlockProducers());\\n emit BridgeOperatorSetUpdated(_newPeriod, _nextEpoch, getBridgeOperators());\\n }\\n\\n /**\\n * @dev Override `CandidateManager-_isTrustedOrg`.\\n */\\n function _isTrustedOrg(address _consensusAddr) internal view override returns (bool) {\\n return _roninTrustedOrganizationContract.getConsensusWeight(_consensusAddr) > 0;\\n }\\n}\\n\",\"keccak256\":\"0xb8cc09bc955f452a9da4624f5404e108be1d715b36af9395c04000d91c02123b\",\"license\":\"MIT\"},\"contracts/ronin/validator/EmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../interfaces/IRoninGovernanceAdmin.sol\\\";\\nimport \\\"../../interfaces/validator/IEmergencyExit.sol\\\";\\nimport \\\"./storage-fragments/CommonStorage.sol\\\";\\nimport \\\"./CandidateManager.sol\\\";\\n\\nabstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateManager, CommonStorage {\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function emergencyExitLockedAmount() external view returns (uint256) {\\n return _emergencyExitLockedAmount;\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function emergencyExpiryDuration() external view returns (uint256) {\\n return _emergencyExpiryDuration;\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external onlyStakingContract {\\n EmergencyExitInfo storage _info = _exitInfo[_consensusAddr];\\n if (_info.recyclingAt != 0) revert ErrAlreadyRequestedEmergencyExit();\\n\\n uint256 _revokingTimestamp = block.timestamp + _secLeftToRevoke;\\n _setRevokingTimestamp(_candidateInfo[_consensusAddr], _revokingTimestamp);\\n _emergencyExitJailedTimestamp[_consensusAddr] = _revokingTimestamp;\\n _bridgeRewardDeprecatedAtPeriod[_consensusAddr][currentPeriod()] = true;\\n\\n uint256 _deductedAmount = _stakingContract.execDeductStakingAmount(_consensusAddr, _emergencyExitLockedAmount);\\n if (_deductedAmount > 0) {\\n uint256 _recyclingAt = block.timestamp + _emergencyExpiryDuration;\\n _lockedConsensusList.push(_consensusAddr);\\n _info.lockedAmount = _deductedAmount;\\n _info.recyclingAt = _recyclingAt;\\n IRoninGovernanceAdmin(_getAdmin()).createEmergencyExitPoll(\\n _consensusAddr,\\n _candidateInfo[_consensusAddr].treasuryAddr,\\n block.timestamp,\\n _recyclingAt\\n );\\n }\\n emit EmergencyExitRequested(_consensusAddr, _deductedAmount);\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external onlyAdmin {\\n _setEmergencyExitLockedAmount(_emergencyExitLockedAmount);\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external onlyAdmin {\\n _setEmergencyExpiryDuration(_emergencyExpiryDuration);\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient)\\n external\\n onlyAdmin\\n {\\n if (_exitInfo[_consensusAddr].recyclingAt == 0) {\\n return;\\n }\\n\\n uint256 _length = _lockedConsensusList.length;\\n uint256 _index = _length;\\n\\n for (uint _i; _i < _length; _i++) {\\n if (_lockedConsensusList[_i] == _consensusAddr) {\\n _index = _i;\\n break;\\n }\\n }\\n\\n // The locked amount might be recycled\\n if (_index == _length) {\\n return;\\n }\\n\\n uint256 _amount = _exitInfo[_consensusAddr].lockedAmount;\\n if (_amount > 0) {\\n delete _exitInfo[_consensusAddr];\\n if (_length > 1) {\\n _lockedConsensusList[_index] = _lockedConsensusList[_length - 1];\\n }\\n _lockedConsensusList.pop();\\n\\n _lockedFundReleased[_consensusAddr] = true;\\n if (_unsafeSendRON(_recipient, _amount, DEFAULT_ADDITION_GAS)) {\\n emit EmergencyExitLockedFundReleased(_consensusAddr, _recipient, _amount);\\n return;\\n }\\n\\n emit EmergencyExitLockedFundReleasingFailed(_consensusAddr, _recipient, _amount, address(this).balance);\\n }\\n }\\n\\n /**\\n * @dev Tries to recycle the locked funds from emergency exit requests.\\n */\\n function _tryRecycleLockedFundsFromEmergencyExits() internal {\\n uint256 _length = _lockedConsensusList.length;\\n\\n uint256 _i;\\n address _addr;\\n EmergencyExitInfo storage _info;\\n\\n while (_i < _length) {\\n _addr = _lockedConsensusList[_i];\\n _info = _exitInfo[_addr];\\n\\n if (_info.recyclingAt <= block.timestamp) {\\n _totalDeprecatedReward += _info.lockedAmount;\\n\\n delete _exitInfo[_addr];\\n if (--_length > 0) {\\n _lockedConsensusList[_i] = _lockedConsensusList[_length];\\n }\\n _lockedConsensusList.pop();\\n continue;\\n }\\n\\n _i++;\\n }\\n }\\n\\n /**\\n * @dev Override `CandidateManager-_emergencyExitLockedFundReleased`.\\n */\\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {\\n return _lockedFundReleased[_consensusAddr];\\n }\\n\\n /**\\n * @dev Override `CandidateManager-_removeCandidate`.\\n */\\n function _removeCandidate(address _consensusAddr) internal override {\\n delete _lockedFundReleased[_consensusAddr];\\n super._removeCandidate(_consensusAddr);\\n }\\n\\n /**\\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\\n */\\n function _bridgeOperatorOf(address _consensusAddr)\\n internal\\n view\\n virtual\\n override(CandidateManager, ValidatorInfoStorage)\\n returns (address)\\n {\\n return CandidateManager._bridgeOperatorOf(_consensusAddr);\\n }\\n\\n /**\\n * @dev See `setEmergencyExitLockedAmount.\\n */\\n function _setEmergencyExitLockedAmount(uint256 _amount) internal {\\n _emergencyExitLockedAmount = _amount;\\n emit EmergencyExitLockedAmountUpdated(_amount);\\n }\\n\\n /**\\n * @dev See `setEmergencyExpiryDuration`.\\n */\\n function _setEmergencyExpiryDuration(uint256 _duration) internal {\\n _emergencyExpiryDuration = _duration;\\n emit EmergencyExpiryDurationUpdated(_duration);\\n }\\n}\\n\",\"keccak256\":\"0x829dd3adae7a2171205dacc768d47f398be52669de1bb32ed3f8b91db6fc8885\",\"license\":\"MIT\"},\"contracts/ronin/validator/RoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"./CoinbaseExecution.sol\\\";\\nimport \\\"./SlashingExecution.sol\\\";\\n\\ncontract RoninValidatorSet is Initializable, CoinbaseExecution, SlashingExecution {\\n constructor() {\\n _disableInitializers();\\n }\\n\\n fallback() external payable {\\n _fallback();\\n }\\n\\n receive() external payable {\\n _fallback();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __slashIndicatorContract,\\n address __stakingContract,\\n address __stakingVestingContract,\\n address __maintenanceContract,\\n address __roninTrustedOrganizationContract,\\n address __bridgeTrackingContract,\\n uint256 __maxValidatorNumber,\\n uint256 __maxValidatorCandidate,\\n uint256 __maxPrioritizedValidatorNumber,\\n uint256 __minEffectiveDaysOnwards,\\n uint256 __numberOfBlocksInEpoch,\\n // __emergencyExitConfigs[0]: emergencyExitLockedAmount\\n // __emergencyExitConfigs[1]: emergencyExpiryDuration\\n uint256[2] calldata __emergencyExitConfigs\\n ) external initializer {\\n _setSlashIndicatorContract(__slashIndicatorContract);\\n _setStakingContract(__stakingContract);\\n _setStakingVestingContract(__stakingVestingContract);\\n _setMaintenanceContract(__maintenanceContract);\\n _setBridgeTrackingContract(__bridgeTrackingContract);\\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\\n _setMaxValidatorNumber(__maxValidatorNumber);\\n _setMaxValidatorCandidate(__maxValidatorCandidate);\\n _setMaxPrioritizedValidatorNumber(__maxPrioritizedValidatorNumber);\\n _setMinEffectiveDaysOnwards(__minEffectiveDaysOnwards);\\n _setEmergencyExitLockedAmount(__emergencyExitConfigs[0]);\\n _setEmergencyExpiryDuration(__emergencyExitConfigs[1]);\\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\\n }\\n\\n /**\\n * @dev Only receives RON from staking vesting contract (for topping up bonus), and from staking contract (for transferring\\n * deducting amount on slashing).\\n */\\n function _fallback() internal view {\\n if (msg.sender != stakingVestingContract() && msg.sender != stakingContract()) revert ErrUnauthorizedReceiveRON();\\n }\\n\\n /**\\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\\n */\\n function _bridgeOperatorOf(address _consensusAddr)\\n internal\\n view\\n override(EmergencyExit, ValidatorInfoStorage)\\n returns (address)\\n {\\n return super._bridgeOperatorOf(_consensusAddr);\\n }\\n}\\n\",\"keccak256\":\"0xd7a2ac4d3a2c8edbd1bbfb1ef3549ef0a019b4c9b4f1c12f1fd07b116b1adab3\",\"license\":\"MIT\"},\"contracts/ronin/validator/SlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasSlashIndicatorContract.sol\\\";\\nimport \\\"../../extensions/collections/HasStakingContract.sol\\\";\\nimport \\\"../../interfaces/validator/ISlashingExecution.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"./storage-fragments/CommonStorage.sol\\\";\\n\\nabstract contract SlashingExecution is\\n ISlashingExecution,\\n HasSlashIndicatorContract,\\n HasStakingContract,\\n CommonStorage\\n{\\n /**\\n * @inheritdoc ISlashingExecution\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external override onlySlashIndicatorContract {\\n uint256 _period = currentPeriod();\\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = true;\\n\\n _totalDeprecatedReward += _miningReward[_validatorAddr] + _delegatingReward[_validatorAddr];\\n\\n delete _miningReward[_validatorAddr];\\n delete _delegatingReward[_validatorAddr];\\n\\n _blockProducerJailedBlock[_validatorAddr] = Math.max(_newJailedUntil, _blockProducerJailedBlock[_validatorAddr]);\\n\\n if (_slashAmount > 0) {\\n uint256 _actualAmount = _stakingContract.execDeductStakingAmount(_validatorAddr, _slashAmount);\\n _totalDeprecatedReward += _actualAmount;\\n }\\n\\n if (_cannotBailout) {\\n _cannotBailoutUntilBlock[_validatorAddr] = Math.max(_newJailedUntil, _cannotBailoutUntilBlock[_validatorAddr]);\\n }\\n\\n emit ValidatorPunished(\\n _validatorAddr,\\n _period,\\n _blockProducerJailedBlock[_validatorAddr],\\n _slashAmount,\\n true,\\n false\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashingExecution\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external override onlySlashIndicatorContract {\\n if (block.number <= _cannotBailoutUntilBlock[_validatorAddr]) revert ErrCannotBailout(_validatorAddr);\\n\\n // Note: Removing rewards of validator in `bailOut` function is not needed, since the rewards have been\\n // removed previously in the `slash` function.\\n _miningRewardBailoutCutOffAtPeriod[_validatorAddr][_period] = true;\\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = false;\\n _blockProducerJailedBlock[_validatorAddr] = block.number - 1;\\n\\n emit ValidatorUnjailed(_validatorAddr, _period);\\n }\\n}\\n\",\"keccak256\":\"0xf10b8566c1397e3dc86c6c16dcd20bf91011726b01dbff7da3a9d9a59bdee9b0\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/CommonStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../interfaces/validator/info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./JailingStorage.sol\\\";\\nimport \\\"./TimingStorage.sol\\\";\\nimport \\\"./ValidatorInfoStorage.sol\\\";\\n\\nabstract contract CommonStorage is ICommonInfo, TimingStorage, JailingStorage, ValidatorInfoStorage {\\n /// @dev Mapping from consensus address => pending reward from producing block\\n mapping(address => uint256) internal _miningReward;\\n /// @dev Mapping from consensus address => pending reward from delegating\\n mapping(address => uint256) internal _delegatingReward;\\n\\n /// @dev The total reward for bridge operators\\n uint256 internal _totalBridgeReward;\\n /// @dev Mapping from consensus address => pending reward for being bridge operator\\n mapping(address => uint256) internal _bridgeOperatingReward;\\n\\n /// @dev The deprecated reward that has not been withdrawn by admin\\n uint256 internal _totalDeprecatedReward;\\n\\n /// @dev The amount of RON to lock from a consensus address.\\n uint256 internal _emergencyExitLockedAmount;\\n /// @dev The duration that an emergency request is expired and the fund will be recycled.\\n uint256 internal _emergencyExpiryDuration;\\n /// @dev The address list of consensus addresses that being locked fund.\\n address[] internal _lockedConsensusList;\\n /// @dev Mapping from consensus => request exist info\\n mapping(address => EmergencyExitInfo) internal _exitInfo;\\n /// @dev Mapping from consensus => flag indicating whether the locked fund is released\\n mapping(address => bool) internal _lockedFundReleased;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[44] private ______gap;\\n\\n /**\\n * @inheritdoc ICommonInfo\\n */\\n function getEmergencyExitInfo(address _consensusAddr)\\n external\\n view\\n override\\n returns (EmergencyExitInfo memory _info)\\n {\\n _info = _exitInfo[_consensusAddr];\\n if (_info.recyclingAt == 0) revert NonExistentRecyclingInfo();\\n }\\n\\n /**\\n * @inheritdoc ICommonInfo\\n */\\n function totalDeprecatedReward() external view override returns (uint256) {\\n return _totalDeprecatedReward;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function epochOf(uint256 _block)\\n public\\n view\\n virtual\\n override(ITimingInfo, JailingStorage, TimingStorage)\\n returns (uint256)\\n {\\n return TimingStorage.epochOf(_block);\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function currentPeriod() public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) {\\n return TimingStorage.currentPeriod();\\n }\\n}\\n\",\"keccak256\":\"0x7372a3febdddcd1fa0fdfd06eba11c58d1c3113ea1b408c0ab13b99eeeeb7b22\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/JailingStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../interfaces/validator/info-fragments/IJailingInfo.sol\\\";\\nimport \\\"./TimingStorage.sol\\\";\\n\\nabstract contract JailingStorage is IJailingInfo {\\n /// @dev Mapping from consensus address => period number => block producer has no pending reward.\\n mapping(address => mapping(uint256 => bool)) internal _miningRewardDeprecatedAtPeriod;\\n /// @dev Mapping from consensus address => period number => whether the block producer get cut off reward, due to bailout.\\n mapping(address => mapping(uint256 => bool)) internal _miningRewardBailoutCutOffAtPeriod;\\n /// @dev Mapping from consensus address => period number => block operator has no pending reward.\\n mapping(address => mapping(uint256 => bool)) internal _bridgeRewardDeprecatedAtPeriod;\\n\\n /// @dev Mapping from consensus address => the last block that the block producer is jailed.\\n mapping(address => uint256) internal _blockProducerJailedBlock;\\n /// @dev Mapping from consensus address => the last timestamp that the bridge operator is jailed.\\n mapping(address => uint256) internal _emergencyExitJailedTimestamp;\\n /// @dev Mapping from consensus address => the last block that the block producer cannot bailout.\\n mapping(address => uint256) internal _cannotBailoutUntilBlock;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] private ______gap;\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkJailed(address _addr) external view override returns (bool) {\\n return checkJailedAtBlock(_addr, block.number);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n override\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n )\\n {\\n return getJailedTimeLeftAtBlock(_addr, block.number);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) public view override returns (bool) {\\n return _jailedAtBlock(_addr, _blockNum);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n public\\n view\\n override\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n )\\n {\\n uint256 _jailedBlock = _blockProducerJailedBlock[_addr];\\n if (_jailedBlock < _blockNum) {\\n return (false, 0, 0);\\n }\\n\\n isJailed_ = true;\\n blockLeft_ = _jailedBlock - _blockNum + 1;\\n epochLeft_ = epochOf(_jailedBlock) - epochOf(_blockNum) + 1;\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkManyJailed(address[] calldata _addrList) external view override returns (bool[] memory _result) {\\n _result = new bool[](_addrList.length);\\n for (uint256 _i; _i < _addrList.length; _i++) {\\n _result[_i] = _jailed(_addrList[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view override returns (bool _result) {\\n uint256 _period = currentPeriod();\\n return _miningRewardDeprecated(_blockProducer, _period);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period)\\n external\\n view\\n override\\n returns (bool _result)\\n {\\n return _miningRewardDeprecated(_blockProducer, _period);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n *\\n * @dev Because the information of deprecating bridge reward of a period is only determined at the end of that period, this\\n * method will return the deprecating info of the latest period. A method for querying that info of current period is no need.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr)\\n external\\n view\\n override\\n returns (bool _result)\\n {\\n uint256 _period = currentPeriod() - 1;\\n return _bridgeRewardDeprecated(_consensusAddr, _period);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n override\\n returns (bool _result)\\n {\\n return _bridgeRewardDeprecated(_consensusAddr, _period);\\n }\\n\\n /**\\n * @dev See `ITimingInfo-epochOf`\\n */\\n function epochOf(uint256 _block) public view virtual returns (uint256);\\n\\n /**\\n * @dev See `ITimingInfo-currentPeriod`\\n */\\n function currentPeriod() public view virtual returns (uint256);\\n\\n /**\\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) during the current period.\\n */\\n function _jailed(address _validatorAddr) internal view returns (bool) {\\n return _jailedAtBlock(_validatorAddr, block.number);\\n }\\n\\n /**\\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) at a specific block.\\n */\\n function _jailedAtBlock(address _validatorAddr, uint256 _blockNum) internal view returns (bool) {\\n return _blockNum <= _blockProducerJailedBlock[_validatorAddr];\\n }\\n\\n /**\\n * @dev Returns whether the block producer has no pending reward in that period.\\n */\\n function _miningRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\\n return _miningRewardDeprecatedAtPeriod[_validatorAddr][_period];\\n }\\n\\n /**\\n * @dev Returns whether the bridge operator has no pending reward in the period.\\n */\\n function _bridgeRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\\n return _bridgeRewardDeprecatedAtPeriod[_validatorAddr][_period];\\n }\\n}\\n\",\"keccak256\":\"0x14ae5cc1f190f1b3e4517677b013638afc39a35d538303b8f0280fe1a52042c6\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/TimingStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../extensions/consumers/GlobalConfigConsumer.sol\\\";\\nimport \\\"../../../interfaces/validator/info-fragments/ITimingInfo.sol\\\";\\n\\nabstract contract TimingStorage is ITimingInfo, GlobalConfigConsumer {\\n /// @dev The number of blocks in a epoch\\n uint256 internal _numberOfBlocksInEpoch;\\n /// @dev The last updated block\\n uint256 internal _lastUpdatedBlock;\\n /// @dev The last updated period\\n uint256 internal _lastUpdatedPeriod;\\n /// @dev The starting block of the last updated period\\n uint256 internal _currentPeriodStartAtBlock;\\n\\n /// @dev Mapping from epoch index => period index\\n mapping(uint256 => uint256) internal _periodOf;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] private ______gap;\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function getLastUpdatedBlock() external view override returns (uint256) {\\n return _lastUpdatedBlock;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function epochOf(uint256 _block) public view virtual override returns (uint256) {\\n return _block / _numberOfBlocksInEpoch + 1;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber) {\\n return (_epoch <= epochOf(block.number) || _periodOf[_epoch] > 0, _periodOf[_epoch]);\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function isPeriodEnding() external view override returns (bool) {\\n return _isPeriodEnding(_computePeriod(block.timestamp));\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function epochEndingAt(uint256 _block) public view virtual override returns (bool) {\\n return _block % _numberOfBlocksInEpoch == _numberOfBlocksInEpoch - 1;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function currentPeriod() public view virtual override returns (uint256) {\\n return _lastUpdatedPeriod;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function currentPeriodStartAtBlock() public view override returns (uint256) {\\n return _currentPeriodStartAtBlock;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function numberOfBlocksInEpoch() public view virtual override returns (uint256 _numberOfBlocks) {\\n return _numberOfBlocksInEpoch;\\n }\\n\\n /**\\n * @dev See `ITimingInfo-isPeriodEnding`\\n */\\n function _isPeriodEnding(uint256 _newPeriod) internal view virtual returns (bool) {\\n return _newPeriod > _lastUpdatedPeriod;\\n }\\n\\n /**\\n * @dev Returns the calculated period.\\n */\\n function _computePeriod(uint256 _timestamp) internal pure returns (uint256) {\\n return _timestamp / PERIOD_DURATION;\\n }\\n}\\n\",\"keccak256\":\"0xc545f119b8b8978d793b62f2495dc2d49c3f416791459b9833bdc65f4dae8e7f\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/ValidatorInfoStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\nimport \\\"../../../extensions/collections/HasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../../interfaces/validator/info-fragments/IValidatorInfo.sol\\\";\\n\\nabstract contract ValidatorInfoStorage is IValidatorInfo, HasRoninTrustedOrganizationContract {\\n using EnumFlags for EnumFlags.ValidatorFlag;\\n\\n /// @dev The maximum number of validator.\\n uint256 internal _maxValidatorNumber;\\n\\n /// @dev The total of validators\\n uint256 public validatorCount;\\n /// @dev Mapping from validator index => validator address\\n mapping(uint256 => address) internal _validators;\\n /// @dev Mapping from address => flag indicating the validator ability: producing block, operating bridge\\n mapping(address => EnumFlags.ValidatorFlag) internal _validatorMap;\\n /// @dev The number of slot that is reserved for prioritized validators\\n uint256 internal _maxPrioritizedValidatorNumber;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getValidators()\\n public\\n view\\n override\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n )\\n {\\n _validatorList = new address[](validatorCount);\\n _bridgeOperators = new address[](validatorCount);\\n _flags = new EnumFlags.ValidatorFlag[](validatorCount);\\n for (uint _i; _i < _validatorList.length; _i++) {\\n address _validator = _validators[_i];\\n _validatorList[_i] = _validator;\\n _bridgeOperators[_i] = _bridgeOperatorOf(_validator);\\n _flags[_i] = _validatorMap[_validator];\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isValidator(address _addr) public view override returns (bool) {\\n return !_validatorMap[_addr].isNone();\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getBlockProducers() public view override returns (address[] memory _result) {\\n _result = new address[](validatorCount);\\n uint256 _count = 0;\\n for (uint _i; _i < _result.length; _i++) {\\n if (isBlockProducer(_validators[_i])) {\\n _result[_count++] = _validators[_i];\\n }\\n }\\n\\n assembly {\\n mstore(_result, _count)\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isBlockProducer(address _addr) public view override returns (bool) {\\n return _validatorMap[_addr].hasFlag(EnumFlags.ValidatorFlag.BlockProducer);\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function totalBlockProducers() external view returns (uint256 _total) {\\n for (uint _i; _i < validatorCount; _i++) {\\n if (isBlockProducer(_validators[_i])) {\\n _total++;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getBridgeOperators() public view override returns (address[] memory _result) {\\n _result = new address[](validatorCount);\\n uint256 _count = 0;\\n for (uint _i; _i < _result.length; _i++) {\\n if (isOperatingBridge(_validators[_i])) {\\n _result[_count++] = _bridgeOperatorOf(_validators[_i]);\\n }\\n }\\n\\n assembly {\\n mstore(_result, _count)\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs)\\n public\\n view\\n override\\n returns (address[] memory _result)\\n {\\n _result = new address[](_validatorAddrs.length);\\n for (uint _i; _i < _result.length; _i++) {\\n _result[_i] = _bridgeOperatorOf(_validatorAddrs[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isBridgeOperator(address _bridgeOperatorAddr) external view override returns (bool _isOperator) {\\n for (uint _i; _i < validatorCount; _i++) {\\n if (_bridgeOperatorOf(_validators[_i]) == _bridgeOperatorAddr && isOperatingBridge(_validators[_i])) {\\n _isOperator = true;\\n break;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isOperatingBridge(address _consensusAddr) public view override returns (bool) {\\n return _validatorMap[_consensusAddr].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator);\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {\\n return _maxValidatorNumber;\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function maxPrioritizedValidatorNumber() external view override returns (uint256 _maximumPrioritizedValidatorNumber) {\\n return _maxPrioritizedValidatorNumber;\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function totalBridgeOperators() public view returns (uint256 _total) {\\n for (uint _i; _i < validatorCount; _i++) {\\n if (isOperatingBridge(_validators[_i])) {\\n _total++;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function setMaxValidatorNumber(uint256 _max) external override onlyAdmin {\\n _setMaxValidatorNumber(_max);\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _number) external override onlyAdmin {\\n _setMaxPrioritizedValidatorNumber(_number);\\n }\\n\\n /**\\n * @dev Returns the bridge operator of a consensus address.\\n */\\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address);\\n\\n /**\\n * @dev See `IValidatorInfo-setMaxValidatorNumber`\\n */\\n function _setMaxValidatorNumber(uint256 _number) internal {\\n _maxValidatorNumber = _number;\\n emit MaxValidatorNumberUpdated(_number);\\n }\\n\\n /**\\n * @dev See `IValidatorInfo-setMaxPrioritizedValidatorNumber`\\n */\\n function _setMaxPrioritizedValidatorNumber(uint256 _number) internal {\\n if (_number > _maxValidatorNumber) revert ErrInvalidMaxPrioritizedValidatorNumber();\\n _maxPrioritizedValidatorNumber = _number;\\n emit MaxPrioritizedValidatorNumberUpdated(_number);\\n }\\n}\\n\",\"keccak256\":\"0x19dca6ad64bd68923a8eaa9983ccfe0adb8cd7ad5d94b4ba708c35483adc430e\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b615fe580620000f46000396000f3fe6080604052600436106103555760003560e01c806365244ece116101b957806365244ece146108075780636558954f146108275780636611f8431461083e578063690b75361461085e5780636aa1c2ef1461087357806372e46810146108885780637593ff7114610890578063823a7b9c146108b0578063873a5a70146108d057806387c891bd146108f05780638d559c381461090557806396585fc2146109195780639b19dbfd146109395780639c8d98da1461094e5780639dd373b91461096e5780639e94b9ec1461098e578063a0c3f2d2146109a3578063a3d545f5146109c3578063a66c0f77146109e3578063a7c2f119146109f8578063ad29578314610a18578063b405aaf214610a38578063b5e337de14610a58578063b7ab4db514610a78578063ba77b06c14610a9c578063c3c8b5d614610ab1578063c94aaa0214610ad1578063cba44de914610af1578063d09f1ab414610b06578063d2cb215e14610b1b578063d5a0744f14610b39578063dd716ad314610b59578063e5125a1d14610b79578063edb194bb14610b99578063ee99205c14610bfb578063eeb629a814610c10578063facd743b14610c2557610364565b8063038278841461036c57806304d971ab1461039557806306040618146103c55780630f43a677146103da5780631104e528146103f057806311662dc2146104105780631196ab661461044d57806315b5ebde1461046d5780631ab4a34c1461048d5780631f628801146104ad578063217f35c2146104cd57806323c65eb0146104e257806328bde1e1146105025780632924de711461052f578063297a8fca1461054f5780632bcf3d15146105645780632d784a98146105845780632f78204c146105b157806331a8aef5146105d15780633529214b146105f1578063367ec12b146106135780633b3159b6146106335780634244d4c9146106475780634493421e14610674578063468c96ae1461069257806346fe9311146106c957806349096d26146106e95780634d8df063146106fe5780634de2b7351461071e5780634ee4d72b1461074b5780634f2a693f1461076057806352091f17146107805780635248184a146107885780635511cde1146107aa578063562d5304146107c85780635a08482d146107dd578063605239a1146107f257610364565b3661036457610362610c45565b005b610362610c45565b34801561037857600080fd5b506103826104b081565b6040519081526020015b60405180910390f35b3480156103a157600080fd5b506103b56103b0366004615447565b610caa565b604051901515815260200161038c565b3480156103d157600080fd5b50610382610cd1565b3480156103e657600080fd5b5061038260aa5481565b3480156103fc57600080fd5b5061036261040b366004615480565b610ce1565b34801561041c57600080fd5b5061043061042b3660046154e4565b610f6c565b60408051931515845260208401929092529082015260600161038c565b34801561045957600080fd5b50610362610468366004615510565b610fef565b34801561047957600080fd5b506103626104883660046154e4565b611033565b34801561049957600080fd5b506103b56104a8366004615529565b61114f565b3480156104b957600080fd5b506103b56104c8366004615529565b611179565b3480156104d957600080fd5b506103b56111b3565b3480156104ee57600080fd5b506103b56104fd3660046154e4565b6111c8565b34801561050e57600080fd5b5061052261051d366004615529565b6111d4565b60405161038c919061559a565b34801561053b57600080fd5b506103b561054a366004615529565b611277565b34801561055b57600080fd5b50600454610382565b34801561057057600080fd5b5061036261057f366004615529565b611283565b34801561059057600080fd5b506105a461059f366004615529565b6112ef565b60405161038c91906155a8565b3480156105bd57600080fd5b506103626105cc3660046155cd565b611351565b3480156105dd57600080fd5b506103b56105ec3660046154e4565b61156d565b3480156105fd57600080fd5b50610606611579565b60405161038c9190615617565b34801561061f57600080fd5b5061036261062e36600461563c565b611588565b34801561063f57600080fd5b506068610606565b34801561065357600080fd5b5061066761066236600461576b565b611713565b60405161038c919061584d565b34801561068057600080fd5b50606e546001600160a01b0316610606565b34801561069e57600080fd5b506106b26106ad366004615510565b6117ca565b60408051921515835260208301919091520161038c565b3480156106d557600080fd5b506103626106e4366004615529565b611808565b3480156106f557600080fd5b50610667611874565b34801561070a57600080fd5b50610362610719366004615510565b61195d565b34801561072a57600080fd5b5061073e610739366004615860565b61199e565b60405161038c91906158d4565b34801561075757600080fd5b5060e454610382565b34801561076c57600080fd5b5061036261077b366004615510565b611a59565b610362611a9a565b34801561079457600080fd5b5061079d611e57565b60405161038c919061591a565b3480156107b657600080fd5b5060a8546001600160a01b0316610606565b3480156107d457600080fd5b50610382611f87565b3480156107e957600080fd5b50610606611fdb565b3480156107fe57600080fd5b50607254610382565b34801561081357600080fd5b506103b5610822366004615529565b611fea565b34801561083357600080fd5b506103826201518081565b34801561084a57600080fd5b50610362610859366004615510565b61201e565b34801561086a57600080fd5b5060e554610382565b34801561087f57600080fd5b50600154610382565b61036261205f565b34801561089c57600080fd5b506103b56108ab366004615510565b6122bf565b3480156108bc57600080fd5b506103626108cb366004615510565b6122e3565b3480156108dc57600080fd5b506103b56108eb366004615529565b612324565b3480156108fc57600080fd5b50600254610382565b34801561091157600080fd5b506066610606565b34801561092557600080fd5b50610430610934366004615529565b61233b565b34801561094557600080fd5b50610667612357565b34801561095a57600080fd5b50610362610969366004615529565b612443565b34801561097a57600080fd5b50610362610989366004615529565b6124af565b34801561099a57600080fd5b5061038261251b565b3480156109af57600080fd5b506103b56109be366004615529565b61256f565b3480156109cf57600080fd5b506103826109de366004615510565b61258c565b3480156109ef57600080fd5b5060e654610382565b348015610a0457600080fd5b50610362610a133660046154e4565b612597565b348015610a2457600080fd5b50610362610a33366004615529565b612843565b348015610a4457600080fd5b506103b5610a53366004615529565b6128af565b348015610a6457600080fd5b50610362610a73366004615529565b612934565b348015610a8457600080fd5b50610a8d6129a0565b60405161038c93929190615972565b348015610aa857600080fd5b50610667612b7e565b348015610abd57600080fd5b50610362610acc366004615447565b612be0565b348015610add57600080fd5b50610362610aec366004615510565b612e63565b348015610afd57600080fd5b50607654610382565b348015610b1257600080fd5b5060a954610382565b348015610b2757600080fd5b50606f546001600160a01b0316610606565b348015610b4557600080fd5b506103b5610b543660046154e4565b612ea4565b348015610b6557600080fd5b50610362610b743660046154e4565b612eb0565b348015610b8557600080fd5b50610362610b943660046159eb565b612f5a565b348015610ba557600080fd5b506105a4610bb4366004615529565b6040805180820190915260008082526020820152506001600160a01b0316600090815260776020908152604091829020825180840190935280548352600101549082015290565b348015610c0757600080fd5b5061060661308d565b348015610c1c57600080fd5b5060ad54610382565b348015610c3157600080fd5b506103b5610c40366004615529565b61309c565b610c4d611579565b6001600160a01b0316336001600160a01b031614158015610c875750610c7161308d565b6001600160a01b0316336001600160a01b031614155b15610ca85760405160016234baed60e01b0319815260040160405180910390fd5b565b6001600160a01b038281166000908152607560205260409020548116908216145b92915050565b6000610cdc60035490565b905090565b33610cea61308d565b6001600160a01b031614610d1157604051638aaf4a0760e01b815260040160405180910390fd5b6073546072548110610d3657604051638616841b60e01b815260040160405180910390fd5b610d3f8561256f565b15610d5d57604051638ad9cdf960e01b815260040160405180910390fd5b612710821115610d8057604051631b8454a360e21b815260040160405180910390fd5b60005b607354811015610e7b5760006075600060738481548110610da657610da6615a20565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190208054909250811690891603610e02578760405163fc3d8c7560e01b8152600401610df99190615617565b60405180910390fd5b60028101546001600160a01b0390811690871603610e355785604051632d33a7e760e11b8152600401610df99190615617565b60038101546001600160a01b0390811690861603610e6857846040516350e1263b60e01b8152600401610df99190615617565b5080610e7381615a4c565b915050610d83565b506001600160a01b038581166000818152607460209081526040808320861990556073805460018082019092557ff79bde9ddd17963ebce6f7d021d60de7c2bd0db944d23c900c0c0e775f5300520180546001600160a01b03199081168717909155607590935292819020805483168c87169081178255938101805484168617905560028101805484168b8816908117909155600382018054909416968a1696909617909255600482018790555190939192907fd690f592ed983cfbc05717fbcf06c4e10ae328432c309fe49246cf4a4be69fcd90610f5b908990615617565b60405180910390a450505050505050565b6001600160a01b0382166000908152603a60205260408120548190819084811015610fa257600080600093509350935050610fe8565b60019350610fb08582615a65565b610fbb906001615a78565b9250610fc68561258c565b610fcf8261258c565b610fd99190615a65565b610fe4906001615a78565b9150505b9250925092565b610ff76130d9565b6001600160a01b0316336001600160a01b0316146110275760405162461bcd60e51b8152600401610df990615a8b565b61103081613107565b50565b3361103c611fdb565b6001600160a01b031614611063576040516328b9c24b60e21b815260040160405180910390fd5b6001600160a01b0382166000908152603c6020526040902054431161109d57816040516353e0424d60e01b8152600401610df99190615617565b6001600160a01b038216600081815260386020908152604080832085845282528083208054600160ff1991821681179092559484526037835281842086855290925290912080549092169091556110f49043615a65565b6001600160a01b0383166000818152603a6020526040908190209290925590517f6bb2436cb6b6eb65d5a52fac2ae0373a77ade6661e523ef3004ee2d5524e6c6e906111439084815260200190565b60405180910390a25050565b600080600161115c610cd1565b6111669190615a65565b90506111728382613165565b9392505050565b6001600160a01b038116600090815260ac6020526040812054610ccb9060029060ff1660038111156111ad576111ad61595c565b90613190565b6000610cdc6111c1426131c3565b6003541090565b600061117283836131d2565b6111dc6153f6565b6111e58261256f565b6112025760405163a64b34ad60e01b815260040160405180910390fd5b506001600160a01b03908116600090815260756020908152604091829020825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015290565b6000610ccb82436111c8565b61128b6130d9565b6001600160a01b0316336001600160a01b0316146112bb5760405162461bcd60e51b8152600401610df990615a8b565b806001600160a01b03163b6000036112e657604051637bcd509160e01b815260040160405180910390fd5b611030816131f2565b604080518082018252600080825260209182018190526001600160a01b038416815260e88252828120835180850190945280548452600101549183018290520361134c576040516370fdd4f160e11b815260040160405180910390fd5b919050565b3361135a611fdb565b6001600160a01b031614611381576040516328b9c24b60e21b815260040160405180910390fd5b600061138b610cd1565b6001600160a01b03861660008181526037602090815260408083208584528252808320805460ff1916600117905592825260e181528282205460e0909152919020549192506113d991615a78565b60e460008282546113ea9190615a78565b90915550506001600160a01b038516600090815260e06020908152604080832083905560e18252808320839055603a90915290205461142a90859061323d565b6001600160a01b0386166000908152603a602052604090205582156114da5760715460405163138ac02f60e11b81526000916001600160a01b031690632715805e9061147c9089908890600401615acd565b6020604051808303816000875af115801561149b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114bf9190615ae6565b90508060e460008282546114d39190615a78565b9091555050505b811561151e576001600160a01b0385166000908152603c602052604090205461150490859061323d565b6001600160a01b0386166000908152603c60205260409020555b6001600160a01b0385166000818152603a6020526040808220549051849392600080516020615f908339815191529261155e929091899160019190615aff565b60405180910390a35050505050565b60006111728383613254565b606d546001600160a01b031690565b600054610100900460ff16158080156115a85750600054600160ff909116105b806115c25750303b1580156115c2575060005460ff166001145b6116255760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610df9565b6000805460ff191660011790558015611648576000805461ff0019166101001790555b6116518d6131f2565b61165a8c61327f565b6116638b6132ca565b61166c8a613315565b61167588613360565b61167e896133ab565b611687876133f6565b6116908661342b565b61169985613460565b6116a284613107565b6116ac82356134b8565b6116b960208301356134ed565b60018390558015611704576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b606081516001600160401b0381111561172e5761172e615702565b604051908082528060200260200182016040528015611757578160200160208202803683370190505b50905060005b81518110156117c45761178883828151811061177b5761177b615a20565b6020026020010151613522565b82828151811061179a5761179a615a20565b6001600160a01b0390921660209283029190910190910152806117bc81615a4c565b91505061175d565b50919050565b6000806117d64361258c565b831115806117f1575060008381526005602052604090205415155b600093845260056020526040909320549293915050565b6118106130d9565b6001600160a01b0316336001600160a01b0316146118405760405162461bcd60e51b8152600401610df990615a8b565b806001600160a01b03163b60000361186b57604051637bcd509160e01b815260040160405180910390fd5b61103081613315565b606060aa546001600160401b0381111561189057611890615702565b6040519080825280602002602001820160405280156118b9578160200160208202803683370190505b5090506000805b825181101561195757600081815260ab60205260409020546118ea906001600160a01b0316611fea565b1561194557600081815260ab60205260409020546001600160a01b0316838361191281615a4c565b94508151811061192457611924615a20565b60200260200101906001600160a01b031690816001600160a01b0316815250505b8061194f81615a4c565b9150506118c0565b50815290565b6119656130d9565b6001600160a01b0316336001600160a01b0316146119955760405162461bcd60e51b8152600401610df990615a8b565b611030816134ed565b6060816001600160401b038111156119b8576119b8615702565b6040519080825280602002602001820160405280156119e1578160200160208202803683370190505b50905060005b82811015611a5257611a1e848483818110611a0457611a04615a20565b9050602002016020810190611a199190615529565b61352d565b828281518110611a3057611a30615a20565b9115156020928302919091019091015280611a4a81615a4c565b9150506119e7565b5092915050565b611a616130d9565b6001600160a01b0316336001600160a01b031614611a915760405162461bcd60e51b8152600401610df990615a8b565b6110308161342b565b334114611aba576040516309f358fd60e01b815260040160405180910390fd5b6000611ac533611fea565b8015611ad75750611ad53361352d565b155b8015611af15750611aef33611aea610cd1565b613254565b155b606d54604051630634f5b960e01b815282151560048201526001602482015291925060009182916001600160a01b031690630634f5b9906044016060604051808303816000875af1158015611b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6e9190615b1e565b92509250508060e26000828254611b859190615a78565b90915550839050611bd7573460e46000828254611ba29190615a78565b90915550506040513390600080516020615f7083398151915290611bca903490600190615b55565b60405180910390a2505050565b336001600160a01b03167f0ede5c3be8625943fa64003cd4b91230089411249f3059bac6500873543ca9b13484604051611c12929190615b79565b60405180910390a26000611c24610cd1565b90506000611c328434615a78565b3360009081526038602090815260408083208684529091528120549192509060ff1615611d2b576070546040805163631c8fd160e11b815290516000926001600160a01b03169163c6391fa29160048083019260809291908290030181865afa158015611ca3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cc79190615b87565b93505050506127108184611cdb9190615bbd565b611ce59190615bea565b91508160e46000828254611cf99190615a78565b90915550506040513390600080516020615f7083398151915290611d21908590600290615b55565b60405180910390a2505b611d358183615a65565b91506000607160009054906101000a90046001600160a01b03166001600160a01b031663c673316c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611db09190615ae6565b3360009081526075602052604081206004015491925090611dd19083613539565b90506000612710611de28684615bbd565b611dec9190615bea565b33600090815260e06020526040812080549293508392909190611e10908490615a78565b9091555060009050611e228287615a65565b33600090815260e16020526040812080549293508392909190611e46908490615a78565b909155505050505050505050505050565b6073546060906001600160401b03811115611e7457611e74615702565b604051908082528060200260200182016040528015611ead57816020015b611e9a6153f6565b815260200190600190039081611e925790505b50905060005b8151811015611f83576075600060738381548110611ed357611ed3615a20565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c08201528251839083908110611f6557611f65615a20565b60200260200101819052508080611f7b90615a4c565b915050611eb3565b5090565b6000805b60aa54811015611f8357600081815260ab6020526040902054611fb6906001600160a01b0316611179565b15611fc95781611fc581615a4c565b9250505b80611fd381615a4c565b915050611f8b565b6070546001600160a01b031690565b6001600160a01b038116600090815260ac6020526040812054610ccb9060019060ff1660038111156111ad576111ad61595c565b6120266130d9565b6001600160a01b0316336001600160a01b0316146120565760405162461bcd60e51b8152600401610df990615a8b565b611030816134b8565b33411461207f576040516309f358fd60e01b815260040160405180910390fd5b612088436122bf565b6120a557604051636c74eecf60e01b815260040160405180910390fd5b6120ae4361258c565b6120b960025461258c565b106120d757604051632458f64160e01b815260040160405180910390fd5b4360025560006120e6426131c3565b905060006120f5826003541090565b905060006121016129a0565b50509050606060006121124361258c565b90506000612121826001615a78565b9050600061212d610cd1565b905085156122595761213f8186613548565b60008061214c83886138d3565b9150915061215c83888484613b05565b612164613c0e565b61216c613d69565b607054604051631da0214360e21b81526001600160a01b0390911690637680850c9061219e908a908790600401615bfe565b600060405180830381600087803b1580156121b857600080fd5b505af11580156121cc573d6000803e3d6000fd5b505050506121d989613e8b565b8051919850965015612248576070546040516303e1697b60e11b81526001600160a01b03909116906307c2d2f69061221590899060040161584d565b600060405180830381600087803b15801561222f57600080fd5b505af1158015612243573d6000803e3d6000fd5b505050505b612253436001615a78565b60045550505b612264878387614016565b82817f0195462033384fec211477c56217da64a58bd405e0bed331ba4ded67e4ae4ce788604051612299911515815260200190565b60405180910390a350600090815260056020526040902085905550505060039190915550565b6000600180546122cf9190615a65565b6001546122dc9084615c20565b1492915050565b6122eb6130d9565b6001600160a01b0316336001600160a01b03161461231b5760405162461bcd60e51b8152600401610df990615a8b565b611030816133f6565b60008061232f610cd1565b90506111728382613254565b600080600061234a8443610f6c565b9250925092509193909250565b606060aa546001600160401b0381111561237357612373615702565b60405190808252806020026020018201604052801561239c578160200160208202803683370190505b5090506000805b825181101561195757600081815260ab60205260409020546123cd906001600160a01b0316611179565b1561243157600081815260ab60205260409020546123f3906001600160a01b0316613522565b83836123fe81615a4c565b94508151811061241057612410615a20565b60200260200101906001600160a01b031690816001600160a01b0316815250505b8061243b81615a4c565b9150506123a3565b61244b6130d9565b6001600160a01b0316336001600160a01b03161461247b5760405162461bcd60e51b8152600401610df990615a8b565b806001600160a01b03163b6000036124a657604051637bcd509160e01b815260040160405180910390fd5b61103081613360565b6124b76130d9565b6001600160a01b0316336001600160a01b0316146124e75760405162461bcd60e51b8152600401610df990615a8b565b806001600160a01b03163b60000361251257604051637bcd509160e01b815260040160405180910390fd5b6110308161327f565b6000805b60aa54811015611f8357600081815260ab602052604090205461254a906001600160a01b0316611fea565b1561255d578161255981615a4c565b9250505b8061256781615a4c565b91505061251f565b6001600160a01b0316600090815260746020526040902054151590565b6000610ccb826143e6565b336125a061308d565b6001600160a01b0316146125c757604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b038216600090815260e8602052604090206001810154156126025760405163057aab3160e31b815260040160405180910390fd5b600061260e8342615a78565b6001600160a01b03851660009081526075602052604090209091506126339082614401565b6001600160a01b0384166000908152603b6020908152604080832084905560399091528120600191612663610cd1565b8152602081019190915260409081016000908120805460ff19169315159390931790925560715460e554915163138ac02f60e11b81526001600160a01b0390911691632715805e916126b9918991600401615acd565b6020604051808303816000875af11580156126d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126fc9190615ae6565b905080156127f957600060e654426127149190615a78565b60e78054600180820183556000929092527f6cb0db1d7354dfb4a1464318006df0643cafe2002a86a29ff8560f900fef28a10180546001600160a01b0319166001600160a01b038a16179055838655850181905590506127726130d9565b6001600160a01b0387811660008181526075602052604090819020600201549051630a2fae5760e41b81526004810192909252821660248201524260448201526064810184905291169063a2fae57090608401600060405180830381600087803b1580156127df57600080fd5b505af11580156127f3573d6000803e3d6000fd5b50505050505b846001600160a01b03167f77a1a819870c0f4d04c3ca4cc2881a0393136abc28bd651af50aedade94a27c48260405161283491815260200190565b60405180910390a25050505050565b61284b6130d9565b6001600160a01b0316336001600160a01b03161461287b5760405162461bcd60e51b8152600401610df990615a8b565b806001600160a01b03163b6000036128a657604051637bcd509160e01b815260040160405180910390fd5b611030816132ca565b6000805b60aa548110156117c457600081815260ab60205260409020546001600160a01b03808516916128e29116613522565b6001600160a01b03161480156129145750600081815260ab6020526040902054612914906001600160a01b0316611179565b1561292257600191506117c4565b8061292c81615a4c565b9150506128b3565b61293c6130d9565b6001600160a01b0316336001600160a01b03161461296c5760405162461bcd60e51b8152600401610df990615a8b565b806001600160a01b03163b60000361299757604051637bcd509160e01b815260040160405180910390fd5b611030816133ab565b606080606060aa546001600160401b038111156129bf576129bf615702565b6040519080825280602002602001820160405280156129e8578160200160208202803683370190505b50925060aa546001600160401b03811115612a0557612a05615702565b604051908082528060200260200182016040528015612a2e578160200160208202803683370190505b50915060aa546001600160401b03811115612a4b57612a4b615702565b604051908082528060200260200182016040528015612a74578160200160208202803683370190505b50905060005b8351811015612b7857600081815260ab602052604090205484516001600160a01b03909116908190869084908110612ab457612ab4615a20565b60200260200101906001600160a01b031690816001600160a01b031681525050612add81613522565b848381518110612aef57612aef615a20565b6001600160a01b03928316602091820292909201810191909152908216600090815260ac9091526040902054835160ff90911690849084908110612b3557612b35615a20565b60200260200101906003811115612b4e57612b4e61595c565b90816003811115612b6157612b6161595c565b905250819050612b7081615a4c565b915050612a7a565b50909192565b60606073805480602002602001604051908101604052809291908181526020018280548015612bd657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612bb8575b5050505050905090565b612be86130d9565b6001600160a01b0316336001600160a01b031614612c185760405162461bcd60e51b8152600401610df990615a8b565b6001600160a01b038216600090815260e8602052604090206001015415612e5f5760e7548060005b82811015612c9957846001600160a01b031660e78281548110612c6557612c65615a20565b6000918252602090912001546001600160a01b031603612c8757809150612c99565b80612c9181615a4c565b915050612c40565b50818103612ca75750505050565b6001600160a01b038416600090815260e860205260409020548015612e5b576001600160a01b038516600090815260e860205260408120818155600190810191909155831115612d695760e7612cfe600185615a65565b81548110612d0e57612d0e615a20565b60009182526020909120015460e780546001600160a01b039092169184908110612d3a57612d3a615a20565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480612d7a57612d7a615c34565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825260e9905260409020805460ff19166001179055612dcc84826104b061447d565b15612e1657836001600160a01b0316856001600160a01b03167f7229136a18186c71a86246c012af3bb1df6460ef163934bbdccd6368abdd41e48360405161155e91815260200190565b836001600160a01b0316856001600160a01b03167f3747d14eb72ad3e35cba9c3e00dab3b8d15b40cac6bdbd08402356e4f69f30a1834760405161155e929190615b79565b5050505b5050565b612e6b6130d9565b6001600160a01b0316336001600160a01b031614612e9b5760405162461bcd60e51b8152600401610df990615a8b565b61103081613460565b60006111728383613165565b33612eb961308d565b6001600160a01b031614612ee057604051638aaf4a0760e01b815260040160405180910390fd5b612ee9826144dd565b15612f075760405163030081e760e01b815260040160405180910390fd5b6001600160a01b0382166000908152607560205260409020600581015415612f425760405163fab9167360e01b815260040160405180910390fd5b612f5581612f508442615a78565b614401565b505050565b33612f6361308d565b6001600160a01b031614612f8a57604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604090205415612fc157604051632f32dcdd60e11b815260040160405180910390fd5b612710811115612fe457604051631b8454a360e21b815260040160405180910390fd5b6076548210156130075760405163fa0ae69360e01b815260040160405180910390fd5b6001600160a01b038316600090815260776020526040812090620151808461302f8242615bea565b6130399190615a78565b6130439190615bbd565b808355600183018490556040519091506001600160a01b038616907f6ebafd1bb6316b2f63198a81b05cff2149c6eaae1784466a6d062b4391900f21906128349084908790615b79565b6071546001600160a01b031690565b6001600160a01b038116600090815260ac60205260408120546130d29060ff1660038111156130cd576130cd61595c565b61455a565b1592915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b6001811015613129576040516317b8970f60e01b815260040160405180910390fd5b60768190556040518181527f266d432ffe659e3565750d26ec685b822a58041eee724b67a5afec3168a25267906020015b60405180910390a150565b6001600160a01b03919091166000908152603960209081526040808320938352929052205460ff1690565b60008160038111156131a4576131a461595c565b8360038111156131b6576131b661595c565b1660ff1615159392505050565b6000610ccb6201518083615bea565b6001600160a01b03919091166000908152603a6020526040902054101590565b607080546001600160a01b0319166001600160a01b0383161790556040517faa5b07dd43aa44c69b70a6a2b9c3fcfed12b6e5f6323596ba7ac91035ab80a4f9061315a908390615617565b60008183101561324d5781611172565b5090919050565b6001600160a01b03919091166000908152603760209081526040808320938352929052205460ff1690565b607180546001600160a01b0319166001600160a01b0383161790556040517f6397f5b135542bb3f477cb346cfab5abdec1251d08dc8f8d4efb4ffe122ea0bf9061315a908390615617565b606d80546001600160a01b0319166001600160a01b0383161790556040517fc328090a37d855191ab58469296f98f87a851ca57d5cdfd1e9ac3c83e9e7096d9061315a908390615617565b606f80546001600160a01b0319166001600160a01b0383161790556040517f31a33f126a5bae3c5bdf6cfc2cd6dcfffe2fe9634bdb09e21c44762993889e3b9061315a908390615617565b606e80546001600160a01b0319166001600160a01b0383161790556040517f034c8da497df28467c79ddadbba1cc3cdd41f510ea73faae271e6f16a61116219061315a908390615617565b60a880546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d79061315a908390615617565b60a98190556040518181527fb5464c05fd0e0f000c535850116cda2742ee1f7b34384cb920ad7b8e802138b59060200161315a565b60728190556040518181527f82d5dc32d1b741512ad09c32404d7e7921e8934c6222343d95f55f7a2b9b2ab49060200161315a565b60a954811115613483576040516355408ce960e11b815260040160405180910390fd5b60ad8190556040518181527fa9588dc77416849bd922605ce4fc806712281ad8a8f32d4238d6c8cca548e15e9060200161315a565b60e58190556040518181527f17a6c3eb965cdd7439982da25abf85be88f0f772ca33198f548e2f99fee0289a9060200161315a565b60e68190556040518181527f0a50c66137118f386332efb949231ddd3946100dbf880003daca37ddd9e0662b9060200161315a565b6000610ccb82614578565b6000610ccb82436131d2565b600081831061324d5781611172565b606e5460405163889998ef60e01b8152600481018490526000916001600160a01b03169063889998ef90602401602060405180830381865afa158015613592573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135b69190615ae6565b606e5460405163033cdc2b60e31b8152600481018690529192506000916001600160a01b03909116906319e6e15890602401602060405180830381865afa158015613605573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136299190615ae6565b606e549091506000906001600160a01b031663f67e81528661364a87611713565b6040518363ffffffff1660e01b8152600401613667929190615c4a565b600060405180830381865afa158015613684573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136ac9190810190615c6b565b90506136b983838361459d565b15806136c3575081155b156137405760005b845181101561373857845160e2546136e39190615bea565b60e360008784815181106136f9576136f9615a20565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550808061373090615a4c565b9150506136cb565b505050505050565b600080600080607060009054906101000a90046001600160a01b03166001600160a01b0316631079402a6040518163ffffffff1660e01b8152600401608060405180830381865afa158015613799573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137bd9190615b87565b9296509094509250905080861160005b89518110156138c657888782815181106137e9576137e9615a20565b602002602001015160e2546137fe9190615bbd565b6138089190615bea565b60e360008c848151811061381e5761381e615a20565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208190555081156138b4576138b48b8b838151811061386657613866615a20565b60200260200101518a6127108b868151811061388457613884615a20565b60200260200101516138969190615bbd565b6138a09190615bea565b6138ac90612710615a65565b878a8a614656565b806138be81615a4c565b9150506137cd565b5050505050505050505050565b6000606060008084516001600160401b038111156138f3576138f3615702565b60405190808252806020026020018201604052801561391c578160200160208202803683370190505b50925060005b8551811015613af55785818151811061393d5761393d615a20565b6020908102919091018101516001600160a01b03808216600090815260759093526040909220600201549094501691506139778388613165565b6139aa576001600160a01b038084166000908152607560205260409020600301546139a591859116846148b6565b6139dc565b6001600160a01b038316600090815260e3602052604081205460e48054919290916139d6908490615a78565b90915550505b6139e58361352d565b1580156139f957506139f78388613254565b155b15613a6d576001600160a01b038316600090815260e16020526040902054613a219086615a78565b6001600160a01b038416600090815260e16020526040902054855191965090859083908110613a5257613a52615a20565b602002602001018181525050613a688383614993565b613ab3565b6001600160a01b038316600090815260e1602090815260408083205460e090925290912054613a9c9190615a78565b60e46000828254613aad9190615a78565b90915550505b6001600160a01b038316600090815260e16020908152604080832083905560e0825280832083905560e390915281205580613aed81615a4c565b915050613922565b5060e26000905550509250929050565b6071546001600160a01b03168215612e5b57613b218184614a5b565b15613bc95760405163566bce2360e11b81526001600160a01b0382169063acd79c4690613b5690879086908a90600401615d20565b600060405180830381600087803b158015613b7057600080fd5b505af1158015613b84573d6000803e3d6000fd5b505050507f9e242ca1ef9dde96eb71ef8d19a3f0f6a619b63e4c0d3998771387103656d087838584604051613bbb93929190615d56565b60405180910390a150613c08565b7fe5668ec1bb2b6bb144a50f810e388da4b1d7d3fc05fcb9d588a1aac59d248f8983858447604051613bfe9493929190615d8b565b60405180910390a1505b50505050565b60e754600080805b83831015613c085760e78381548110613c3157613c31615a20565b60009182526020808320909101546001600160a01b031680835260e89091526040909120600181015491935091504210613d5757805460e48054600090613c79908490615a78565b90915550506001600160a01b038216600090815260e860205260408120818155600101819055613ca885615dc8565b9450841115613d1f5760e78481548110613cc457613cc4615a20565b60009182526020909120015460e780546001600160a01b039092169185908110613cf057613cf0615a20565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480613d3057613d30615c34565b600082815260209020810160001990810180546001600160a01b0319169055019055613c16565b82613d6181615a4c565b935050613c16565b60e4548015611030576000613d7c611579565b600060e481905560408051600481526024810182526020810180516001600160e01b03166359f778df60e01b179052905192935090916001600160a01b038416918591613dc99190615ddf565b60006040518083038185875af1925050503d8060008114613e06576040519150601f19603f3d011682016040523d82523d6000602084013e613e0b565b606091505b505090508015613e5057816001600160a01b03167fc447c884574da5878be39c403db2245c22530c99b579ea7bcbb3720e1d110dc884604051611bca91815260200190565b816001600160a01b03167fa0561a59abed308fcd0556834574739d778cc6229018039a24ddda0f86aa0b738447604051611bca929190615b79565b606080613e9783614ab7565b6071546040516391f8723f60e01b81529192506000916001600160a01b03909116906391f8723f90613ece90607390600401615e0e565b600060405180830381865afa158015613eeb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f139190810190615c6b565b60a854604051632907e73160e11b81529192506000916001600160a01b039091169063520fce6290613f4a90607390600401615e0e565b600060405180830381865afa158015613f67573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f8f9190810190615c6b565b90506000613ffe6073805480602002602001604051908101604052809291908181526020018280548015613fec57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613fce575b5050505050848460a95460ad54614faa565b909550905061400e858288615074565b505050915091565b606f546000906001600160a01b031663fdadda8183614036436001615a78565b6040518363ffffffff1660e01b8152600401614053929190615bfe565b600060405180830381865afa158015614070573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526140989190810190615e52565b905060005b825181101561435f5760008382815181106140ba576140ba615a20565b6020908102919091018101516001600160a01b0381166000908152603b9092526040822054909250421115906140ef83611fea565b9050600061410784614102436001615a78565b6131d2565b80614128575085858151811061411f5761411f615a20565b60200260200101515b806141305750825b1590508115801561413e5750805b156141b9576001600160a01b038416600090815260ac602052604090205461417d9060019060ff1660038111156141775761417761595c565b906151d2565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156141af576141af61595c565b021790555061423b565b8180156141c4575080155b1561423b576001600160a01b038416600090815260ac60205260409020546142039060019060ff1660038111156141fd576141fd61595c565b9061520d565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156142355761423561595c565b02179055505b600061424685611179565b90508315811580156142555750805b156142ca576001600160a01b038616600090815260ac602052604090205461428e9060029060ff1660038111156141775761417761595c565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156142c0576142c061595c565b0217905550614346565b8180156142d5575080155b15614346576001600160a01b038616600090815260ac602052604090205461430e9060029060ff1660038111156141fd576141fd61595c565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156143405761434061595c565b02179055505b505050505050808061435790615a4c565b91505061409d565b5082847f283b50d76057d5f828df85bc87724c6af604e9b55c363a07c9faa2a2cd688b8261438b611874565b604051614398919061584d565b60405180910390a382847f773d1888df530d69716b183a92450d45f97fba49f2a4bb34fae3b23da0e2cc6f6143cb612357565b6040516143d8919061584d565b60405180910390a350505050565b6000600154826143f69190615bea565b610ccb906001615a78565b6001820154614418906001600160a01b031661256f565b6144355760405163a64b34ad60e01b815260040160405180910390fd5b6005820181905560018201546040518281526001600160a01b03909116907fb9a1e33376bfbda9092f2d1e37662c1b435aab0d3fa8da3acc8f37ee222f99e790602001611143565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d80600081146144cd576040519150601f19603f3d011682016040523d82523d6000602084013e6144d2565b606091505b509095945050505050565b60a85460405163107fbb4760e21b815260009182916001600160a01b03909116906341feed1c90614512908690600401615617565b602060405180830381865afa15801561452f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145539190615ae6565b1192915050565b600081600381111561456e5761456e61595c565b60ff161592915050565b6001600160a01b03808216600090815260756020526040812060030154909116610ccb565b60016000805b835181101561460f57848482815181106145bf576145bf615a20565b602002602001015111156145d6576000925061460f565b8381815181106145e8576145e8615a20565b6020026020010151826145fb9190615a78565b91508061460781615a4c565b9150506145a3565b5081801561461d5750848111155b91508161464e576040517f64ba7143ea5a17abea37667aa9ae137e3afba5033c5f504770c02829c128189c90600090a15b509392505050565b8084106147d2576001600160a01b03851660008181526039602090815260408083208a845282528083208054600160ff199182168117909255948452603783528184208b855290925282208054909316179091556146b44385615249565b6001600160a01b0387166000908152603a60205260409020549091506146db90829061323d565b6001600160a01b0387166000908152603a6020908152604080832093909355603c9052205461470b90829061323d565b6001600160a01b038088166000908152603c60205260409081902092909255607054915163c008ce3960e01b815291169063c008ce39906147559089906002908c90600401615ee0565b600060405180830381600087803b15801561476f57600080fd5b505af1158015614783573d6000803e3d6000fd5b5050506001600160a01b0387166000818152603a60205260408082205490518b9450600080516020615f90833981519152926147c492916001908190615aff565b60405180910390a350613738565b818410613738576001600160a01b0380861660009081526039602090815260408083208a845290915290819020805460ff19166001908117909155607054915163c008ce3960e01b8152919092169163c008ce39916148379189918b90600401615ee0565b600060405180830381600087803b15801561485157600080fd5b505af1158015614865573d6000803e3d6000fd5b5050506001600160a01b0386166000818152603a60205260408082205490518a9450600080516020615f90833981519152926148a692918190600190615aff565b60405180910390a3505050505050565b6001600160a01b038316600090815260e360205260409020548015613c08576148e282826104b061447d565b1561494457816001600160a01b0316836001600160a01b0316856001600160a01b03167f72a57dc38837a1cba7881b7b1a5594d9e6b65cec6a985b54e2cee3e89369691c8460405161493691815260200190565b60405180910390a450505050565b816001600160a01b0316836001600160a01b0316856001600160a01b03167fd35d76d87d51ed89407fc7ceaaccf32cf72784b94530892ce33546540e141b728447604051614936929190615b79565b6001600160a01b038216600090815260e060205260409020548015612f55576149bf82826104b061447d565b15614a1657816001600160a01b0316836001600160a01b03167f1ce7a1c4702402cd393500acb1de5bd927727a54e144a587d328f1b679abe4ec83604051614a0991815260200190565b60405180910390a3505050565b816001600160a01b0316836001600160a01b03167f6c69e09ee5c5ac33c0cd57787261c5bade070a392ab34a4b5487c6868f723f6e8347604051614a09929190615b79565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114614aa8576040519150601f19603f3d011682016040523d82523d6000602084013e614aad565b606091505b5090949350505050565b6071546040805163af24542960e01b815290516060926001600160a01b031691600091839163af2454299160048083019260209291908290030181865afa158015614b06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b2a9190615ae6565b90506000826001600160a01b031663909791dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b909190615ae6565b90506000836001600160a01b03166342ef3c3460736040518263ffffffff1660e01b8152600401614bc19190615e0e565b600060405180830381865afa158015614bde573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052614c069190810190615c6b565b6073549091506000816001600160401b03811115614c2657614c26615702565b604051908082528060200260200182016040528015614c4f578160200160208202803683370190505b50965060008060005b84831015614efb5760738381548110614c7357614c73615a20565b60009182526020808320909101546001600160a01b031680835260759091526040909120600681015488519294509092501515908890889086908110614cbb57614cbb615a20565b60200260200101511015614d175780614d12576000614cda8a42615a78565b600684018190556040518181529091506001600160a01b03851690600080516020615f508339815191529060200160405180910390a2505b614d58565b8015614d58578160060160009055826001600160a01b0316600080516020615f508339815191526000604051614d4f91815260200190565b60405180910390a25b60008260050154600014158015614d73575042836005015411155b80614d9657506001600160a01b038416600090815260e9602052604090205460ff165b905060008360060154600014158015614db3575042846006015411155b90508180614dbe5750805b15614e545788614dcd89615dc8565b98508881518110614de057614de0615a20565b6020026020010151898781518110614dfa57614dfa615a20565b6020908102919091010152848d88614e1181615a4c565b995081518110614e2357614e23615a20565b60200260200101906001600160a01b031690816001600160a01b031681525050614e4c85615264565b505050614c58565b6001600160a01b0385166000908152607760205260409020548015801590614e7c5750428111155b15614ee5576001600160a01b0386166000818152607760209081526040808320600181018054918590559390935560048901839055518281529192917f86d576c20e383fc2413ef692209cc48ddad5e52f25db5b32f8f7ec5076461ae9910160405180910390a2505b86614eef81615a4c565b97505050505050614c58565b5050508087528015614f9f577f4eaf233b9dc25a5552c1927feee1412eea69add17c2485c831c2e60e234f3c9187604051614f36919061584d565b60405180910390a160405163e22d1c9d60e01b81526001600160a01b0387169063e22d1c9d90614f6c908a908c90600401615bfe565b600060405180830381600087803b158015614f8657600080fd5b505af1158015614f9a573d6000803e3d6000fd5b505050505b505050505050919050565b60606000806068905060008888888888604051602401614fce959493929190615f01565b60408051601f19818403018152919052602080820180516001600160e01b0316633bca0a8960e11b17905281518b51929350600192909160009161501191615bbd565b61501c906040615a78565b90506020840181888483895afa61503257600093505b503d61503d57600092505b6020870196508261506157604051630fc2632160e01b815260040160405180910390fd5b8651955050505050509550959350505050565b815b60aa548110156150d257600081815260ab6020818152604080842080546001600160a01b0316855260ac8352908420805460ff19169055928490525280546001600160a01b0319169055806150ca81615a4c565b915050615076565b5060005b8281101561511c57600081815260ab60209081526040808320546001600160a01b0316835260ac9091529020805460ff191690558061511481615a4c565b9150506150d6565b5060005b8281101561519a57600084828151811061513c5761513c615a20565b6020908102919091018101516001600160a01b0316600081815260ac83526040808220805460ff1916600317905585825260ab9093529190912080546001600160a01b0319169091179055508061519281615a4c565b915050615120565b508160aa81905550807f3d0eea40644a206ec25781dd5bb3b60eb4fa1264b993c3bddf3c73b14f29ef5e84604051611bca919061584d565b60008160038111156151e6576151e661595c565b8360038111156151f8576151f861595c565b1760ff1660038111156111725761117261595c565b60008160038111156152215761522161595c565b198360038111156152345761523461595c565b1660ff1660038111156111725761117261595c565b60008160000361525a576000611172565b6111728284615a78565b6001600160a01b038116600090815260e960209081526040808320805460ff191690556074909152812054611030918391908190036152a1575050565b6001600160a01b038216600090815260756020908152604080832080546001600160a01b03199081168255600180830180548316905560028301805483169055600383018054909216909155600482018590556005820185905560069091018490556074835281842084905560779092528220828155810182905560738054909161532b91615a65565b8154811061533b5761533b615a20565b6000918252602090912001546001600160a01b039081169150831681146153be576001600160a01b038116600090815260746020526040902082905560738054829190841990811061538f5761538f615a20565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60738054806153cf576153cf615c34565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6001600160a01b038116811461103057600080fd5b6000806040838503121561545a57600080fd5b823561546581615432565b9150602083013561547581615432565b809150509250929050565b600080600080600060a0868803121561549857600080fd5b85356154a381615432565b945060208601356154b381615432565b935060408601356154c381615432565b925060608601356154d381615432565b949793965091946080013592915050565b600080604083850312156154f757600080fd5b823561550281615432565b946020939093013593505050565b60006020828403121561552257600080fd5b5035919050565b60006020828403121561553b57600080fd5b813561117281615432565b60018060a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b60e08101610ccb8284615546565b815181526020808301519082015260408101610ccb565b801515811461103057600080fd5b600080600080608085870312156155e357600080fd5b84356155ee81615432565b93506020850135925060408501359150606085013561560c816155bf565b939692955090935050565b6001600160a01b0391909116815260200190565b8060408101831015610ccb57600080fd5b6000806000806000806000806000806000806101a08d8f03121561565f57600080fd5b8c3561566a81615432565b9b5060208d013561567a81615432565b9a5060408d013561568a81615432565b995060608d013561569a81615432565b985060808d01356156aa81615432565b975060a08d01356156ba81615432565b965060c08d0135955060e08d013594506101008d013593506101208d013592506101408d013591506156f08e6101608f0161562b565b90509295989b509295989b509295989b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561574057615740615702565b604052919050565b60006001600160401b0382111561576157615761615702565b5060051b60200190565b6000602080838503121561577e57600080fd5b82356001600160401b0381111561579457600080fd5b8301601f810185136157a557600080fd5b80356157b86157b382615748565b615718565b81815260059190911b820183019083810190878311156157d757600080fd5b928401925b828410156157fe5783356157ef81615432565b825292840192908401906157dc565b979650505050505050565b600081518084526020808501945080840160005b838110156158425781516001600160a01b03168752958201959082019060010161581d565b509495945050505050565b6020815260006111726020830184615809565b6000806020838503121561587357600080fd5b82356001600160401b038082111561588a57600080fd5b818501915085601f83011261589e57600080fd5b8135818111156158ad57600080fd5b8660208260051b85010111156158c257600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b8181101561590e5783511515835292840192918401916001016158f0565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561590e57615949838551615546565b9284019260e09290920191600101615936565b634e487b7160e01b600052602160045260246000fd5b6060815260006159856060830186615809565b6020838203818501526159988287615809565b8481036040860152855180825282870193509082019060005b818110156159dd578451600481106159cb576159cb61595c565b835293830193918301916001016159b1565b509098975050505050505050565b600080600060608486031215615a0057600080fd5b8335615a0b81615432565b95602085013595506040909401359392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201615a5e57615a5e615a36565b5060010190565b81810381811115610ccb57610ccb615a36565b80820180821115610ccb57610ccb615a36565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b6001600160a01b03929092168252602082015260400190565b600060208284031215615af857600080fd5b5051919050565b9384526020840192909252151560408301521515606082015260800190565b600080600060608486031215615b3357600080fd5b8351615b3e816155bf565b602085015160409095015190969495509392505050565b8281526040810160038310615b6c57615b6c61595c565b8260208301529392505050565b918252602082015260400190565b60008060008060808587031215615b9d57600080fd5b505082516020840151604085015160609095015191969095509092509050565b8082028115828204841417610ccb57610ccb615a36565b634e487b7160e01b600052601260045260246000fd5b600082615bf957615bf9615bd4565b500490565b604081526000615c116040830185615809565b90508260208301529392505050565b600082615c2f57615c2f615bd4565b500690565b634e487b7160e01b600052603160045260246000fd5b828152604060208201526000615c636040830184615809565b949350505050565b60006020808385031215615c7e57600080fd5b82516001600160401b03811115615c9457600080fd5b8301601f81018513615ca557600080fd5b8051615cb36157b382615748565b81815260059190911b82018301908381019087831115615cd257600080fd5b928401925b828410156157fe57835182529284019290840190615cd7565b600081518084526020808501945080840160005b8381101561584257815187529582019590820190600101615d04565b606081526000615d336060830186615809565b8281036020840152615d458186615cf0565b915050826040830152949350505050565b838152606060208201526000615d6f6060830185615809565b8281036040840152615d818185615cf0565b9695505050505050565b848152608060208201526000615da46080830186615809565b8281036040840152615db68186615cf0565b91505082606083015295945050505050565b600081615dd757615dd7615a36565b506000190190565b6000825160005b81811015615e005760208186018101518583015201615de6565b506000920191825250919050565b6020808252825482820181905260008481528281209092916040850190845b8181101561590e5783546001600160a01b031683526001938401939285019201615e2d565b60006020808385031215615e6557600080fd5b82516001600160401b03811115615e7b57600080fd5b8301601f81018513615e8c57600080fd5b8051615e9a6157b382615748565b81815260059190911b82018301908381019087831115615eb957600080fd5b928401925b828410156157fe578351615ed1816155bf565b82529284019290840190615ebe565b6001600160a01b039390931683526020830191909152604082015260600190565b60a081526000615f1460a0830188615809565b8281036020840152615f268188615cf0565b90508281036040840152615f3a8187615cf0565b6060840195909552505060800152939250505056fe88f854e137380c14d63f6ed99781bf13402167cf55bac49bcd44d4f2d6a342754042bb9a70998f80a86d9963f0d2132e9b11c8ad94d207c6141c8e34b05ce53e54ce99c5ce1fc9f61656d4a0fb2697974d0c973ac32eecaefe06fcf18b8ef68aa264697066735822122040f2b0559f81977d0a2a4c4435e240754acea0e6a8f693df6e3130917143847f64736f6c63430008110033", - "deployedBytecode": "0x6080604052600436106103555760003560e01c806365244ece116101b957806365244ece146108075780636558954f146108275780636611f8431461083e578063690b75361461085e5780636aa1c2ef1461087357806372e46810146108885780637593ff7114610890578063823a7b9c146108b0578063873a5a70146108d057806387c891bd146108f05780638d559c381461090557806396585fc2146109195780639b19dbfd146109395780639c8d98da1461094e5780639dd373b91461096e5780639e94b9ec1461098e578063a0c3f2d2146109a3578063a3d545f5146109c3578063a66c0f77146109e3578063a7c2f119146109f8578063ad29578314610a18578063b405aaf214610a38578063b5e337de14610a58578063b7ab4db514610a78578063ba77b06c14610a9c578063c3c8b5d614610ab1578063c94aaa0214610ad1578063cba44de914610af1578063d09f1ab414610b06578063d2cb215e14610b1b578063d5a0744f14610b39578063dd716ad314610b59578063e5125a1d14610b79578063edb194bb14610b99578063ee99205c14610bfb578063eeb629a814610c10578063facd743b14610c2557610364565b8063038278841461036c57806304d971ab1461039557806306040618146103c55780630f43a677146103da5780631104e528146103f057806311662dc2146104105780631196ab661461044d57806315b5ebde1461046d5780631ab4a34c1461048d5780631f628801146104ad578063217f35c2146104cd57806323c65eb0146104e257806328bde1e1146105025780632924de711461052f578063297a8fca1461054f5780632bcf3d15146105645780632d784a98146105845780632f78204c146105b157806331a8aef5146105d15780633529214b146105f1578063367ec12b146106135780633b3159b6146106335780634244d4c9146106475780634493421e14610674578063468c96ae1461069257806346fe9311146106c957806349096d26146106e95780634d8df063146106fe5780634de2b7351461071e5780634ee4d72b1461074b5780634f2a693f1461076057806352091f17146107805780635248184a146107885780635511cde1146107aa578063562d5304146107c85780635a08482d146107dd578063605239a1146107f257610364565b3661036457610362610c45565b005b610362610c45565b34801561037857600080fd5b506103826104b081565b6040519081526020015b60405180910390f35b3480156103a157600080fd5b506103b56103b0366004615447565b610caa565b604051901515815260200161038c565b3480156103d157600080fd5b50610382610cd1565b3480156103e657600080fd5b5061038260aa5481565b3480156103fc57600080fd5b5061036261040b366004615480565b610ce1565b34801561041c57600080fd5b5061043061042b3660046154e4565b610f6c565b60408051931515845260208401929092529082015260600161038c565b34801561045957600080fd5b50610362610468366004615510565b610fef565b34801561047957600080fd5b506103626104883660046154e4565b611033565b34801561049957600080fd5b506103b56104a8366004615529565b61114f565b3480156104b957600080fd5b506103b56104c8366004615529565b611179565b3480156104d957600080fd5b506103b56111b3565b3480156104ee57600080fd5b506103b56104fd3660046154e4565b6111c8565b34801561050e57600080fd5b5061052261051d366004615529565b6111d4565b60405161038c919061559a565b34801561053b57600080fd5b506103b561054a366004615529565b611277565b34801561055b57600080fd5b50600454610382565b34801561057057600080fd5b5061036261057f366004615529565b611283565b34801561059057600080fd5b506105a461059f366004615529565b6112ef565b60405161038c91906155a8565b3480156105bd57600080fd5b506103626105cc3660046155cd565b611351565b3480156105dd57600080fd5b506103b56105ec3660046154e4565b61156d565b3480156105fd57600080fd5b50610606611579565b60405161038c9190615617565b34801561061f57600080fd5b5061036261062e36600461563c565b611588565b34801561063f57600080fd5b506068610606565b34801561065357600080fd5b5061066761066236600461576b565b611713565b60405161038c919061584d565b34801561068057600080fd5b50606e546001600160a01b0316610606565b34801561069e57600080fd5b506106b26106ad366004615510565b6117ca565b60408051921515835260208301919091520161038c565b3480156106d557600080fd5b506103626106e4366004615529565b611808565b3480156106f557600080fd5b50610667611874565b34801561070a57600080fd5b50610362610719366004615510565b61195d565b34801561072a57600080fd5b5061073e610739366004615860565b61199e565b60405161038c91906158d4565b34801561075757600080fd5b5060e454610382565b34801561076c57600080fd5b5061036261077b366004615510565b611a59565b610362611a9a565b34801561079457600080fd5b5061079d611e57565b60405161038c919061591a565b3480156107b657600080fd5b5060a8546001600160a01b0316610606565b3480156107d457600080fd5b50610382611f87565b3480156107e957600080fd5b50610606611fdb565b3480156107fe57600080fd5b50607254610382565b34801561081357600080fd5b506103b5610822366004615529565b611fea565b34801561083357600080fd5b506103826201518081565b34801561084a57600080fd5b50610362610859366004615510565b61201e565b34801561086a57600080fd5b5060e554610382565b34801561087f57600080fd5b50600154610382565b61036261205f565b34801561089c57600080fd5b506103b56108ab366004615510565b6122bf565b3480156108bc57600080fd5b506103626108cb366004615510565b6122e3565b3480156108dc57600080fd5b506103b56108eb366004615529565b612324565b3480156108fc57600080fd5b50600254610382565b34801561091157600080fd5b506066610606565b34801561092557600080fd5b50610430610934366004615529565b61233b565b34801561094557600080fd5b50610667612357565b34801561095a57600080fd5b50610362610969366004615529565b612443565b34801561097a57600080fd5b50610362610989366004615529565b6124af565b34801561099a57600080fd5b5061038261251b565b3480156109af57600080fd5b506103b56109be366004615529565b61256f565b3480156109cf57600080fd5b506103826109de366004615510565b61258c565b3480156109ef57600080fd5b5060e654610382565b348015610a0457600080fd5b50610362610a133660046154e4565b612597565b348015610a2457600080fd5b50610362610a33366004615529565b612843565b348015610a4457600080fd5b506103b5610a53366004615529565b6128af565b348015610a6457600080fd5b50610362610a73366004615529565b612934565b348015610a8457600080fd5b50610a8d6129a0565b60405161038c93929190615972565b348015610aa857600080fd5b50610667612b7e565b348015610abd57600080fd5b50610362610acc366004615447565b612be0565b348015610add57600080fd5b50610362610aec366004615510565b612e63565b348015610afd57600080fd5b50607654610382565b348015610b1257600080fd5b5060a954610382565b348015610b2757600080fd5b50606f546001600160a01b0316610606565b348015610b4557600080fd5b506103b5610b543660046154e4565b612ea4565b348015610b6557600080fd5b50610362610b743660046154e4565b612eb0565b348015610b8557600080fd5b50610362610b943660046159eb565b612f5a565b348015610ba557600080fd5b506105a4610bb4366004615529565b6040805180820190915260008082526020820152506001600160a01b0316600090815260776020908152604091829020825180840190935280548352600101549082015290565b348015610c0757600080fd5b5061060661308d565b348015610c1c57600080fd5b5060ad54610382565b348015610c3157600080fd5b506103b5610c40366004615529565b61309c565b610c4d611579565b6001600160a01b0316336001600160a01b031614158015610c875750610c7161308d565b6001600160a01b0316336001600160a01b031614155b15610ca85760405160016234baed60e01b0319815260040160405180910390fd5b565b6001600160a01b038281166000908152607560205260409020548116908216145b92915050565b6000610cdc60035490565b905090565b33610cea61308d565b6001600160a01b031614610d1157604051638aaf4a0760e01b815260040160405180910390fd5b6073546072548110610d3657604051638616841b60e01b815260040160405180910390fd5b610d3f8561256f565b15610d5d57604051638ad9cdf960e01b815260040160405180910390fd5b612710821115610d8057604051631b8454a360e21b815260040160405180910390fd5b60005b607354811015610e7b5760006075600060738481548110610da657610da6615a20565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190208054909250811690891603610e02578760405163fc3d8c7560e01b8152600401610df99190615617565b60405180910390fd5b60028101546001600160a01b0390811690871603610e355785604051632d33a7e760e11b8152600401610df99190615617565b60038101546001600160a01b0390811690861603610e6857846040516350e1263b60e01b8152600401610df99190615617565b5080610e7381615a4c565b915050610d83565b506001600160a01b038581166000818152607460209081526040808320861990556073805460018082019092557ff79bde9ddd17963ebce6f7d021d60de7c2bd0db944d23c900c0c0e775f5300520180546001600160a01b03199081168717909155607590935292819020805483168c87169081178255938101805484168617905560028101805484168b8816908117909155600382018054909416968a1696909617909255600482018790555190939192907fd690f592ed983cfbc05717fbcf06c4e10ae328432c309fe49246cf4a4be69fcd90610f5b908990615617565b60405180910390a450505050505050565b6001600160a01b0382166000908152603a60205260408120548190819084811015610fa257600080600093509350935050610fe8565b60019350610fb08582615a65565b610fbb906001615a78565b9250610fc68561258c565b610fcf8261258c565b610fd99190615a65565b610fe4906001615a78565b9150505b9250925092565b610ff76130d9565b6001600160a01b0316336001600160a01b0316146110275760405162461bcd60e51b8152600401610df990615a8b565b61103081613107565b50565b3361103c611fdb565b6001600160a01b031614611063576040516328b9c24b60e21b815260040160405180910390fd5b6001600160a01b0382166000908152603c6020526040902054431161109d57816040516353e0424d60e01b8152600401610df99190615617565b6001600160a01b038216600081815260386020908152604080832085845282528083208054600160ff1991821681179092559484526037835281842086855290925290912080549092169091556110f49043615a65565b6001600160a01b0383166000818152603a6020526040908190209290925590517f6bb2436cb6b6eb65d5a52fac2ae0373a77ade6661e523ef3004ee2d5524e6c6e906111439084815260200190565b60405180910390a25050565b600080600161115c610cd1565b6111669190615a65565b90506111728382613165565b9392505050565b6001600160a01b038116600090815260ac6020526040812054610ccb9060029060ff1660038111156111ad576111ad61595c565b90613190565b6000610cdc6111c1426131c3565b6003541090565b600061117283836131d2565b6111dc6153f6565b6111e58261256f565b6112025760405163a64b34ad60e01b815260040160405180910390fd5b506001600160a01b03908116600090815260756020908152604091829020825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015290565b6000610ccb82436111c8565b61128b6130d9565b6001600160a01b0316336001600160a01b0316146112bb5760405162461bcd60e51b8152600401610df990615a8b565b806001600160a01b03163b6000036112e657604051637bcd509160e01b815260040160405180910390fd5b611030816131f2565b604080518082018252600080825260209182018190526001600160a01b038416815260e88252828120835180850190945280548452600101549183018290520361134c576040516370fdd4f160e11b815260040160405180910390fd5b919050565b3361135a611fdb565b6001600160a01b031614611381576040516328b9c24b60e21b815260040160405180910390fd5b600061138b610cd1565b6001600160a01b03861660008181526037602090815260408083208584528252808320805460ff1916600117905592825260e181528282205460e0909152919020549192506113d991615a78565b60e460008282546113ea9190615a78565b90915550506001600160a01b038516600090815260e06020908152604080832083905560e18252808320839055603a90915290205461142a90859061323d565b6001600160a01b0386166000908152603a602052604090205582156114da5760715460405163138ac02f60e11b81526000916001600160a01b031690632715805e9061147c9089908890600401615acd565b6020604051808303816000875af115801561149b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114bf9190615ae6565b90508060e460008282546114d39190615a78565b9091555050505b811561151e576001600160a01b0385166000908152603c602052604090205461150490859061323d565b6001600160a01b0386166000908152603c60205260409020555b6001600160a01b0385166000818152603a6020526040808220549051849392600080516020615f908339815191529261155e929091899160019190615aff565b60405180910390a35050505050565b60006111728383613254565b606d546001600160a01b031690565b600054610100900460ff16158080156115a85750600054600160ff909116105b806115c25750303b1580156115c2575060005460ff166001145b6116255760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610df9565b6000805460ff191660011790558015611648576000805461ff0019166101001790555b6116518d6131f2565b61165a8c61327f565b6116638b6132ca565b61166c8a613315565b61167588613360565b61167e896133ab565b611687876133f6565b6116908661342b565b61169985613460565b6116a284613107565b6116ac82356134b8565b6116b960208301356134ed565b60018390558015611704576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b606081516001600160401b0381111561172e5761172e615702565b604051908082528060200260200182016040528015611757578160200160208202803683370190505b50905060005b81518110156117c45761178883828151811061177b5761177b615a20565b6020026020010151613522565b82828151811061179a5761179a615a20565b6001600160a01b0390921660209283029190910190910152806117bc81615a4c565b91505061175d565b50919050565b6000806117d64361258c565b831115806117f1575060008381526005602052604090205415155b600093845260056020526040909320549293915050565b6118106130d9565b6001600160a01b0316336001600160a01b0316146118405760405162461bcd60e51b8152600401610df990615a8b565b806001600160a01b03163b60000361186b57604051637bcd509160e01b815260040160405180910390fd5b61103081613315565b606060aa546001600160401b0381111561189057611890615702565b6040519080825280602002602001820160405280156118b9578160200160208202803683370190505b5090506000805b825181101561195757600081815260ab60205260409020546118ea906001600160a01b0316611fea565b1561194557600081815260ab60205260409020546001600160a01b0316838361191281615a4c565b94508151811061192457611924615a20565b60200260200101906001600160a01b031690816001600160a01b0316815250505b8061194f81615a4c565b9150506118c0565b50815290565b6119656130d9565b6001600160a01b0316336001600160a01b0316146119955760405162461bcd60e51b8152600401610df990615a8b565b611030816134ed565b6060816001600160401b038111156119b8576119b8615702565b6040519080825280602002602001820160405280156119e1578160200160208202803683370190505b50905060005b82811015611a5257611a1e848483818110611a0457611a04615a20565b9050602002016020810190611a199190615529565b61352d565b828281518110611a3057611a30615a20565b9115156020928302919091019091015280611a4a81615a4c565b9150506119e7565b5092915050565b611a616130d9565b6001600160a01b0316336001600160a01b031614611a915760405162461bcd60e51b8152600401610df990615a8b565b6110308161342b565b334114611aba576040516309f358fd60e01b815260040160405180910390fd5b6000611ac533611fea565b8015611ad75750611ad53361352d565b155b8015611af15750611aef33611aea610cd1565b613254565b155b606d54604051630634f5b960e01b815282151560048201526001602482015291925060009182916001600160a01b031690630634f5b9906044016060604051808303816000875af1158015611b4a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6e9190615b1e565b92509250508060e26000828254611b859190615a78565b90915550839050611bd7573460e46000828254611ba29190615a78565b90915550506040513390600080516020615f7083398151915290611bca903490600190615b55565b60405180910390a2505050565b336001600160a01b03167f0ede5c3be8625943fa64003cd4b91230089411249f3059bac6500873543ca9b13484604051611c12929190615b79565b60405180910390a26000611c24610cd1565b90506000611c328434615a78565b3360009081526038602090815260408083208684529091528120549192509060ff1615611d2b576070546040805163631c8fd160e11b815290516000926001600160a01b03169163c6391fa29160048083019260809291908290030181865afa158015611ca3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cc79190615b87565b93505050506127108184611cdb9190615bbd565b611ce59190615bea565b91508160e46000828254611cf99190615a78565b90915550506040513390600080516020615f7083398151915290611d21908590600290615b55565b60405180910390a2505b611d358183615a65565b91506000607160009054906101000a90046001600160a01b03166001600160a01b031663c673316c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d8c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611db09190615ae6565b3360009081526075602052604081206004015491925090611dd19083613539565b90506000612710611de28684615bbd565b611dec9190615bea565b33600090815260e06020526040812080549293508392909190611e10908490615a78565b9091555060009050611e228287615a65565b33600090815260e16020526040812080549293508392909190611e46908490615a78565b909155505050505050505050505050565b6073546060906001600160401b03811115611e7457611e74615702565b604051908082528060200260200182016040528015611ead57816020015b611e9a6153f6565b815260200190600190039081611e925790505b50905060005b8151811015611f83576075600060738381548110611ed357611ed3615a20565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c08201528251839083908110611f6557611f65615a20565b60200260200101819052508080611f7b90615a4c565b915050611eb3565b5090565b6000805b60aa54811015611f8357600081815260ab6020526040902054611fb6906001600160a01b0316611179565b15611fc95781611fc581615a4c565b9250505b80611fd381615a4c565b915050611f8b565b6070546001600160a01b031690565b6001600160a01b038116600090815260ac6020526040812054610ccb9060019060ff1660038111156111ad576111ad61595c565b6120266130d9565b6001600160a01b0316336001600160a01b0316146120565760405162461bcd60e51b8152600401610df990615a8b565b611030816134b8565b33411461207f576040516309f358fd60e01b815260040160405180910390fd5b612088436122bf565b6120a557604051636c74eecf60e01b815260040160405180910390fd5b6120ae4361258c565b6120b960025461258c565b106120d757604051632458f64160e01b815260040160405180910390fd5b4360025560006120e6426131c3565b905060006120f5826003541090565b905060006121016129a0565b50509050606060006121124361258c565b90506000612121826001615a78565b9050600061212d610cd1565b905085156122595761213f8186613548565b60008061214c83886138d3565b9150915061215c83888484613b05565b612164613c0e565b61216c613d69565b607054604051631da0214360e21b81526001600160a01b0390911690637680850c9061219e908a908790600401615bfe565b600060405180830381600087803b1580156121b857600080fd5b505af11580156121cc573d6000803e3d6000fd5b505050506121d989613e8b565b8051919850965015612248576070546040516303e1697b60e11b81526001600160a01b03909116906307c2d2f69061221590899060040161584d565b600060405180830381600087803b15801561222f57600080fd5b505af1158015612243573d6000803e3d6000fd5b505050505b612253436001615a78565b60045550505b612264878387614016565b82817f0195462033384fec211477c56217da64a58bd405e0bed331ba4ded67e4ae4ce788604051612299911515815260200190565b60405180910390a350600090815260056020526040902085905550505060039190915550565b6000600180546122cf9190615a65565b6001546122dc9084615c20565b1492915050565b6122eb6130d9565b6001600160a01b0316336001600160a01b03161461231b5760405162461bcd60e51b8152600401610df990615a8b565b611030816133f6565b60008061232f610cd1565b90506111728382613254565b600080600061234a8443610f6c565b9250925092509193909250565b606060aa546001600160401b0381111561237357612373615702565b60405190808252806020026020018201604052801561239c578160200160208202803683370190505b5090506000805b825181101561195757600081815260ab60205260409020546123cd906001600160a01b0316611179565b1561243157600081815260ab60205260409020546123f3906001600160a01b0316613522565b83836123fe81615a4c565b94508151811061241057612410615a20565b60200260200101906001600160a01b031690816001600160a01b0316815250505b8061243b81615a4c565b9150506123a3565b61244b6130d9565b6001600160a01b0316336001600160a01b03161461247b5760405162461bcd60e51b8152600401610df990615a8b565b806001600160a01b03163b6000036124a657604051637bcd509160e01b815260040160405180910390fd5b61103081613360565b6124b76130d9565b6001600160a01b0316336001600160a01b0316146124e75760405162461bcd60e51b8152600401610df990615a8b565b806001600160a01b03163b60000361251257604051637bcd509160e01b815260040160405180910390fd5b6110308161327f565b6000805b60aa54811015611f8357600081815260ab602052604090205461254a906001600160a01b0316611fea565b1561255d578161255981615a4c565b9250505b8061256781615a4c565b91505061251f565b6001600160a01b0316600090815260746020526040902054151590565b6000610ccb826143e6565b336125a061308d565b6001600160a01b0316146125c757604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b038216600090815260e8602052604090206001810154156126025760405163057aab3160e31b815260040160405180910390fd5b600061260e8342615a78565b6001600160a01b03851660009081526075602052604090209091506126339082614401565b6001600160a01b0384166000908152603b6020908152604080832084905560399091528120600191612663610cd1565b8152602081019190915260409081016000908120805460ff19169315159390931790925560715460e554915163138ac02f60e11b81526001600160a01b0390911691632715805e916126b9918991600401615acd565b6020604051808303816000875af11580156126d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126fc9190615ae6565b905080156127f957600060e654426127149190615a78565b60e78054600180820183556000929092527f6cb0db1d7354dfb4a1464318006df0643cafe2002a86a29ff8560f900fef28a10180546001600160a01b0319166001600160a01b038a16179055838655850181905590506127726130d9565b6001600160a01b0387811660008181526075602052604090819020600201549051630a2fae5760e41b81526004810192909252821660248201524260448201526064810184905291169063a2fae57090608401600060405180830381600087803b1580156127df57600080fd5b505af11580156127f3573d6000803e3d6000fd5b50505050505b846001600160a01b03167f77a1a819870c0f4d04c3ca4cc2881a0393136abc28bd651af50aedade94a27c48260405161283491815260200190565b60405180910390a25050505050565b61284b6130d9565b6001600160a01b0316336001600160a01b03161461287b5760405162461bcd60e51b8152600401610df990615a8b565b806001600160a01b03163b6000036128a657604051637bcd509160e01b815260040160405180910390fd5b611030816132ca565b6000805b60aa548110156117c457600081815260ab60205260409020546001600160a01b03808516916128e29116613522565b6001600160a01b03161480156129145750600081815260ab6020526040902054612914906001600160a01b0316611179565b1561292257600191506117c4565b8061292c81615a4c565b9150506128b3565b61293c6130d9565b6001600160a01b0316336001600160a01b03161461296c5760405162461bcd60e51b8152600401610df990615a8b565b806001600160a01b03163b60000361299757604051637bcd509160e01b815260040160405180910390fd5b611030816133ab565b606080606060aa546001600160401b038111156129bf576129bf615702565b6040519080825280602002602001820160405280156129e8578160200160208202803683370190505b50925060aa546001600160401b03811115612a0557612a05615702565b604051908082528060200260200182016040528015612a2e578160200160208202803683370190505b50915060aa546001600160401b03811115612a4b57612a4b615702565b604051908082528060200260200182016040528015612a74578160200160208202803683370190505b50905060005b8351811015612b7857600081815260ab602052604090205484516001600160a01b03909116908190869084908110612ab457612ab4615a20565b60200260200101906001600160a01b031690816001600160a01b031681525050612add81613522565b848381518110612aef57612aef615a20565b6001600160a01b03928316602091820292909201810191909152908216600090815260ac9091526040902054835160ff90911690849084908110612b3557612b35615a20565b60200260200101906003811115612b4e57612b4e61595c565b90816003811115612b6157612b6161595c565b905250819050612b7081615a4c565b915050612a7a565b50909192565b60606073805480602002602001604051908101604052809291908181526020018280548015612bd657602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612bb8575b5050505050905090565b612be86130d9565b6001600160a01b0316336001600160a01b031614612c185760405162461bcd60e51b8152600401610df990615a8b565b6001600160a01b038216600090815260e8602052604090206001015415612e5f5760e7548060005b82811015612c9957846001600160a01b031660e78281548110612c6557612c65615a20565b6000918252602090912001546001600160a01b031603612c8757809150612c99565b80612c9181615a4c565b915050612c40565b50818103612ca75750505050565b6001600160a01b038416600090815260e860205260409020548015612e5b576001600160a01b038516600090815260e860205260408120818155600190810191909155831115612d695760e7612cfe600185615a65565b81548110612d0e57612d0e615a20565b60009182526020909120015460e780546001600160a01b039092169184908110612d3a57612d3a615a20565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480612d7a57612d7a615c34565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825260e9905260409020805460ff19166001179055612dcc84826104b061447d565b15612e1657836001600160a01b0316856001600160a01b03167f7229136a18186c71a86246c012af3bb1df6460ef163934bbdccd6368abdd41e48360405161155e91815260200190565b836001600160a01b0316856001600160a01b03167f3747d14eb72ad3e35cba9c3e00dab3b8d15b40cac6bdbd08402356e4f69f30a1834760405161155e929190615b79565b5050505b5050565b612e6b6130d9565b6001600160a01b0316336001600160a01b031614612e9b5760405162461bcd60e51b8152600401610df990615a8b565b61103081613460565b60006111728383613165565b33612eb961308d565b6001600160a01b031614612ee057604051638aaf4a0760e01b815260040160405180910390fd5b612ee9826144dd565b15612f075760405163030081e760e01b815260040160405180910390fd5b6001600160a01b0382166000908152607560205260409020600581015415612f425760405163fab9167360e01b815260040160405180910390fd5b612f5581612f508442615a78565b614401565b505050565b33612f6361308d565b6001600160a01b031614612f8a57604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604090205415612fc157604051632f32dcdd60e11b815260040160405180910390fd5b612710811115612fe457604051631b8454a360e21b815260040160405180910390fd5b6076548210156130075760405163fa0ae69360e01b815260040160405180910390fd5b6001600160a01b038316600090815260776020526040812090620151808461302f8242615bea565b6130399190615a78565b6130439190615bbd565b808355600183018490556040519091506001600160a01b038616907f6ebafd1bb6316b2f63198a81b05cff2149c6eaae1784466a6d062b4391900f21906128349084908790615b79565b6071546001600160a01b031690565b6001600160a01b038116600090815260ac60205260408120546130d29060ff1660038111156130cd576130cd61595c565b61455a565b1592915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b6001811015613129576040516317b8970f60e01b815260040160405180910390fd5b60768190556040518181527f266d432ffe659e3565750d26ec685b822a58041eee724b67a5afec3168a25267906020015b60405180910390a150565b6001600160a01b03919091166000908152603960209081526040808320938352929052205460ff1690565b60008160038111156131a4576131a461595c565b8360038111156131b6576131b661595c565b1660ff1615159392505050565b6000610ccb6201518083615bea565b6001600160a01b03919091166000908152603a6020526040902054101590565b607080546001600160a01b0319166001600160a01b0383161790556040517faa5b07dd43aa44c69b70a6a2b9c3fcfed12b6e5f6323596ba7ac91035ab80a4f9061315a908390615617565b60008183101561324d5781611172565b5090919050565b6001600160a01b03919091166000908152603760209081526040808320938352929052205460ff1690565b607180546001600160a01b0319166001600160a01b0383161790556040517f6397f5b135542bb3f477cb346cfab5abdec1251d08dc8f8d4efb4ffe122ea0bf9061315a908390615617565b606d80546001600160a01b0319166001600160a01b0383161790556040517fc328090a37d855191ab58469296f98f87a851ca57d5cdfd1e9ac3c83e9e7096d9061315a908390615617565b606f80546001600160a01b0319166001600160a01b0383161790556040517f31a33f126a5bae3c5bdf6cfc2cd6dcfffe2fe9634bdb09e21c44762993889e3b9061315a908390615617565b606e80546001600160a01b0319166001600160a01b0383161790556040517f034c8da497df28467c79ddadbba1cc3cdd41f510ea73faae271e6f16a61116219061315a908390615617565b60a880546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d79061315a908390615617565b60a98190556040518181527fb5464c05fd0e0f000c535850116cda2742ee1f7b34384cb920ad7b8e802138b59060200161315a565b60728190556040518181527f82d5dc32d1b741512ad09c32404d7e7921e8934c6222343d95f55f7a2b9b2ab49060200161315a565b60a954811115613483576040516355408ce960e11b815260040160405180910390fd5b60ad8190556040518181527fa9588dc77416849bd922605ce4fc806712281ad8a8f32d4238d6c8cca548e15e9060200161315a565b60e58190556040518181527f17a6c3eb965cdd7439982da25abf85be88f0f772ca33198f548e2f99fee0289a9060200161315a565b60e68190556040518181527f0a50c66137118f386332efb949231ddd3946100dbf880003daca37ddd9e0662b9060200161315a565b6000610ccb82614578565b6000610ccb82436131d2565b600081831061324d5781611172565b606e5460405163889998ef60e01b8152600481018490526000916001600160a01b03169063889998ef90602401602060405180830381865afa158015613592573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135b69190615ae6565b606e5460405163033cdc2b60e31b8152600481018690529192506000916001600160a01b03909116906319e6e15890602401602060405180830381865afa158015613605573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136299190615ae6565b606e549091506000906001600160a01b031663f67e81528661364a87611713565b6040518363ffffffff1660e01b8152600401613667929190615c4a565b600060405180830381865afa158015613684573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526136ac9190810190615c6b565b90506136b983838361459d565b15806136c3575081155b156137405760005b845181101561373857845160e2546136e39190615bea565b60e360008784815181106136f9576136f9615a20565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550808061373090615a4c565b9150506136cb565b505050505050565b600080600080607060009054906101000a90046001600160a01b03166001600160a01b0316631079402a6040518163ffffffff1660e01b8152600401608060405180830381865afa158015613799573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137bd9190615b87565b9296509094509250905080861160005b89518110156138c657888782815181106137e9576137e9615a20565b602002602001015160e2546137fe9190615bbd565b6138089190615bea565b60e360008c848151811061381e5761381e615a20565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208190555081156138b4576138b48b8b838151811061386657613866615a20565b60200260200101518a6127108b868151811061388457613884615a20565b60200260200101516138969190615bbd565b6138a09190615bea565b6138ac90612710615a65565b878a8a614656565b806138be81615a4c565b9150506137cd565b5050505050505050505050565b6000606060008084516001600160401b038111156138f3576138f3615702565b60405190808252806020026020018201604052801561391c578160200160208202803683370190505b50925060005b8551811015613af55785818151811061393d5761393d615a20565b6020908102919091018101516001600160a01b03808216600090815260759093526040909220600201549094501691506139778388613165565b6139aa576001600160a01b038084166000908152607560205260409020600301546139a591859116846148b6565b6139dc565b6001600160a01b038316600090815260e3602052604081205460e48054919290916139d6908490615a78565b90915550505b6139e58361352d565b1580156139f957506139f78388613254565b155b15613a6d576001600160a01b038316600090815260e16020526040902054613a219086615a78565b6001600160a01b038416600090815260e16020526040902054855191965090859083908110613a5257613a52615a20565b602002602001018181525050613a688383614993565b613ab3565b6001600160a01b038316600090815260e1602090815260408083205460e090925290912054613a9c9190615a78565b60e46000828254613aad9190615a78565b90915550505b6001600160a01b038316600090815260e16020908152604080832083905560e0825280832083905560e390915281205580613aed81615a4c565b915050613922565b5060e26000905550509250929050565b6071546001600160a01b03168215612e5b57613b218184614a5b565b15613bc95760405163566bce2360e11b81526001600160a01b0382169063acd79c4690613b5690879086908a90600401615d20565b600060405180830381600087803b158015613b7057600080fd5b505af1158015613b84573d6000803e3d6000fd5b505050507f9e242ca1ef9dde96eb71ef8d19a3f0f6a619b63e4c0d3998771387103656d087838584604051613bbb93929190615d56565b60405180910390a150613c08565b7fe5668ec1bb2b6bb144a50f810e388da4b1d7d3fc05fcb9d588a1aac59d248f8983858447604051613bfe9493929190615d8b565b60405180910390a1505b50505050565b60e754600080805b83831015613c085760e78381548110613c3157613c31615a20565b60009182526020808320909101546001600160a01b031680835260e89091526040909120600181015491935091504210613d5757805460e48054600090613c79908490615a78565b90915550506001600160a01b038216600090815260e860205260408120818155600101819055613ca885615dc8565b9450841115613d1f5760e78481548110613cc457613cc4615a20565b60009182526020909120015460e780546001600160a01b039092169185908110613cf057613cf0615a20565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480613d3057613d30615c34565b600082815260209020810160001990810180546001600160a01b0319169055019055613c16565b82613d6181615a4c565b935050613c16565b60e4548015611030576000613d7c611579565b600060e481905560408051600481526024810182526020810180516001600160e01b03166359f778df60e01b179052905192935090916001600160a01b038416918591613dc99190615ddf565b60006040518083038185875af1925050503d8060008114613e06576040519150601f19603f3d011682016040523d82523d6000602084013e613e0b565b606091505b505090508015613e5057816001600160a01b03167fc447c884574da5878be39c403db2245c22530c99b579ea7bcbb3720e1d110dc884604051611bca91815260200190565b816001600160a01b03167fa0561a59abed308fcd0556834574739d778cc6229018039a24ddda0f86aa0b738447604051611bca929190615b79565b606080613e9783614ab7565b6071546040516391f8723f60e01b81529192506000916001600160a01b03909116906391f8723f90613ece90607390600401615e0e565b600060405180830381865afa158015613eeb573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f139190810190615c6b565b60a854604051632907e73160e11b81529192506000916001600160a01b039091169063520fce6290613f4a90607390600401615e0e565b600060405180830381865afa158015613f67573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f8f9190810190615c6b565b90506000613ffe6073805480602002602001604051908101604052809291908181526020018280548015613fec57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613fce575b5050505050848460a95460ad54614faa565b909550905061400e858288615074565b505050915091565b606f546000906001600160a01b031663fdadda8183614036436001615a78565b6040518363ffffffff1660e01b8152600401614053929190615bfe565b600060405180830381865afa158015614070573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526140989190810190615e52565b905060005b825181101561435f5760008382815181106140ba576140ba615a20565b6020908102919091018101516001600160a01b0381166000908152603b9092526040822054909250421115906140ef83611fea565b9050600061410784614102436001615a78565b6131d2565b80614128575085858151811061411f5761411f615a20565b60200260200101515b806141305750825b1590508115801561413e5750805b156141b9576001600160a01b038416600090815260ac602052604090205461417d9060019060ff1660038111156141775761417761595c565b906151d2565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156141af576141af61595c565b021790555061423b565b8180156141c4575080155b1561423b576001600160a01b038416600090815260ac60205260409020546142039060019060ff1660038111156141fd576141fd61595c565b9061520d565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156142355761423561595c565b02179055505b600061424685611179565b90508315811580156142555750805b156142ca576001600160a01b038616600090815260ac602052604090205461428e9060029060ff1660038111156141775761417761595c565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156142c0576142c061595c565b0217905550614346565b8180156142d5575080155b15614346576001600160a01b038616600090815260ac602052604090205461430e9060029060ff1660038111156141fd576141fd61595c565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156143405761434061595c565b02179055505b505050505050808061435790615a4c565b91505061409d565b5082847f283b50d76057d5f828df85bc87724c6af604e9b55c363a07c9faa2a2cd688b8261438b611874565b604051614398919061584d565b60405180910390a382847f773d1888df530d69716b183a92450d45f97fba49f2a4bb34fae3b23da0e2cc6f6143cb612357565b6040516143d8919061584d565b60405180910390a350505050565b6000600154826143f69190615bea565b610ccb906001615a78565b6001820154614418906001600160a01b031661256f565b6144355760405163a64b34ad60e01b815260040160405180910390fd5b6005820181905560018201546040518281526001600160a01b03909116907fb9a1e33376bfbda9092f2d1e37662c1b435aab0d3fa8da3acc8f37ee222f99e790602001611143565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d80600081146144cd576040519150601f19603f3d011682016040523d82523d6000602084013e6144d2565b606091505b509095945050505050565b60a85460405163107fbb4760e21b815260009182916001600160a01b03909116906341feed1c90614512908690600401615617565b602060405180830381865afa15801561452f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145539190615ae6565b1192915050565b600081600381111561456e5761456e61595c565b60ff161592915050565b6001600160a01b03808216600090815260756020526040812060030154909116610ccb565b60016000805b835181101561460f57848482815181106145bf576145bf615a20565b602002602001015111156145d6576000925061460f565b8381815181106145e8576145e8615a20565b6020026020010151826145fb9190615a78565b91508061460781615a4c565b9150506145a3565b5081801561461d5750848111155b91508161464e576040517f64ba7143ea5a17abea37667aa9ae137e3afba5033c5f504770c02829c128189c90600090a15b509392505050565b8084106147d2576001600160a01b03851660008181526039602090815260408083208a845282528083208054600160ff199182168117909255948452603783528184208b855290925282208054909316179091556146b44385615249565b6001600160a01b0387166000908152603a60205260409020549091506146db90829061323d565b6001600160a01b0387166000908152603a6020908152604080832093909355603c9052205461470b90829061323d565b6001600160a01b038088166000908152603c60205260409081902092909255607054915163c008ce3960e01b815291169063c008ce39906147559089906002908c90600401615ee0565b600060405180830381600087803b15801561476f57600080fd5b505af1158015614783573d6000803e3d6000fd5b5050506001600160a01b0387166000818152603a60205260408082205490518b9450600080516020615f90833981519152926147c492916001908190615aff565b60405180910390a350613738565b818410613738576001600160a01b0380861660009081526039602090815260408083208a845290915290819020805460ff19166001908117909155607054915163c008ce3960e01b8152919092169163c008ce39916148379189918b90600401615ee0565b600060405180830381600087803b15801561485157600080fd5b505af1158015614865573d6000803e3d6000fd5b5050506001600160a01b0386166000818152603a60205260408082205490518a9450600080516020615f90833981519152926148a692918190600190615aff565b60405180910390a3505050505050565b6001600160a01b038316600090815260e360205260409020548015613c08576148e282826104b061447d565b1561494457816001600160a01b0316836001600160a01b0316856001600160a01b03167f72a57dc38837a1cba7881b7b1a5594d9e6b65cec6a985b54e2cee3e89369691c8460405161493691815260200190565b60405180910390a450505050565b816001600160a01b0316836001600160a01b0316856001600160a01b03167fd35d76d87d51ed89407fc7ceaaccf32cf72784b94530892ce33546540e141b728447604051614936929190615b79565b6001600160a01b038216600090815260e060205260409020548015612f55576149bf82826104b061447d565b15614a1657816001600160a01b0316836001600160a01b03167f1ce7a1c4702402cd393500acb1de5bd927727a54e144a587d328f1b679abe4ec83604051614a0991815260200190565b60405180910390a3505050565b816001600160a01b0316836001600160a01b03167f6c69e09ee5c5ac33c0cd57787261c5bade070a392ab34a4b5487c6868f723f6e8347604051614a09929190615b79565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114614aa8576040519150601f19603f3d011682016040523d82523d6000602084013e614aad565b606091505b5090949350505050565b6071546040805163af24542960e01b815290516060926001600160a01b031691600091839163af2454299160048083019260209291908290030181865afa158015614b06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b2a9190615ae6565b90506000826001600160a01b031663909791dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b6c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b909190615ae6565b90506000836001600160a01b03166342ef3c3460736040518263ffffffff1660e01b8152600401614bc19190615e0e565b600060405180830381865afa158015614bde573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052614c069190810190615c6b565b6073549091506000816001600160401b03811115614c2657614c26615702565b604051908082528060200260200182016040528015614c4f578160200160208202803683370190505b50965060008060005b84831015614efb5760738381548110614c7357614c73615a20565b60009182526020808320909101546001600160a01b031680835260759091526040909120600681015488519294509092501515908890889086908110614cbb57614cbb615a20565b60200260200101511015614d175780614d12576000614cda8a42615a78565b600684018190556040518181529091506001600160a01b03851690600080516020615f508339815191529060200160405180910390a2505b614d58565b8015614d58578160060160009055826001600160a01b0316600080516020615f508339815191526000604051614d4f91815260200190565b60405180910390a25b60008260050154600014158015614d73575042836005015411155b80614d9657506001600160a01b038416600090815260e9602052604090205460ff165b905060008360060154600014158015614db3575042846006015411155b90508180614dbe5750805b15614e545788614dcd89615dc8565b98508881518110614de057614de0615a20565b6020026020010151898781518110614dfa57614dfa615a20565b6020908102919091010152848d88614e1181615a4c565b995081518110614e2357614e23615a20565b60200260200101906001600160a01b031690816001600160a01b031681525050614e4c85615264565b505050614c58565b6001600160a01b0385166000908152607760205260409020548015801590614e7c5750428111155b15614ee5576001600160a01b0386166000818152607760209081526040808320600181018054918590559390935560048901839055518281529192917f86d576c20e383fc2413ef692209cc48ddad5e52f25db5b32f8f7ec5076461ae9910160405180910390a2505b86614eef81615a4c565b97505050505050614c58565b5050508087528015614f9f577f4eaf233b9dc25a5552c1927feee1412eea69add17c2485c831c2e60e234f3c9187604051614f36919061584d565b60405180910390a160405163e22d1c9d60e01b81526001600160a01b0387169063e22d1c9d90614f6c908a908c90600401615bfe565b600060405180830381600087803b158015614f8657600080fd5b505af1158015614f9a573d6000803e3d6000fd5b505050505b505050505050919050565b60606000806068905060008888888888604051602401614fce959493929190615f01565b60408051601f19818403018152919052602080820180516001600160e01b0316633bca0a8960e11b17905281518b51929350600192909160009161501191615bbd565b61501c906040615a78565b90506020840181888483895afa61503257600093505b503d61503d57600092505b6020870196508261506157604051630fc2632160e01b815260040160405180910390fd5b8651955050505050509550959350505050565b815b60aa548110156150d257600081815260ab6020818152604080842080546001600160a01b0316855260ac8352908420805460ff19169055928490525280546001600160a01b0319169055806150ca81615a4c565b915050615076565b5060005b8281101561511c57600081815260ab60209081526040808320546001600160a01b0316835260ac9091529020805460ff191690558061511481615a4c565b9150506150d6565b5060005b8281101561519a57600084828151811061513c5761513c615a20565b6020908102919091018101516001600160a01b0316600081815260ac83526040808220805460ff1916600317905585825260ab9093529190912080546001600160a01b0319169091179055508061519281615a4c565b915050615120565b508160aa81905550807f3d0eea40644a206ec25781dd5bb3b60eb4fa1264b993c3bddf3c73b14f29ef5e84604051611bca919061584d565b60008160038111156151e6576151e661595c565b8360038111156151f8576151f861595c565b1760ff1660038111156111725761117261595c565b60008160038111156152215761522161595c565b198360038111156152345761523461595c565b1660ff1660038111156111725761117261595c565b60008160000361525a576000611172565b6111728284615a78565b6001600160a01b038116600090815260e960209081526040808320805460ff191690556074909152812054611030918391908190036152a1575050565b6001600160a01b038216600090815260756020908152604080832080546001600160a01b03199081168255600180830180548316905560028301805483169055600383018054909216909155600482018590556005820185905560069091018490556074835281842084905560779092528220828155810182905560738054909161532b91615a65565b8154811061533b5761533b615a20565b6000918252602090912001546001600160a01b039081169150831681146153be576001600160a01b038116600090815260746020526040902082905560738054829190841990811061538f5761538f615a20565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60738054806153cf576153cf615c34565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6001600160a01b038116811461103057600080fd5b6000806040838503121561545a57600080fd5b823561546581615432565b9150602083013561547581615432565b809150509250929050565b600080600080600060a0868803121561549857600080fd5b85356154a381615432565b945060208601356154b381615432565b935060408601356154c381615432565b925060608601356154d381615432565b949793965091946080013592915050565b600080604083850312156154f757600080fd5b823561550281615432565b946020939093013593505050565b60006020828403121561552257600080fd5b5035919050565b60006020828403121561553b57600080fd5b813561117281615432565b60018060a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b60e08101610ccb8284615546565b815181526020808301519082015260408101610ccb565b801515811461103057600080fd5b600080600080608085870312156155e357600080fd5b84356155ee81615432565b93506020850135925060408501359150606085013561560c816155bf565b939692955090935050565b6001600160a01b0391909116815260200190565b8060408101831015610ccb57600080fd5b6000806000806000806000806000806000806101a08d8f03121561565f57600080fd5b8c3561566a81615432565b9b5060208d013561567a81615432565b9a5060408d013561568a81615432565b995060608d013561569a81615432565b985060808d01356156aa81615432565b975060a08d01356156ba81615432565b965060c08d0135955060e08d013594506101008d013593506101208d013592506101408d013591506156f08e6101608f0161562b565b90509295989b509295989b509295989b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b038111828210171561574057615740615702565b604052919050565b60006001600160401b0382111561576157615761615702565b5060051b60200190565b6000602080838503121561577e57600080fd5b82356001600160401b0381111561579457600080fd5b8301601f810185136157a557600080fd5b80356157b86157b382615748565b615718565b81815260059190911b820183019083810190878311156157d757600080fd5b928401925b828410156157fe5783356157ef81615432565b825292840192908401906157dc565b979650505050505050565b600081518084526020808501945080840160005b838110156158425781516001600160a01b03168752958201959082019060010161581d565b509495945050505050565b6020815260006111726020830184615809565b6000806020838503121561587357600080fd5b82356001600160401b038082111561588a57600080fd5b818501915085601f83011261589e57600080fd5b8135818111156158ad57600080fd5b8660208260051b85010111156158c257600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b8181101561590e5783511515835292840192918401916001016158f0565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b8181101561590e57615949838551615546565b9284019260e09290920191600101615936565b634e487b7160e01b600052602160045260246000fd5b6060815260006159856060830186615809565b6020838203818501526159988287615809565b8481036040860152855180825282870193509082019060005b818110156159dd578451600481106159cb576159cb61595c565b835293830193918301916001016159b1565b509098975050505050505050565b600080600060608486031215615a0057600080fd5b8335615a0b81615432565b95602085013595506040909401359392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201615a5e57615a5e615a36565b5060010190565b81810381811115610ccb57610ccb615a36565b80820180821115610ccb57610ccb615a36565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b6001600160a01b03929092168252602082015260400190565b600060208284031215615af857600080fd5b5051919050565b9384526020840192909252151560408301521515606082015260800190565b600080600060608486031215615b3357600080fd5b8351615b3e816155bf565b602085015160409095015190969495509392505050565b8281526040810160038310615b6c57615b6c61595c565b8260208301529392505050565b918252602082015260400190565b60008060008060808587031215615b9d57600080fd5b505082516020840151604085015160609095015191969095509092509050565b8082028115828204841417610ccb57610ccb615a36565b634e487b7160e01b600052601260045260246000fd5b600082615bf957615bf9615bd4565b500490565b604081526000615c116040830185615809565b90508260208301529392505050565b600082615c2f57615c2f615bd4565b500690565b634e487b7160e01b600052603160045260246000fd5b828152604060208201526000615c636040830184615809565b949350505050565b60006020808385031215615c7e57600080fd5b82516001600160401b03811115615c9457600080fd5b8301601f81018513615ca557600080fd5b8051615cb36157b382615748565b81815260059190911b82018301908381019087831115615cd257600080fd5b928401925b828410156157fe57835182529284019290840190615cd7565b600081518084526020808501945080840160005b8381101561584257815187529582019590820190600101615d04565b606081526000615d336060830186615809565b8281036020840152615d458186615cf0565b915050826040830152949350505050565b838152606060208201526000615d6f6060830185615809565b8281036040840152615d818185615cf0565b9695505050505050565b848152608060208201526000615da46080830186615809565b8281036040840152615db68186615cf0565b91505082606083015295945050505050565b600081615dd757615dd7615a36565b506000190190565b6000825160005b81811015615e005760208186018101518583015201615de6565b506000920191825250919050565b6020808252825482820181905260008481528281209092916040850190845b8181101561590e5783546001600160a01b031683526001938401939285019201615e2d565b60006020808385031215615e6557600080fd5b82516001600160401b03811115615e7b57600080fd5b8301601f81018513615e8c57600080fd5b8051615e9a6157b382615748565b81815260059190911b82018301908381019087831115615eb957600080fd5b928401925b828410156157fe578351615ed1816155bf565b82529284019290840190615ebe565b6001600160a01b039390931683526020830191909152604082015260600190565b60a081526000615f1460a0830188615809565b8281036020840152615f268188615cf0565b90508281036040840152615f3a8187615cf0565b6060840195909552505060800152939250505056fe88f854e137380c14d63f6ed99781bf13402167cf55bac49bcd44d4f2d6a342754042bb9a70998f80a86d9963f0d2132e9b11c8ad94d207c6141c8e34b05ce53e54ce99c5ce1fc9f61656d4a0fb2697974d0c973ac32eecaefe06fcf18b8ef68aa264697066735822122040f2b0559f81977d0a2a4c4435e240754acea0e6a8f693df6e3130917143847f64736f6c63430008110033", + "numDeployments": 3, + "solcInputHash": "2a8db5de0d3bfe0cb40ba15ae8460f16", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedEmergencyExit\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedRevokingCandidate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyRequestedUpdatingCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAlreadyWrappedEpoch\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrAtEndOfEpochOnly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallPrecompiled\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeBridgeTrackingContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeCoinbase\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeMaintenanceContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeRoninTrustedOrgContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeSlashIndicatorContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeStakingContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeStakingVestingContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"}],\"name\":\"ErrCannotBailout\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExceedsMaxNumberOfCandidate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentBridgeOperator\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrExistentCandidate\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdminAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentCandidateAdmin\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_treasuryAddr\",\"type\":\"address\"}],\"name\":\"ErrExistentTreasury\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidEffectiveDaysOnwards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMaxPrioritizedValidatorNumber\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidMinEffectiveDaysOnwards\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrNonExistentCandidate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrTrustedOrgCannotRenounce\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnauthorizedReceiveRON\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NonExistentRecyclingInfo\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"BlockProducerSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coinbaseAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rewardAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"enum ICoinbaseExecution.BlockRewardDeprecatedType\",\"name\":\"deprecatedType\",\"type\":\"uint8\"}],\"name\":\"BlockRewardDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"coinbaseAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"submittedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"bonusAmount\",\"type\":\"uint256\"}],\"name\":\"BlockRewardSubmitted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"BridgeOperatorRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epoch\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"bridgeOperators\",\"type\":\"address[]\"}],\"name\":\"BridgeOperatorSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"BridgeTrackingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[],\"name\":\"BridgeTrackingIncorrectlyResponded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"bridgeOperator\",\"type\":\"address\"}],\"name\":\"CandidateGranted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"}],\"name\":\"CandidateRevokingTimestampUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"name\":\"CandidateTopupDeadlineUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"CandidatesRevoked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"effectiveTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateUpdateScheduled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"rate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"balance\",\"type\":\"uint256\"}],\"name\":\"DeprecatedRewardRecycleFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipientAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"DeprecatedRewardRecycled\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockedAmount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedFundReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"unlockedAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitLockedFundReleasingFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"lockedAmount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExitRequested\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"EmergencyExpiryDurationUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"MaintenanceContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MaxPrioritizedValidatorNumberUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"MaxValidatorCandidateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"MaxValidatorNumberUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"numOfDays\",\"type\":\"uint256\"}],\"name\":\"MinEffectiveDaysOnwardsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"MiningRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"MiningRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"RoninTrustedOrganizationContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"SlashIndicatorContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"StakingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"StakingRewardDistributed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"totalAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingRewardDistributionFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"StakingVestingContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"jailedUntil\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"deductedStakingAmount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"blockProducerRewardDeprecated\",\"type\":\"bool\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"bridgeOperatorRewardDeprecated\",\"type\":\"bool\"}],\"name\":\"ValidatorPunished\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"consensusAddrs\",\"type\":\"address[]\"}],\"name\":\"ValidatorSetUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"}],\"name\":\"ValidatorUnjailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"periodNumber\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"epochNumber\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bool\",\"name\":\"periodEnding\",\"type\":\"bool\"}],\"name\":\"WrappedUpEpoch\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADDITION_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERIOD_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bridgeTrackingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"checkBridgeRewardDeprecatedAtLatestPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"checkBridgeRewardDeprecatedAtPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"checkJailed\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_blockNum\",\"type\":\"uint256\"}],\"name\":\"checkJailedAtBlock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_addrList\",\"type\":\"address[]\"}],\"name\":\"checkManyJailed\",\"outputs\":[{\"internalType\":\"bool[]\",\"name\":\"_result\",\"type\":\"bool[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_blockProducer\",\"type\":\"address\"}],\"name\":\"checkMiningRewardDeprecated\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_blockProducer\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"checkMiningRewardDeprecatedAtPeriod\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_result\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentPeriod\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentPeriodStartAtBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyExitLockedAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"emergencyExpiryDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"epochEndingAt\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_block\",\"type\":\"uint256\"}],\"name\":\"epochOf\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"execApplyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"execBailOut\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_secLeftToRevoke\",\"type\":\"uint256\"}],\"name\":\"execEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_recipient\",\"type\":\"address\"}],\"name\":\"execReleaseLockedFundForEmergencyExitRequest\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_secsLeft\",\"type\":\"uint256\"}],\"name\":\"execRequestRenounceCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_effectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"execRequestUpdateCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_validatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_newJailedUntil\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_slashAmount\",\"type\":\"uint256\"},{\"internalType\":\"bool\",\"name\":\"_cannotBailout\",\"type\":\"bool\"}],\"name\":\"execSlash\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBlockProducers\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getBridgeOperators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_validatorAddrs\",\"type\":\"address[]\"}],\"name\":\"getBridgeOperatorsOf\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_result\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCandidateInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.ValidatorCandidate\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCandidateInfos\",\"outputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"revokingTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"topupDeadline\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.ValidatorCandidate[]\",\"name\":\"_list\",\"type\":\"tuple[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"}],\"name\":\"getCommissionChangeSchedule\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"effectiveTimestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"commissionRate\",\"type\":\"uint256\"}],\"internalType\":\"struct ICandidateManager.CommissionSchedule\",\"name\":\"\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"getEmergencyExitInfo\",\"outputs\":[{\"components\":[{\"internalType\":\"uint256\",\"name\":\"lockedAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"recyclingAt\",\"type\":\"uint256\"}],\"internalType\":\"struct ICommonInfo.EmergencyExitInfo\",\"name\":\"_info\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"getJailedTimeLeft\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isJailed_\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"blockLeft_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochLeft_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_blockNum\",\"type\":\"uint256\"}],\"name\":\"getJailedTimeLeftAtBlock\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"isJailed_\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"blockLeft_\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"epochLeft_\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getLastUpdatedBlock\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidatorCandidates\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getValidators\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"_validatorList\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_bridgeOperators\",\"type\":\"address[]\"},{\"internalType\":\"enum EnumFlags.ValidatorFlag[]\",\"name\":\"_flags\",\"type\":\"uint8[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__slashIndicatorContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__stakingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__stakingVestingContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__maintenanceContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__roninTrustedOrganizationContract\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"__bridgeTrackingContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__maxValidatorNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxValidatorCandidate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxPrioritizedValidatorNumber\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__minEffectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__numberOfBlocksInEpoch\",\"type\":\"uint256\"},{\"internalType\":\"uint256[2]\",\"name\":\"__emergencyExitConfigs\",\"type\":\"uint256[2]\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isBlockProducer\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"}],\"name\":\"isBridgeOperator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_isOperator\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidate\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"}],\"name\":\"isCandidateAdmin\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"isOperatingBridge\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"isPeriodEnding\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isValidator\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"isValidatorCandidate\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maintenanceContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxPrioritizedValidatorNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maximumPrioritizedValidatorNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorCandidate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxValidatorNumber\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_maximumValidatorNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minEffectiveDaysOnwards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"numberOfBlocksInEpoch\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_numberOfBlocks\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompilePickValidatorSetAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"precompileSortValidatorsAddress\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"roninTrustedOrganizationContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setBridgeTrackingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_emergencyExitLockedAmount\",\"type\":\"uint256\"}],\"name\":\"setEmergencyExitLockedAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_emergencyExpiryDuration\",\"type\":\"uint256\"}],\"name\":\"setEmergencyExpiryDuration\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setMaintenanceContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"name\":\"setMaxPrioritizedValidatorNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_number\",\"type\":\"uint256\"}],\"name\":\"setMaxValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_max\",\"type\":\"uint256\"}],\"name\":\"setMaxValidatorNumber\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_numOfDays\",\"type\":\"uint256\"}],\"name\":\"setMinEffectiveDaysOnwards\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setRoninTrustedOrganizationContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setSlashIndicatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setStakingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setStakingVestingContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"slashIndicatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"stakingVestingContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"submitBlockReward\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBlockProducers\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalBridgeOperators\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_total\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"totalDeprecatedReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_epoch\",\"type\":\"uint256\"}],\"name\":\"tryGetPeriodOfEpoch\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"_filled\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"_periodNumber\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorCount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"wrapUpEpoch\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrAlreadyRequestedEmergencyExit()\":[{\"details\":\"Error of already requested emergency exit before.\"}],\"ErrAlreadyRequestedRevokingCandidate()\":[{\"details\":\"Error of already requested revoking candidate before.\"}],\"ErrAlreadyRequestedUpdatingCommissionRate()\":[{\"details\":\"Error of commission change schedule exists.\"}],\"ErrAlreadyWrappedEpoch()\":[{\"details\":\"Error of query for already wrapped up epoch\"}],\"ErrAtEndOfEpochOnly()\":[{\"details\":\"Error of only allowed at the end of epoch\"}],\"ErrCallPrecompiled()\":[{\"details\":\"Error of call to precompile fails.\"}],\"ErrCallerMustBeBridgeTrackingContract()\":[{\"details\":\"Error of method caller must be bridge tracking contract.\"}],\"ErrCallerMustBeCoinbase()\":[{\"details\":\"Error of method caller must be coinbase\"}],\"ErrCallerMustBeMaintenanceContract()\":[{\"details\":\"Error of method caller must be maintenance contract.\"}],\"ErrCallerMustBeRoninTrustedOrgContract()\":[{\"details\":\"Error of method caller must be Ronin trusted org contract.\"}],\"ErrCallerMustBeSlashIndicatorContract()\":[{\"details\":\"Error of method caller must be slash indicator contract.\"}],\"ErrCallerMustBeStakingContract()\":[{\"details\":\"Error of method caller must be staking contract.\"}],\"ErrCallerMustBeStakingVestingContract()\":[{\"details\":\"Error of method caller must be staking vesting contract.\"}],\"ErrCannotBailout(address)\":[{\"details\":\"Error of cannot bailout due to high tier slash.\"}],\"ErrExceedsMaxNumberOfCandidate()\":[{\"details\":\"Error of exceeding maximum number of candidates.\"}],\"ErrExistentBridgeOperator(address)\":[{\"details\":\"Error of bridge operator already exists.\"}],\"ErrExistentCandidate()\":[{\"details\":\"Error of querying for already existent candidate.\"}],\"ErrExistentCandidateAdmin(address)\":[{\"details\":\"Error of candidate admin already exists.\"}],\"ErrExistentTreasury(address)\":[{\"details\":\"Error of treasury already exists.\"}],\"ErrInsufficientBalance()\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrInvalidCommissionRate()\":[{\"details\":\"Error of invalid commission rate.\"}],\"ErrInvalidEffectiveDaysOnwards()\":[{\"details\":\"Error of invalid effective days onwards.\"}],\"ErrInvalidMaxPrioritizedValidatorNumber()\":[{\"details\":\"Error of number of prioritized greater than number of max validators.\"}],\"ErrInvalidMinEffectiveDaysOnwards()\":[{\"details\":\"Error of invalid min effective days onwards.\"}],\"ErrNonExistentCandidate()\":[{\"details\":\"Error of querying for non-existent candidate.\"}],\"ErrRecipientRevert()\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrTrustedOrgCannotRenounce()\":[{\"details\":\"Error of trusted org cannot renounce.\"}],\"ErrUnauthorizedReceiveRON()\":[{\"details\":\"Error thrown when receives RON from neither staking vesting contract nor staking contract\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}],\"NonExistentRecyclingInfo()\":[{\"details\":\"Error thrown when queries for a non existent info.\"}]},\"kind\":\"dev\",\"methods\":{\"bridgeTrackingContract()\":{\"details\":\"Returns the bridge tracking contract.\"},\"checkBridgeRewardDeprecatedAtLatestPeriod(address)\":{\"details\":\"Because the information of deprecating bridge reward of a period is only determined at the end of that period, this method will return the deprecating info of the latest period. A method for querying that info of current period is no need.\"},\"checkBridgeRewardDeprecatedAtPeriod(address,uint256)\":{\"details\":\"Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\"},\"checkJailed(address)\":{\"details\":\"Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\"},\"checkJailedAtBlock(address,uint256)\":{\"details\":\"Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\"},\"checkManyJailed(address[])\":{\"details\":\"Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\"},\"checkMiningRewardDeprecated(address)\":{\"details\":\"Returns whether the incoming reward of the block producer is deprecated during the current period.\"},\"checkMiningRewardDeprecatedAtPeriod(address,uint256)\":{\"details\":\"Returns whether the incoming reward of the block producer is deprecated during a specific period.\"},\"currentPeriod()\":{\"details\":\"Returns the period index from the current block.\"},\"currentPeriodStartAtBlock()\":{\"details\":\"Returns the block number that the current period starts at.\"},\"emergencyExitLockedAmount()\":{\"details\":\"Returns the amount of RON to lock from a consensus address.\"},\"emergencyExpiryDuration()\":{\"details\":\"Returns the duration that an emergency request is expired and the fund will be recycled.\"},\"epochEndingAt(uint256)\":{\"details\":\"Returns whether the epoch ending is at the block number `_block`.\"},\"epochOf(uint256)\":{\"details\":\"Returns the epoch index from the block number.\"},\"execApplyValidatorCandidate(address,address,address,address,uint256)\":{\"details\":\"Grants a validator candidate. Requirements: - The method caller is staking contract. Emits the event `CandidateGranted`.\"},\"execBailOut(address,uint256)\":{\"details\":\"Finalize the bailout request from slash indicator contract. Requirements: - The method caller is slash indicator contract. Emits the event `ValidatorUnjailed`.\"},\"execEmergencyExit(address,uint256)\":{\"details\":\"Fallback function of `IStaking-requestEmergencyExit`. Requirements: - The method caller is staking contract.\"},\"execReleaseLockedFundForEmergencyExitRequest(address,address)\":{\"details\":\"Unlocks fund for emergency exit request. Requirements: - The method caller is admin. Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked. Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\"},\"execRequestRenounceCandidate(address,uint256)\":{\"details\":\"Requests to revoke a validator candidate in next `_secsLeft` seconds. Requirements: - The method caller is staking contract. Emits the event `CandidateRevokingTimestampUpdated`.\"},\"execRequestUpdateCommissionRate(address,uint256,uint256)\":{\"details\":\"Fallback function of `CandidateStaking-requestUpdateCommissionRate`. Requirements: - The method caller is the staking contract. - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdateScheduled`.\"},\"execSlash(address,uint256,uint256,bool)\":{\"details\":\"Finalize the slash request from slash indicator contract. Requirements: - The method caller is slash indicator contract. Emits the event `ValidatorPunished`.\"},\"getBlockProducers()\":{\"details\":\"Returns the current block producer list.\"},\"getBridgeOperators()\":{\"details\":\"Returns the current bridge operator list.\"},\"getBridgeOperatorsOf(address[])\":{\"details\":\"Returns the bridge operator list corresponding to validator address list.\"},\"getCandidateInfo(address)\":{\"details\":\"Returns the info of a candidate.\"},\"getCandidateInfos()\":{\"details\":\"Returns all candidate info.\"},\"getCommissionChangeSchedule(address)\":{\"details\":\"Returns the schedule of changing commission rate of a candidate address.\"},\"getEmergencyExitInfo(address)\":{\"details\":\"Returns the emergency exit request.\"},\"getJailedTimeLeft(address)\":{\"details\":\"Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\"},\"getJailedTimeLeftAtBlock(address,uint256)\":{\"details\":\"Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\"},\"getLastUpdatedBlock()\":{\"details\":\"Returns the block that validator set was updated.\"},\"getValidatorCandidates()\":{\"details\":\"Returns the validator candidate.\"},\"getValidators()\":{\"details\":\"Returns the current validator list.\"},\"initialize(address,address,address,address,address,address,uint256,uint256,uint256,uint256,uint256,uint256[2])\":{\"details\":\"Initializes the contract storage.\"},\"isBlockProducer(address)\":{\"details\":\"Returns whether the address is block producer or not.\"},\"isBridgeOperator(address)\":{\"details\":\"Returns whether the address is bridge operator.\"},\"isCandidateAdmin(address,address)\":{\"details\":\"Returns whether the address is the candidate admin.\"},\"isOperatingBridge(address)\":{\"details\":\"Returns whether the consensus address is operating the bridge or not.\"},\"isPeriodEnding()\":{\"details\":\"Returns whether the period ending at the current block number.\"},\"isValidator(address)\":{\"details\":\"Returns whether the address is either a bridge operator or a block producer.\"},\"isValidatorCandidate(address)\":{\"details\":\"Returns whether the address is a validator (candidate).\"},\"maintenanceContract()\":{\"details\":\"Returns the maintenance contract.\"},\"maxPrioritizedValidatorNumber()\":{\"details\":\"Returns the number of reserved slots for prioritized validators.\"},\"maxValidatorCandidate()\":{\"details\":\"Returns the maximum number of validator candidate.\"},\"maxValidatorNumber()\":{\"details\":\"Returns the maximum number of validators in the epoch.\"},\"minEffectiveDaysOnwards()\":{\"details\":\"Returns the minimum number of days to the effective date of commission rate change.\"},\"numberOfBlocksInEpoch()\":{\"details\":\"Returns the number of blocks in a epoch.\"},\"precompilePickValidatorSetAddress()\":{\"details\":\"Gets the address of the precompile of picking validator set\"},\"precompileSortValidatorsAddress()\":{\"details\":\"Gets the address of the precompile of sorting validators\"},\"roninTrustedOrganizationContract()\":{\"details\":\"Returns the ronin trusted organization contract.\"},\"setBridgeTrackingContract(address)\":{\"details\":\"Sets the bridge tracking contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `BridgeTrackingContractUpdated`.\"},\"setEmergencyExitLockedAmount(uint256)\":{\"details\":\"Sets the amount of RON to lock from a consensus address. Requirements: - The method caller is admin. Emits the event `EmergencyExitLockedAmountUpdated`.\"},\"setEmergencyExpiryDuration(uint256)\":{\"details\":\"Sets the duration that an emergency request is expired and the fund will be recycled. Requirements: - The method caller is admin. Emits the event `EmergencyExpiryDurationUpdated`.\"},\"setMaintenanceContract(address)\":{\"details\":\"Sets the maintenance contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `MaintenanceContractUpdated`.\"},\"setMaxPrioritizedValidatorNumber(uint256)\":{\"details\":\"Updates the number of reserved slots for prioritized validators Requirements: - The method caller is admin Emits the event `MaxPrioritizedValidatorNumberUpdated`\"},\"setMaxValidatorCandidate(uint256)\":{\"details\":\"Sets the maximum number of validator candidate. Requirements: - The method caller is admin. Emits the `MaxValidatorCandidateUpdated` event.\"},\"setMaxValidatorNumber(uint256)\":{\"details\":\"Updates the max validator number Requirements: - The method caller is admin Emits the event `MaxValidatorNumberUpdated`\"},\"setMinEffectiveDaysOnwards(uint256)\":{\"details\":\"Sets the minimum number of days to the effective date of commision rate change. Requirements: - The method caller is admin. Emits the `MinEffectiveDaysOnwardsUpdated` event.\"},\"setRoninTrustedOrganizationContract(address)\":{\"details\":\"Sets the ronin trusted organization contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `RoninTrustedOrganizationContractUpdated`.\"},\"setSlashIndicatorContract(address)\":{\"details\":\"Sets the slash indicator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `SlashIndicatorContractUpdated`.\"},\"setStakingContract(address)\":{\"details\":\"Sets the staking contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `StakingContractUpdated`.\"},\"setStakingVestingContract(address)\":{\"details\":\"Sets the staking vesting contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `StakingVestingContractUpdated`.\"},\"slashIndicatorContract()\":{\"details\":\"Returns the slash indicator contract.\"},\"stakingContract()\":{\"details\":\"Returns the staking contract.\"},\"stakingVestingContract()\":{\"details\":\"Returns the staking vesting contract.\"},\"submitBlockReward()\":{\"details\":\"Submits reward of the current block. Requirements: - The method caller is coinbase. Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer. Emits the event `BlockRewardSubmitted` for the valid call.\"},\"totalBlockProducers()\":{\"details\":\"Returns total numbers of the block producers.\"},\"totalBridgeOperators()\":{\"details\":\"Returns total numbers of the bridge operators.\"},\"totalDeprecatedReward()\":{\"details\":\"Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\"},\"tryGetPeriodOfEpoch(uint256)\":{\"details\":\"Tries to get the period index from the epoch number.\"},\"wrapUpEpoch()\":{\"details\":\"Wraps up the current epoch. Requirements: - The method must be called when the current epoch is ending. - The epoch is not wrapped yet. - The method caller is coinbase. Emits the event `MiningRewardDistributed` when some validator has reward distributed. Emits the event `StakingRewardDistributed` when some staking pool has reward distributed. Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up. Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending. Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated. Emits the event `WrappedUpEpoch`.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/validator/RoninValidatorSet.sol\":\"RoninValidatorSet\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":0},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Strings.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev String operations.\\n */\\nlibrary Strings {\\n bytes16 private constant _HEX_SYMBOLS = \\\"0123456789abcdef\\\";\\n uint8 private constant _ADDRESS_LENGTH = 20;\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\\n */\\n function toString(uint256 value) internal pure returns (string memory) {\\n // Inspired by OraclizeAPI's implementation - MIT licence\\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\\n\\n if (value == 0) {\\n return \\\"0\\\";\\n }\\n uint256 temp = value;\\n uint256 digits;\\n while (temp != 0) {\\n digits++;\\n temp /= 10;\\n }\\n bytes memory buffer = new bytes(digits);\\n while (value != 0) {\\n digits -= 1;\\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\\n value /= 10;\\n }\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\\n */\\n function toHexString(uint256 value) internal pure returns (string memory) {\\n if (value == 0) {\\n return \\\"0x00\\\";\\n }\\n uint256 temp = value;\\n uint256 length = 0;\\n while (temp != 0) {\\n length++;\\n temp >>= 8;\\n }\\n return toHexString(value, length);\\n }\\n\\n /**\\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\\n */\\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\\n bytes memory buffer = new bytes(2 * length + 2);\\n buffer[0] = \\\"0\\\";\\n buffer[1] = \\\"x\\\";\\n for (uint256 i = 2 * length + 1; i > 1; --i) {\\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\\n value >>= 4;\\n }\\n require(value == 0, \\\"Strings: hex length insufficient\\\");\\n return string(buffer);\\n }\\n\\n /**\\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\\n */\\n function toHexString(address addr) internal pure returns (string memory) {\\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\\n }\\n}\\n\",\"keccak256\":\"0xaf159a8b1923ad2a26d516089bceca9bdeaeacd04be50983ea00ba63070f08a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Strings.sol\\\";\\n\\n/**\\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\\n *\\n * These functions can be used to verify that a message was signed by the holder\\n * of the private keys of a given address.\\n */\\nlibrary ECDSA {\\n enum RecoverError {\\n NoError,\\n InvalidSignature,\\n InvalidSignatureLength,\\n InvalidSignatureS,\\n InvalidSignatureV\\n }\\n\\n function _throwError(RecoverError error) private pure {\\n if (error == RecoverError.NoError) {\\n return; // no error: do nothing\\n } else if (error == RecoverError.InvalidSignature) {\\n revert(\\\"ECDSA: invalid signature\\\");\\n } else if (error == RecoverError.InvalidSignatureLength) {\\n revert(\\\"ECDSA: invalid signature length\\\");\\n } else if (error == RecoverError.InvalidSignatureS) {\\n revert(\\\"ECDSA: invalid signature 's' value\\\");\\n } else if (error == RecoverError.InvalidSignatureV) {\\n revert(\\\"ECDSA: invalid signature 'v' value\\\");\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature` or error string. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n *\\n * Documentation for signature generation:\\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\\n if (signature.length == 65) {\\n bytes32 r;\\n bytes32 s;\\n uint8 v;\\n // ecrecover takes the signature parameters, and the only way to get them\\n // currently is to use assembly.\\n /// @solidity memory-safe-assembly\\n assembly {\\n r := mload(add(signature, 0x20))\\n s := mload(add(signature, 0x40))\\n v := byte(0, mload(add(signature, 0x60)))\\n }\\n return tryRecover(hash, v, r, s);\\n } else {\\n return (address(0), RecoverError.InvalidSignatureLength);\\n }\\n }\\n\\n /**\\n * @dev Returns the address that signed a hashed message (`hash`) with\\n * `signature`. This address can then be used for verification purposes.\\n *\\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\\n * this function rejects them by requiring the `s` value to be in the lower\\n * half order, and the `v` value to be either 27 or 28.\\n *\\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\\n * verification to be secure: it is possible to craft signatures that\\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\\n * this is by receiving a hash of the original message (which may otherwise\\n * be too long), and then calling {toEthSignedMessageHash} on it.\\n */\\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, signature);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\\n *\\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address, RecoverError) {\\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\\n uint8 v = uint8((uint256(vs) >> 255) + 27);\\n return tryRecover(hash, v, r, s);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\\n *\\n * _Available since v4.2._\\n */\\n function recover(\\n bytes32 hash,\\n bytes32 r,\\n bytes32 vs\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n *\\n * _Available since v4.3._\\n */\\n function tryRecover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address, RecoverError) {\\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\\n // the valid range for s in (301): 0 < s < secp256k1n \\u00f7 2 + 1, and for v in (302): v \\u2208 {27, 28}. Most\\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\\n //\\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\\n // these malleable signatures as well.\\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\\n return (address(0), RecoverError.InvalidSignatureS);\\n }\\n if (v != 27 && v != 28) {\\n return (address(0), RecoverError.InvalidSignatureV);\\n }\\n\\n // If the signature is valid (and not malleable), return the signer address\\n address signer = ecrecover(hash, v, r, s);\\n if (signer == address(0)) {\\n return (address(0), RecoverError.InvalidSignature);\\n }\\n\\n return (signer, RecoverError.NoError);\\n }\\n\\n /**\\n * @dev Overload of {ECDSA-recover} that receives the `v`,\\n * `r` and `s` signature fields separately.\\n */\\n function recover(\\n bytes32 hash,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal pure returns (address) {\\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\\n _throwError(error);\\n return recovered;\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\\n // 32 is the length in bytes of hash,\\n // enforced by the type signature above\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n32\\\", hash));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Message, created from `s`. This\\n * produces hash corresponding to the one signed with the\\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\\n * JSON-RPC method as part of EIP-191.\\n *\\n * See {recover}.\\n */\\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19Ethereum Signed Message:\\\\n\\\", Strings.toString(s.length), s));\\n }\\n\\n /**\\n * @dev Returns an Ethereum Signed Typed Data, created from a\\n * `domainSeparator` and a `structHash`. This produces hash corresponding\\n * to the one signed with the\\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\\n * JSON-RPC method as part of EIP-712.\\n *\\n * See {recover}.\\n */\\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\\n return keccak256(abi.encodePacked(\\\"\\\\x19\\\\x01\\\", domainSeparator, structHash));\\n }\\n}\\n\",\"keccak256\":\"0xdb7f5c28fc61cda0bd8ab60ce288e206b791643bcd3ba464a70cbec18895a2f5\",\"license\":\"MIT\"},\"contracts/extensions/RONTransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract RONTransferHelper {\\n /// @dev Error of recipient not accepting RON when transfer RON.\\n error ErrRecipientRevert();\\n /// @dev Error of sender has insufficient balance.\\n error ErrInsufficientBalance();\\n\\n /**\\n * @dev See `_sendRON`.\\n * Reverts if the recipient does not receive RON.\\n */\\n function _transferRON(address payable _recipient, uint256 _amount) internal {\\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\\n }\\n\\n /**\\n * @dev Send `_amount` RON to the address `_recipient`.\\n * Returns whether the recipient receives RON or not.\\n * Reverts once the contract balance is insufficient.\\n *\\n * Note: consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\\n return _unsafeSendRON(_recipient, _amount);\\n }\\n\\n /**\\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\\n * the call does not revert.\\n *\\n * Note:\\n * - Does not assert whether the balance of sender is sufficient.\\n * - Does not assert whether the recipient accepts RON.\\n * - Consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount }(\\\"\\\");\\n }\\n\\n /**\\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\\n */\\n function _unsafeSendRON(\\n address payable _recipient,\\n uint256 _amount,\\n uint256 _gas\\n ) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbf47d40b2431cf190fa737b803e4cb6fb55aee3f8804470da57a9e340f7914f8\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasBridgeTrackingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasBridgeTrackingContract.sol\\\";\\nimport \\\"../../interfaces/IBridgeTracking.sol\\\";\\n\\ncontract HasBridgeTrackingContract is IHasBridgeTrackingContract, HasProxyAdmin {\\n IBridgeTracking internal _bridgeTrackingContract;\\n\\n modifier onlyBridgeTrackingContract() {\\n if (bridgeTrackingContract() != msg.sender) revert ErrCallerMustBeBridgeTrackingContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeTrackingContract\\n */\\n function bridgeTrackingContract() public view override returns (address) {\\n return address(_bridgeTrackingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasBridgeTrackingContract\\n */\\n function setBridgeTrackingContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setBridgeTrackingContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the bridge tracking contract.\\n *\\n * Emits the event `BridgeTrackingContractUpdated`.\\n *\\n */\\n function _setBridgeTrackingContract(address _addr) internal {\\n _bridgeTrackingContract = IBridgeTracking(_addr);\\n emit BridgeTrackingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x195b0d3fc2305aa4620f5091ba161f3e983b4cef2272d80f5f5b180a8ab98a34\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasMaintenanceContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasMaintenanceContract.sol\\\";\\nimport \\\"../../interfaces/IMaintenance.sol\\\";\\n\\ncontract HasMaintenanceContract is IHasMaintenanceContract, HasProxyAdmin {\\n IMaintenance internal _maintenanceContract;\\n\\n modifier onlyMaintenanceContract() {\\n if (maintenanceContract() != msg.sender) revert ErrCallerMustBeMaintenanceContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasMaintenanceContract\\n */\\n function maintenanceContract() public view override returns (address) {\\n return address(_maintenanceContract);\\n }\\n\\n /**\\n * @inheritdoc IHasMaintenanceContract\\n */\\n function setMaintenanceContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setMaintenanceContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the scheduled maintenance contract.\\n *\\n * Emits the event `MaintenanceContractUpdated`.\\n *\\n */\\n function _setMaintenanceContract(address _addr) internal {\\n _maintenanceContract = IMaintenance(_addr);\\n emit MaintenanceContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x117a29d878d44a20350df8ab539d34335713ba0f3b2c768a58124f61efb74357\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../interfaces/IRoninTrustedOrganization.sol\\\";\\n\\ncontract HasRoninTrustedOrganizationContract is IHasRoninTrustedOrganizationContract, HasProxyAdmin {\\n IRoninTrustedOrganization internal _roninTrustedOrganizationContract;\\n\\n modifier onlyRoninTrustedOrganizationContract() {\\n if (roninTrustedOrganizationContract() != msg.sender) revert ErrCallerMustBeRoninTrustedOrgContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function roninTrustedOrganizationContract() public view override returns (address) {\\n return address(_roninTrustedOrganizationContract);\\n }\\n\\n /**\\n * @inheritdoc IHasRoninTrustedOrganizationContract\\n */\\n function setRoninTrustedOrganizationContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setRoninTrustedOrganizationContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function _setRoninTrustedOrganizationContract(address _addr) internal {\\n _roninTrustedOrganizationContract = IRoninTrustedOrganization(_addr);\\n emit RoninTrustedOrganizationContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x951fd730f4853d8c932da5484ea093f3094c8186735b603d31fb53035c395751\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasSlashIndicatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasSlashIndicatorContract.sol\\\";\\nimport \\\"../../interfaces/slash-indicator/ISlashIndicator.sol\\\";\\n\\ncontract HasSlashIndicatorContract is IHasSlashIndicatorContract, HasProxyAdmin {\\n ISlashIndicator internal _slashIndicatorContract;\\n\\n modifier onlySlashIndicatorContract() {\\n if (slashIndicatorContract() != msg.sender) revert ErrCallerMustBeSlashIndicatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasSlashIndicatorContract\\n */\\n function slashIndicatorContract() public view override returns (address) {\\n return address(_slashIndicatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasSlashIndicatorContract\\n */\\n function setSlashIndicatorContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setSlashIndicatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the slash indicator contract.\\n *\\n * Emits the event `SlashIndicatorContractUpdated`.\\n *\\n */\\n function _setSlashIndicatorContract(address _addr) internal {\\n _slashIndicatorContract = ISlashIndicator(_addr);\\n emit SlashIndicatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x280c56e53c53bf1438cf7d3e71026baf383d24332359bce59282074c94abe5bb\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasStakingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasStakingContract.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\n\\ncontract HasStakingContract is IHasStakingContract, HasProxyAdmin {\\n IStaking internal _stakingContract;\\n\\n modifier onlyStakingContract() {\\n if (stakingContract() != msg.sender) revert ErrCallerMustBeStakingContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasStakingContract\\n */\\n function stakingContract() public view override returns (address) {\\n return address(_stakingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasStakingContract\\n */\\n function setStakingContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setStakingContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the staking contract.\\n *\\n * Emits the event `StakingContractUpdated`.\\n *\\n */\\n function _setStakingContract(address _addr) internal {\\n _stakingContract = IStaking(_addr);\\n emit StakingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x54d2a4608e0a8819ebd7fdb4ae784d3c709285e93f002034f9e2e787a6607923\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasStakingVestingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasStakingVestingContract.sol\\\";\\nimport \\\"../../interfaces/IStakingVesting.sol\\\";\\n\\ncontract HasStakingVestingContract is IHasStakingVestingContract, HasProxyAdmin {\\n IStakingVesting internal _stakingVestingContract;\\n\\n modifier onlyStakingVestingContract() {\\n if (stakingVestingContract() != msg.sender) revert ErrCallerMustBeStakingVestingContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasStakingVestingContract\\n */\\n function stakingVestingContract() public view override returns (address) {\\n return address(_stakingVestingContract);\\n }\\n\\n /**\\n * @inheritdoc IHasStakingVestingContract\\n */\\n function setStakingVestingContract(address _addr) external override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setStakingVestingContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the staking vesting contract.\\n *\\n * Emits the event `StakingVestingContractUpdated`.\\n *\\n */\\n function _setStakingVestingContract(address _addr) internal {\\n _stakingVestingContract = IStakingVesting(_addr);\\n emit StakingVestingContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0x1893fae5d612b0d78f6d66695194aa6b03817a3b92be602887918781fba29e37\",\"license\":\"MIT\"},\"contracts/extensions/consumers/GlobalConfigConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract GlobalConfigConsumer {\\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\\n /// @dev The length of a period in second.\\n uint256 public constant PERIOD_DURATION = 1 days;\\n}\\n\",\"keccak256\":\"0x96d6b1ea4c8e126a8c2468683e7513d195f8e05456d85dd8f259ab049347b527\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/IBridgeTracking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IBridgeTracking {\\n struct Request {\\n VoteKind kind;\\n uint256 id;\\n }\\n\\n enum VoteKind {\\n Deposit,\\n Withdrawal,\\n MainchainWithdrawal\\n }\\n\\n /**\\n * @dev Returns the total number of votes at the specific period `_period`.\\n */\\n function totalVotes(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots at the specific period `_period`.\\n */\\n function totalBallots(uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\\n */\\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\\n */\\n function totalBallotsOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\\n\\n /**\\n * @dev Handles the request once it is approved.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\\n\\n /**\\n * @dev Records vote for a receipt and a operator.\\n *\\n * Requirements:\\n * - The method caller is the bridge contract.\\n *\\n */\\n function recordVote(\\n VoteKind _kind,\\n uint256 _requestId,\\n address _operator\\n ) external;\\n}\\n\",\"keccak256\":\"0x6066ff36c2ad0494a676dfeb4289c3cbe48d0d70266e8ec0930014a41f2a39a3\",\"license\":\"MIT\"},\"contracts/interfaces/IMaintenance.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IMaintenance {\\n struct Schedule {\\n uint256 from;\\n uint256 to;\\n uint256 lastUpdatedBlock;\\n uint256 requestTimestamp;\\n }\\n\\n /// @dev Emitted when a maintenance is scheduled.\\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\\n /// @dev Emitted when a schedule of maintenance is cancelled.\\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\\n /// @dev Emitted when the maintenance config is updated.\\n event MaintenanceConfigUpdated(\\n uint256 minMaintenanceDurationInBlock,\\n uint256 maxMaintenanceDurationInBlock,\\n uint256 minOffsetToStartSchedule,\\n uint256 maxOffsetToStartSchedule,\\n uint256 maxSchedules,\\n uint256 cooldownSecsToMaintain\\n );\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\\n */\\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\\n */\\n function checkMaintainedInBlockRange(\\n address _consensusAddr,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool);\\n\\n /**\\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\\n */\\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\\n */\\n function checkManyMaintainedInBlockRange(\\n address[] calldata _addrList,\\n uint256 _fromBlock,\\n uint256 _toBlock\\n ) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\\n */\\n function checkScheduled(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator `_consensusAddr`\\n */\\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\\n */\\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\\n\\n /**\\n * @dev Returns the total of current schedules.\\n */\\n function totalSchedules() external view returns (uint256 _count);\\n\\n /**\\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The max duration is larger than the min duration.\\n * - The max offset is larger than the min offset.\\n *\\n * Emits the event `MaintenanceConfigUpdated`.\\n *\\n */\\n function setMaintenanceConfig(\\n uint256 _minMaintenanceDurationInBlock,\\n uint256 _maxMaintenanceDurationInBlock,\\n uint256 _minOffsetToStartSchedule,\\n uint256 _maxOffsetToStartSchedule,\\n uint256 _maxSchedules,\\n uint256 _cooldownSecsToMaintain\\n ) external;\\n\\n /**\\n * @dev Returns the min duration for maintenance in block.\\n */\\n function minMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max duration for maintenance in block.\\n */\\n function maxMaintenanceDurationInBlock() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the min block number that the schedule can start\\n */\\n function minOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev The offset to the max block number that the schedule can start\\n */\\n function maxOffsetToStartSchedule() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max number of scheduled maintenances.\\n */\\n function maxSchedules() external view returns (uint256);\\n\\n /**\\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\\n * - The total number of schedules is not larger than `maxSchedules()`.\\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\\n * - The end block is larger than the start block.\\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\\n * - The start block is at the start of an epoch.\\n * - The end block is at the end of an epoch.\\n *\\n * Emits the event `MaintenanceScheduled`.\\n *\\n */\\n function schedule(\\n address _consensusAddr,\\n uint256 _startedAtBlock,\\n uint256 _endedAtBlock\\n ) external;\\n\\n /**\\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\\n *\\n * Requirements:\\n * - The candidate `_consensusAddr` is the block producer.\\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\\n *\\n * Emits the event `MaintenanceScheduleCancelled`.\\n */\\n function cancelSchedule(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4f06c8f3ad7ec8b863882c655ddf443675d557272445e51d8a1e1f3454089d09\",\"license\":\"MIT\"},\"contracts/interfaces/IQuorum.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface IQuorum {\\n /// @dev Emitted when the threshold is updated\\n event ThresholdUpdated(\\n uint256 indexed nonce,\\n uint256 indexed numerator,\\n uint256 indexed denominator,\\n uint256 previousNumerator,\\n uint256 previousDenominator\\n );\\n\\n /**\\n * @dev Returns the threshold.\\n */\\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\\n\\n /**\\n * @dev Checks whether the `_voteWeight` passes the threshold.\\n */\\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\\n\\n /**\\n * @dev Returns the minimum vote weight to pass the threshold.\\n */\\n function minimumVoteWeight() external view returns (uint256);\\n\\n /**\\n * @dev Sets the threshold.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `ThresholdUpdated` event.\\n *\\n */\\n function setThreshold(uint256 _numerator, uint256 _denominator)\\n external\\n returns (uint256 _previousNum, uint256 _previousDenom);\\n}\\n\",\"keccak256\":\"0x10f3b360430e6d03773c9959f54cbed6fb0346069645c05b05ef50cfb19f3753\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninGovernanceAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"../libraries/BridgeOperatorsBallot.sol\\\";\\n\\ninterface IRoninGovernanceAdmin {\\n /// @dev Emitted when the bridge operators are approved.\\n event BridgeOperatorsApproved(uint256 _period, uint256 _epoch, address[] _operators);\\n /// @dev Emitted when an emergency exit poll is created.\\n event EmergencyExitPollCreated(\\n bytes32 _voteHash,\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n );\\n /// @dev Emitted when an emergency exit poll is approved.\\n event EmergencyExitPollApproved(bytes32 _voteHash);\\n /// @dev Emitted when an emergency exit poll is expired.\\n event EmergencyExitPollExpired(bytes32 _voteHash);\\n\\n /**\\n * @dev Returns the last voted block of the bridge voter.\\n */\\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256);\\n\\n /**\\n * @dev Returns the synced bridge operator set info.\\n */\\n function lastSyncedBridgeOperatorSetInfo()\\n external\\n view\\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory _bridgeOperatorSetInfo);\\n\\n /**\\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n */\\n function createEmergencyExitPoll(\\n address _consensusAddr,\\n address _recipientAfterUnlockedFund,\\n uint256 _requestedAt,\\n uint256 _expiredAt\\n ) external;\\n}\\n\",\"keccak256\":\"0x1aa218f9a8cad8fa9f865c179b257aa8f2614e034100dedebdd352da9a7d96d9\",\"license\":\"MIT\"},\"contracts/interfaces/IRoninTrustedOrganization.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IQuorum.sol\\\";\\n\\ninterface IRoninTrustedOrganization is IQuorum {\\n struct TrustedOrganization {\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address to voting proposal\\n address governor;\\n // Address to voting bridge operators\\n address bridgeVoter;\\n // Its Weight\\n uint256 weight;\\n // The block that the organization was added\\n uint256 addedBlock;\\n }\\n\\n /// @dev Emitted when the trusted organization is added.\\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is updated.\\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\\n /// @dev Emitted when the trusted organization is removed.\\n event TrustedOrganizationsRemoved(address[] orgs);\\n\\n /**\\n * @dev Adds a list of addresses into the trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n * - The field `addedBlock` should be blank.\\n *\\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\\n *\\n */\\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\\n\\n /**\\n * @dev Updates weights for a list of existent trusted organization.\\n *\\n * Requirements:\\n * - The weights should larger than 0.\\n * - The method caller is admin.\\n *\\n * Emits the `TrustedOrganizationUpdated` event.\\n *\\n */\\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\\n\\n /**\\n * @dev Removes a list of addresses from the trusted organization.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\\n *\\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\\n */\\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\\n\\n /**\\n * @dev Returns total weights.\\n */\\n function totalWeights() external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a consensus.\\n */\\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a governor.\\n */\\n function getGovernorWeight(address _governor) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weight of a bridge voter.\\n */\\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the weights of a list of consensus addresses.\\n */\\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of governor addresses.\\n */\\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the weights of a list of bridge voter addresses.\\n */\\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns total weights of the consensus list.\\n */\\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the governor list.\\n */\\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns total weights of the bridge voter list.\\n */\\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\\n\\n /**\\n * @dev Returns the trusted organization at `_index`.\\n */\\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\\n\\n /**\\n * @dev Returns the number of trusted organizations.\\n */\\n function countTrustedOrganizations() external view returns (uint256);\\n\\n /**\\n * @dev Returns all of the trusted organizations.\\n */\\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\\n\\n /**\\n * @dev Returns the trusted organization by consensus address.\\n *\\n * Reverts once the consensus address is non-existent.\\n */\\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\\n}\\n\",\"keccak256\":\"0x1edb7a3f5d340e7efc141cb8d94c5499954dec869f026d3998ad92cbc714d604\",\"license\":\"MIT\"},\"contracts/interfaces/IStakingVesting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IStakingVesting {\\n /// @dev Emitted when the block bonus for block producer is transferred.\\n event BonusTransferred(\\n uint256 indexed blockNumber,\\n address indexed recipient,\\n uint256 blockProducerAmount,\\n uint256 bridgeOperatorAmount\\n );\\n /// @dev Emitted when the transfer of block bonus for block producer is failed.\\n event BonusTransferFailed(\\n uint256 indexed blockNumber,\\n address indexed recipient,\\n uint256 blockProducerAmount,\\n uint256 bridgeOperatorAmount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the block bonus for block producer is updated\\n event BlockProducerBonusPerBlockUpdated(uint256);\\n /// @dev Emitted when the block bonus for bridge operator is updated\\n event BridgeOperatorBonusPerBlockUpdated(uint256);\\n\\n /**\\n * @dev Returns the bonus amount for the block producer at `_block`.\\n */\\n function blockProducerBlockBonus(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns the bonus amount for the bridge validator at `_block`.\\n */\\n function bridgeOperatorBlockBonus(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Receives RON from any address.\\n */\\n function receiveRON() external payable;\\n\\n /**\\n * @dev Returns the last block number that the staking vesting is sent.\\n */\\n function lastBlockSendingBonus() external view returns (uint256);\\n\\n /**\\n * @dev Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n * - The method must be called only once per block.\\n *\\n * Emits the event `BonusTransferred` or `BonusTransferFailed`.\\n *\\n * Notes:\\n * - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method\\n * will not be reverted, and the underlying nodes does not hang.\\n *\\n * @param _forBlockProducer Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\\n * @param _forBridgeOperator Indicates whether requesting the bonus for the bridge operator.\\n *\\n * @return _success Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\\n * @return _blockProducerBonus The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\\n * @return _bridgeOperatorBonus The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\\n *\\n */\\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\\n external\\n returns (\\n bool _success,\\n uint256 _blockProducerBonus,\\n uint256 _bridgeOperatorBonus\\n );\\n\\n /**\\n * @dev Sets the bonus amount per block for block producer.\\n *\\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n */\\n function setBlockProducerBonusPerBlock(uint256 _amount) external;\\n\\n /**\\n * @dev Sets the bonus amount per block for bridge operator.\\n *\\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n */\\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external;\\n}\\n\",\"keccak256\":\"0x6705fdccf03c4acd34ceb1034c2ab556c901781d6d5597e63f257eafe75cf1ae\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasBridgeTrackingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasBridgeTrackingContract is IHasContract {\\n /// @dev Emitted when the bridge tracking contract is updated.\\n event BridgeTrackingContractUpdated(address);\\n\\n /// @dev Error of method caller must be bridge tracking contract.\\n error ErrCallerMustBeBridgeTrackingContract();\\n\\n /**\\n * @dev Returns the bridge tracking contract.\\n */\\n function bridgeTrackingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the bridge tracking contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `BridgeTrackingContractUpdated`.\\n *\\n */\\n function setBridgeTrackingContract(address) external;\\n}\\n\",\"keccak256\":\"0x2d1b7e356826bfe1c2a3348137d828f46ca931f7c2f48197379ad987e713714b\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasMaintenanceContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasMaintenanceContract is IHasContract {\\n /// @dev Emitted when the maintenance contract is updated.\\n event MaintenanceContractUpdated(address);\\n\\n /// @dev Error of method caller must be maintenance contract.\\n error ErrCallerMustBeMaintenanceContract();\\n\\n /**\\n * @dev Returns the maintenance contract.\\n */\\n function maintenanceContract() external view returns (address);\\n\\n /**\\n * @dev Sets the maintenance contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `MaintenanceContractUpdated`.\\n *\\n */\\n function setMaintenanceContract(address) external;\\n}\\n\",\"keccak256\":\"0x0a0ef6ba14e2929c7c8dda0642a7a831c9997d1b0d049eb83f64dfc21ff0e72e\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\\n /// @dev Emitted when the ronin trusted organization contract is updated.\\n event RoninTrustedOrganizationContractUpdated(address);\\n\\n /// @dev Error of method caller must be Ronin trusted org contract.\\n error ErrCallerMustBeRoninTrustedOrgContract();\\n\\n /**\\n * @dev Returns the ronin trusted organization contract.\\n */\\n function roninTrustedOrganizationContract() external view returns (address);\\n\\n /**\\n * @dev Sets the ronin trusted organization contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\\n *\\n */\\n function setRoninTrustedOrganizationContract(address) external;\\n}\\n\",\"keccak256\":\"0x7d0a0b1d658e9cf4d69f4934748e0a5c1d22183024d26927f5d621fc61aff0b2\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasSlashIndicatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasSlashIndicatorContract is IHasContract {\\n /// @dev Emitted when the slash indicator contract is updated.\\n event SlashIndicatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be slash indicator contract.\\n error ErrCallerMustBeSlashIndicatorContract();\\n\\n /**\\n * @dev Returns the slash indicator contract.\\n */\\n function slashIndicatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `SlashIndicatorContractUpdated`.\\n *\\n */\\n function setSlashIndicatorContract(address) external;\\n}\\n\",\"keccak256\":\"0xfaaeec87f74039a55fe451c07c341b88794e62a8a331c878a8d9e91f55f1ff45\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasStakingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasStakingContract is IHasContract {\\n /// @dev Emitted when the staking contract is updated.\\n event StakingContractUpdated(address);\\n\\n /// @dev Error of method caller must be staking contract.\\n error ErrCallerMustBeStakingContract();\\n\\n /**\\n * @dev Returns the staking contract.\\n */\\n function stakingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the staking contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `StakingContractUpdated`.\\n *\\n */\\n function setStakingContract(address) external;\\n}\\n\",\"keccak256\":\"0xd5e9b017f7ba0157fa41152a8bb166edbc6ef54a97fa3bb71a2a9b333d846c0b\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasStakingVestingContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasStakingVestingContract is IHasContract {\\n /// @dev Emitted when the staking vesting contract is updated.\\n event StakingVestingContractUpdated(address);\\n\\n /// @dev Error of method caller must be staking vesting contract.\\n error ErrCallerMustBeStakingVestingContract();\\n\\n /**\\n * @dev Returns the staking vesting contract.\\n */\\n function stakingVestingContract() external view returns (address);\\n\\n /**\\n * @dev Sets the staking vesting contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `StakingVestingContractUpdated`.\\n *\\n */\\n function setStakingVestingContract(address) external;\\n}\\n\",\"keccak256\":\"0xfc5f14854b15f81d5b535e4baaeca7cedca69b26813bfc6ade75fdabc4eaffcf\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface PeriodWrapperConsumer {\\n struct PeriodWrapper {\\n // Inner value.\\n uint256 inner;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n}\\n\",\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/IBaseSlash.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseSlash {\\n enum SlashType {\\n UNKNOWN,\\n UNAVAILABILITY_TIER_1,\\n UNAVAILABILITY_TIER_2,\\n DOUBLE_SIGNING,\\n BRIDGE_VOTING,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\\n UNAVAILABILITY_TIER_3\\n }\\n\\n /// @dev Emitted when the validator is slashed.\\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\\n}\\n\",\"keccak256\":\"0x04d449f2852840566dfff4e3673929f6e9b8d9b5fc5b29744bf4f344dc7f9bc0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ICreditScore.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICreditScore {\\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\\n event CreditScoreConfigsUpdated(\\n uint256 gainCreditScore,\\n uint256 maxCreditScore,\\n uint256 bailOutCostMultiplier,\\n uint256 cutOffPercentageAfterBailout\\n );\\n /// @dev Emitted the credit score of validators is updated.\\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\\n /// @dev Emitted when a validator bailed out of jail.\\n event BailedOut(address indexed validator, uint256 period, uint256 usedCreditScore);\\n\\n /**\\n * @dev Updates the credit score for the validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function updateCreditScores(address[] calldata _validators, uint256 _period) external;\\n\\n /**\\n * @dev Resets the credit score for the revoked validators.\\n *\\n * Requirements:\\n * - Only validator contract can call this method.\\n * - This method is only called at the end of each period.\\n *\\n * Emits the event `CreditScoresUpdated`.\\n *\\n */\\n function execResetCreditScores(address[] calldata _validators) external;\\n\\n /**\\n * @dev A slashed validator use this method to get out of jail.\\n *\\n * Requirements:\\n * - The `_consensusAddr` must be a validator.\\n * - Only validator's admin can call this method.\\n *\\n * Emits the event `BailedOut`.\\n *\\n */\\n function bailOut(address _consensusAddr) external;\\n\\n /**\\n * @dev Sets the configs to credit score.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CreditScoreConfigsUpdated`.\\n *\\n * @param _gainScore The score to gain per period.\\n * @param _maxScore The max number of credit score that a validator can hold.\\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function setCreditScoreConfigs(\\n uint256 _gainScore,\\n uint256 _maxScore,\\n uint256 _bailOutMultiplier,\\n uint256 _cutOffPercentage\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to credit score.\\n *\\n * @return _gainCreditScore The score to gain per period.\\n * @return _maxCreditScore The max number of credit score that a validator can hold.\\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\\n *\\n */\\n function getCreditScoreConfigs()\\n external\\n view\\n returns (\\n uint256 _gainCreditScore,\\n uint256 _maxCreditScore,\\n uint256 _bailOutCostMultiplier,\\n uint256 _cutOffPercentageAfterBailout\\n );\\n\\n /**\\n * @dev Returns the current credit score of the validator.\\n */\\n function getCreditScore(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the current credit score of a list of validators.\\n */\\n function getManyCreditScores(address[] calldata _validators) external view returns (uint256[] memory _resultList);\\n\\n /**\\n * @dev Returns the whether the `_validator` has been bailed out at the `_period`.\\n */\\n function checkBailedOutAtPeriod(address _validator, uint256 _period) external view returns (bool);\\n}\\n\",\"keccak256\":\"0xd5364db88efb971f73aac569e27e5604758a123f28567af757b9933fdddd14f8\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeOperator is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method\\n * `getBridgeOperatorSlashingConfigs` for param details.\\n */\\n event BridgeOperatorSlashingConfigsUpdated(\\n uint256 missingVotesRatioTier1,\\n uint256 missingVotesRatioTier2,\\n uint256 jailDurationForMissingVotesRatioTier2,\\n uint256 skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\\n * @param _tier The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1`\\n * and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2`\\n *\\n * Requirements:\\n * - Only validator contract can invoke this method.\\n * - Should be called only at the end of period.\\n * - Should be called only when there is slash of bridge operator.\\n *\\n * Emits the event `Slashed`.\\n */\\n function execSlashBridgeOperator(\\n address _consensusAddr,\\n uint256 _tier,\\n uint256 _period\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to bridge operator slashing.\\n *\\n * @return _missingVotesRatioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio.\\n * @return _missingVotesRatioTier2 The bridge reward and mining reward will be deprecated and the corresponding\\n * block producer will be put in jail if (s)he misses more than this ratio.\\n * @return _jailDurationForMissingVotesRatioTier2 The number of blocks to jail the corresponding block producer when\\n * its bridge operator is slashed tier-2.\\n * @return _skipBridgeOperatorSlashingThreshold The threshold to skip slashing the bridge operator in case the total\\n * number of votes in the bridge is too small.\\n *\\n */\\n function getBridgeOperatorSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _missingVotesRatioTier1,\\n uint256 _missingVotesRatioTier2,\\n uint256 _jailDurationForMissingVotesRatioTier2,\\n uint256 _skipBridgeOperatorSlashingThreshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash bridge operators.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _ratioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map\\n * to 0%-100%.\\n * @param _ratioTier2 The bridge reward and mining reward will be deprecated and the corresponding block producer will\\n * be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\\n * @param _jailDurationTier2 The number of blocks to jail the corresponding block producer when its bridge operator is\\n * slashed tier-2.\\n * @param _skipSlashingThreshold The threshold to skip slashing the bridge operator in case the total number of votes\\n * in the bridge is too small.\\n *\\n */\\n function setBridgeOperatorSlashingConfigs(\\n uint256 _ratioTier1,\\n uint256 _ratioTier2,\\n uint256 _jailDurationTier2,\\n uint256 _skipSlashingThreshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x5c09ac11ead005bfa25ae58e970c441144849b14d58fd5f53fadc3b9be16e5d6\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashBridgeVoting is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge voting is updated. See the method `getBridgeVotingSlashingConfigs` for param\\n * details.\\n */\\n event BridgeVotingSlashingConfigsUpdated(uint256 bridgeVotingThreshold, uint256 bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Slashes for bridge voter governance.\\n *\\n * Emits the event `Slashed`.\\n */\\n function slashBridgeVoting(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the configs related to bridge voting slashing.\\n *\\n * @return _bridgeVotingThreshold The threshold to slash when a trusted organization does not vote for bridge\\n * operators.\\n * @return _bridgeVotingSlashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function getBridgeVotingSlashingConfigs()\\n external\\n view\\n returns (uint256 _bridgeVotingThreshold, uint256 _bridgeVotingSlashAmount);\\n\\n /**\\n * @dev Sets the configs to slash bridge voting.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeVotingSlashingConfigsUpdated`.\\n *\\n * @param _threshold The threshold to slash when a trusted organization does not vote for bridge operators.\\n * @param _slashAmount The amount of RON to slash bridge voting.\\n *\\n */\\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external;\\n}\\n\",\"keccak256\":\"0x72c3bcfe3c49f946651caa3066bd5296d007871c9a56fa113e2d3c0f3db7eb99\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashDoubleSign.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashDoubleSign is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\\n * for param details.\\n */\\n event DoubleSignSlashingConfigsUpdated(\\n uint256 slashDoubleSignAmount,\\n uint256 doubleSigningJailUntilBlock,\\n uint256 doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Slashes for double signing.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\\n */\\n function slashDoubleSign(\\n address _validatorAddr,\\n bytes calldata _header1,\\n bytes calldata _header2\\n ) external;\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\\n * double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function getDoubleSignSlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _slashDoubleSignAmount,\\n uint256 _doubleSigningJailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\\n *\\n * @param _slashAmount The amount of RON to slash double sign.\\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\\n * signing block.\\n *\\n */\\n function setDoubleSignSlashingConfigs(\\n uint256 _slashAmount,\\n uint256 _jailUntilBlock,\\n uint256 _doubleSigningOffsetLimitBlock\\n ) external;\\n}\\n\",\"keccak256\":\"0xe72708c42d468b0c40ffa0c72b3386899f11273e4149425aab490a78d5312222\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashIndicator.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashDoubleSign.sol\\\";\\nimport \\\"./ISlashBridgeVoting.sol\\\";\\nimport \\\"./ISlashBridgeOperator.sol\\\";\\nimport \\\"./ISlashUnavailability.sol\\\";\\nimport \\\"./ICreditScore.sol\\\";\\n\\ninterface ISlashIndicator is\\n ISlashDoubleSign,\\n ISlashBridgeVoting,\\n ISlashBridgeOperator,\\n ISlashUnavailability,\\n ICreditScore\\n{}\\n\",\"keccak256\":\"0xe8b8fde3af614735cb304bc1eb82b05d65ede4df804b5d555787e5d5ecb95ec0\",\"license\":\"MIT\"},\"contracts/interfaces/slash-indicator/ISlashUnavailability.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseSlash.sol\\\";\\n\\ninterface ISlashUnavailability is IBaseSlash {\\n /**\\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\\n * for param details.\\n */\\n event UnavailabilitySlashingConfigsUpdated(\\n uint256 unavailabilityTier1Threshold,\\n uint256 unavailabilityTier2Threshold,\\n uint256 slashAmountForUnavailabilityTier2Threshold,\\n uint256 jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Returns the last block that a block producer is slashed for unavailability.\\n */\\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Slashes for unavailability by increasing the counter of block producer `_consensusAddr`.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `Slashed` when the threshold is reached.\\n *\\n */\\n function slashUnavailability(address _consensusAddr) external;\\n\\n /**\\n * @dev Returns the current unavailability indicator of a block producer.\\n */\\n function currentUnavailabilityIndicator(address _validator) external view returns (uint256);\\n\\n /**\\n * @dev Returns the unavailability indicator in the period `_period` of a block producer.\\n */\\n function getUnavailabilityIndicator(address _validator, uint256 _period) external view returns (uint256);\\n\\n /**\\n * @dev Returns the configs related to block producer slashing.\\n *\\n * @return _unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\\n * @return _unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\\n * @return _slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\\n * producer when (s)he is slashed with tier-2 or tier-3.\\n * @return _jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\\n * slashed with tier-2 or tier-3.\\n *\\n */\\n function getUnavailabilitySlashingConfigs()\\n external\\n view\\n returns (\\n uint256 _unavailabilityTier1Threshold,\\n uint256 _unavailabilityTier2Threshold,\\n uint256 _slashAmountForUnavailabilityTier2Threshold,\\n uint256 _jailDurationForUnavailabilityTier2Threshold\\n );\\n\\n /**\\n * @dev Sets the configs to slash block producers.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\\n *\\n * @param _tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\\n * @param _tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\\n * self-staking if (s)he misses more than this threshold.\\n * @param _slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\\n * is slashed tier-2.\\n * @param _jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\\n *\\n */\\n function setUnavailabilitySlashingConfigs(\\n uint256 _tier1Threshold,\\n uint256 _tier2Threshold,\\n uint256 _slashAmountForTier2Threshold,\\n uint256 _jailDurationForTier2Threshold\\n ) external;\\n}\\n\",\"keccak256\":\"0x92f7d8e9c6f80d4fedab80515c68db0a46cf4f8da143f8d766bf5f7582aa0a21\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseStaking {\\n struct PoolDetail {\\n // Address of the pool i.e. consensus address of the validator\\n address addr;\\n // Pool admin address\\n address admin;\\n // Self-staking amount\\n uint256 stakingAmount;\\n // Total number of RON staking for the pool\\n uint256 stakingTotal;\\n // Mapping from delegator => delegating amount\\n mapping(address => uint256) delegatingAmount;\\n // Mapping from delegator => the last timestamp that delegator staked\\n mapping(address => uint256) lastDelegatingTimestamp;\\n }\\n\\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\\n event WaitingSecsToRevokeUpdated(uint256 secs);\\n\\n /// @dev Error of cannot transfer RON.\\n error ErrCannotTransferRON();\\n /// @dev Error of receiving zero message value.\\n error ErrZeroValue();\\n /// @dev Error of pool admin is not allowed to call.\\n error ErrPoolAdminForbidden();\\n /// @dev Error of no one is allowed to call but the pool's admin.\\n error ErrOnlyPoolAdminAllowed();\\n /// @dev Error of admin of any active pool cannot delegate.\\n error ErrAdminOfAnyActivePoolForbidden(address admin);\\n /// @dev Error of querying inactive pool.\\n error ErrInactivePool(address poolAddr);\\n /// @dev Error of length of input arrays are not of the same.\\n error ErrInvalidArrays();\\n\\n /**\\n * @dev Returns whether the `_poolAdminAddr` is currently active.\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the consensus address corresponding to the pool admin.\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\\n\\n /**\\n * @dev Returns the staking pool detail.\\n */\\n function getPoolDetail(address)\\n external\\n view\\n returns (\\n address _admin,\\n uint256 _stakingAmount,\\n uint256 _stakingTotal\\n );\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\\n */\\n function waitingSecsToRevoke() external view returns (uint256);\\n\\n /**\\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external;\\n}\\n\",\"keccak256\":\"0x008b3d42a3104820de7b7edb5ea4b21c75d4417767fc0791f89f00ac9a2cce8d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface ICandidateStaking is IRewardPool {\\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\\n event MinValidatorStakingAmountUpdated(uint256 threshold);\\n /// @dev Emitted when the commission rate range is updated.\\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\\n\\n /// @dev Emitted when the pool admin staked for themself.\\n event Staked(address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\\n event Unstaked(address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Emitted when the validator pool is approved.\\n event PoolApproved(address indexed validator, address indexed admin);\\n /// @dev Emitted when the validator pool is deprecated.\\n event PoolsDeprecated(address[] validator);\\n /// @dev Emitted when the staking amount transfer failed.\\n event StakingAmountTransferFailed(\\n address indexed validator,\\n address indexed admin,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\\n event StakingAmountDeductFailed(\\n address indexed validator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Error of cannot transfer RON to specified target.\\n error ErrCannotInitTransferRON(address addr, string extraInfo);\\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\\n error ErrThreeInteractionAddrsNotEqual();\\n /// @dev Error of three operation addresses must be distinct in applying for validator candidate.\\n error ErrThreeOperationAddrsNotDistinct();\\n /// @dev Error of unstaking zero amount.\\n error ErrUnstakeZeroAmount();\\n /// @dev Error of invalid staking amount left after deducted.\\n error ErrStakingAmountLeft();\\n /// @dev Error of insufficient staking amount for unstaking.\\n error ErrInsufficientStakingAmount();\\n /// @dev Error of unstaking too early.\\n error ErrUnstakeTooEarly();\\n /// @dev Error of setting commission rate exceeds max allowed.\\n error ErrInvalidCommissionRate();\\n\\n /**\\n * @dev Returns the minimum threshold for being a validator candidate.\\n */\\n function minValidatorStakingAmount() external view returns (uint256);\\n\\n /**\\n * @dev Returns the commission rate range that the candidate can set.\\n */\\n function getCommissionRateRange() external view returns (uint256 _minRange, uint256 _maxRange);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function setMinValidatorStakingAmount(uint256) external;\\n\\n /**\\n * @dev Sets the commission rate range that a candidate can set.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `CommissionRateRangeUpdated` event.\\n *\\n */\\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external;\\n\\n /**\\n * @dev Proposes a candidate to become a validator.\\n *\\n * Requirements:\\n * - The method caller is able to receive RON.\\n * - The treasury is able to receive RON.\\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\\n *\\n * Emits the event `PoolApproved`.\\n *\\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\\n * to its candidate, e.g. scheduling maintenance.\\n *\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external payable;\\n\\n /**\\n * @dev Deprecates the pool.\\n * - Deduct self-staking amount of the pool admin to zero.\\n * - Transfer the deducted amount to the pool admin.\\n * - Deactivate the pool admin address in the mapping of active pool admins\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\\n *\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\\n\\n /**\\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `msg.value` is larger than 0.\\n *\\n * Emits the event `Staked`.\\n *\\n */\\n function stake(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function unstake(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdated`.\\n *\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestRenounce(address _consensusAddr) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestEmergencyExit(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x5681cd641c0014aa2cc0ae336e110ebd9a5b28419ae387acd720683ba54ca89f\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface IDelegatorStaking is IRewardPool {\\n /// @dev Emitted when the delegator staked for a validator candidate.\\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the delegator unstaked from a validator candidate.\\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Error of undelegating zero amount.\\n error ErrUndelegateZeroAmount();\\n /// @dev Error of undelegating insufficient amount.\\n error ErrInsufficientDelegatingAmount();\\n /// @dev Error of undelegating too early.\\n error ErrUndelegateTooEarly();\\n\\n /**\\n * @dev Stakes for a validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n */\\n function delegate(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Undelegated` event.\\n *\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Bulk unstakes from a list of candidates.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the events `Undelegated`.\\n *\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\\n\\n /**\\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `Undelegated` event and the `Delegated` event.\\n *\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external;\\n\\n /**\\n * @dev Returns the claimable reward of the user `_user`.\\n */\\n function getRewards(address _user, address[] calldata _poolAddrList)\\n external\\n view\\n returns (uint256[] memory _rewards);\\n\\n /**\\n * @dev Claims the reward of method caller.\\n *\\n * Emits the `RewardClaimed` event.\\n *\\n */\\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `RewardClaimed` event and the `Delegated` event.\\n *\\n */\\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\\n external\\n returns (uint256 _amount);\\n}\\n\",\"keccak256\":\"0x5ce840a920ed06139f9e33d306c8ee50b2a81e4bd2ac6ed24b47297c348576b8\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IRewardPool.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/consumers/PeriodWrapperConsumer.sol\\\";\\n\\ninterface IRewardPool is PeriodWrapperConsumer {\\n struct UserRewardFields {\\n // Recorded reward amount.\\n uint256 debited;\\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\\n uint256 aRps;\\n // Lowest staking amount in the period.\\n uint256 lowestAmount;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n\\n struct PoolFields {\\n // Accumulated of the amount rewards per share (one unit staking).\\n uint256 aRps;\\n // The staking total to share reward of the current period.\\n PeriodWrapper shares;\\n }\\n\\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\\n /// @dev Emitted when the user claimed their reward\\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\\n\\n /// @dev Emitted when the pool shares are updated\\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\\n /// @dev Emitted when the pools are updated\\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\\n /// @dev Emitted when the contract fails when updating the pools\\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\\n /// @dev Emitted when the contract fails when updating the pools that already set\\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\\n\\n /// @dev Error of invalid pool share.\\n error ErrInvalidPoolShare();\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amount of an user.\\n */\\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amounts of the users.\\n */\\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total staking amount of all users for a pool.\\n */\\n function getStakingTotal(address _poolAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\\n */\\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\\n}\\n\",\"keccak256\":\"0x92315ca9d6d93f55a7752adf2567adb86745f708198bfcd74b9a626b6570208f\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseStaking.sol\\\";\\nimport \\\"./ICandidateStaking.sol\\\";\\nimport \\\"./IDelegatorStaking.sol\\\";\\n\\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable;\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\\n external\\n returns (uint256 _actualDeductingAmount);\\n}\\n\",\"keccak256\":\"0xb7942c5032c16ea567ac0bfc07ecacd84840d6de134735ea538aa22fc6da05a5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/BridgeOperatorsBallot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\\\";\\n\\nlibrary BridgeOperatorsBallot {\\n struct BridgeOperatorSet {\\n uint256 period;\\n uint256 epoch;\\n address[] operators;\\n }\\n\\n // keccak256(\\\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\\\");\\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\\n\\n /**\\n * @dev Verifies whether the ballot is valid or not.\\n *\\n * Requirements:\\n * - The ballot is not for an empty operator set.\\n * - The operator address list is in order.\\n *\\n */\\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\\n require(_ballot.operators.length > 0, \\\"BridgeOperatorsBallot: invalid array length\\\");\\n address _addr = _ballot.operators[0];\\n for (uint _i = 1; _i < _ballot.operators.length; _i++) {\\n require(_addr < _ballot.operators[_i], \\\"BridgeOperatorsBallot: invalid order of bridge operators\\\");\\n _addr = _ballot.operators[_i];\\n }\\n }\\n\\n /**\\n * @dev Returns hash of the ballot.\\n */\\n function hash(BridgeOperatorSet calldata _ballot) internal pure returns (bytes32) {\\n bytes32 _operatorsHash;\\n address[] memory _operators = _ballot.operators;\\n\\n assembly {\\n _operatorsHash := keccak256(add(_operators, 32), mul(mload(_operators), 32))\\n }\\n\\n return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\\n }\\n}\\n\",\"keccak256\":\"0x986425ebae2dcfcfa266c9ca825232ff300ec8ce796e8975da6714d87e921793\",\"license\":\"MIT\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xf719e74bc39be7aceb4e5cc455260f81b2b21e83aa693e0b50c390c9909e08c4\",\"license\":\"UNLICENSED\"},\"contracts/precompile-usages/PCUPickValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUPickValidatorSet is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of picking validator set\\n function precompilePickValidatorSetAddress() public view virtual returns (address) {\\n return address(0x68);\\n }\\n\\n /**\\n * @dev Sorts and arranges to return a new validator set.\\n *\\n * Note: The recover process is done by pre-compiled contract. This function is marked as\\n * virtual for implementing mocking contract for testing purpose.\\n */\\n function _pcPickValidatorSet(\\n address[] memory _candidates,\\n uint256[] memory _weights,\\n uint256[] memory _trustedWeights,\\n uint256 _maxValidatorNumber,\\n uint256 _maxPrioritizedValidatorNumber\\n ) internal view virtual returns (address[] memory _result, uint256 _newValidatorCount) {\\n address _smc = precompilePickValidatorSetAddress();\\n bytes memory _payload = abi.encodeWithSignature(\\n \\\"pickValidatorSet(address[],uint256[],uint256[],uint256,uint256)\\\",\\n _candidates,\\n _weights,\\n _trustedWeights,\\n _maxValidatorNumber,\\n _maxPrioritizedValidatorNumber\\n );\\n bool _success = true;\\n\\n uint256 _payloadLength = _payload.length;\\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\\n\\n assembly {\\n let _payloadStart := add(_payload, 0x20)\\n\\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\\n _success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n _success := 0\\n }\\n\\n _result := add(_result, 0x20)\\n }\\n\\n if (!_success) revert ErrCallPrecompiled();\\n\\n _newValidatorCount = _result.length;\\n }\\n}\\n\",\"keccak256\":\"0xcb57a021897a773d11be9d98a195e0653f2124b7e95e84c4832b57d9d36d67e1\",\"license\":\"MIT\"},\"contracts/precompile-usages/PCUSortValidators.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PCUSortValidators is PrecompiledUsage {\\n /// @dev Gets the address of the precompile of sorting validators\\n function precompileSortValidatorsAddress() public view virtual returns (address) {\\n return address(0x66);\\n }\\n\\n /**\\n * @dev Sorts candidates descending by their weights by calling precompile contract.\\n *\\n * Note: This function is marked as virtual for being wrapping in mock contract for testing purpose.\\n */\\n function _pcSortCandidates(address[] memory _candidates, uint256[] memory _weights)\\n internal\\n view\\n virtual\\n returns (address[] memory _result)\\n {\\n address _smc = precompileSortValidatorsAddress();\\n bool _success = true;\\n\\n bytes memory _payload = abi.encodeWithSignature(\\\"sortValidators(address[],uint256[])\\\", _candidates, _weights);\\n uint256 _payloadLength = _payload.length;\\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\\n\\n assembly {\\n let _payloadStart := add(_payload, 0x20)\\n\\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\\n _success := 0\\n }\\n\\n if iszero(returndatasize()) {\\n _success := 0\\n }\\n\\n _result := add(_result, 0x20)\\n }\\n\\n if (!_success) revert ErrCallPrecompiled();\\n }\\n}\\n\",\"keccak256\":\"0xc779a5a5e29fb4416450b2eb6608a09e2cf63f6d9af5b2c1eec130dd16b0d22a\",\"license\":\"MIT\"},\"contracts/precompile-usages/PrecompiledUsage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./PrecompiledUsage.sol\\\";\\n\\nabstract contract PrecompiledUsage {\\n /// @dev Error of call to precompile fails.\\n error ErrCallPrecompiled();\\n}\\n\",\"keccak256\":\"0x76facc3f3a8dd573c826bbbfedaa5cd8ef30963fbabd8c163c0c72b6efea5551\",\"license\":\"MIT\"},\"contracts/ronin/validator/CandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasStakingContract.sol\\\";\\nimport \\\"../../extensions/consumers/GlobalConfigConsumer.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../interfaces/validator/ICandidateManager.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\n\\nabstract contract CandidateManager is ICandidateManager, PercentageConsumer, GlobalConfigConsumer, HasStakingContract {\\n /// @dev Maximum number of validator candidate\\n uint256 private _maxValidatorCandidate;\\n\\n /// @dev The validator candidate array\\n address[] internal _candidates;\\n /// @dev Mapping from candidate consensus address => bitwise negation of validator index in `_candidates`\\n mapping(address => uint256) internal _candidateIndex;\\n /// @dev Mapping from candidate consensus address => their info\\n mapping(address => ValidatorCandidate) internal _candidateInfo;\\n\\n /**\\n * @dev The minimum offset in day from current date to the effective date of a new commission schedule.\\n * Value of 1 means the change gets affected at the beginning of the following day.\\n **/\\n uint256 internal _minEffectiveDaysOnwards;\\n /// @dev Mapping from candidate consensus address => schedule commission change.\\n mapping(address => CommissionSchedule) internal _candidateCommissionChangeSchedule;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] private ______gap;\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function maxValidatorCandidate() public view override returns (uint256) {\\n return _maxValidatorCandidate;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function minEffectiveDaysOnwards() external view override returns (uint256) {\\n return _minEffectiveDaysOnwards;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function setMaxValidatorCandidate(uint256 _number) external override onlyAdmin {\\n _setMaxValidatorCandidate(_number);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external override onlyAdmin {\\n _setMinEffectiveDaysOnwards(_numOfDays);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function execApplyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external override onlyStakingContract {\\n uint256 _length = _candidates.length;\\n if (_length >= maxValidatorCandidate()) revert ErrExceedsMaxNumberOfCandidate();\\n if (isValidatorCandidate(_consensusAddr)) revert ErrExistentCandidate();\\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\\n\\n for (uint _i; _i < _candidates.length; _i++) {\\n ValidatorCandidate storage existentInfo = _candidateInfo[_candidates[_i]];\\n if (_candidateAdmin == existentInfo.admin) revert ErrExistentCandidateAdmin(_candidateAdmin);\\n if (_treasuryAddr == existentInfo.treasuryAddr) revert ErrExistentTreasury(_treasuryAddr);\\n if (_bridgeOperatorAddr == existentInfo.bridgeOperatorAddr) revert ErrExistentBridgeOperator(_bridgeOperatorAddr);\\n }\\n\\n _candidateIndex[_consensusAddr] = ~_length;\\n _candidates.push(_consensusAddr);\\n\\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\\n _info.admin = _candidateAdmin;\\n _info.consensusAddr = _consensusAddr;\\n _info.treasuryAddr = _treasuryAddr;\\n _info.bridgeOperatorAddr = _bridgeOperatorAddr;\\n _info.commissionRate = _commissionRate;\\n emit CandidateGranted(_consensusAddr, _treasuryAddr, _candidateAdmin, _bridgeOperatorAddr);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function execRequestRenounceCandidate(address _consensusAddr, uint256 _secsLeft)\\n external\\n override\\n onlyStakingContract\\n {\\n if (_isTrustedOrg(_consensusAddr)) revert ErrTrustedOrgCannotRenounce();\\n\\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\\n if (_info.revokingTimestamp != 0) revert ErrAlreadyRequestedRevokingCandidate();\\n _setRevokingTimestamp(_info, block.timestamp + _secsLeft);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external override onlyStakingContract {\\n if (_candidateCommissionChangeSchedule[_consensusAddr].effectiveTimestamp != 0) {\\n revert ErrAlreadyRequestedUpdatingCommissionRate();\\n }\\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\\n if (_effectiveDaysOnwards < _minEffectiveDaysOnwards) revert ErrInvalidEffectiveDaysOnwards();\\n\\n CommissionSchedule storage _schedule = _candidateCommissionChangeSchedule[_consensusAddr];\\n uint256 _effectiveTimestamp = ((block.timestamp / PERIOD_DURATION) + _effectiveDaysOnwards) * PERIOD_DURATION;\\n _schedule.effectiveTimestamp = _effectiveTimestamp;\\n _schedule.commissionRate = _commissionRate;\\n\\n emit CommissionRateUpdateScheduled(_consensusAddr, _effectiveTimestamp, _commissionRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function isValidatorCandidate(address _addr) public view override returns (bool) {\\n return _candidateIndex[_addr] != 0;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getCandidateInfos() external view override returns (ValidatorCandidate[] memory _list) {\\n _list = new ValidatorCandidate[](_candidates.length);\\n for (uint _i; _i < _list.length; _i++) {\\n _list[_i] = _candidateInfo[_candidates[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getCandidateInfo(address _candidate) external view override returns (ValidatorCandidate memory) {\\n if (!isValidatorCandidate(_candidate)) revert ErrNonExistentCandidate();\\n return _candidateInfo[_candidate];\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getValidatorCandidates() public view override returns (address[] memory) {\\n return _candidates;\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function getCommissionChangeSchedule(address _candidate) external view override returns (CommissionSchedule memory) {\\n return _candidateCommissionChangeSchedule[_candidate];\\n }\\n\\n /**\\n * @dev Removes unsastisfied candidates, the ones who have insufficient minimum candidate staking amount,\\n * or the ones who requested to renounce their candidate role.\\n *\\n * Emits the event `CandidatesRevoked` when a candidate is revoked.\\n *\\n */\\n function _syncCandidateSet(uint256 _nextPeriod) internal returns (address[] memory _unsatisfiedCandidates) {\\n IStaking _staking = _stakingContract;\\n uint256 _waitingSecsToRevoke = _staking.waitingSecsToRevoke();\\n uint256 _minStakingAmount = _staking.minValidatorStakingAmount();\\n uint256[] memory _selfStakings = _staking.getManySelfStakings(_candidates);\\n\\n uint256 _length = _candidates.length;\\n uint256 _unsatisfiedCount;\\n _unsatisfiedCandidates = new address[](_length);\\n\\n {\\n uint256 _i;\\n address _addr;\\n ValidatorCandidate storage _info;\\n while (_i < _length) {\\n _addr = _candidates[_i];\\n _info = _candidateInfo[_addr];\\n\\n // Checks for under-balance status of candidates\\n bool _hasTopupDeadline = _info.topupDeadline != 0;\\n if (_selfStakings[_i] < _minStakingAmount) {\\n // Updates deadline on the first time unsatisfied the staking amount condition\\n if (!_hasTopupDeadline) {\\n uint256 _topupDeadline = block.timestamp + _waitingSecsToRevoke;\\n _info.topupDeadline = _topupDeadline;\\n emit CandidateTopupDeadlineUpdated(_addr, _topupDeadline);\\n }\\n } else if (_hasTopupDeadline) {\\n // Removes the deadline if the staking amount condition is satisfied\\n delete _info.topupDeadline;\\n emit CandidateTopupDeadlineUpdated(_addr, 0);\\n }\\n\\n // Removes unsastisfied candidates\\n bool _revokingActivated = (_info.revokingTimestamp != 0 && _info.revokingTimestamp <= block.timestamp) ||\\n _emergencyExitLockedFundReleased(_addr);\\n bool _topupDeadlineMissed = _info.topupDeadline != 0 && _info.topupDeadline <= block.timestamp;\\n if (_revokingActivated || _topupDeadlineMissed) {\\n _selfStakings[_i] = _selfStakings[--_length];\\n _unsatisfiedCandidates[_unsatisfiedCount++] = _addr;\\n _removeCandidate(_addr);\\n continue;\\n }\\n\\n // Checks for schedule of commission change and updates commission rate\\n uint256 _scheduleTimestamp = _candidateCommissionChangeSchedule[_addr].effectiveTimestamp;\\n if (_scheduleTimestamp != 0 && _scheduleTimestamp <= block.timestamp) {\\n uint256 _commisionRate = _candidateCommissionChangeSchedule[_addr].commissionRate;\\n delete _candidateCommissionChangeSchedule[_addr];\\n _info.commissionRate = _commisionRate;\\n emit CommissionRateUpdated(_addr, _commisionRate);\\n }\\n\\n _i++;\\n }\\n }\\n\\n assembly {\\n mstore(_unsatisfiedCandidates, _unsatisfiedCount)\\n }\\n\\n if (_unsatisfiedCount > 0) {\\n emit CandidatesRevoked(_unsatisfiedCandidates);\\n _staking.execDeprecatePools(_unsatisfiedCandidates, _nextPeriod);\\n }\\n }\\n\\n /**\\n * @inheritdoc ICandidateManager\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view override returns (bool) {\\n return _candidateInfo[_candidate].admin == _admin;\\n }\\n\\n /**\\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\\n */\\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address) {\\n return _candidateInfo[_consensusAddr].bridgeOperatorAddr;\\n }\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function _setMaxValidatorCandidate(uint256 _threshold) internal {\\n _maxValidatorCandidate = _threshold;\\n emit MaxValidatorCandidateUpdated(_threshold);\\n }\\n\\n /**\\n * @dev Sets the minimum number of days onwards to the effective date of commission rate change.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function _setMinEffectiveDaysOnwards(uint256 _numOfDays) internal {\\n if (_numOfDays < 1) revert ErrInvalidMinEffectiveDaysOnwards();\\n _minEffectiveDaysOnwards = _numOfDays;\\n emit MinEffectiveDaysOnwardsUpdated(_numOfDays);\\n }\\n\\n /**\\n * @dev Removes the candidate.\\n */\\n function _removeCandidate(address _addr) internal virtual {\\n uint256 _idx = _candidateIndex[_addr];\\n if (_idx == 0) {\\n return;\\n }\\n\\n delete _candidateInfo[_addr];\\n delete _candidateIndex[_addr];\\n delete _candidateCommissionChangeSchedule[_addr];\\n\\n address _lastCandidate = _candidates[_candidates.length - 1];\\n if (_lastCandidate != _addr) {\\n _candidateIndex[_lastCandidate] = _idx;\\n _candidates[~_idx] = _lastCandidate;\\n }\\n\\n _candidates.pop();\\n }\\n\\n /**\\n * @dev Sets timestamp to revoke a candidate.\\n */\\n function _setRevokingTimestamp(ValidatorCandidate storage _candidate, uint256 _timestamp) internal {\\n if (!isValidatorCandidate(_candidate.consensusAddr)) revert ErrNonExistentCandidate();\\n _candidate.revokingTimestamp = _timestamp;\\n emit CandidateRevokingTimestampUpdated(_candidate.consensusAddr, _timestamp);\\n }\\n\\n /**\\n * @dev Returns a flag indicating whether the fund is unlocked.\\n */\\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual returns (bool);\\n\\n /**\\n * @dev Returns whether the consensus address is a trusted org or not.\\n */\\n function _isTrustedOrg(address _consensusAddr) internal virtual returns (bool);\\n}\\n\",\"keccak256\":\"0x118e406abfbaba67fdb5a282740674f4e2442f55fe182fee6d0bd82ea8d7a8e7\",\"license\":\"MIT\"},\"contracts/ronin/validator/CoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasBridgeTrackingContract.sol\\\";\\nimport \\\"../../extensions/collections/HasMaintenanceContract.sol\\\";\\nimport \\\"../../extensions/collections/HasSlashIndicatorContract.sol\\\";\\nimport \\\"../../extensions/collections/HasStakingVestingContract.sol\\\";\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../interfaces/validator/ICoinbaseExecution.sol\\\";\\nimport \\\"../../libraries/EnumFlags.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"../../precompile-usages/PCUSortValidators.sol\\\";\\nimport \\\"../../precompile-usages/PCUPickValidatorSet.sol\\\";\\nimport \\\"./storage-fragments/CommonStorage.sol\\\";\\nimport \\\"./CandidateManager.sol\\\";\\nimport \\\"./EmergencyExit.sol\\\";\\n\\nabstract contract CoinbaseExecution is\\n ICoinbaseExecution,\\n RONTransferHelper,\\n PCUSortValidators,\\n PCUPickValidatorSet,\\n HasStakingVestingContract,\\n HasBridgeTrackingContract,\\n HasMaintenanceContract,\\n HasSlashIndicatorContract,\\n EmergencyExit\\n{\\n using EnumFlags for EnumFlags.ValidatorFlag;\\n\\n modifier onlyCoinbase() {\\n if (msg.sender != block.coinbase) revert ErrCallerMustBeCoinbase();\\n _;\\n }\\n\\n modifier whenEpochEnding() {\\n if (!epochEndingAt(block.number)) revert ErrAtEndOfEpochOnly();\\n _;\\n }\\n\\n modifier oncePerEpoch() {\\n if (epochOf(_lastUpdatedBlock) >= epochOf(block.number)) revert ErrAlreadyWrappedEpoch();\\n _lastUpdatedBlock = block.number;\\n _;\\n }\\n\\n /**\\n * @inheritdoc ICoinbaseExecution\\n */\\n function submitBlockReward() external payable override onlyCoinbase {\\n bool _requestForBlockProducer = isBlockProducer(msg.sender) &&\\n !_jailed(msg.sender) &&\\n !_miningRewardDeprecated(msg.sender, currentPeriod());\\n\\n (, uint256 _blockProducerBonus, uint256 _bridgeOperatorBonus) = _stakingVestingContract.requestBonus(\\n _requestForBlockProducer,\\n true // _requestForBridgeOperator\\n );\\n\\n _totalBridgeReward += _bridgeOperatorBonus;\\n\\n // Deprecates reward for non-validator or slashed validator\\n if (!_requestForBlockProducer) {\\n _totalDeprecatedReward += msg.value;\\n emit BlockRewardDeprecated(msg.sender, msg.value, BlockRewardDeprecatedType.UNAVAILABILITY);\\n return;\\n }\\n\\n emit BlockRewardSubmitted(msg.sender, msg.value, _blockProducerBonus);\\n\\n uint256 _period = currentPeriod();\\n uint256 _reward = msg.value + _blockProducerBonus;\\n uint256 _cutOffReward;\\n if (_miningRewardBailoutCutOffAtPeriod[msg.sender][_period]) {\\n (, , , uint256 _cutOffPercentage) = _slashIndicatorContract.getCreditScoreConfigs();\\n _cutOffReward = (_reward * _cutOffPercentage) / _MAX_PERCENTAGE;\\n _totalDeprecatedReward += _cutOffReward;\\n emit BlockRewardDeprecated(msg.sender, _cutOffReward, BlockRewardDeprecatedType.AFTER_BAILOUT);\\n }\\n\\n _reward -= _cutOffReward;\\n (uint256 _minRate, uint256 _maxRate) = _stakingContract.getCommissionRateRange();\\n uint256 _rate = Math.max(Math.min(_candidateInfo[msg.sender].commissionRate, _maxRate), _minRate);\\n uint256 _miningAmount = (_rate * _reward) / _MAX_PERCENTAGE;\\n _miningReward[msg.sender] += _miningAmount;\\n\\n uint256 _delegatingAmount = _reward - _miningAmount;\\n _delegatingReward[msg.sender] += _delegatingAmount;\\n }\\n\\n /**\\n * @inheritdoc ICoinbaseExecution\\n */\\n function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {\\n uint256 _newPeriod = _computePeriod(block.timestamp);\\n bool _periodEnding = _isPeriodEnding(_newPeriod);\\n\\n (address[] memory _currentValidators, , ) = getValidators();\\n address[] memory _revokedCandidates;\\n uint256 _epoch = epochOf(block.number);\\n uint256 _nextEpoch = _epoch + 1;\\n uint256 _lastPeriod = currentPeriod();\\n\\n if (_periodEnding) {\\n _syncBridgeOperatingReward(_lastPeriod, _currentValidators);\\n (\\n uint256 _totalDelegatingReward,\\n uint256[] memory _delegatingRewards\\n ) = _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(_lastPeriod, _currentValidators);\\n _settleAndTransferDelegatingRewards(_lastPeriod, _currentValidators, _totalDelegatingReward, _delegatingRewards);\\n _tryRecycleLockedFundsFromEmergencyExits();\\n _recycleDeprecatedRewards();\\n _slashIndicatorContract.updateCreditScores(_currentValidators, _lastPeriod);\\n (_currentValidators, _revokedCandidates) = _syncValidatorSet(_newPeriod);\\n if (_revokedCandidates.length > 0) {\\n _slashIndicatorContract.execResetCreditScores(_revokedCandidates);\\n }\\n _currentPeriodStartAtBlock = block.number + 1;\\n }\\n _revampRoles(_newPeriod, _nextEpoch, _currentValidators);\\n emit WrappedUpEpoch(_lastPeriod, _epoch, _periodEnding);\\n _periodOf[_nextEpoch] = _newPeriod;\\n _lastUpdatedPeriod = _newPeriod;\\n }\\n\\n /**\\n * @dev This loop over the all current validators to sync the bridge operating reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _syncBridgeOperatingReward(uint256 _lastPeriod, address[] memory _currentValidators) internal {\\n uint256 _totalBridgeBallots = _bridgeTrackingContract.totalBallots(_lastPeriod);\\n uint256 _totalBridgeVotes = _bridgeTrackingContract.totalVotes(_lastPeriod);\\n uint256[] memory _bridgeBallots = _bridgeTrackingContract.getManyTotalBallots(\\n _lastPeriod,\\n getBridgeOperatorsOf(_currentValidators)\\n );\\n\\n if (\\n !_validateBridgeTrackingResponse(_totalBridgeBallots, _totalBridgeVotes, _bridgeBallots) || _totalBridgeVotes == 0\\n ) {\\n // Shares equally in case the bridge has nothing to vote or bridge tracking response is incorrect\\n for (uint256 _i; _i < _currentValidators.length; _i++) {\\n _bridgeOperatingReward[_currentValidators[_i]] = _totalBridgeReward / _currentValidators.length;\\n }\\n return;\\n }\\n\\n (\\n uint256 _missingVotesRatioTier1,\\n uint256 _missingVotesRatioTier2,\\n uint256 _jailDurationForMissingVotesRatioTier2,\\n uint256 _skipBridgeOperatorSlashingThreshold\\n ) = _slashIndicatorContract.getBridgeOperatorSlashingConfigs();\\n\\n // Slashes the bridge reward if the total of votes exceeds the slashing threshold.\\n bool _shouldSlash = _totalBridgeVotes > _skipBridgeOperatorSlashingThreshold;\\n for (uint256 _i; _i < _currentValidators.length; _i++) {\\n // Shares the bridge operators reward proportionally.\\n _bridgeOperatingReward[_currentValidators[_i]] = (_totalBridgeReward * _bridgeBallots[_i]) / _totalBridgeBallots;\\n if (_shouldSlash) {\\n _slashBridgeOperatorBasedOnPerformance(\\n _lastPeriod,\\n _currentValidators[_i],\\n _MAX_PERCENTAGE - (_bridgeBallots[_i] * _MAX_PERCENTAGE) / _totalBridgeVotes,\\n _jailDurationForMissingVotesRatioTier2,\\n _missingVotesRatioTier1,\\n _missingVotesRatioTier2\\n );\\n }\\n }\\n }\\n\\n /**\\n * @dev Returns whether the responses from bridge tracking are correct.\\n */\\n function _validateBridgeTrackingResponse(\\n uint256 _totalBridgeBallots,\\n uint256 _totalBridgeVotes,\\n uint256[] memory _bridgeBallots\\n ) private returns (bool _valid) {\\n _valid = true;\\n uint256 _sumBallots;\\n for (uint _i; _i < _bridgeBallots.length; _i++) {\\n if (_bridgeBallots[_i] > _totalBridgeVotes) {\\n _valid = false;\\n break;\\n }\\n _sumBallots += _bridgeBallots[_i];\\n }\\n _valid = _valid && (_sumBallots <= _totalBridgeBallots);\\n if (!_valid) {\\n emit BridgeTrackingIncorrectlyResponded();\\n }\\n }\\n\\n /**\\n * @dev Slashes the validator on the corresponding bridge operator performance. Updates the status of the deprecated reward. Not update the reward amount.\\n *\\n * Consider validating the bridge tracking response by using the method `_validateBridgeTrackingResponse` before calling this function.\\n */\\n function _slashBridgeOperatorBasedOnPerformance(\\n uint256 _period,\\n address _validator,\\n uint256 _missedRatio,\\n uint256 _jailDurationTier2,\\n uint256 _ratioTier1,\\n uint256 _ratioTier2\\n ) internal {\\n if (_missedRatio >= _ratioTier2) {\\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\\n _miningRewardDeprecatedAtPeriod[_validator][_period] = true;\\n\\n uint256 _newJailUntilBlock = Math.addIfNonZero(block.number, _jailDurationTier2);\\n _blockProducerJailedBlock[_validator] = Math.max(_newJailUntilBlock, _blockProducerJailedBlock[_validator]);\\n _cannotBailoutUntilBlock[_validator] = Math.max(_newJailUntilBlock, _cannotBailoutUntilBlock[_validator]);\\n\\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 2, _period);\\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, true, true);\\n } else if (_missedRatio >= _ratioTier1) {\\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 1, _period);\\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, false, true);\\n }\\n }\\n\\n /**\\n * @dev This loops over all current validators to:\\n * - Update delegating reward for and calculate total delegating rewards to be sent to the staking contract,\\n * - Distribute the reward of block producers and bridge operators to their treasury addresses,\\n * - Update the total deprecated reward if the two previous conditions do not sastify.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(\\n uint256 _lastPeriod,\\n address[] memory _currentValidators\\n ) private returns (uint256 _totalDelegatingReward, uint256[] memory _delegatingRewards) {\\n address _consensusAddr;\\n address payable _treasury;\\n _delegatingRewards = new uint256[](_currentValidators.length);\\n for (uint _i; _i < _currentValidators.length; _i++) {\\n _consensusAddr = _currentValidators[_i];\\n _treasury = _candidateInfo[_consensusAddr].treasuryAddr;\\n\\n if (!_bridgeRewardDeprecated(_consensusAddr, _lastPeriod)) {\\n _distributeBridgeOperatingReward(_consensusAddr, _candidateInfo[_consensusAddr].bridgeOperatorAddr, _treasury);\\n } else {\\n _totalDeprecatedReward += _bridgeOperatingReward[_consensusAddr];\\n }\\n\\n if (!_jailed(_consensusAddr) && !_miningRewardDeprecated(_consensusAddr, _lastPeriod)) {\\n _totalDelegatingReward += _delegatingReward[_consensusAddr];\\n _delegatingRewards[_i] = _delegatingReward[_consensusAddr];\\n _distributeMiningReward(_consensusAddr, _treasury);\\n } else {\\n _totalDeprecatedReward += _miningReward[_consensusAddr] + _delegatingReward[_consensusAddr];\\n }\\n\\n delete _delegatingReward[_consensusAddr];\\n delete _miningReward[_consensusAddr];\\n delete _bridgeOperatingReward[_consensusAddr];\\n }\\n delete _totalBridgeReward;\\n }\\n\\n /**\\n * @dev Distributes bonus of staking vesting and mining fee for the block producer.\\n *\\n * Emits the `MiningRewardDistributed` once the reward is distributed successfully.\\n * Emits the `MiningRewardDistributionFailed` once the contract fails to distribute reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _distributeMiningReward(address _consensusAddr, address payable _treasury) private {\\n uint256 _amount = _miningReward[_consensusAddr];\\n if (_amount > 0) {\\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\\n emit MiningRewardDistributed(_consensusAddr, _treasury, _amount);\\n return;\\n }\\n\\n emit MiningRewardDistributionFailed(_consensusAddr, _treasury, _amount, address(this).balance);\\n }\\n }\\n\\n /**\\n * @dev Distribute bonus of staking vesting for the bridge operator.\\n *\\n * Emits the `BridgeOperatorRewardDistributed` once the reward is distributed successfully.\\n * Emits the `BridgeOperatorRewardDistributionFailed` once the contract fails to distribute reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _distributeBridgeOperatingReward(\\n address _consensusAddr,\\n address _bridgeOperator,\\n address payable _treasury\\n ) private {\\n uint256 _amount = _bridgeOperatingReward[_consensusAddr];\\n if (_amount > 0) {\\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\\n emit BridgeOperatorRewardDistributed(_consensusAddr, _bridgeOperator, _treasury, _amount);\\n return;\\n }\\n\\n emit BridgeOperatorRewardDistributionFailed(\\n _consensusAddr,\\n _bridgeOperator,\\n _treasury,\\n _amount,\\n address(this).balance\\n );\\n }\\n }\\n\\n /**\\n * @dev Helper function to settle rewards for delegators of `_currentValidators` at the end of each period,\\n * then transfer the rewards from this contract to the staking contract, in order to finalize a period.\\n *\\n * Emits the `StakingRewardDistributed` once the reward is distributed successfully.\\n * Emits the `StakingRewardDistributionFailed` once the contract fails to distribute reward.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _settleAndTransferDelegatingRewards(\\n uint256 _period,\\n address[] memory _currentValidators,\\n uint256 _totalDelegatingReward,\\n uint256[] memory _delegatingRewards\\n ) private {\\n IStaking _staking = _stakingContract;\\n if (_totalDelegatingReward > 0) {\\n if (_unsafeSendRON(payable(address(_staking)), _totalDelegatingReward)) {\\n _staking.execRecordRewards(_currentValidators, _delegatingRewards, _period);\\n emit StakingRewardDistributed(_totalDelegatingReward, _currentValidators, _delegatingRewards);\\n return;\\n }\\n\\n emit StakingRewardDistributionFailed(\\n _totalDelegatingReward,\\n _currentValidators,\\n _delegatingRewards,\\n address(this).balance\\n );\\n }\\n }\\n\\n /**\\n * @dev Transfer the deprecated rewards e.g. the rewards that get deprecated when validator is slashed/maintained,\\n * to the staking vesting contract\\n *\\n * Note: This method should be called once in the end of each period.\\n */\\n function _recycleDeprecatedRewards() private {\\n uint256 _withdrawAmount = _totalDeprecatedReward;\\n\\n if (_withdrawAmount != 0) {\\n address _withdrawTarget = stakingVestingContract();\\n\\n delete _totalDeprecatedReward;\\n\\n (bool _success, ) = _withdrawTarget.call{ value: _withdrawAmount }(\\n abi.encodeWithSelector(IStakingVesting.receiveRON.selector)\\n );\\n\\n if (_success) {\\n emit DeprecatedRewardRecycled(_withdrawTarget, _withdrawAmount);\\n } else {\\n emit DeprecatedRewardRecycleFailed(_withdrawTarget, _withdrawAmount, address(this).balance);\\n }\\n }\\n }\\n\\n /**\\n * @dev Updates the validator set based on the validator candidates from the Staking contract.\\n *\\n * Emits the `ValidatorSetUpdated` event.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _syncValidatorSet(uint256 _newPeriod)\\n private\\n returns (address[] memory _newValidators, address[] memory _unsastifiedCandidates)\\n {\\n _unsastifiedCandidates = _syncCandidateSet(_newPeriod);\\n uint256[] memory _weights = _stakingContract.getManyStakingTotals(_candidates);\\n uint256[] memory _trustedWeights = _roninTrustedOrganizationContract.getConsensusWeights(_candidates);\\n uint256 _newValidatorCount;\\n (_newValidators, _newValidatorCount) = _pcPickValidatorSet(\\n _candidates,\\n _weights,\\n _trustedWeights,\\n _maxValidatorNumber,\\n _maxPrioritizedValidatorNumber\\n );\\n _setNewValidatorSet(_newValidators, _newValidatorCount, _newPeriod);\\n }\\n\\n /**\\n * @dev Private helper function helps writing the new validator set into the contract storage.\\n *\\n * Emits the `ValidatorSetUpdated` event.\\n *\\n * Note: This method should be called once in the end of each period.\\n *\\n */\\n function _setNewValidatorSet(\\n address[] memory _newValidators,\\n uint256 _newValidatorCount,\\n uint256 _newPeriod\\n ) private {\\n // Remove exceeding validators in the current set\\n for (uint256 _i = _newValidatorCount; _i < validatorCount; _i++) {\\n delete _validatorMap[_validators[_i]];\\n delete _validators[_i];\\n }\\n\\n // Remove flag for all validator in the current set\\n for (uint _i; _i < _newValidatorCount; _i++) {\\n delete _validatorMap[_validators[_i]];\\n }\\n\\n // Update new validator set and set flag correspondingly.\\n for (uint256 _i; _i < _newValidatorCount; _i++) {\\n address _newValidator = _newValidators[_i];\\n _validatorMap[_newValidator] = EnumFlags.ValidatorFlag.Both;\\n _validators[_i] = _newValidator;\\n }\\n\\n validatorCount = _newValidatorCount;\\n emit ValidatorSetUpdated(_newPeriod, _newValidators);\\n }\\n\\n /**\\n * @dev Activate/Deactivate the validators from producing blocks, based on their in jail status and maintenance status.\\n *\\n * Requirements:\\n * - This method is called at the end of each epoch\\n *\\n * Emits the `BlockProducerSetUpdated` event.\\n * Emits the `BridgeOperatorSetUpdated` event.\\n *\\n */\\n function _revampRoles(\\n uint256 _newPeriod,\\n uint256 _nextEpoch,\\n address[] memory _currentValidators\\n ) private {\\n bool[] memory _maintainedList = _maintenanceContract.checkManyMaintained(_currentValidators, block.number + 1);\\n\\n for (uint _i; _i < _currentValidators.length; _i++) {\\n address _validator = _currentValidators[_i];\\n bool _emergencyExitRequested = block.timestamp <= _emergencyExitJailedTimestamp[_validator];\\n bool _isProducerBefore = isBlockProducer(_validator);\\n bool _isProducerAfter = !(_jailedAtBlock(_validator, block.number + 1) ||\\n _maintainedList[_i] ||\\n _emergencyExitRequested);\\n\\n if (!_isProducerBefore && _isProducerAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BlockProducer);\\n } else if (_isProducerBefore && !_isProducerAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BlockProducer);\\n }\\n\\n bool _isBridgeOperatorBefore = isOperatingBridge(_validator);\\n bool _isBridgeOperatorAfter = !_emergencyExitRequested;\\n if (!_isBridgeOperatorBefore && _isBridgeOperatorAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BridgeOperator);\\n } else if (_isBridgeOperatorBefore && !_isBridgeOperatorAfter) {\\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BridgeOperator);\\n }\\n }\\n\\n emit BlockProducerSetUpdated(_newPeriod, _nextEpoch, getBlockProducers());\\n emit BridgeOperatorSetUpdated(_newPeriod, _nextEpoch, getBridgeOperators());\\n }\\n\\n /**\\n * @dev Override `CandidateManager-_isTrustedOrg`.\\n */\\n function _isTrustedOrg(address _consensusAddr) internal view override returns (bool) {\\n return _roninTrustedOrganizationContract.getConsensusWeight(_consensusAddr) > 0;\\n }\\n}\\n\",\"keccak256\":\"0x9d66bb0bb44607da8b24cbd5f65c65c148c8363d2615486651d2d328bef0e23a\",\"license\":\"MIT\"},\"contracts/ronin/validator/EmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../interfaces/IRoninGovernanceAdmin.sol\\\";\\nimport \\\"../../interfaces/validator/IEmergencyExit.sol\\\";\\nimport \\\"./storage-fragments/CommonStorage.sol\\\";\\nimport \\\"./CandidateManager.sol\\\";\\n\\nabstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateManager, CommonStorage {\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function emergencyExitLockedAmount() external view returns (uint256) {\\n return _emergencyExitLockedAmount;\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function emergencyExpiryDuration() external view returns (uint256) {\\n return _emergencyExpiryDuration;\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external onlyStakingContract {\\n EmergencyExitInfo storage _info = _exitInfo[_consensusAddr];\\n if (_info.recyclingAt != 0) revert ErrAlreadyRequestedEmergencyExit();\\n\\n uint256 _revokingTimestamp = block.timestamp + _secLeftToRevoke;\\n _setRevokingTimestamp(_candidateInfo[_consensusAddr], _revokingTimestamp);\\n _emergencyExitJailedTimestamp[_consensusAddr] = _revokingTimestamp;\\n _bridgeRewardDeprecatedAtPeriod[_consensusAddr][currentPeriod()] = true;\\n\\n uint256 _deductedAmount = _stakingContract.execDeductStakingAmount(_consensusAddr, _emergencyExitLockedAmount);\\n if (_deductedAmount > 0) {\\n uint256 _recyclingAt = block.timestamp + _emergencyExpiryDuration;\\n _lockedConsensusList.push(_consensusAddr);\\n _info.lockedAmount = _deductedAmount;\\n _info.recyclingAt = _recyclingAt;\\n IRoninGovernanceAdmin(_getAdmin()).createEmergencyExitPoll(\\n _consensusAddr,\\n _candidateInfo[_consensusAddr].treasuryAddr,\\n block.timestamp,\\n _recyclingAt\\n );\\n }\\n emit EmergencyExitRequested(_consensusAddr, _deductedAmount);\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external onlyAdmin {\\n _setEmergencyExitLockedAmount(_emergencyExitLockedAmount);\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external onlyAdmin {\\n _setEmergencyExpiryDuration(_emergencyExpiryDuration);\\n }\\n\\n /**\\n * @inheritdoc IEmergencyExit\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient)\\n external\\n onlyAdmin\\n {\\n if (_exitInfo[_consensusAddr].recyclingAt == 0) {\\n return;\\n }\\n\\n uint256 _length = _lockedConsensusList.length;\\n uint256 _index = _length;\\n\\n for (uint _i; _i < _length; _i++) {\\n if (_lockedConsensusList[_i] == _consensusAddr) {\\n _index = _i;\\n break;\\n }\\n }\\n\\n // The locked amount might be recycled\\n if (_index == _length) {\\n return;\\n }\\n\\n uint256 _amount = _exitInfo[_consensusAddr].lockedAmount;\\n if (_amount > 0) {\\n delete _exitInfo[_consensusAddr];\\n if (_length > 1) {\\n _lockedConsensusList[_index] = _lockedConsensusList[_length - 1];\\n }\\n _lockedConsensusList.pop();\\n\\n _lockedFundReleased[_consensusAddr] = true;\\n if (_unsafeSendRON(_recipient, _amount, DEFAULT_ADDITION_GAS)) {\\n emit EmergencyExitLockedFundReleased(_consensusAddr, _recipient, _amount);\\n return;\\n }\\n\\n emit EmergencyExitLockedFundReleasingFailed(_consensusAddr, _recipient, _amount, address(this).balance);\\n }\\n }\\n\\n /**\\n * @dev Tries to recycle the locked funds from emergency exit requests.\\n */\\n function _tryRecycleLockedFundsFromEmergencyExits() internal {\\n uint256 _length = _lockedConsensusList.length;\\n\\n uint256 _i;\\n address _addr;\\n EmergencyExitInfo storage _info;\\n\\n while (_i < _length) {\\n _addr = _lockedConsensusList[_i];\\n _info = _exitInfo[_addr];\\n\\n if (_info.recyclingAt <= block.timestamp) {\\n _totalDeprecatedReward += _info.lockedAmount;\\n\\n delete _exitInfo[_addr];\\n if (--_length > 0) {\\n _lockedConsensusList[_i] = _lockedConsensusList[_length];\\n }\\n _lockedConsensusList.pop();\\n continue;\\n }\\n\\n _i++;\\n }\\n }\\n\\n /**\\n * @dev Override `CandidateManager-_emergencyExitLockedFundReleased`.\\n */\\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {\\n return _lockedFundReleased[_consensusAddr];\\n }\\n\\n /**\\n * @dev Override `CandidateManager-_removeCandidate`.\\n */\\n function _removeCandidate(address _consensusAddr) internal override {\\n delete _lockedFundReleased[_consensusAddr];\\n super._removeCandidate(_consensusAddr);\\n }\\n\\n /**\\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\\n */\\n function _bridgeOperatorOf(address _consensusAddr)\\n internal\\n view\\n virtual\\n override(CandidateManager, ValidatorInfoStorage)\\n returns (address)\\n {\\n return CandidateManager._bridgeOperatorOf(_consensusAddr);\\n }\\n\\n /**\\n * @dev See `setEmergencyExitLockedAmount.\\n */\\n function _setEmergencyExitLockedAmount(uint256 _amount) internal {\\n _emergencyExitLockedAmount = _amount;\\n emit EmergencyExitLockedAmountUpdated(_amount);\\n }\\n\\n /**\\n * @dev See `setEmergencyExpiryDuration`.\\n */\\n function _setEmergencyExpiryDuration(uint256 _duration) internal {\\n _emergencyExpiryDuration = _duration;\\n emit EmergencyExpiryDurationUpdated(_duration);\\n }\\n}\\n\",\"keccak256\":\"0x829dd3adae7a2171205dacc768d47f398be52669de1bb32ed3f8b91db6fc8885\",\"license\":\"MIT\"},\"contracts/ronin/validator/RoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"./CoinbaseExecution.sol\\\";\\nimport \\\"./SlashingExecution.sol\\\";\\n\\ncontract RoninValidatorSet is Initializable, CoinbaseExecution, SlashingExecution {\\n constructor() {\\n _disableInitializers();\\n }\\n\\n fallback() external payable {\\n _fallback();\\n }\\n\\n receive() external payable {\\n _fallback();\\n }\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __slashIndicatorContract,\\n address __stakingContract,\\n address __stakingVestingContract,\\n address __maintenanceContract,\\n address __roninTrustedOrganizationContract,\\n address __bridgeTrackingContract,\\n uint256 __maxValidatorNumber,\\n uint256 __maxValidatorCandidate,\\n uint256 __maxPrioritizedValidatorNumber,\\n uint256 __minEffectiveDaysOnwards,\\n uint256 __numberOfBlocksInEpoch,\\n // __emergencyExitConfigs[0]: emergencyExitLockedAmount\\n // __emergencyExitConfigs[1]: emergencyExpiryDuration\\n uint256[2] calldata __emergencyExitConfigs\\n ) external initializer {\\n _setSlashIndicatorContract(__slashIndicatorContract);\\n _setStakingContract(__stakingContract);\\n _setStakingVestingContract(__stakingVestingContract);\\n _setMaintenanceContract(__maintenanceContract);\\n _setBridgeTrackingContract(__bridgeTrackingContract);\\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\\n _setMaxValidatorNumber(__maxValidatorNumber);\\n _setMaxValidatorCandidate(__maxValidatorCandidate);\\n _setMaxPrioritizedValidatorNumber(__maxPrioritizedValidatorNumber);\\n _setMinEffectiveDaysOnwards(__minEffectiveDaysOnwards);\\n _setEmergencyExitLockedAmount(__emergencyExitConfigs[0]);\\n _setEmergencyExpiryDuration(__emergencyExitConfigs[1]);\\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\\n }\\n\\n /**\\n * @dev Only receives RON from staking vesting contract (for topping up bonus), and from staking contract (for transferring\\n * deducting amount on slashing).\\n */\\n function _fallback() internal view {\\n if (msg.sender != stakingVestingContract() && msg.sender != stakingContract()) revert ErrUnauthorizedReceiveRON();\\n }\\n\\n /**\\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\\n */\\n function _bridgeOperatorOf(address _consensusAddr)\\n internal\\n view\\n override(EmergencyExit, ValidatorInfoStorage)\\n returns (address)\\n {\\n return super._bridgeOperatorOf(_consensusAddr);\\n }\\n}\\n\",\"keccak256\":\"0xd7a2ac4d3a2c8edbd1bbfb1ef3549ef0a019b4c9b4f1c12f1fd07b116b1adab3\",\"license\":\"MIT\"},\"contracts/ronin/validator/SlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/collections/HasSlashIndicatorContract.sol\\\";\\nimport \\\"../../extensions/collections/HasStakingContract.sol\\\";\\nimport \\\"../../interfaces/validator/ISlashingExecution.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"./storage-fragments/CommonStorage.sol\\\";\\n\\nabstract contract SlashingExecution is\\n ISlashingExecution,\\n HasSlashIndicatorContract,\\n HasStakingContract,\\n CommonStorage\\n{\\n /**\\n * @inheritdoc ISlashingExecution\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external override onlySlashIndicatorContract {\\n uint256 _period = currentPeriod();\\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = true;\\n\\n _totalDeprecatedReward += _miningReward[_validatorAddr] + _delegatingReward[_validatorAddr];\\n\\n delete _miningReward[_validatorAddr];\\n delete _delegatingReward[_validatorAddr];\\n\\n _blockProducerJailedBlock[_validatorAddr] = Math.max(_newJailedUntil, _blockProducerJailedBlock[_validatorAddr]);\\n\\n if (_slashAmount > 0) {\\n uint256 _actualAmount = _stakingContract.execDeductStakingAmount(_validatorAddr, _slashAmount);\\n _totalDeprecatedReward += _actualAmount;\\n }\\n\\n if (_cannotBailout) {\\n _cannotBailoutUntilBlock[_validatorAddr] = Math.max(_newJailedUntil, _cannotBailoutUntilBlock[_validatorAddr]);\\n }\\n\\n emit ValidatorPunished(\\n _validatorAddr,\\n _period,\\n _blockProducerJailedBlock[_validatorAddr],\\n _slashAmount,\\n true,\\n false\\n );\\n }\\n\\n /**\\n * @inheritdoc ISlashingExecution\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external override onlySlashIndicatorContract {\\n if (block.number <= _cannotBailoutUntilBlock[_validatorAddr]) revert ErrCannotBailout(_validatorAddr);\\n\\n // Note: Removing rewards of validator in `bailOut` function is not needed, since the rewards have been\\n // removed previously in the `slash` function.\\n _miningRewardBailoutCutOffAtPeriod[_validatorAddr][_period] = true;\\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = false;\\n _blockProducerJailedBlock[_validatorAddr] = block.number - 1;\\n\\n emit ValidatorUnjailed(_validatorAddr, _period);\\n }\\n}\\n\",\"keccak256\":\"0xf10b8566c1397e3dc86c6c16dcd20bf91011726b01dbff7da3a9d9a59bdee9b0\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/CommonStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../interfaces/validator/info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./JailingStorage.sol\\\";\\nimport \\\"./TimingStorage.sol\\\";\\nimport \\\"./ValidatorInfoStorage.sol\\\";\\n\\nabstract contract CommonStorage is ICommonInfo, TimingStorage, JailingStorage, ValidatorInfoStorage {\\n /// @dev Mapping from consensus address => pending reward from producing block\\n mapping(address => uint256) internal _miningReward;\\n /// @dev Mapping from consensus address => pending reward from delegating\\n mapping(address => uint256) internal _delegatingReward;\\n\\n /// @dev The total reward for bridge operators\\n uint256 internal _totalBridgeReward;\\n /// @dev Mapping from consensus address => pending reward for being bridge operator\\n mapping(address => uint256) internal _bridgeOperatingReward;\\n\\n /// @dev The deprecated reward that has not been withdrawn by admin\\n uint256 internal _totalDeprecatedReward;\\n\\n /// @dev The amount of RON to lock from a consensus address.\\n uint256 internal _emergencyExitLockedAmount;\\n /// @dev The duration that an emergency request is expired and the fund will be recycled.\\n uint256 internal _emergencyExpiryDuration;\\n /// @dev The address list of consensus addresses that being locked fund.\\n address[] internal _lockedConsensusList;\\n /// @dev Mapping from consensus => request exist info\\n mapping(address => EmergencyExitInfo) internal _exitInfo;\\n /// @dev Mapping from consensus => flag indicating whether the locked fund is released\\n mapping(address => bool) internal _lockedFundReleased;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[44] private ______gap;\\n\\n /**\\n * @inheritdoc ICommonInfo\\n */\\n function getEmergencyExitInfo(address _consensusAddr)\\n external\\n view\\n override\\n returns (EmergencyExitInfo memory _info)\\n {\\n _info = _exitInfo[_consensusAddr];\\n if (_info.recyclingAt == 0) revert NonExistentRecyclingInfo();\\n }\\n\\n /**\\n * @inheritdoc ICommonInfo\\n */\\n function totalDeprecatedReward() external view override returns (uint256) {\\n return _totalDeprecatedReward;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function epochOf(uint256 _block)\\n public\\n view\\n virtual\\n override(ITimingInfo, JailingStorage, TimingStorage)\\n returns (uint256)\\n {\\n return TimingStorage.epochOf(_block);\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function currentPeriod() public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) {\\n return TimingStorage.currentPeriod();\\n }\\n}\\n\",\"keccak256\":\"0x7372a3febdddcd1fa0fdfd06eba11c58d1c3113ea1b408c0ab13b99eeeeb7b22\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/JailingStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../interfaces/validator/info-fragments/IJailingInfo.sol\\\";\\nimport \\\"./TimingStorage.sol\\\";\\n\\nabstract contract JailingStorage is IJailingInfo {\\n /// @dev Mapping from consensus address => period number => block producer has no pending reward.\\n mapping(address => mapping(uint256 => bool)) internal _miningRewardDeprecatedAtPeriod;\\n /// @dev Mapping from consensus address => period number => whether the block producer get cut off reward, due to bailout.\\n mapping(address => mapping(uint256 => bool)) internal _miningRewardBailoutCutOffAtPeriod;\\n /// @dev Mapping from consensus address => period number => block operator has no pending reward.\\n mapping(address => mapping(uint256 => bool)) internal _bridgeRewardDeprecatedAtPeriod;\\n\\n /// @dev Mapping from consensus address => the last block that the block producer is jailed.\\n mapping(address => uint256) internal _blockProducerJailedBlock;\\n /// @dev Mapping from consensus address => the last timestamp that the bridge operator is jailed.\\n mapping(address => uint256) internal _emergencyExitJailedTimestamp;\\n /// @dev Mapping from consensus address => the last block that the block producer cannot bailout.\\n mapping(address => uint256) internal _cannotBailoutUntilBlock;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] private ______gap;\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkJailed(address _addr) external view override returns (bool) {\\n return checkJailedAtBlock(_addr, block.number);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n override\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n )\\n {\\n return getJailedTimeLeftAtBlock(_addr, block.number);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) public view override returns (bool) {\\n return _jailedAtBlock(_addr, _blockNum);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n public\\n view\\n override\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n )\\n {\\n uint256 _jailedBlock = _blockProducerJailedBlock[_addr];\\n if (_jailedBlock < _blockNum) {\\n return (false, 0, 0);\\n }\\n\\n isJailed_ = true;\\n blockLeft_ = _jailedBlock - _blockNum + 1;\\n epochLeft_ = epochOf(_jailedBlock) - epochOf(_blockNum) + 1;\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkManyJailed(address[] calldata _addrList) external view override returns (bool[] memory _result) {\\n _result = new bool[](_addrList.length);\\n for (uint256 _i; _i < _addrList.length; _i++) {\\n _result[_i] = _jailed(_addrList[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view override returns (bool _result) {\\n uint256 _period = currentPeriod();\\n return _miningRewardDeprecated(_blockProducer, _period);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period)\\n external\\n view\\n override\\n returns (bool _result)\\n {\\n return _miningRewardDeprecated(_blockProducer, _period);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n *\\n * @dev Because the information of deprecating bridge reward of a period is only determined at the end of that period, this\\n * method will return the deprecating info of the latest period. A method for querying that info of current period is no need.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr)\\n external\\n view\\n override\\n returns (bool _result)\\n {\\n uint256 _period = currentPeriod() - 1;\\n return _bridgeRewardDeprecated(_consensusAddr, _period);\\n }\\n\\n /**\\n * @inheritdoc IJailingInfo\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n override\\n returns (bool _result)\\n {\\n return _bridgeRewardDeprecated(_consensusAddr, _period);\\n }\\n\\n /**\\n * @dev See `ITimingInfo-epochOf`\\n */\\n function epochOf(uint256 _block) public view virtual returns (uint256);\\n\\n /**\\n * @dev See `ITimingInfo-currentPeriod`\\n */\\n function currentPeriod() public view virtual returns (uint256);\\n\\n /**\\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) during the current period.\\n */\\n function _jailed(address _validatorAddr) internal view returns (bool) {\\n return _jailedAtBlock(_validatorAddr, block.number);\\n }\\n\\n /**\\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) at a specific block.\\n */\\n function _jailedAtBlock(address _validatorAddr, uint256 _blockNum) internal view returns (bool) {\\n return _blockNum <= _blockProducerJailedBlock[_validatorAddr];\\n }\\n\\n /**\\n * @dev Returns whether the block producer has no pending reward in that period.\\n */\\n function _miningRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\\n return _miningRewardDeprecatedAtPeriod[_validatorAddr][_period];\\n }\\n\\n /**\\n * @dev Returns whether the bridge operator has no pending reward in the period.\\n */\\n function _bridgeRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\\n return _bridgeRewardDeprecatedAtPeriod[_validatorAddr][_period];\\n }\\n}\\n\",\"keccak256\":\"0x14ae5cc1f190f1b3e4517677b013638afc39a35d538303b8f0280fe1a52042c6\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/TimingStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../extensions/consumers/GlobalConfigConsumer.sol\\\";\\nimport \\\"../../../interfaces/validator/info-fragments/ITimingInfo.sol\\\";\\n\\nabstract contract TimingStorage is ITimingInfo, GlobalConfigConsumer {\\n /// @dev The number of blocks in a epoch\\n uint256 internal _numberOfBlocksInEpoch;\\n /// @dev The last updated block\\n uint256 internal _lastUpdatedBlock;\\n /// @dev The last updated period\\n uint256 internal _lastUpdatedPeriod;\\n /// @dev The starting block of the last updated period\\n uint256 internal _currentPeriodStartAtBlock;\\n\\n /// @dev Mapping from epoch index => period index\\n mapping(uint256 => uint256) internal _periodOf;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] private ______gap;\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function getLastUpdatedBlock() external view override returns (uint256) {\\n return _lastUpdatedBlock;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function epochOf(uint256 _block) public view virtual override returns (uint256) {\\n return _block / _numberOfBlocksInEpoch + 1;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber) {\\n return (_epoch <= epochOf(block.number) || _periodOf[_epoch] > 0, _periodOf[_epoch]);\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function isPeriodEnding() external view override returns (bool) {\\n return _isPeriodEnding(_computePeriod(block.timestamp));\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function epochEndingAt(uint256 _block) public view virtual override returns (bool) {\\n return _block % _numberOfBlocksInEpoch == _numberOfBlocksInEpoch - 1;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function currentPeriod() public view virtual override returns (uint256) {\\n return _lastUpdatedPeriod;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function currentPeriodStartAtBlock() public view override returns (uint256) {\\n return _currentPeriodStartAtBlock;\\n }\\n\\n /**\\n * @inheritdoc ITimingInfo\\n */\\n function numberOfBlocksInEpoch() public view virtual override returns (uint256 _numberOfBlocks) {\\n return _numberOfBlocksInEpoch;\\n }\\n\\n /**\\n * @dev See `ITimingInfo-isPeriodEnding`\\n */\\n function _isPeriodEnding(uint256 _newPeriod) internal view virtual returns (bool) {\\n return _newPeriod > _lastUpdatedPeriod;\\n }\\n\\n /**\\n * @dev Returns the calculated period.\\n */\\n function _computePeriod(uint256 _timestamp) internal pure returns (uint256) {\\n return _timestamp / PERIOD_DURATION;\\n }\\n}\\n\",\"keccak256\":\"0xc545f119b8b8978d793b62f2495dc2d49c3f416791459b9833bdc65f4dae8e7f\",\"license\":\"MIT\"},\"contracts/ronin/validator/storage-fragments/ValidatorInfoStorage.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\nimport \\\"../../../extensions/collections/HasRoninTrustedOrganizationContract.sol\\\";\\nimport \\\"../../../interfaces/validator/info-fragments/IValidatorInfo.sol\\\";\\n\\nabstract contract ValidatorInfoStorage is IValidatorInfo, HasRoninTrustedOrganizationContract {\\n using EnumFlags for EnumFlags.ValidatorFlag;\\n\\n /// @dev The maximum number of validator.\\n uint256 internal _maxValidatorNumber;\\n\\n /// @dev The total of validators\\n uint256 public validatorCount;\\n /// @dev Mapping from validator index => validator address\\n mapping(uint256 => address) internal _validators;\\n /// @dev Mapping from address => flag indicating the validator ability: producing block, operating bridge\\n mapping(address => EnumFlags.ValidatorFlag) internal _validatorMap;\\n /// @dev The number of slot that is reserved for prioritized validators\\n uint256 internal _maxPrioritizedValidatorNumber;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getValidators()\\n public\\n view\\n override\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n )\\n {\\n _validatorList = new address[](validatorCount);\\n _bridgeOperators = new address[](validatorCount);\\n _flags = new EnumFlags.ValidatorFlag[](validatorCount);\\n for (uint _i; _i < _validatorList.length; _i++) {\\n address _validator = _validators[_i];\\n _validatorList[_i] = _validator;\\n _bridgeOperators[_i] = _bridgeOperatorOf(_validator);\\n _flags[_i] = _validatorMap[_validator];\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isValidator(address _addr) public view override returns (bool) {\\n return !_validatorMap[_addr].isNone();\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getBlockProducers() public view override returns (address[] memory _result) {\\n _result = new address[](validatorCount);\\n uint256 _count = 0;\\n for (uint _i; _i < _result.length; _i++) {\\n if (isBlockProducer(_validators[_i])) {\\n _result[_count++] = _validators[_i];\\n }\\n }\\n\\n assembly {\\n mstore(_result, _count)\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isBlockProducer(address _addr) public view override returns (bool) {\\n return _validatorMap[_addr].hasFlag(EnumFlags.ValidatorFlag.BlockProducer);\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function totalBlockProducers() external view returns (uint256 _total) {\\n for (uint _i; _i < validatorCount; _i++) {\\n if (isBlockProducer(_validators[_i])) {\\n _total++;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getBridgeOperators() public view override returns (address[] memory _result) {\\n _result = new address[](validatorCount);\\n uint256 _count = 0;\\n for (uint _i; _i < _result.length; _i++) {\\n if (isOperatingBridge(_validators[_i])) {\\n _result[_count++] = _bridgeOperatorOf(_validators[_i]);\\n }\\n }\\n\\n assembly {\\n mstore(_result, _count)\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs)\\n public\\n view\\n override\\n returns (address[] memory _result)\\n {\\n _result = new address[](_validatorAddrs.length);\\n for (uint _i; _i < _result.length; _i++) {\\n _result[_i] = _bridgeOperatorOf(_validatorAddrs[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isBridgeOperator(address _bridgeOperatorAddr) external view override returns (bool _isOperator) {\\n for (uint _i; _i < validatorCount; _i++) {\\n if (_bridgeOperatorOf(_validators[_i]) == _bridgeOperatorAddr && isOperatingBridge(_validators[_i])) {\\n _isOperator = true;\\n break;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function isOperatingBridge(address _consensusAddr) public view override returns (bool) {\\n return _validatorMap[_consensusAddr].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator);\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {\\n return _maxValidatorNumber;\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function maxPrioritizedValidatorNumber() external view override returns (uint256 _maximumPrioritizedValidatorNumber) {\\n return _maxPrioritizedValidatorNumber;\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function totalBridgeOperators() public view returns (uint256 _total) {\\n for (uint _i; _i < validatorCount; _i++) {\\n if (isOperatingBridge(_validators[_i])) {\\n _total++;\\n }\\n }\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function setMaxValidatorNumber(uint256 _max) external override onlyAdmin {\\n _setMaxValidatorNumber(_max);\\n }\\n\\n /**\\n * @inheritdoc IValidatorInfo\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _number) external override onlyAdmin {\\n _setMaxPrioritizedValidatorNumber(_number);\\n }\\n\\n /**\\n * @dev Returns the bridge operator of a consensus address.\\n */\\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address);\\n\\n /**\\n * @dev See `IValidatorInfo-setMaxValidatorNumber`\\n */\\n function _setMaxValidatorNumber(uint256 _number) internal {\\n _maxValidatorNumber = _number;\\n emit MaxValidatorNumberUpdated(_number);\\n }\\n\\n /**\\n * @dev See `IValidatorInfo-setMaxPrioritizedValidatorNumber`\\n */\\n function _setMaxPrioritizedValidatorNumber(uint256 _number) internal {\\n if (_number > _maxValidatorNumber) revert ErrInvalidMaxPrioritizedValidatorNumber();\\n _maxPrioritizedValidatorNumber = _number;\\n emit MaxPrioritizedValidatorNumberUpdated(_number);\\n }\\n}\\n\",\"keccak256\":\"0x19dca6ad64bd68923a8eaa9983ccfe0adb8cd7ad5d94b4ba708c35483adc430e\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b506200001c62000022565b620000e4565b600054610100900460ff16156200008f5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff9081161015620000e2576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b615ffb80620000f46000396000f3fe6080604052600436106103455760003560e01c8063038278841461035c57806304d971ab1461038557806306040618146103b55780630f43a677146103ca5780631104e528146103e057806311662dc2146104005780631196ab661461043d57806315b5ebde1461045d5780631ab4a34c1461047d5780631f6288011461049d578063217f35c2146104bd57806323c65eb0146104d257806328bde1e1146104f25780632924de711461051f578063297a8fca1461053f5780632bcf3d15146105545780632d784a98146105745780632f78204c146105a157806331a8aef5146105c15780633529214b146105e1578063367ec12b146106035780633b3159b6146106235780634244d4c9146106375780634493421e14610664578063468c96ae1461068257806346fe9311146106b957806349096d26146106d95780634d8df063146106ee5780634de2b7351461070e5780634ee4d72b1461073b5780634f2a693f1461075057806352091f17146107705780635248184a146107785780635511cde11461079a578063562d5304146107b85780635a08482d146107cd578063605239a1146107e257806365244ece146107f75780636558954f146108175780636611f8431461082e578063690b75361461084e5780636aa1c2ef1461086357806372e46810146108785780637593ff7114610880578063823a7b9c146108a0578063873a5a70146108c057806387c891bd146108e05780638d559c38146108f557806396585fc2146109095780639b19dbfd146109295780639c8d98da1461093e5780639dd373b91461095e5780639e94b9ec1461097e578063a0c3f2d214610993578063a3d545f5146109b3578063a66c0f77146109d3578063a7c2f119146109e8578063ad29578314610a08578063b405aaf214610a28578063b5e337de14610a48578063b7ab4db514610a68578063ba77b06c14610a8c578063c3c8b5d614610aa1578063c94aaa0214610ac1578063cba44de914610ae1578063d09f1ab414610af6578063d2cb215e14610b0b578063d5a0744f14610b29578063dd716ad314610b49578063e5125a1d14610b69578063edb194bb14610b89578063ee99205c14610beb578063eeb629a814610c00578063facd743b14610c1557610354565b3661035457610352610c35565b005b610352610c35565b34801561036857600080fd5b506103726104b081565b6040519081526020015b60405180910390f35b34801561039157600080fd5b506103a56103a0366004615439565b610c9a565b604051901515815260200161037c565b3480156103c157600080fd5b50610372610cc1565b3480156103d657600080fd5b5061037260aa5481565b3480156103ec57600080fd5b506103526103fb366004615472565b610cd1565b34801561040c57600080fd5b5061042061041b3660046154d6565b610f5c565b60408051931515845260208401929092529082015260600161037c565b34801561044957600080fd5b50610352610458366004615502565b610fdf565b34801561046957600080fd5b506103526104783660046154d6565b611023565b34801561048957600080fd5b506103a561049836600461551b565b61113f565b3480156104a957600080fd5b506103a56104b836600461551b565b611169565b3480156104c957600080fd5b506103a56111a3565b3480156104de57600080fd5b506103a56104ed3660046154d6565b6111b8565b3480156104fe57600080fd5b5061051261050d36600461551b565b6111c4565b60405161037c919061558c565b34801561052b57600080fd5b506103a561053a36600461551b565b611267565b34801561054b57600080fd5b50600454610372565b34801561056057600080fd5b5061035261056f36600461551b565b611273565b34801561058057600080fd5b5061059461058f36600461551b565b6112df565b60405161037c919061559a565b3480156105ad57600080fd5b506103526105bc3660046155bf565b611341565b3480156105cd57600080fd5b506103a56105dc3660046154d6565b61155d565b3480156105ed57600080fd5b506105f6611569565b60405161037c9190615609565b34801561060f57600080fd5b5061035261061e36600461562e565b611578565b34801561062f57600080fd5b5060686105f6565b34801561064357600080fd5b5061065761065236600461575d565b611703565b60405161037c919061583f565b34801561067057600080fd5b50606e546001600160a01b03166105f6565b34801561068e57600080fd5b506106a261069d366004615502565b6117ba565b60408051921515835260208301919091520161037c565b3480156106c557600080fd5b506103526106d436600461551b565b6117f8565b3480156106e557600080fd5b50610657611864565b3480156106fa57600080fd5b50610352610709366004615502565b61194d565b34801561071a57600080fd5b5061072e610729366004615852565b61198e565b60405161037c91906158c6565b34801561074757600080fd5b5060e454610372565b34801561075c57600080fd5b5061035261076b366004615502565b611a49565b610352611a8a565b34801561078457600080fd5b5061078d611e49565b60405161037c919061590c565b3480156107a657600080fd5b5060a8546001600160a01b03166105f6565b3480156107c457600080fd5b50610372611f79565b3480156107d957600080fd5b506105f6611fcd565b3480156107ee57600080fd5b50607254610372565b34801561080357600080fd5b506103a561081236600461551b565b611fdc565b34801561082357600080fd5b506103726201518081565b34801561083a57600080fd5b50610352610849366004615502565b612010565b34801561085a57600080fd5b5060e554610372565b34801561086f57600080fd5b50600154610372565b610352612051565b34801561088c57600080fd5b506103a561089b366004615502565b6122b1565b3480156108ac57600080fd5b506103526108bb366004615502565b6122d5565b3480156108cc57600080fd5b506103a56108db36600461551b565b612316565b3480156108ec57600080fd5b50600254610372565b34801561090157600080fd5b5060666105f6565b34801561091557600080fd5b5061042061092436600461551b565b61232d565b34801561093557600080fd5b50610657612349565b34801561094a57600080fd5b5061035261095936600461551b565b612435565b34801561096a57600080fd5b5061035261097936600461551b565b6124a1565b34801561098a57600080fd5b5061037261250d565b34801561099f57600080fd5b506103a56109ae36600461551b565b612561565b3480156109bf57600080fd5b506103726109ce366004615502565b61257e565b3480156109df57600080fd5b5060e654610372565b3480156109f457600080fd5b50610352610a033660046154d6565b612589565b348015610a1457600080fd5b50610352610a2336600461551b565b612835565b348015610a3457600080fd5b506103a5610a4336600461551b565b6128a1565b348015610a5457600080fd5b50610352610a6336600461551b565b612926565b348015610a7457600080fd5b50610a7d612992565b60405161037c93929190615964565b348015610a9857600080fd5b50610657612b70565b348015610aad57600080fd5b50610352610abc366004615439565b612bd2565b348015610acd57600080fd5b50610352610adc366004615502565b612e55565b348015610aed57600080fd5b50607654610372565b348015610b0257600080fd5b5060a954610372565b348015610b1757600080fd5b50606f546001600160a01b03166105f6565b348015610b3557600080fd5b506103a5610b443660046154d6565b612e96565b348015610b5557600080fd5b50610352610b643660046154d6565b612ea2565b348015610b7557600080fd5b50610352610b843660046159dd565b612f4c565b348015610b9557600080fd5b50610594610ba436600461551b565b6040805180820190915260008082526020820152506001600160a01b0316600090815260776020908152604091829020825180840190935280548352600101549082015290565b348015610bf757600080fd5b506105f661307f565b348015610c0c57600080fd5b5060ad54610372565b348015610c2157600080fd5b506103a5610c3036600461551b565b61308e565b610c3d611569565b6001600160a01b0316336001600160a01b031614158015610c775750610c6161307f565b6001600160a01b0316336001600160a01b031614155b15610c985760405160016234baed60e01b0319815260040160405180910390fd5b565b6001600160a01b038281166000908152607560205260409020548116908216145b92915050565b6000610ccc60035490565b905090565b33610cda61307f565b6001600160a01b031614610d0157604051638aaf4a0760e01b815260040160405180910390fd5b6073546072548110610d2657604051638616841b60e01b815260040160405180910390fd5b610d2f85612561565b15610d4d57604051638ad9cdf960e01b815260040160405180910390fd5b612710821115610d7057604051631b8454a360e21b815260040160405180910390fd5b60005b607354811015610e6b5760006075600060738481548110610d9657610d96615a12565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190208054909250811690891603610df2578760405163fc3d8c7560e01b8152600401610de99190615609565b60405180910390fd5b60028101546001600160a01b0390811690871603610e255785604051632d33a7e760e11b8152600401610de99190615609565b60038101546001600160a01b0390811690861603610e5857846040516350e1263b60e01b8152600401610de99190615609565b5080610e6381615a3e565b915050610d73565b506001600160a01b038581166000818152607460209081526040808320861990556073805460018082019092557ff79bde9ddd17963ebce6f7d021d60de7c2bd0db944d23c900c0c0e775f5300520180546001600160a01b03199081168717909155607590935292819020805483168c87169081178255938101805484168617905560028101805484168b8816908117909155600382018054909416968a1696909617909255600482018790555190939192907fd690f592ed983cfbc05717fbcf06c4e10ae328432c309fe49246cf4a4be69fcd90610f4b908990615609565b60405180910390a450505050505050565b6001600160a01b0382166000908152603a60205260408120548190819084811015610f9257600080600093509350935050610fd8565b60019350610fa08582615a57565b610fab906001615a6a565b9250610fb68561257e565b610fbf8261257e565b610fc99190615a57565b610fd4906001615a6a565b9150505b9250925092565b610fe76130cb565b6001600160a01b0316336001600160a01b0316146110175760405162461bcd60e51b8152600401610de990615a7d565b611020816130f9565b50565b3361102c611fcd565b6001600160a01b031614611053576040516328b9c24b60e21b815260040160405180910390fd5b6001600160a01b0382166000908152603c6020526040902054431161108d57816040516353e0424d60e01b8152600401610de99190615609565b6001600160a01b038216600081815260386020908152604080832085845282528083208054600160ff1991821681179092559484526037835281842086855290925290912080549092169091556110e49043615a57565b6001600160a01b0383166000818152603a6020526040908190209290925590517f6bb2436cb6b6eb65d5a52fac2ae0373a77ade6661e523ef3004ee2d5524e6c6e906111339084815260200190565b60405180910390a25050565b600080600161114c610cc1565b6111569190615a57565b90506111628382613157565b9392505050565b6001600160a01b038116600090815260ac6020526040812054610cbb9060029060ff16600381111561119d5761119d61594e565b90613182565b6000610ccc6111b1426131b5565b6003541090565b600061116283836131c4565b6111cc6153e8565b6111d582612561565b6111f25760405163a64b34ad60e01b815260040160405180910390fd5b506001600160a01b03908116600090815260756020908152604091829020825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015290565b6000610cbb82436111b8565b61127b6130cb565b6001600160a01b0316336001600160a01b0316146112ab5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b6000036112d657604051637bcd509160e01b815260040160405180910390fd5b611020816131e4565b604080518082018252600080825260209182018190526001600160a01b038416815260e88252828120835180850190945280548452600101549183018290520361133c576040516370fdd4f160e11b815260040160405180910390fd5b919050565b3361134a611fcd565b6001600160a01b031614611371576040516328b9c24b60e21b815260040160405180910390fd5b600061137b610cc1565b6001600160a01b03861660008181526037602090815260408083208584528252808320805460ff1916600117905592825260e181528282205460e0909152919020549192506113c991615a6a565b60e460008282546113da9190615a6a565b90915550506001600160a01b038516600090815260e06020908152604080832083905560e18252808320839055603a90915290205461141a90859061322f565b6001600160a01b0386166000908152603a602052604090205582156114ca5760715460405163138ac02f60e11b81526000916001600160a01b031690632715805e9061146c9089908890600401615abf565b6020604051808303816000875af115801561148b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114af9190615ad8565b90508060e460008282546114c39190615a6a565b9091555050505b811561150e576001600160a01b0385166000908152603c60205260409020546114f490859061322f565b6001600160a01b0386166000908152603c60205260409020555b6001600160a01b0385166000818152603a6020526040808220549051849392600080516020615fa68339815191529261154e929091899160019190615af1565b60405180910390a35050505050565b60006111628383613246565b606d546001600160a01b031690565b600054610100900460ff16158080156115985750600054600160ff909116105b806115b25750303b1580156115b2575060005460ff166001145b6116155760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610de9565b6000805460ff191660011790558015611638576000805461ff0019166101001790555b6116418d6131e4565b61164a8c613271565b6116538b6132bc565b61165c8a613307565b61166588613352565b61166e8961339d565b611677876133e8565b6116808661341d565b61168985613452565b611692846130f9565b61169c82356134aa565b6116a960208301356134df565b600183905580156116f4576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b606081516001600160401b0381111561171e5761171e6156f4565b604051908082528060200260200182016040528015611747578160200160208202803683370190505b50905060005b81518110156117b45761177883828151811061176b5761176b615a12565b6020026020010151613514565b82828151811061178a5761178a615a12565b6001600160a01b0390921660209283029190910190910152806117ac81615a3e565b91505061174d565b50919050565b6000806117c64361257e565b831115806117e1575060008381526005602052604090205415155b600093845260056020526040909320549293915050565b6118006130cb565b6001600160a01b0316336001600160a01b0316146118305760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361185b57604051637bcd509160e01b815260040160405180910390fd5b61102081613307565b606060aa546001600160401b03811115611880576118806156f4565b6040519080825280602002602001820160405280156118a9578160200160208202803683370190505b5090506000805b825181101561194757600081815260ab60205260409020546118da906001600160a01b0316611fdc565b1561193557600081815260ab60205260409020546001600160a01b0316838361190281615a3e565b94508151811061191457611914615a12565b60200260200101906001600160a01b031690816001600160a01b0316815250505b8061193f81615a3e565b9150506118b0565b50815290565b6119556130cb565b6001600160a01b0316336001600160a01b0316146119855760405162461bcd60e51b8152600401610de990615a7d565b611020816134df565b6060816001600160401b038111156119a8576119a86156f4565b6040519080825280602002602001820160405280156119d1578160200160208202803683370190505b50905060005b82811015611a4257611a0e8484838181106119f4576119f4615a12565b9050602002016020810190611a09919061551b565b61351f565b828281518110611a2057611a20615a12565b9115156020928302919091019091015280611a3a81615a3e565b9150506119d7565b5092915050565b611a516130cb565b6001600160a01b0316336001600160a01b031614611a815760405162461bcd60e51b8152600401610de990615a7d565b6110208161341d565b334114611aaa576040516309f358fd60e01b815260040160405180910390fd5b6000611ab533611fdc565b8015611ac75750611ac53361351f565b155b8015611ae15750611adf33611ada610cc1565b613246565b155b606d54604051630634f5b960e01b815282151560048201526001602482015291925060009182916001600160a01b031690630634f5b9906044016060604051808303816000875af1158015611b3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5e9190615b10565b92509250508060e26000828254611b759190615a6a565b90915550839050611bc7573460e46000828254611b929190615a6a565b90915550506040513390600080516020615f8683398151915290611bba903490600190615b47565b60405180910390a2505050565b336001600160a01b03167f0ede5c3be8625943fa64003cd4b91230089411249f3059bac6500873543ca9b13484604051611c02929190615b6b565b60405180910390a26000611c14610cc1565b90506000611c228434615a6a565b3360009081526038602090815260408083208684529091528120549192509060ff1615611d1b576070546040805163631c8fd160e11b815290516000926001600160a01b03169163c6391fa29160048083019260809291908290030181865afa158015611c93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb79190615b79565b93505050506127108184611ccb9190615baf565b611cd59190615bdc565b91508160e46000828254611ce99190615a6a565b90915550506040513390600080516020615f8683398151915290611d11908590600290615b47565b60405180910390a2505b611d258183615a57565b60715460408051632298690160e11b8152815193955060009384936001600160a01b031692634530d20292600480820193918290030181865afa158015611d70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d949190615bf0565b3360009081526075602052604081206004015492945090925090611dc290611dbc908461352b565b8461322f565b90506000612710611dd38784615baf565b611ddd9190615bdc565b33600090815260e06020526040812080549293508392909190611e01908490615a6a565b9091555060009050611e138288615a57565b33600090815260e16020526040812080549293508392909190611e37908490615a6a565b90915550505050505050505050505050565b6073546060906001600160401b03811115611e6657611e666156f4565b604051908082528060200260200182016040528015611e9f57816020015b611e8c6153e8565b815260200190600190039081611e845790505b50905060005b8151811015611f75576075600060738381548110611ec557611ec5615a12565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c08201528251839083908110611f5757611f57615a12565b60200260200101819052508080611f6d90615a3e565b915050611ea5565b5090565b6000805b60aa54811015611f7557600081815260ab6020526040902054611fa8906001600160a01b0316611169565b15611fbb5781611fb781615a3e565b9250505b80611fc581615a3e565b915050611f7d565b6070546001600160a01b031690565b6001600160a01b038116600090815260ac6020526040812054610cbb9060019060ff16600381111561119d5761119d61594e565b6120186130cb565b6001600160a01b0316336001600160a01b0316146120485760405162461bcd60e51b8152600401610de990615a7d565b611020816134aa565b334114612071576040516309f358fd60e01b815260040160405180910390fd5b61207a436122b1565b61209757604051636c74eecf60e01b815260040160405180910390fd5b6120a04361257e565b6120ab60025461257e565b106120c957604051632458f64160e01b815260040160405180910390fd5b4360025560006120d8426131b5565b905060006120e7826003541090565b905060006120f3612992565b50509050606060006121044361257e565b90506000612113826001615a6a565b9050600061211f610cc1565b9050851561224b57612131818661353a565b60008061213e83886138c5565b9150915061214e83888484613af7565b612156613c00565b61215e613d5b565b607054604051631da0214360e21b81526001600160a01b0390911690637680850c90612190908a908790600401615c14565b600060405180830381600087803b1580156121aa57600080fd5b505af11580156121be573d6000803e3d6000fd5b505050506121cb89613e7d565b805191985096501561223a576070546040516303e1697b60e11b81526001600160a01b03909116906307c2d2f69061220790899060040161583f565b600060405180830381600087803b15801561222157600080fd5b505af1158015612235573d6000803e3d6000fd5b505050505b612245436001615a6a565b60045550505b612256878387614008565b82817f0195462033384fec211477c56217da64a58bd405e0bed331ba4ded67e4ae4ce78860405161228b911515815260200190565b60405180910390a350600090815260056020526040902085905550505060039190915550565b6000600180546122c19190615a57565b6001546122ce9084615c36565b1492915050565b6122dd6130cb565b6001600160a01b0316336001600160a01b03161461230d5760405162461bcd60e51b8152600401610de990615a7d565b611020816133e8565b600080612321610cc1565b90506111628382613246565b600080600061233c8443610f5c565b9250925092509193909250565b606060aa546001600160401b03811115612365576123656156f4565b60405190808252806020026020018201604052801561238e578160200160208202803683370190505b5090506000805b825181101561194757600081815260ab60205260409020546123bf906001600160a01b0316611169565b1561242357600081815260ab60205260409020546123e5906001600160a01b0316613514565b83836123f081615a3e565b94508151811061240257612402615a12565b60200260200101906001600160a01b031690816001600160a01b0316815250505b8061242d81615a3e565b915050612395565b61243d6130cb565b6001600160a01b0316336001600160a01b03161461246d5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361249857604051637bcd509160e01b815260040160405180910390fd5b61102081613352565b6124a96130cb565b6001600160a01b0316336001600160a01b0316146124d95760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361250457604051637bcd509160e01b815260040160405180910390fd5b61102081613271565b6000805b60aa54811015611f7557600081815260ab602052604090205461253c906001600160a01b0316611fdc565b1561254f578161254b81615a3e565b9250505b8061255981615a3e565b915050612511565b6001600160a01b0316600090815260746020526040902054151590565b6000610cbb826143d8565b3361259261307f565b6001600160a01b0316146125b957604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b038216600090815260e8602052604090206001810154156125f45760405163057aab3160e31b815260040160405180910390fd5b60006126008342615a6a565b6001600160a01b038516600090815260756020526040902090915061262590826143f3565b6001600160a01b0384166000908152603b6020908152604080832084905560399091528120600191612655610cc1565b8152602081019190915260409081016000908120805460ff19169315159390931790925560715460e554915163138ac02f60e11b81526001600160a01b0390911691632715805e916126ab918991600401615abf565b6020604051808303816000875af11580156126ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126ee9190615ad8565b905080156127eb57600060e654426127069190615a6a565b60e78054600180820183556000929092527f6cb0db1d7354dfb4a1464318006df0643cafe2002a86a29ff8560f900fef28a10180546001600160a01b0319166001600160a01b038a16179055838655850181905590506127646130cb565b6001600160a01b0387811660008181526075602052604090819020600201549051630a2fae5760e41b81526004810192909252821660248201524260448201526064810184905291169063a2fae57090608401600060405180830381600087803b1580156127d157600080fd5b505af11580156127e5573d6000803e3d6000fd5b50505050505b846001600160a01b03167f77a1a819870c0f4d04c3ca4cc2881a0393136abc28bd651af50aedade94a27c48260405161282691815260200190565b60405180910390a25050505050565b61283d6130cb565b6001600160a01b0316336001600160a01b03161461286d5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361289857604051637bcd509160e01b815260040160405180910390fd5b611020816132bc565b6000805b60aa548110156117b457600081815260ab60205260409020546001600160a01b03808516916128d49116613514565b6001600160a01b03161480156129065750600081815260ab6020526040902054612906906001600160a01b0316611169565b1561291457600191506117b4565b8061291e81615a3e565b9150506128a5565b61292e6130cb565b6001600160a01b0316336001600160a01b03161461295e5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361298957604051637bcd509160e01b815260040160405180910390fd5b6110208161339d565b606080606060aa546001600160401b038111156129b1576129b16156f4565b6040519080825280602002602001820160405280156129da578160200160208202803683370190505b50925060aa546001600160401b038111156129f7576129f76156f4565b604051908082528060200260200182016040528015612a20578160200160208202803683370190505b50915060aa546001600160401b03811115612a3d57612a3d6156f4565b604051908082528060200260200182016040528015612a66578160200160208202803683370190505b50905060005b8351811015612b6a57600081815260ab602052604090205484516001600160a01b03909116908190869084908110612aa657612aa6615a12565b60200260200101906001600160a01b031690816001600160a01b031681525050612acf81613514565b848381518110612ae157612ae1615a12565b6001600160a01b03928316602091820292909201810191909152908216600090815260ac9091526040902054835160ff90911690849084908110612b2757612b27615a12565b60200260200101906003811115612b4057612b4061594e565b90816003811115612b5357612b5361594e565b905250819050612b6281615a3e565b915050612a6c565b50909192565b60606073805480602002602001604051908101604052809291908181526020018280548015612bc857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612baa575b5050505050905090565b612bda6130cb565b6001600160a01b0316336001600160a01b031614612c0a5760405162461bcd60e51b8152600401610de990615a7d565b6001600160a01b038216600090815260e8602052604090206001015415612e515760e7548060005b82811015612c8b57846001600160a01b031660e78281548110612c5757612c57615a12565b6000918252602090912001546001600160a01b031603612c7957809150612c8b565b80612c8381615a3e565b915050612c32565b50818103612c995750505050565b6001600160a01b038416600090815260e860205260409020548015612e4d576001600160a01b038516600090815260e860205260408120818155600190810191909155831115612d5b5760e7612cf0600185615a57565b81548110612d0057612d00615a12565b60009182526020909120015460e780546001600160a01b039092169184908110612d2c57612d2c615a12565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480612d6c57612d6c615c4a565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825260e9905260409020805460ff19166001179055612dbe84826104b061446f565b15612e0857836001600160a01b0316856001600160a01b03167f7229136a18186c71a86246c012af3bb1df6460ef163934bbdccd6368abdd41e48360405161154e91815260200190565b836001600160a01b0316856001600160a01b03167f3747d14eb72ad3e35cba9c3e00dab3b8d15b40cac6bdbd08402356e4f69f30a1834760405161154e929190615b6b565b5050505b5050565b612e5d6130cb565b6001600160a01b0316336001600160a01b031614612e8d5760405162461bcd60e51b8152600401610de990615a7d565b61102081613452565b60006111628383613157565b33612eab61307f565b6001600160a01b031614612ed257604051638aaf4a0760e01b815260040160405180910390fd5b612edb826144cf565b15612ef95760405163030081e760e01b815260040160405180910390fd5b6001600160a01b0382166000908152607560205260409020600581015415612f345760405163fab9167360e01b815260040160405180910390fd5b612f4781612f428442615a6a565b6143f3565b505050565b33612f5561307f565b6001600160a01b031614612f7c57604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604090205415612fb357604051632f32dcdd60e11b815260040160405180910390fd5b612710811115612fd657604051631b8454a360e21b815260040160405180910390fd5b607654821015612ff95760405163fa0ae69360e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604081209062015180846130218242615bdc565b61302b9190615a6a565b6130359190615baf565b808355600183018490556040519091506001600160a01b038616907f6ebafd1bb6316b2f63198a81b05cff2149c6eaae1784466a6d062b4391900f21906128269084908790615b6b565b6071546001600160a01b031690565b6001600160a01b038116600090815260ac60205260408120546130c49060ff1660038111156130bf576130bf61594e565b61454c565b1592915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b600181101561311b576040516317b8970f60e01b815260040160405180910390fd5b60768190556040518181527f266d432ffe659e3565750d26ec685b822a58041eee724b67a5afec3168a25267906020015b60405180910390a150565b6001600160a01b03919091166000908152603960209081526040808320938352929052205460ff1690565b60008160038111156131965761319661594e565b8360038111156131a8576131a861594e565b1660ff1615159392505050565b6000610cbb6201518083615bdc565b6001600160a01b03919091166000908152603a6020526040902054101590565b607080546001600160a01b0319166001600160a01b0383161790556040517faa5b07dd43aa44c69b70a6a2b9c3fcfed12b6e5f6323596ba7ac91035ab80a4f9061314c908390615609565b60008183101561323f5781611162565b5090919050565b6001600160a01b03919091166000908152603760209081526040808320938352929052205460ff1690565b607180546001600160a01b0319166001600160a01b0383161790556040517f6397f5b135542bb3f477cb346cfab5abdec1251d08dc8f8d4efb4ffe122ea0bf9061314c908390615609565b606d80546001600160a01b0319166001600160a01b0383161790556040517fc328090a37d855191ab58469296f98f87a851ca57d5cdfd1e9ac3c83e9e7096d9061314c908390615609565b606f80546001600160a01b0319166001600160a01b0383161790556040517f31a33f126a5bae3c5bdf6cfc2cd6dcfffe2fe9634bdb09e21c44762993889e3b9061314c908390615609565b606e80546001600160a01b0319166001600160a01b0383161790556040517f034c8da497df28467c79ddadbba1cc3cdd41f510ea73faae271e6f16a61116219061314c908390615609565b60a880546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d79061314c908390615609565b60a98190556040518181527fb5464c05fd0e0f000c535850116cda2742ee1f7b34384cb920ad7b8e802138b59060200161314c565b60728190556040518181527f82d5dc32d1b741512ad09c32404d7e7921e8934c6222343d95f55f7a2b9b2ab49060200161314c565b60a954811115613475576040516355408ce960e11b815260040160405180910390fd5b60ad8190556040518181527fa9588dc77416849bd922605ce4fc806712281ad8a8f32d4238d6c8cca548e15e9060200161314c565b60e58190556040518181527f17a6c3eb965cdd7439982da25abf85be88f0f772ca33198f548e2f99fee0289a9060200161314c565b60e68190556040518181527f0a50c66137118f386332efb949231ddd3946100dbf880003daca37ddd9e0662b9060200161314c565b6000610cbb8261456a565b6000610cbb82436131c4565b600081831061323f5781611162565b606e5460405163889998ef60e01b8152600481018490526000916001600160a01b03169063889998ef90602401602060405180830381865afa158015613584573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135a89190615ad8565b606e5460405163033cdc2b60e31b8152600481018690529192506000916001600160a01b03909116906319e6e15890602401602060405180830381865afa1580156135f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061361b9190615ad8565b606e549091506000906001600160a01b031663f67e81528661363c87611703565b6040518363ffffffff1660e01b8152600401613659929190615c60565b600060405180830381865afa158015613676573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261369e9190810190615c81565b90506136ab83838361458f565b15806136b5575081155b156137325760005b845181101561372a57845160e2546136d59190615bdc565b60e360008784815181106136eb576136eb615a12565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550808061372290615a3e565b9150506136bd565b505050505050565b600080600080607060009054906101000a90046001600160a01b03166001600160a01b0316631079402a6040518163ffffffff1660e01b8152600401608060405180830381865afa15801561378b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137af9190615b79565b9296509094509250905080861160005b89518110156138b857888782815181106137db576137db615a12565b602002602001015160e2546137f09190615baf565b6137fa9190615bdc565b60e360008c848151811061381057613810615a12565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208190555081156138a6576138a68b8b838151811061385857613858615a12565b60200260200101518a6127108b868151811061387657613876615a12565b60200260200101516138889190615baf565b6138929190615bdc565b61389e90612710615a57565b878a8a614648565b806138b081615a3e565b9150506137bf565b5050505050505050505050565b6000606060008084516001600160401b038111156138e5576138e56156f4565b60405190808252806020026020018201604052801561390e578160200160208202803683370190505b50925060005b8551811015613ae75785818151811061392f5761392f615a12565b6020908102919091018101516001600160a01b03808216600090815260759093526040909220600201549094501691506139698388613157565b61399c576001600160a01b0380841660009081526075602052604090206003015461399791859116846148a8565b6139ce565b6001600160a01b038316600090815260e3602052604081205460e48054919290916139c8908490615a6a565b90915550505b6139d78361351f565b1580156139eb57506139e98388613246565b155b15613a5f576001600160a01b038316600090815260e16020526040902054613a139086615a6a565b6001600160a01b038416600090815260e16020526040902054855191965090859083908110613a4457613a44615a12565b602002602001018181525050613a5a8383614985565b613aa5565b6001600160a01b038316600090815260e1602090815260408083205460e090925290912054613a8e9190615a6a565b60e46000828254613a9f9190615a6a565b90915550505b6001600160a01b038316600090815260e16020908152604080832083905560e0825280832083905560e390915281205580613adf81615a3e565b915050613914565b5060e26000905550509250929050565b6071546001600160a01b03168215612e4d57613b138184614a4d565b15613bbb5760405163566bce2360e11b81526001600160a01b0382169063acd79c4690613b4890879086908a90600401615d36565b600060405180830381600087803b158015613b6257600080fd5b505af1158015613b76573d6000803e3d6000fd5b505050507f9e242ca1ef9dde96eb71ef8d19a3f0f6a619b63e4c0d3998771387103656d087838584604051613bad93929190615d6c565b60405180910390a150613bfa565b7fe5668ec1bb2b6bb144a50f810e388da4b1d7d3fc05fcb9d588a1aac59d248f8983858447604051613bf09493929190615da1565b60405180910390a1505b50505050565b60e754600080805b83831015613bfa5760e78381548110613c2357613c23615a12565b60009182526020808320909101546001600160a01b031680835260e89091526040909120600181015491935091504210613d4957805460e48054600090613c6b908490615a6a565b90915550506001600160a01b038216600090815260e860205260408120818155600101819055613c9a85615dde565b9450841115613d115760e78481548110613cb657613cb6615a12565b60009182526020909120015460e780546001600160a01b039092169185908110613ce257613ce2615a12565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480613d2257613d22615c4a565b600082815260209020810160001990810180546001600160a01b0319169055019055613c08565b82613d5381615a3e565b935050613c08565b60e4548015611020576000613d6e611569565b600060e481905560408051600481526024810182526020810180516001600160e01b03166359f778df60e01b179052905192935090916001600160a01b038416918591613dbb9190615df5565b60006040518083038185875af1925050503d8060008114613df8576040519150601f19603f3d011682016040523d82523d6000602084013e613dfd565b606091505b505090508015613e4257816001600160a01b03167fc447c884574da5878be39c403db2245c22530c99b579ea7bcbb3720e1d110dc884604051611bba91815260200190565b816001600160a01b03167fa0561a59abed308fcd0556834574739d778cc6229018039a24ddda0f86aa0b738447604051611bba929190615b6b565b606080613e8983614aa9565b6071546040516391f8723f60e01b81529192506000916001600160a01b03909116906391f8723f90613ec090607390600401615e24565b600060405180830381865afa158015613edd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f059190810190615c81565b60a854604051632907e73160e11b81529192506000916001600160a01b039091169063520fce6290613f3c90607390600401615e24565b600060405180830381865afa158015613f59573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f819190810190615c81565b90506000613ff06073805480602002602001604051908101604052809291908181526020018280548015613fde57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613fc0575b5050505050848460a95460ad54614f9c565b9095509050614000858288615066565b505050915091565b606f546000906001600160a01b031663fdadda8183614028436001615a6a565b6040518363ffffffff1660e01b8152600401614045929190615c14565b600060405180830381865afa158015614062573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261408a9190810190615e68565b905060005b82518110156143515760008382815181106140ac576140ac615a12565b6020908102919091018101516001600160a01b0381166000908152603b9092526040822054909250421115906140e183611fdc565b905060006140f9846140f4436001615a6a565b6131c4565b8061411a575085858151811061411157614111615a12565b60200260200101515b806141225750825b159050811580156141305750805b156141ab576001600160a01b038416600090815260ac602052604090205461416f9060019060ff1660038111156141695761416961594e565b906151c4565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156141a1576141a161594e565b021790555061422d565b8180156141b6575080155b1561422d576001600160a01b038416600090815260ac60205260409020546141f59060019060ff1660038111156141ef576141ef61594e565b906151ff565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156142275761422761594e565b02179055505b600061423885611169565b90508315811580156142475750805b156142bc576001600160a01b038616600090815260ac60205260409020546142809060029060ff1660038111156141695761416961594e565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156142b2576142b261594e565b0217905550614338565b8180156142c7575080155b15614338576001600160a01b038616600090815260ac60205260409020546143009060029060ff1660038111156141ef576141ef61594e565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156143325761433261594e565b02179055505b505050505050808061434990615a3e565b91505061408f565b5082847f283b50d76057d5f828df85bc87724c6af604e9b55c363a07c9faa2a2cd688b8261437d611864565b60405161438a919061583f565b60405180910390a382847f773d1888df530d69716b183a92450d45f97fba49f2a4bb34fae3b23da0e2cc6f6143bd612349565b6040516143ca919061583f565b60405180910390a350505050565b6000600154826143e89190615bdc565b610cbb906001615a6a565b600182015461440a906001600160a01b0316612561565b6144275760405163a64b34ad60e01b815260040160405180910390fd5b6005820181905560018201546040518281526001600160a01b03909116907fb9a1e33376bfbda9092f2d1e37662c1b435aab0d3fa8da3acc8f37ee222f99e790602001611133565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d80600081146144bf576040519150601f19603f3d011682016040523d82523d6000602084013e6144c4565b606091505b509095945050505050565b60a85460405163107fbb4760e21b815260009182916001600160a01b03909116906341feed1c90614504908690600401615609565b602060405180830381865afa158015614521573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145459190615ad8565b1192915050565b60008160038111156145605761456061594e565b60ff161592915050565b6001600160a01b03808216600090815260756020526040812060030154909116610cbb565b60016000805b835181101561460157848482815181106145b1576145b1615a12565b602002602001015111156145c85760009250614601565b8381815181106145da576145da615a12565b6020026020010151826145ed9190615a6a565b9150806145f981615a3e565b915050614595565b5081801561460f5750848111155b915081614640576040517f64ba7143ea5a17abea37667aa9ae137e3afba5033c5f504770c02829c128189c90600090a15b509392505050565b8084106147c4576001600160a01b03851660008181526039602090815260408083208a845282528083208054600160ff199182168117909255948452603783528184208b855290925282208054909316179091556146a6438561523b565b6001600160a01b0387166000908152603a60205260409020549091506146cd90829061322f565b6001600160a01b0387166000908152603a6020908152604080832093909355603c905220546146fd90829061322f565b6001600160a01b038088166000908152603c60205260409081902092909255607054915163c008ce3960e01b815291169063c008ce39906147479089906002908c90600401615ef6565b600060405180830381600087803b15801561476157600080fd5b505af1158015614775573d6000803e3d6000fd5b5050506001600160a01b0387166000818152603a60205260408082205490518b9450600080516020615fa6833981519152926147b692916001908190615af1565b60405180910390a35061372a565b81841061372a576001600160a01b0380861660009081526039602090815260408083208a845290915290819020805460ff19166001908117909155607054915163c008ce3960e01b8152919092169163c008ce39916148299189918b90600401615ef6565b600060405180830381600087803b15801561484357600080fd5b505af1158015614857573d6000803e3d6000fd5b5050506001600160a01b0386166000818152603a60205260408082205490518a9450600080516020615fa68339815191529261489892918190600190615af1565b60405180910390a3505050505050565b6001600160a01b038316600090815260e360205260409020548015613bfa576148d482826104b061446f565b1561493657816001600160a01b0316836001600160a01b0316856001600160a01b03167f72a57dc38837a1cba7881b7b1a5594d9e6b65cec6a985b54e2cee3e89369691c8460405161492891815260200190565b60405180910390a450505050565b816001600160a01b0316836001600160a01b0316856001600160a01b03167fd35d76d87d51ed89407fc7ceaaccf32cf72784b94530892ce33546540e141b728447604051614928929190615b6b565b6001600160a01b038216600090815260e060205260409020548015612f47576149b182826104b061446f565b15614a0857816001600160a01b0316836001600160a01b03167f1ce7a1c4702402cd393500acb1de5bd927727a54e144a587d328f1b679abe4ec836040516149fb91815260200190565b60405180910390a3505050565b816001600160a01b0316836001600160a01b03167f6c69e09ee5c5ac33c0cd57787261c5bade070a392ab34a4b5487c6868f723f6e83476040516149fb929190615b6b565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114614a9a576040519150601f19603f3d011682016040523d82523d6000602084013e614a9f565b606091505b5090949350505050565b6071546040805163af24542960e01b815290516060926001600160a01b031691600091839163af2454299160048083019260209291908290030181865afa158015614af8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b1c9190615ad8565b90506000826001600160a01b031663909791dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b829190615ad8565b90506000836001600160a01b03166342ef3c3460736040518263ffffffff1660e01b8152600401614bb39190615e24565b600060405180830381865afa158015614bd0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052614bf89190810190615c81565b6073549091506000816001600160401b03811115614c1857614c186156f4565b604051908082528060200260200182016040528015614c41578160200160208202803683370190505b50965060008060005b84831015614eed5760738381548110614c6557614c65615a12565b60009182526020808320909101546001600160a01b031680835260759091526040909120600681015488519294509092501515908890889086908110614cad57614cad615a12565b60200260200101511015614d095780614d04576000614ccc8a42615a6a565b600684018190556040518181529091506001600160a01b03851690600080516020615f668339815191529060200160405180910390a2505b614d4a565b8015614d4a578160060160009055826001600160a01b0316600080516020615f668339815191526000604051614d4191815260200190565b60405180910390a25b60008260050154600014158015614d65575042836005015411155b80614d8857506001600160a01b038416600090815260e9602052604090205460ff165b905060008360060154600014158015614da5575042846006015411155b90508180614db05750805b15614e465788614dbf89615dde565b98508881518110614dd257614dd2615a12565b6020026020010151898781518110614dec57614dec615a12565b6020908102919091010152848d88614e0381615a3e565b995081518110614e1557614e15615a12565b60200260200101906001600160a01b031690816001600160a01b031681525050614e3e85615256565b505050614c4a565b6001600160a01b0385166000908152607760205260409020548015801590614e6e5750428111155b15614ed7576001600160a01b0386166000818152607760209081526040808320600181018054918590559390935560048901839055518281529192917f86d576c20e383fc2413ef692209cc48ddad5e52f25db5b32f8f7ec5076461ae9910160405180910390a2505b86614ee181615a3e565b97505050505050614c4a565b5050508087528015614f91577f4eaf233b9dc25a5552c1927feee1412eea69add17c2485c831c2e60e234f3c9187604051614f28919061583f565b60405180910390a160405163e22d1c9d60e01b81526001600160a01b0387169063e22d1c9d90614f5e908a908c90600401615c14565b600060405180830381600087803b158015614f7857600080fd5b505af1158015614f8c573d6000803e3d6000fd5b505050505b505050505050919050565b60606000806068905060008888888888604051602401614fc0959493929190615f17565b60408051601f19818403018152919052602080820180516001600160e01b0316633bca0a8960e11b17905281518b51929350600192909160009161500391615baf565b61500e906040615a6a565b90506020840181888483895afa61502457600093505b503d61502f57600092505b6020870196508261505357604051630fc2632160e01b815260040160405180910390fd5b8651955050505050509550959350505050565b815b60aa548110156150c457600081815260ab6020818152604080842080546001600160a01b0316855260ac8352908420805460ff19169055928490525280546001600160a01b0319169055806150bc81615a3e565b915050615068565b5060005b8281101561510e57600081815260ab60209081526040808320546001600160a01b0316835260ac9091529020805460ff191690558061510681615a3e565b9150506150c8565b5060005b8281101561518c57600084828151811061512e5761512e615a12565b6020908102919091018101516001600160a01b0316600081815260ac83526040808220805460ff1916600317905585825260ab9093529190912080546001600160a01b0319169091179055508061518481615a3e565b915050615112565b508160aa81905550807f3d0eea40644a206ec25781dd5bb3b60eb4fa1264b993c3bddf3c73b14f29ef5e84604051611bba919061583f565b60008160038111156151d8576151d861594e565b8360038111156151ea576151ea61594e565b1760ff1660038111156111625761116261594e565b60008160038111156152135761521361594e565b198360038111156152265761522661594e565b1660ff1660038111156111625761116261594e565b60008160000361524c576000611162565b6111628284615a6a565b6001600160a01b038116600090815260e960209081526040808320805460ff19169055607490915281205461102091839190819003615293575050565b6001600160a01b038216600090815260756020908152604080832080546001600160a01b03199081168255600180830180548316905560028301805483169055600383018054909216909155600482018590556005820185905560069091018490556074835281842084905560779092528220828155810182905560738054909161531d91615a57565b8154811061532d5761532d615a12565b6000918252602090912001546001600160a01b039081169150831681146153b0576001600160a01b038116600090815260746020526040902082905560738054829190841990811061538157615381615a12565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60738054806153c1576153c1615c4a565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6001600160a01b038116811461102057600080fd5b6000806040838503121561544c57600080fd5b823561545781615424565b9150602083013561546781615424565b809150509250929050565b600080600080600060a0868803121561548a57600080fd5b853561549581615424565b945060208601356154a581615424565b935060408601356154b581615424565b925060608601356154c581615424565b949793965091946080013592915050565b600080604083850312156154e957600080fd5b82356154f481615424565b946020939093013593505050565b60006020828403121561551457600080fd5b5035919050565b60006020828403121561552d57600080fd5b813561116281615424565b60018060a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b60e08101610cbb8284615538565b815181526020808301519082015260408101610cbb565b801515811461102057600080fd5b600080600080608085870312156155d557600080fd5b84356155e081615424565b9350602085013592506040850135915060608501356155fe816155b1565b939692955090935050565b6001600160a01b0391909116815260200190565b8060408101831015610cbb57600080fd5b6000806000806000806000806000806000806101a08d8f03121561565157600080fd5b8c3561565c81615424565b9b5060208d013561566c81615424565b9a5060408d013561567c81615424565b995060608d013561568c81615424565b985060808d013561569c81615424565b975060a08d01356156ac81615424565b965060c08d0135955060e08d013594506101008d013593506101208d013592506101408d013591506156e28e6101608f0161561d565b90509295989b509295989b509295989b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715615732576157326156f4565b604052919050565b60006001600160401b03821115615753576157536156f4565b5060051b60200190565b6000602080838503121561577057600080fd5b82356001600160401b0381111561578657600080fd5b8301601f8101851361579757600080fd5b80356157aa6157a58261573a565b61570a565b81815260059190911b820183019083810190878311156157c957600080fd5b928401925b828410156157f05783356157e181615424565b825292840192908401906157ce565b979650505050505050565b600081518084526020808501945080840160005b838110156158345781516001600160a01b03168752958201959082019060010161580f565b509495945050505050565b60208152600061116260208301846157fb565b6000806020838503121561586557600080fd5b82356001600160401b038082111561587c57600080fd5b818501915085601f83011261589057600080fd5b81358181111561589f57600080fd5b8660208260051b85010111156158b457600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b818110156159005783511515835292840192918401916001016158e2565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156159005761593b838551615538565b9284019260e09290920191600101615928565b634e487b7160e01b600052602160045260246000fd5b60608152600061597760608301866157fb565b60208382038185015261598a82876157fb565b8481036040860152855180825282870193509082019060005b818110156159cf578451600481106159bd576159bd61594e565b835293830193918301916001016159a3565b509098975050505050505050565b6000806000606084860312156159f257600080fd5b83356159fd81615424565b95602085013595506040909401359392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201615a5057615a50615a28565b5060010190565b81810381811115610cbb57610cbb615a28565b80820180821115610cbb57610cbb615a28565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b6001600160a01b03929092168252602082015260400190565b600060208284031215615aea57600080fd5b5051919050565b9384526020840192909252151560408301521515606082015260800190565b600080600060608486031215615b2557600080fd5b8351615b30816155b1565b602085015160409095015190969495509392505050565b8281526040810160038310615b5e57615b5e61594e565b8260208301529392505050565b918252602082015260400190565b60008060008060808587031215615b8f57600080fd5b505082516020840151604085015160609095015191969095509092509050565b8082028115828204841417610cbb57610cbb615a28565b634e487b7160e01b600052601260045260246000fd5b600082615beb57615beb615bc6565b500490565b60008060408385031215615c0357600080fd5b505080516020909101519092909150565b604081526000615c2760408301856157fb565b90508260208301529392505050565b600082615c4557615c45615bc6565b500690565b634e487b7160e01b600052603160045260246000fd5b828152604060208201526000615c7960408301846157fb565b949350505050565b60006020808385031215615c9457600080fd5b82516001600160401b03811115615caa57600080fd5b8301601f81018513615cbb57600080fd5b8051615cc96157a58261573a565b81815260059190911b82018301908381019087831115615ce857600080fd5b928401925b828410156157f057835182529284019290840190615ced565b600081518084526020808501945080840160005b8381101561583457815187529582019590820190600101615d1a565b606081526000615d4960608301866157fb565b8281036020840152615d5b8186615d06565b915050826040830152949350505050565b838152606060208201526000615d8560608301856157fb565b8281036040840152615d978185615d06565b9695505050505050565b848152608060208201526000615dba60808301866157fb565b8281036040840152615dcc8186615d06565b91505082606083015295945050505050565b600081615ded57615ded615a28565b506000190190565b6000825160005b81811015615e165760208186018101518583015201615dfc565b506000920191825250919050565b6020808252825482820181905260008481528281209092916040850190845b818110156159005783546001600160a01b031683526001938401939285019201615e43565b60006020808385031215615e7b57600080fd5b82516001600160401b03811115615e9157600080fd5b8301601f81018513615ea257600080fd5b8051615eb06157a58261573a565b81815260059190911b82018301908381019087831115615ecf57600080fd5b928401925b828410156157f0578351615ee7816155b1565b82529284019290840190615ed4565b6001600160a01b039390931683526020830191909152604082015260600190565b60a081526000615f2a60a08301886157fb565b8281036020840152615f3c8188615d06565b90508281036040840152615f508187615d06565b6060840195909552505060800152939250505056fe88f854e137380c14d63f6ed99781bf13402167cf55bac49bcd44d4f2d6a342754042bb9a70998f80a86d9963f0d2132e9b11c8ad94d207c6141c8e34b05ce53e54ce99c5ce1fc9f61656d4a0fb2697974d0c973ac32eecaefe06fcf18b8ef68aa2646970667358221220a1eb2c9a0a4cbc889fd4810519c15ef9865e041ad7aa23ef79fce6ce5a27a4c564736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106103455760003560e01c8063038278841461035c57806304d971ab1461038557806306040618146103b55780630f43a677146103ca5780631104e528146103e057806311662dc2146104005780631196ab661461043d57806315b5ebde1461045d5780631ab4a34c1461047d5780631f6288011461049d578063217f35c2146104bd57806323c65eb0146104d257806328bde1e1146104f25780632924de711461051f578063297a8fca1461053f5780632bcf3d15146105545780632d784a98146105745780632f78204c146105a157806331a8aef5146105c15780633529214b146105e1578063367ec12b146106035780633b3159b6146106235780634244d4c9146106375780634493421e14610664578063468c96ae1461068257806346fe9311146106b957806349096d26146106d95780634d8df063146106ee5780634de2b7351461070e5780634ee4d72b1461073b5780634f2a693f1461075057806352091f17146107705780635248184a146107785780635511cde11461079a578063562d5304146107b85780635a08482d146107cd578063605239a1146107e257806365244ece146107f75780636558954f146108175780636611f8431461082e578063690b75361461084e5780636aa1c2ef1461086357806372e46810146108785780637593ff7114610880578063823a7b9c146108a0578063873a5a70146108c057806387c891bd146108e05780638d559c38146108f557806396585fc2146109095780639b19dbfd146109295780639c8d98da1461093e5780639dd373b91461095e5780639e94b9ec1461097e578063a0c3f2d214610993578063a3d545f5146109b3578063a66c0f77146109d3578063a7c2f119146109e8578063ad29578314610a08578063b405aaf214610a28578063b5e337de14610a48578063b7ab4db514610a68578063ba77b06c14610a8c578063c3c8b5d614610aa1578063c94aaa0214610ac1578063cba44de914610ae1578063d09f1ab414610af6578063d2cb215e14610b0b578063d5a0744f14610b29578063dd716ad314610b49578063e5125a1d14610b69578063edb194bb14610b89578063ee99205c14610beb578063eeb629a814610c00578063facd743b14610c1557610354565b3661035457610352610c35565b005b610352610c35565b34801561036857600080fd5b506103726104b081565b6040519081526020015b60405180910390f35b34801561039157600080fd5b506103a56103a0366004615439565b610c9a565b604051901515815260200161037c565b3480156103c157600080fd5b50610372610cc1565b3480156103d657600080fd5b5061037260aa5481565b3480156103ec57600080fd5b506103526103fb366004615472565b610cd1565b34801561040c57600080fd5b5061042061041b3660046154d6565b610f5c565b60408051931515845260208401929092529082015260600161037c565b34801561044957600080fd5b50610352610458366004615502565b610fdf565b34801561046957600080fd5b506103526104783660046154d6565b611023565b34801561048957600080fd5b506103a561049836600461551b565b61113f565b3480156104a957600080fd5b506103a56104b836600461551b565b611169565b3480156104c957600080fd5b506103a56111a3565b3480156104de57600080fd5b506103a56104ed3660046154d6565b6111b8565b3480156104fe57600080fd5b5061051261050d36600461551b565b6111c4565b60405161037c919061558c565b34801561052b57600080fd5b506103a561053a36600461551b565b611267565b34801561054b57600080fd5b50600454610372565b34801561056057600080fd5b5061035261056f36600461551b565b611273565b34801561058057600080fd5b5061059461058f36600461551b565b6112df565b60405161037c919061559a565b3480156105ad57600080fd5b506103526105bc3660046155bf565b611341565b3480156105cd57600080fd5b506103a56105dc3660046154d6565b61155d565b3480156105ed57600080fd5b506105f6611569565b60405161037c9190615609565b34801561060f57600080fd5b5061035261061e36600461562e565b611578565b34801561062f57600080fd5b5060686105f6565b34801561064357600080fd5b5061065761065236600461575d565b611703565b60405161037c919061583f565b34801561067057600080fd5b50606e546001600160a01b03166105f6565b34801561068e57600080fd5b506106a261069d366004615502565b6117ba565b60408051921515835260208301919091520161037c565b3480156106c557600080fd5b506103526106d436600461551b565b6117f8565b3480156106e557600080fd5b50610657611864565b3480156106fa57600080fd5b50610352610709366004615502565b61194d565b34801561071a57600080fd5b5061072e610729366004615852565b61198e565b60405161037c91906158c6565b34801561074757600080fd5b5060e454610372565b34801561075c57600080fd5b5061035261076b366004615502565b611a49565b610352611a8a565b34801561078457600080fd5b5061078d611e49565b60405161037c919061590c565b3480156107a657600080fd5b5060a8546001600160a01b03166105f6565b3480156107c457600080fd5b50610372611f79565b3480156107d957600080fd5b506105f6611fcd565b3480156107ee57600080fd5b50607254610372565b34801561080357600080fd5b506103a561081236600461551b565b611fdc565b34801561082357600080fd5b506103726201518081565b34801561083a57600080fd5b50610352610849366004615502565b612010565b34801561085a57600080fd5b5060e554610372565b34801561086f57600080fd5b50600154610372565b610352612051565b34801561088c57600080fd5b506103a561089b366004615502565b6122b1565b3480156108ac57600080fd5b506103526108bb366004615502565b6122d5565b3480156108cc57600080fd5b506103a56108db36600461551b565b612316565b3480156108ec57600080fd5b50600254610372565b34801561090157600080fd5b5060666105f6565b34801561091557600080fd5b5061042061092436600461551b565b61232d565b34801561093557600080fd5b50610657612349565b34801561094a57600080fd5b5061035261095936600461551b565b612435565b34801561096a57600080fd5b5061035261097936600461551b565b6124a1565b34801561098a57600080fd5b5061037261250d565b34801561099f57600080fd5b506103a56109ae36600461551b565b612561565b3480156109bf57600080fd5b506103726109ce366004615502565b61257e565b3480156109df57600080fd5b5060e654610372565b3480156109f457600080fd5b50610352610a033660046154d6565b612589565b348015610a1457600080fd5b50610352610a2336600461551b565b612835565b348015610a3457600080fd5b506103a5610a4336600461551b565b6128a1565b348015610a5457600080fd5b50610352610a6336600461551b565b612926565b348015610a7457600080fd5b50610a7d612992565b60405161037c93929190615964565b348015610a9857600080fd5b50610657612b70565b348015610aad57600080fd5b50610352610abc366004615439565b612bd2565b348015610acd57600080fd5b50610352610adc366004615502565b612e55565b348015610aed57600080fd5b50607654610372565b348015610b0257600080fd5b5060a954610372565b348015610b1757600080fd5b50606f546001600160a01b03166105f6565b348015610b3557600080fd5b506103a5610b443660046154d6565b612e96565b348015610b5557600080fd5b50610352610b643660046154d6565b612ea2565b348015610b7557600080fd5b50610352610b843660046159dd565b612f4c565b348015610b9557600080fd5b50610594610ba436600461551b565b6040805180820190915260008082526020820152506001600160a01b0316600090815260776020908152604091829020825180840190935280548352600101549082015290565b348015610bf757600080fd5b506105f661307f565b348015610c0c57600080fd5b5060ad54610372565b348015610c2157600080fd5b506103a5610c3036600461551b565b61308e565b610c3d611569565b6001600160a01b0316336001600160a01b031614158015610c775750610c6161307f565b6001600160a01b0316336001600160a01b031614155b15610c985760405160016234baed60e01b0319815260040160405180910390fd5b565b6001600160a01b038281166000908152607560205260409020548116908216145b92915050565b6000610ccc60035490565b905090565b33610cda61307f565b6001600160a01b031614610d0157604051638aaf4a0760e01b815260040160405180910390fd5b6073546072548110610d2657604051638616841b60e01b815260040160405180910390fd5b610d2f85612561565b15610d4d57604051638ad9cdf960e01b815260040160405180910390fd5b612710821115610d7057604051631b8454a360e21b815260040160405180910390fd5b60005b607354811015610e6b5760006075600060738481548110610d9657610d96615a12565b60009182526020808320909101546001600160a01b03908116845290830193909352604090910190208054909250811690891603610df2578760405163fc3d8c7560e01b8152600401610de99190615609565b60405180910390fd5b60028101546001600160a01b0390811690871603610e255785604051632d33a7e760e11b8152600401610de99190615609565b60038101546001600160a01b0390811690861603610e5857846040516350e1263b60e01b8152600401610de99190615609565b5080610e6381615a3e565b915050610d73565b506001600160a01b038581166000818152607460209081526040808320861990556073805460018082019092557ff79bde9ddd17963ebce6f7d021d60de7c2bd0db944d23c900c0c0e775f5300520180546001600160a01b03199081168717909155607590935292819020805483168c87169081178255938101805484168617905560028101805484168b8816908117909155600382018054909416968a1696909617909255600482018790555190939192907fd690f592ed983cfbc05717fbcf06c4e10ae328432c309fe49246cf4a4be69fcd90610f4b908990615609565b60405180910390a450505050505050565b6001600160a01b0382166000908152603a60205260408120548190819084811015610f9257600080600093509350935050610fd8565b60019350610fa08582615a57565b610fab906001615a6a565b9250610fb68561257e565b610fbf8261257e565b610fc99190615a57565b610fd4906001615a6a565b9150505b9250925092565b610fe76130cb565b6001600160a01b0316336001600160a01b0316146110175760405162461bcd60e51b8152600401610de990615a7d565b611020816130f9565b50565b3361102c611fcd565b6001600160a01b031614611053576040516328b9c24b60e21b815260040160405180910390fd5b6001600160a01b0382166000908152603c6020526040902054431161108d57816040516353e0424d60e01b8152600401610de99190615609565b6001600160a01b038216600081815260386020908152604080832085845282528083208054600160ff1991821681179092559484526037835281842086855290925290912080549092169091556110e49043615a57565b6001600160a01b0383166000818152603a6020526040908190209290925590517f6bb2436cb6b6eb65d5a52fac2ae0373a77ade6661e523ef3004ee2d5524e6c6e906111339084815260200190565b60405180910390a25050565b600080600161114c610cc1565b6111569190615a57565b90506111628382613157565b9392505050565b6001600160a01b038116600090815260ac6020526040812054610cbb9060029060ff16600381111561119d5761119d61594e565b90613182565b6000610ccc6111b1426131b5565b6003541090565b600061116283836131c4565b6111cc6153e8565b6111d582612561565b6111f25760405163a64b34ad60e01b815260040160405180910390fd5b506001600160a01b03908116600090815260756020908152604091829020825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c082015290565b6000610cbb82436111b8565b61127b6130cb565b6001600160a01b0316336001600160a01b0316146112ab5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b6000036112d657604051637bcd509160e01b815260040160405180910390fd5b611020816131e4565b604080518082018252600080825260209182018190526001600160a01b038416815260e88252828120835180850190945280548452600101549183018290520361133c576040516370fdd4f160e11b815260040160405180910390fd5b919050565b3361134a611fcd565b6001600160a01b031614611371576040516328b9c24b60e21b815260040160405180910390fd5b600061137b610cc1565b6001600160a01b03861660008181526037602090815260408083208584528252808320805460ff1916600117905592825260e181528282205460e0909152919020549192506113c991615a6a565b60e460008282546113da9190615a6a565b90915550506001600160a01b038516600090815260e06020908152604080832083905560e18252808320839055603a90915290205461141a90859061322f565b6001600160a01b0386166000908152603a602052604090205582156114ca5760715460405163138ac02f60e11b81526000916001600160a01b031690632715805e9061146c9089908890600401615abf565b6020604051808303816000875af115801561148b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114af9190615ad8565b90508060e460008282546114c39190615a6a565b9091555050505b811561150e576001600160a01b0385166000908152603c60205260409020546114f490859061322f565b6001600160a01b0386166000908152603c60205260409020555b6001600160a01b0385166000818152603a6020526040808220549051849392600080516020615fa68339815191529261154e929091899160019190615af1565b60405180910390a35050505050565b60006111628383613246565b606d546001600160a01b031690565b600054610100900460ff16158080156115985750600054600160ff909116105b806115b25750303b1580156115b2575060005460ff166001145b6116155760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610de9565b6000805460ff191660011790558015611638576000805461ff0019166101001790555b6116418d6131e4565b61164a8c613271565b6116538b6132bc565b61165c8a613307565b61166588613352565b61166e8961339d565b611677876133e8565b6116808661341d565b61168985613452565b611692846130f9565b61169c82356134aa565b6116a960208301356134df565b600183905580156116f4576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b606081516001600160401b0381111561171e5761171e6156f4565b604051908082528060200260200182016040528015611747578160200160208202803683370190505b50905060005b81518110156117b45761177883828151811061176b5761176b615a12565b6020026020010151613514565b82828151811061178a5761178a615a12565b6001600160a01b0390921660209283029190910190910152806117ac81615a3e565b91505061174d565b50919050565b6000806117c64361257e565b831115806117e1575060008381526005602052604090205415155b600093845260056020526040909320549293915050565b6118006130cb565b6001600160a01b0316336001600160a01b0316146118305760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361185b57604051637bcd509160e01b815260040160405180910390fd5b61102081613307565b606060aa546001600160401b03811115611880576118806156f4565b6040519080825280602002602001820160405280156118a9578160200160208202803683370190505b5090506000805b825181101561194757600081815260ab60205260409020546118da906001600160a01b0316611fdc565b1561193557600081815260ab60205260409020546001600160a01b0316838361190281615a3e565b94508151811061191457611914615a12565b60200260200101906001600160a01b031690816001600160a01b0316815250505b8061193f81615a3e565b9150506118b0565b50815290565b6119556130cb565b6001600160a01b0316336001600160a01b0316146119855760405162461bcd60e51b8152600401610de990615a7d565b611020816134df565b6060816001600160401b038111156119a8576119a86156f4565b6040519080825280602002602001820160405280156119d1578160200160208202803683370190505b50905060005b82811015611a4257611a0e8484838181106119f4576119f4615a12565b9050602002016020810190611a09919061551b565b61351f565b828281518110611a2057611a20615a12565b9115156020928302919091019091015280611a3a81615a3e565b9150506119d7565b5092915050565b611a516130cb565b6001600160a01b0316336001600160a01b031614611a815760405162461bcd60e51b8152600401610de990615a7d565b6110208161341d565b334114611aaa576040516309f358fd60e01b815260040160405180910390fd5b6000611ab533611fdc565b8015611ac75750611ac53361351f565b155b8015611ae15750611adf33611ada610cc1565b613246565b155b606d54604051630634f5b960e01b815282151560048201526001602482015291925060009182916001600160a01b031690630634f5b9906044016060604051808303816000875af1158015611b3a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b5e9190615b10565b92509250508060e26000828254611b759190615a6a565b90915550839050611bc7573460e46000828254611b929190615a6a565b90915550506040513390600080516020615f8683398151915290611bba903490600190615b47565b60405180910390a2505050565b336001600160a01b03167f0ede5c3be8625943fa64003cd4b91230089411249f3059bac6500873543ca9b13484604051611c02929190615b6b565b60405180910390a26000611c14610cc1565b90506000611c228434615a6a565b3360009081526038602090815260408083208684529091528120549192509060ff1615611d1b576070546040805163631c8fd160e11b815290516000926001600160a01b03169163c6391fa29160048083019260809291908290030181865afa158015611c93573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611cb79190615b79565b93505050506127108184611ccb9190615baf565b611cd59190615bdc565b91508160e46000828254611ce99190615a6a565b90915550506040513390600080516020615f8683398151915290611d11908590600290615b47565b60405180910390a2505b611d258183615a57565b60715460408051632298690160e11b8152815193955060009384936001600160a01b031692634530d20292600480820193918290030181865afa158015611d70573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d949190615bf0565b3360009081526075602052604081206004015492945090925090611dc290611dbc908461352b565b8461322f565b90506000612710611dd38784615baf565b611ddd9190615bdc565b33600090815260e06020526040812080549293508392909190611e01908490615a6a565b9091555060009050611e138288615a57565b33600090815260e16020526040812080549293508392909190611e37908490615a6a565b90915550505050505050505050505050565b6073546060906001600160401b03811115611e6657611e666156f4565b604051908082528060200260200182016040528015611e9f57816020015b611e8c6153e8565b815260200190600190039081611e845790505b50905060005b8151811015611f75576075600060738381548110611ec557611ec5615a12565b60009182526020808320909101546001600160a01b039081168452838201949094526040928301909120825160e081018452815485168152600182015485169281019290925260028101548416928201929092526003820154909216606083015260048101546080830152600581015460a08301526006015460c08201528251839083908110611f5757611f57615a12565b60200260200101819052508080611f6d90615a3e565b915050611ea5565b5090565b6000805b60aa54811015611f7557600081815260ab6020526040902054611fa8906001600160a01b0316611169565b15611fbb5781611fb781615a3e565b9250505b80611fc581615a3e565b915050611f7d565b6070546001600160a01b031690565b6001600160a01b038116600090815260ac6020526040812054610cbb9060019060ff16600381111561119d5761119d61594e565b6120186130cb565b6001600160a01b0316336001600160a01b0316146120485760405162461bcd60e51b8152600401610de990615a7d565b611020816134aa565b334114612071576040516309f358fd60e01b815260040160405180910390fd5b61207a436122b1565b61209757604051636c74eecf60e01b815260040160405180910390fd5b6120a04361257e565b6120ab60025461257e565b106120c957604051632458f64160e01b815260040160405180910390fd5b4360025560006120d8426131b5565b905060006120e7826003541090565b905060006120f3612992565b50509050606060006121044361257e565b90506000612113826001615a6a565b9050600061211f610cc1565b9050851561224b57612131818661353a565b60008061213e83886138c5565b9150915061214e83888484613af7565b612156613c00565b61215e613d5b565b607054604051631da0214360e21b81526001600160a01b0390911690637680850c90612190908a908790600401615c14565b600060405180830381600087803b1580156121aa57600080fd5b505af11580156121be573d6000803e3d6000fd5b505050506121cb89613e7d565b805191985096501561223a576070546040516303e1697b60e11b81526001600160a01b03909116906307c2d2f69061220790899060040161583f565b600060405180830381600087803b15801561222157600080fd5b505af1158015612235573d6000803e3d6000fd5b505050505b612245436001615a6a565b60045550505b612256878387614008565b82817f0195462033384fec211477c56217da64a58bd405e0bed331ba4ded67e4ae4ce78860405161228b911515815260200190565b60405180910390a350600090815260056020526040902085905550505060039190915550565b6000600180546122c19190615a57565b6001546122ce9084615c36565b1492915050565b6122dd6130cb565b6001600160a01b0316336001600160a01b03161461230d5760405162461bcd60e51b8152600401610de990615a7d565b611020816133e8565b600080612321610cc1565b90506111628382613246565b600080600061233c8443610f5c565b9250925092509193909250565b606060aa546001600160401b03811115612365576123656156f4565b60405190808252806020026020018201604052801561238e578160200160208202803683370190505b5090506000805b825181101561194757600081815260ab60205260409020546123bf906001600160a01b0316611169565b1561242357600081815260ab60205260409020546123e5906001600160a01b0316613514565b83836123f081615a3e565b94508151811061240257612402615a12565b60200260200101906001600160a01b031690816001600160a01b0316815250505b8061242d81615a3e565b915050612395565b61243d6130cb565b6001600160a01b0316336001600160a01b03161461246d5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361249857604051637bcd509160e01b815260040160405180910390fd5b61102081613352565b6124a96130cb565b6001600160a01b0316336001600160a01b0316146124d95760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361250457604051637bcd509160e01b815260040160405180910390fd5b61102081613271565b6000805b60aa54811015611f7557600081815260ab602052604090205461253c906001600160a01b0316611fdc565b1561254f578161254b81615a3e565b9250505b8061255981615a3e565b915050612511565b6001600160a01b0316600090815260746020526040902054151590565b6000610cbb826143d8565b3361259261307f565b6001600160a01b0316146125b957604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b038216600090815260e8602052604090206001810154156125f45760405163057aab3160e31b815260040160405180910390fd5b60006126008342615a6a565b6001600160a01b038516600090815260756020526040902090915061262590826143f3565b6001600160a01b0384166000908152603b6020908152604080832084905560399091528120600191612655610cc1565b8152602081019190915260409081016000908120805460ff19169315159390931790925560715460e554915163138ac02f60e11b81526001600160a01b0390911691632715805e916126ab918991600401615abf565b6020604051808303816000875af11580156126ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126ee9190615ad8565b905080156127eb57600060e654426127069190615a6a565b60e78054600180820183556000929092527f6cb0db1d7354dfb4a1464318006df0643cafe2002a86a29ff8560f900fef28a10180546001600160a01b0319166001600160a01b038a16179055838655850181905590506127646130cb565b6001600160a01b0387811660008181526075602052604090819020600201549051630a2fae5760e41b81526004810192909252821660248201524260448201526064810184905291169063a2fae57090608401600060405180830381600087803b1580156127d157600080fd5b505af11580156127e5573d6000803e3d6000fd5b50505050505b846001600160a01b03167f77a1a819870c0f4d04c3ca4cc2881a0393136abc28bd651af50aedade94a27c48260405161282691815260200190565b60405180910390a25050505050565b61283d6130cb565b6001600160a01b0316336001600160a01b03161461286d5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361289857604051637bcd509160e01b815260040160405180910390fd5b611020816132bc565b6000805b60aa548110156117b457600081815260ab60205260409020546001600160a01b03808516916128d49116613514565b6001600160a01b03161480156129065750600081815260ab6020526040902054612906906001600160a01b0316611169565b1561291457600191506117b4565b8061291e81615a3e565b9150506128a5565b61292e6130cb565b6001600160a01b0316336001600160a01b03161461295e5760405162461bcd60e51b8152600401610de990615a7d565b806001600160a01b03163b60000361298957604051637bcd509160e01b815260040160405180910390fd5b6110208161339d565b606080606060aa546001600160401b038111156129b1576129b16156f4565b6040519080825280602002602001820160405280156129da578160200160208202803683370190505b50925060aa546001600160401b038111156129f7576129f76156f4565b604051908082528060200260200182016040528015612a20578160200160208202803683370190505b50915060aa546001600160401b03811115612a3d57612a3d6156f4565b604051908082528060200260200182016040528015612a66578160200160208202803683370190505b50905060005b8351811015612b6a57600081815260ab602052604090205484516001600160a01b03909116908190869084908110612aa657612aa6615a12565b60200260200101906001600160a01b031690816001600160a01b031681525050612acf81613514565b848381518110612ae157612ae1615a12565b6001600160a01b03928316602091820292909201810191909152908216600090815260ac9091526040902054835160ff90911690849084908110612b2757612b27615a12565b60200260200101906003811115612b4057612b4061594e565b90816003811115612b5357612b5361594e565b905250819050612b6281615a3e565b915050612a6c565b50909192565b60606073805480602002602001604051908101604052809291908181526020018280548015612bc857602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311612baa575b5050505050905090565b612bda6130cb565b6001600160a01b0316336001600160a01b031614612c0a5760405162461bcd60e51b8152600401610de990615a7d565b6001600160a01b038216600090815260e8602052604090206001015415612e515760e7548060005b82811015612c8b57846001600160a01b031660e78281548110612c5757612c57615a12565b6000918252602090912001546001600160a01b031603612c7957809150612c8b565b80612c8381615a3e565b915050612c32565b50818103612c995750505050565b6001600160a01b038416600090815260e860205260409020548015612e4d576001600160a01b038516600090815260e860205260408120818155600190810191909155831115612d5b5760e7612cf0600185615a57565b81548110612d0057612d00615a12565b60009182526020909120015460e780546001600160a01b039092169184908110612d2c57612d2c615a12565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480612d6c57612d6c615c4a565b60008281526020808220830160001990810180546001600160a01b03191690559092019092556001600160a01b038716825260e9905260409020805460ff19166001179055612dbe84826104b061446f565b15612e0857836001600160a01b0316856001600160a01b03167f7229136a18186c71a86246c012af3bb1df6460ef163934bbdccd6368abdd41e48360405161154e91815260200190565b836001600160a01b0316856001600160a01b03167f3747d14eb72ad3e35cba9c3e00dab3b8d15b40cac6bdbd08402356e4f69f30a1834760405161154e929190615b6b565b5050505b5050565b612e5d6130cb565b6001600160a01b0316336001600160a01b031614612e8d5760405162461bcd60e51b8152600401610de990615a7d565b61102081613452565b60006111628383613157565b33612eab61307f565b6001600160a01b031614612ed257604051638aaf4a0760e01b815260040160405180910390fd5b612edb826144cf565b15612ef95760405163030081e760e01b815260040160405180910390fd5b6001600160a01b0382166000908152607560205260409020600581015415612f345760405163fab9167360e01b815260040160405180910390fd5b612f4781612f428442615a6a565b6143f3565b505050565b33612f5561307f565b6001600160a01b031614612f7c57604051638aaf4a0760e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604090205415612fb357604051632f32dcdd60e11b815260040160405180910390fd5b612710811115612fd657604051631b8454a360e21b815260040160405180910390fd5b607654821015612ff95760405163fa0ae69360e01b815260040160405180910390fd5b6001600160a01b03831660009081526077602052604081209062015180846130218242615bdc565b61302b9190615a6a565b6130359190615baf565b808355600183018490556040519091506001600160a01b038616907f6ebafd1bb6316b2f63198a81b05cff2149c6eaae1784466a6d062b4391900f21906128269084908790615b6b565b6071546001600160a01b031690565b6001600160a01b038116600090815260ac60205260408120546130c49060ff1660038111156130bf576130bf61594e565b61454c565b1592915050565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b600181101561311b576040516317b8970f60e01b815260040160405180910390fd5b60768190556040518181527f266d432ffe659e3565750d26ec685b822a58041eee724b67a5afec3168a25267906020015b60405180910390a150565b6001600160a01b03919091166000908152603960209081526040808320938352929052205460ff1690565b60008160038111156131965761319661594e565b8360038111156131a8576131a861594e565b1660ff1615159392505050565b6000610cbb6201518083615bdc565b6001600160a01b03919091166000908152603a6020526040902054101590565b607080546001600160a01b0319166001600160a01b0383161790556040517faa5b07dd43aa44c69b70a6a2b9c3fcfed12b6e5f6323596ba7ac91035ab80a4f9061314c908390615609565b60008183101561323f5781611162565b5090919050565b6001600160a01b03919091166000908152603760209081526040808320938352929052205460ff1690565b607180546001600160a01b0319166001600160a01b0383161790556040517f6397f5b135542bb3f477cb346cfab5abdec1251d08dc8f8d4efb4ffe122ea0bf9061314c908390615609565b606d80546001600160a01b0319166001600160a01b0383161790556040517fc328090a37d855191ab58469296f98f87a851ca57d5cdfd1e9ac3c83e9e7096d9061314c908390615609565b606f80546001600160a01b0319166001600160a01b0383161790556040517f31a33f126a5bae3c5bdf6cfc2cd6dcfffe2fe9634bdb09e21c44762993889e3b9061314c908390615609565b606e80546001600160a01b0319166001600160a01b0383161790556040517f034c8da497df28467c79ddadbba1cc3cdd41f510ea73faae271e6f16a61116219061314c908390615609565b60a880546001600160a01b0319166001600160a01b0383161790556040517ffd6f5f93d69a07c593a09be0b208bff13ab4ffd6017df3b33433d63bdc59b4d79061314c908390615609565b60a98190556040518181527fb5464c05fd0e0f000c535850116cda2742ee1f7b34384cb920ad7b8e802138b59060200161314c565b60728190556040518181527f82d5dc32d1b741512ad09c32404d7e7921e8934c6222343d95f55f7a2b9b2ab49060200161314c565b60a954811115613475576040516355408ce960e11b815260040160405180910390fd5b60ad8190556040518181527fa9588dc77416849bd922605ce4fc806712281ad8a8f32d4238d6c8cca548e15e9060200161314c565b60e58190556040518181527f17a6c3eb965cdd7439982da25abf85be88f0f772ca33198f548e2f99fee0289a9060200161314c565b60e68190556040518181527f0a50c66137118f386332efb949231ddd3946100dbf880003daca37ddd9e0662b9060200161314c565b6000610cbb8261456a565b6000610cbb82436131c4565b600081831061323f5781611162565b606e5460405163889998ef60e01b8152600481018490526000916001600160a01b03169063889998ef90602401602060405180830381865afa158015613584573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135a89190615ad8565b606e5460405163033cdc2b60e31b8152600481018690529192506000916001600160a01b03909116906319e6e15890602401602060405180830381865afa1580156135f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061361b9190615ad8565b606e549091506000906001600160a01b031663f67e81528661363c87611703565b6040518363ffffffff1660e01b8152600401613659929190615c60565b600060405180830381865afa158015613676573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261369e9190810190615c81565b90506136ab83838361458f565b15806136b5575081155b156137325760005b845181101561372a57845160e2546136d59190615bdc565b60e360008784815181106136eb576136eb615a12565b60200260200101516001600160a01b03166001600160a01b0316815260200190815260200160002081905550808061372290615a3e565b9150506136bd565b505050505050565b600080600080607060009054906101000a90046001600160a01b03166001600160a01b0316631079402a6040518163ffffffff1660e01b8152600401608060405180830381865afa15801561378b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906137af9190615b79565b9296509094509250905080861160005b89518110156138b857888782815181106137db576137db615a12565b602002602001015160e2546137f09190615baf565b6137fa9190615bdc565b60e360008c848151811061381057613810615a12565b60200260200101516001600160a01b03166001600160a01b031681526020019081526020016000208190555081156138a6576138a68b8b838151811061385857613858615a12565b60200260200101518a6127108b868151811061387657613876615a12565b60200260200101516138889190615baf565b6138929190615bdc565b61389e90612710615a57565b878a8a614648565b806138b081615a3e565b9150506137bf565b5050505050505050505050565b6000606060008084516001600160401b038111156138e5576138e56156f4565b60405190808252806020026020018201604052801561390e578160200160208202803683370190505b50925060005b8551811015613ae75785818151811061392f5761392f615a12565b6020908102919091018101516001600160a01b03808216600090815260759093526040909220600201549094501691506139698388613157565b61399c576001600160a01b0380841660009081526075602052604090206003015461399791859116846148a8565b6139ce565b6001600160a01b038316600090815260e3602052604081205460e48054919290916139c8908490615a6a565b90915550505b6139d78361351f565b1580156139eb57506139e98388613246565b155b15613a5f576001600160a01b038316600090815260e16020526040902054613a139086615a6a565b6001600160a01b038416600090815260e16020526040902054855191965090859083908110613a4457613a44615a12565b602002602001018181525050613a5a8383614985565b613aa5565b6001600160a01b038316600090815260e1602090815260408083205460e090925290912054613a8e9190615a6a565b60e46000828254613a9f9190615a6a565b90915550505b6001600160a01b038316600090815260e16020908152604080832083905560e0825280832083905560e390915281205580613adf81615a3e565b915050613914565b5060e26000905550509250929050565b6071546001600160a01b03168215612e4d57613b138184614a4d565b15613bbb5760405163566bce2360e11b81526001600160a01b0382169063acd79c4690613b4890879086908a90600401615d36565b600060405180830381600087803b158015613b6257600080fd5b505af1158015613b76573d6000803e3d6000fd5b505050507f9e242ca1ef9dde96eb71ef8d19a3f0f6a619b63e4c0d3998771387103656d087838584604051613bad93929190615d6c565b60405180910390a150613bfa565b7fe5668ec1bb2b6bb144a50f810e388da4b1d7d3fc05fcb9d588a1aac59d248f8983858447604051613bf09493929190615da1565b60405180910390a1505b50505050565b60e754600080805b83831015613bfa5760e78381548110613c2357613c23615a12565b60009182526020808320909101546001600160a01b031680835260e89091526040909120600181015491935091504210613d4957805460e48054600090613c6b908490615a6a565b90915550506001600160a01b038216600090815260e860205260408120818155600101819055613c9a85615dde565b9450841115613d115760e78481548110613cb657613cb6615a12565b60009182526020909120015460e780546001600160a01b039092169185908110613ce257613ce2615a12565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60e7805480613d2257613d22615c4a565b600082815260209020810160001990810180546001600160a01b0319169055019055613c08565b82613d5381615a3e565b935050613c08565b60e4548015611020576000613d6e611569565b600060e481905560408051600481526024810182526020810180516001600160e01b03166359f778df60e01b179052905192935090916001600160a01b038416918591613dbb9190615df5565b60006040518083038185875af1925050503d8060008114613df8576040519150601f19603f3d011682016040523d82523d6000602084013e613dfd565b606091505b505090508015613e4257816001600160a01b03167fc447c884574da5878be39c403db2245c22530c99b579ea7bcbb3720e1d110dc884604051611bba91815260200190565b816001600160a01b03167fa0561a59abed308fcd0556834574739d778cc6229018039a24ddda0f86aa0b738447604051611bba929190615b6b565b606080613e8983614aa9565b6071546040516391f8723f60e01b81529192506000916001600160a01b03909116906391f8723f90613ec090607390600401615e24565b600060405180830381865afa158015613edd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f059190810190615c81565b60a854604051632907e73160e11b81529192506000916001600160a01b039091169063520fce6290613f3c90607390600401615e24565b600060405180830381865afa158015613f59573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052613f819190810190615c81565b90506000613ff06073805480602002602001604051908101604052809291908181526020018280548015613fde57602002820191906000526020600020905b81546001600160a01b03168152600190910190602001808311613fc0575b5050505050848460a95460ad54614f9c565b9095509050614000858288615066565b505050915091565b606f546000906001600160a01b031663fdadda8183614028436001615a6a565b6040518363ffffffff1660e01b8152600401614045929190615c14565b600060405180830381865afa158015614062573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261408a9190810190615e68565b905060005b82518110156143515760008382815181106140ac576140ac615a12565b6020908102919091018101516001600160a01b0381166000908152603b9092526040822054909250421115906140e183611fdc565b905060006140f9846140f4436001615a6a565b6131c4565b8061411a575085858151811061411157614111615a12565b60200260200101515b806141225750825b159050811580156141305750805b156141ab576001600160a01b038416600090815260ac602052604090205461416f9060019060ff1660038111156141695761416961594e565b906151c4565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156141a1576141a161594e565b021790555061422d565b8180156141b6575080155b1561422d576001600160a01b038416600090815260ac60205260409020546141f59060019060ff1660038111156141ef576141ef61594e565b906151ff565b6001600160a01b038516600090815260ac60205260409020805460ff191660018360038111156142275761422761594e565b02179055505b600061423885611169565b90508315811580156142475750805b156142bc576001600160a01b038616600090815260ac60205260409020546142809060029060ff1660038111156141695761416961594e565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156142b2576142b261594e565b0217905550614338565b8180156142c7575080155b15614338576001600160a01b038616600090815260ac60205260409020546143009060029060ff1660038111156141ef576141ef61594e565b6001600160a01b038716600090815260ac60205260409020805460ff191660018360038111156143325761433261594e565b02179055505b505050505050808061434990615a3e565b91505061408f565b5082847f283b50d76057d5f828df85bc87724c6af604e9b55c363a07c9faa2a2cd688b8261437d611864565b60405161438a919061583f565b60405180910390a382847f773d1888df530d69716b183a92450d45f97fba49f2a4bb34fae3b23da0e2cc6f6143bd612349565b6040516143ca919061583f565b60405180910390a350505050565b6000600154826143e89190615bdc565b610cbb906001615a6a565b600182015461440a906001600160a01b0316612561565b6144275760405163a64b34ad60e01b815260040160405180910390fd5b6005820181905560018201546040518281526001600160a01b03909116907fb9a1e33376bfbda9092f2d1e37662c1b435aab0d3fa8da3acc8f37ee222f99e790602001611133565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d80600081146144bf576040519150601f19603f3d011682016040523d82523d6000602084013e6144c4565b606091505b509095945050505050565b60a85460405163107fbb4760e21b815260009182916001600160a01b03909116906341feed1c90614504908690600401615609565b602060405180830381865afa158015614521573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906145459190615ad8565b1192915050565b60008160038111156145605761456061594e565b60ff161592915050565b6001600160a01b03808216600090815260756020526040812060030154909116610cbb565b60016000805b835181101561460157848482815181106145b1576145b1615a12565b602002602001015111156145c85760009250614601565b8381815181106145da576145da615a12565b6020026020010151826145ed9190615a6a565b9150806145f981615a3e565b915050614595565b5081801561460f5750848111155b915081614640576040517f64ba7143ea5a17abea37667aa9ae137e3afba5033c5f504770c02829c128189c90600090a15b509392505050565b8084106147c4576001600160a01b03851660008181526039602090815260408083208a845282528083208054600160ff199182168117909255948452603783528184208b855290925282208054909316179091556146a6438561523b565b6001600160a01b0387166000908152603a60205260409020549091506146cd90829061322f565b6001600160a01b0387166000908152603a6020908152604080832093909355603c905220546146fd90829061322f565b6001600160a01b038088166000908152603c60205260409081902092909255607054915163c008ce3960e01b815291169063c008ce39906147479089906002908c90600401615ef6565b600060405180830381600087803b15801561476157600080fd5b505af1158015614775573d6000803e3d6000fd5b5050506001600160a01b0387166000818152603a60205260408082205490518b9450600080516020615fa6833981519152926147b692916001908190615af1565b60405180910390a35061372a565b81841061372a576001600160a01b0380861660009081526039602090815260408083208a845290915290819020805460ff19166001908117909155607054915163c008ce3960e01b8152919092169163c008ce39916148299189918b90600401615ef6565b600060405180830381600087803b15801561484357600080fd5b505af1158015614857573d6000803e3d6000fd5b5050506001600160a01b0386166000818152603a60205260408082205490518a9450600080516020615fa68339815191529261489892918190600190615af1565b60405180910390a3505050505050565b6001600160a01b038316600090815260e360205260409020548015613bfa576148d482826104b061446f565b1561493657816001600160a01b0316836001600160a01b0316856001600160a01b03167f72a57dc38837a1cba7881b7b1a5594d9e6b65cec6a985b54e2cee3e89369691c8460405161492891815260200190565b60405180910390a450505050565b816001600160a01b0316836001600160a01b0316856001600160a01b03167fd35d76d87d51ed89407fc7ceaaccf32cf72784b94530892ce33546540e141b728447604051614928929190615b6b565b6001600160a01b038216600090815260e060205260409020548015612f47576149b182826104b061446f565b15614a0857816001600160a01b0316836001600160a01b03167f1ce7a1c4702402cd393500acb1de5bd927727a54e144a587d328f1b679abe4ec836040516149fb91815260200190565b60405180910390a3505050565b816001600160a01b0316836001600160a01b03167f6c69e09ee5c5ac33c0cd57787261c5bade070a392ab34a4b5487c6868f723f6e83476040516149fb929190615b6b565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114614a9a576040519150601f19603f3d011682016040523d82523d6000602084013e614a9f565b606091505b5090949350505050565b6071546040805163af24542960e01b815290516060926001600160a01b031691600091839163af2454299160048083019260209291908290030181865afa158015614af8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b1c9190615ad8565b90506000826001600160a01b031663909791dd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015614b5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190614b829190615ad8565b90506000836001600160a01b03166342ef3c3460736040518263ffffffff1660e01b8152600401614bb39190615e24565b600060405180830381865afa158015614bd0573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052614bf89190810190615c81565b6073549091506000816001600160401b03811115614c1857614c186156f4565b604051908082528060200260200182016040528015614c41578160200160208202803683370190505b50965060008060005b84831015614eed5760738381548110614c6557614c65615a12565b60009182526020808320909101546001600160a01b031680835260759091526040909120600681015488519294509092501515908890889086908110614cad57614cad615a12565b60200260200101511015614d095780614d04576000614ccc8a42615a6a565b600684018190556040518181529091506001600160a01b03851690600080516020615f668339815191529060200160405180910390a2505b614d4a565b8015614d4a578160060160009055826001600160a01b0316600080516020615f668339815191526000604051614d4191815260200190565b60405180910390a25b60008260050154600014158015614d65575042836005015411155b80614d8857506001600160a01b038416600090815260e9602052604090205460ff165b905060008360060154600014158015614da5575042846006015411155b90508180614db05750805b15614e465788614dbf89615dde565b98508881518110614dd257614dd2615a12565b6020026020010151898781518110614dec57614dec615a12565b6020908102919091010152848d88614e0381615a3e565b995081518110614e1557614e15615a12565b60200260200101906001600160a01b031690816001600160a01b031681525050614e3e85615256565b505050614c4a565b6001600160a01b0385166000908152607760205260409020548015801590614e6e5750428111155b15614ed7576001600160a01b0386166000818152607760209081526040808320600181018054918590559390935560048901839055518281529192917f86d576c20e383fc2413ef692209cc48ddad5e52f25db5b32f8f7ec5076461ae9910160405180910390a2505b86614ee181615a3e565b97505050505050614c4a565b5050508087528015614f91577f4eaf233b9dc25a5552c1927feee1412eea69add17c2485c831c2e60e234f3c9187604051614f28919061583f565b60405180910390a160405163e22d1c9d60e01b81526001600160a01b0387169063e22d1c9d90614f5e908a908c90600401615c14565b600060405180830381600087803b158015614f7857600080fd5b505af1158015614f8c573d6000803e3d6000fd5b505050505b505050505050919050565b60606000806068905060008888888888604051602401614fc0959493929190615f17565b60408051601f19818403018152919052602080820180516001600160e01b0316633bca0a8960e11b17905281518b51929350600192909160009161500391615baf565b61500e906040615a6a565b90506020840181888483895afa61502457600093505b503d61502f57600092505b6020870196508261505357604051630fc2632160e01b815260040160405180910390fd5b8651955050505050509550959350505050565b815b60aa548110156150c457600081815260ab6020818152604080842080546001600160a01b0316855260ac8352908420805460ff19169055928490525280546001600160a01b0319169055806150bc81615a3e565b915050615068565b5060005b8281101561510e57600081815260ab60209081526040808320546001600160a01b0316835260ac9091529020805460ff191690558061510681615a3e565b9150506150c8565b5060005b8281101561518c57600084828151811061512e5761512e615a12565b6020908102919091018101516001600160a01b0316600081815260ac83526040808220805460ff1916600317905585825260ab9093529190912080546001600160a01b0319169091179055508061518481615a3e565b915050615112565b508160aa81905550807f3d0eea40644a206ec25781dd5bb3b60eb4fa1264b993c3bddf3c73b14f29ef5e84604051611bba919061583f565b60008160038111156151d8576151d861594e565b8360038111156151ea576151ea61594e565b1760ff1660038111156111625761116261594e565b60008160038111156152135761521361594e565b198360038111156152265761522661594e565b1660ff1660038111156111625761116261594e565b60008160000361524c576000611162565b6111628284615a6a565b6001600160a01b038116600090815260e960209081526040808320805460ff19169055607490915281205461102091839190819003615293575050565b6001600160a01b038216600090815260756020908152604080832080546001600160a01b03199081168255600180830180548316905560028301805483169055600383018054909216909155600482018590556005820185905560069091018490556074835281842084905560779092528220828155810182905560738054909161531d91615a57565b8154811061532d5761532d615a12565b6000918252602090912001546001600160a01b039081169150831681146153b0576001600160a01b038116600090815260746020526040902082905560738054829190841990811061538157615381615a12565b9060005260206000200160006101000a8154816001600160a01b0302191690836001600160a01b031602179055505b60738054806153c1576153c1615c4a565b600082815260209020810160001990810180546001600160a01b0319169055019055505050565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c081019190915290565b6001600160a01b038116811461102057600080fd5b6000806040838503121561544c57600080fd5b823561545781615424565b9150602083013561546781615424565b809150509250929050565b600080600080600060a0868803121561548a57600080fd5b853561549581615424565b945060208601356154a581615424565b935060408601356154b581615424565b925060608601356154c581615424565b949793965091946080013592915050565b600080604083850312156154e957600080fd5b82356154f481615424565b946020939093013593505050565b60006020828403121561551457600080fd5b5035919050565b60006020828403121561552d57600080fd5b813561116281615424565b60018060a01b03808251168352806020830151166020840152806040830151166040840152806060830151166060840152506080810151608083015260a081015160a083015260c081015160c08301525050565b60e08101610cbb8284615538565b815181526020808301519082015260408101610cbb565b801515811461102057600080fd5b600080600080608085870312156155d557600080fd5b84356155e081615424565b9350602085013592506040850135915060608501356155fe816155b1565b939692955090935050565b6001600160a01b0391909116815260200190565b8060408101831015610cbb57600080fd5b6000806000806000806000806000806000806101a08d8f03121561565157600080fd5b8c3561565c81615424565b9b5060208d013561566c81615424565b9a5060408d013561567c81615424565b995060608d013561568c81615424565b985060808d013561569c81615424565b975060a08d01356156ac81615424565b965060c08d0135955060e08d013594506101008d013593506101208d013592506101408d013591506156e28e6101608f0161561d565b90509295989b509295989b509295989b565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715615732576157326156f4565b604052919050565b60006001600160401b03821115615753576157536156f4565b5060051b60200190565b6000602080838503121561577057600080fd5b82356001600160401b0381111561578657600080fd5b8301601f8101851361579757600080fd5b80356157aa6157a58261573a565b61570a565b81815260059190911b820183019083810190878311156157c957600080fd5b928401925b828410156157f05783356157e181615424565b825292840192908401906157ce565b979650505050505050565b600081518084526020808501945080840160005b838110156158345781516001600160a01b03168752958201959082019060010161580f565b509495945050505050565b60208152600061116260208301846157fb565b6000806020838503121561586557600080fd5b82356001600160401b038082111561587c57600080fd5b818501915085601f83011261589057600080fd5b81358181111561589f57600080fd5b8660208260051b85010111156158b457600080fd5b60209290920196919550909350505050565b6020808252825182820181905260009190848201906040850190845b818110156159005783511515835292840192918401916001016158e2565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b818110156159005761593b838551615538565b9284019260e09290920191600101615928565b634e487b7160e01b600052602160045260246000fd5b60608152600061597760608301866157fb565b60208382038185015261598a82876157fb565b8481036040860152855180825282870193509082019060005b818110156159cf578451600481106159bd576159bd61594e565b835293830193918301916001016159a3565b509098975050505050505050565b6000806000606084860312156159f257600080fd5b83356159fd81615424565b95602085013595506040909401359392505050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201615a5057615a50615a28565b5060010190565b81810381811115610cbb57610cbb615a28565b80820180821115610cbb57610cbb615a28565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b6001600160a01b03929092168252602082015260400190565b600060208284031215615aea57600080fd5b5051919050565b9384526020840192909252151560408301521515606082015260800190565b600080600060608486031215615b2557600080fd5b8351615b30816155b1565b602085015160409095015190969495509392505050565b8281526040810160038310615b5e57615b5e61594e565b8260208301529392505050565b918252602082015260400190565b60008060008060808587031215615b8f57600080fd5b505082516020840151604085015160609095015191969095509092509050565b8082028115828204841417610cbb57610cbb615a28565b634e487b7160e01b600052601260045260246000fd5b600082615beb57615beb615bc6565b500490565b60008060408385031215615c0357600080fd5b505080516020909101519092909150565b604081526000615c2760408301856157fb565b90508260208301529392505050565b600082615c4557615c45615bc6565b500690565b634e487b7160e01b600052603160045260246000fd5b828152604060208201526000615c7960408301846157fb565b949350505050565b60006020808385031215615c9457600080fd5b82516001600160401b03811115615caa57600080fd5b8301601f81018513615cbb57600080fd5b8051615cc96157a58261573a565b81815260059190911b82018301908381019087831115615ce857600080fd5b928401925b828410156157f057835182529284019290840190615ced565b600081518084526020808501945080840160005b8381101561583457815187529582019590820190600101615d1a565b606081526000615d4960608301866157fb565b8281036020840152615d5b8186615d06565b915050826040830152949350505050565b838152606060208201526000615d8560608301856157fb565b8281036040840152615d978185615d06565b9695505050505050565b848152608060208201526000615dba60808301866157fb565b8281036040840152615dcc8186615d06565b91505082606083015295945050505050565b600081615ded57615ded615a28565b506000190190565b6000825160005b81811015615e165760208186018101518583015201615dfc565b506000920191825250919050565b6020808252825482820181905260008481528281209092916040850190845b818110156159005783546001600160a01b031683526001938401939285019201615e43565b60006020808385031215615e7b57600080fd5b82516001600160401b03811115615e9157600080fd5b8301601f81018513615ea257600080fd5b8051615eb06157a58261573a565b81815260059190911b82018301908381019087831115615ecf57600080fd5b928401925b828410156157f0578351615ee7816155b1565b82529284019290840190615ed4565b6001600160a01b039390931683526020830191909152604082015260600190565b60a081526000615f2a60a08301886157fb565b8281036020840152615f3c8188615d06565b90508281036040840152615f508187615d06565b6060840195909552505060800152939250505056fe88f854e137380c14d63f6ed99781bf13402167cf55bac49bcd44d4f2d6a342754042bb9a70998f80a86d9963f0d2132e9b11c8ad94d207c6141c8e34b05ce53e54ce99c5ce1fc9f61656d4a0fb2697974d0c973ac32eecaefe06fcf18b8ef68aa2646970667358221220a1eb2c9a0a4cbc889fd4810519c15ef9865e041ad7aa23ef79fce6ce5a27a4c564736f6c63430008110033", "devdoc": { "errors": { "ErrAlreadyRequestedEmergencyExit()": [ @@ -2785,7 +2785,7 @@ "type": "t_bool" }, { - "astId": 33691, + "astId": 33718, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_numberOfBlocksInEpoch", "offset": 0, @@ -2793,7 +2793,7 @@ "type": "t_uint256" }, { - "astId": 33694, + "astId": 33721, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_lastUpdatedBlock", "offset": 0, @@ -2801,7 +2801,7 @@ "type": "t_uint256" }, { - "astId": 33697, + "astId": 33724, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_lastUpdatedPeriod", "offset": 0, @@ -2809,7 +2809,7 @@ "type": "t_uint256" }, { - "astId": 33700, + "astId": 33727, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_currentPeriodStartAtBlock", "offset": 0, @@ -2817,7 +2817,7 @@ "type": "t_uint256" }, { - "astId": 33705, + "astId": 33732, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_periodOf", "offset": 0, @@ -2825,7 +2825,7 @@ "type": "t_mapping(t_uint256,t_uint256)" }, { - "astId": 33710, + "astId": 33737, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "______gap", "offset": 0, @@ -2833,7 +2833,7 @@ "type": "t_array(t_uint256)49_storage" }, { - "astId": 33337, + "astId": 33364, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_miningRewardDeprecatedAtPeriod", "offset": 0, @@ -2841,7 +2841,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 33344, + "astId": 33371, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_miningRewardBailoutCutOffAtPeriod", "offset": 0, @@ -2849,7 +2849,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 33351, + "astId": 33378, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_bridgeRewardDeprecatedAtPeriod", "offset": 0, @@ -2857,7 +2857,7 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_bool))" }, { - "astId": 33356, + "astId": 33383, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_blockProducerJailedBlock", "offset": 0, @@ -2865,7 +2865,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 33361, + "astId": 33388, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_emergencyExitJailedTimestamp", "offset": 0, @@ -2873,7 +2873,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 33366, + "astId": 33393, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_cannotBailoutUntilBlock", "offset": 0, @@ -2881,7 +2881,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 33371, + "astId": 33398, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "______gap", "offset": 0, @@ -2926,10 +2926,10 @@ "label": "_stakingContract", "offset": 0, "slot": "113", - "type": "t_contract(IStaking)11483" + "type": "t_contract(IStaking)11489" }, { - "astId": 30093, + "astId": 30114, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_maxValidatorCandidate", "offset": 0, @@ -2937,7 +2937,7 @@ "type": "t_uint256" }, { - "astId": 30097, + "astId": 30118, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_candidates", "offset": 0, @@ -2945,7 +2945,7 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 30102, + "astId": 30123, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_candidateIndex", "offset": 0, @@ -2953,15 +2953,15 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 30108, + "astId": 30129, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_candidateInfo", "offset": 0, "slot": "117", - "type": "t_mapping(t_address,t_struct(ValidatorCandidate)11500_storage)" + "type": "t_mapping(t_address,t_struct(ValidatorCandidate)11506_storage)" }, { - "astId": 30111, + "astId": 30132, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_minEffectiveDaysOnwards", "offset": 0, @@ -2969,15 +2969,15 @@ "type": "t_uint256" }, { - "astId": 30117, + "astId": 30138, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_candidateCommissionChangeSchedule", "offset": 0, "slot": "119", - "type": "t_mapping(t_address,t_struct(CommissionSchedule)11505_storage)" + "type": "t_mapping(t_address,t_struct(CommissionSchedule)11511_storage)" }, { - "astId": 30122, + "astId": 30143, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "______gap", "offset": 0, @@ -2993,7 +2993,7 @@ "type": "t_contract(IRoninTrustedOrganization)10182" }, { - "astId": 33870, + "astId": 33897, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_maxValidatorNumber", "offset": 0, @@ -3001,7 +3001,7 @@ "type": "t_uint256" }, { - "astId": 33873, + "astId": 33900, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "validatorCount", "offset": 0, @@ -3009,7 +3009,7 @@ "type": "t_uint256" }, { - "astId": 33878, + "astId": 33905, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_validators", "offset": 0, @@ -3017,15 +3017,15 @@ "type": "t_mapping(t_uint256,t_address)" }, { - "astId": 33884, + "astId": 33911, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_validatorMap", "offset": 0, "slot": "172", - "type": "t_mapping(t_address,t_enum(ValidatorFlag)12612)" + "type": "t_mapping(t_address,t_enum(ValidatorFlag)12618)" }, { - "astId": 33887, + "astId": 33914, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_maxPrioritizedValidatorNumber", "offset": 0, @@ -3033,7 +3033,7 @@ "type": "t_uint256" }, { - "astId": 33892, + "astId": 33919, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "______gap", "offset": 0, @@ -3041,7 +3041,7 @@ "type": "t_array(t_uint256)50_storage" }, { - "astId": 33213, + "astId": 33240, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_miningReward", "offset": 0, @@ -3049,7 +3049,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 33218, + "astId": 33245, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_delegatingReward", "offset": 0, @@ -3057,7 +3057,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 33221, + "astId": 33248, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_totalBridgeReward", "offset": 0, @@ -3065,7 +3065,7 @@ "type": "t_uint256" }, { - "astId": 33226, + "astId": 33253, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_bridgeOperatingReward", "offset": 0, @@ -3073,7 +3073,7 @@ "type": "t_mapping(t_address,t_uint256)" }, { - "astId": 33229, + "astId": 33256, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_totalDeprecatedReward", "offset": 0, @@ -3081,7 +3081,7 @@ "type": "t_uint256" }, { - "astId": 33232, + "astId": 33259, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_emergencyExitLockedAmount", "offset": 0, @@ -3089,7 +3089,7 @@ "type": "t_uint256" }, { - "astId": 33235, + "astId": 33262, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_emergencyExpiryDuration", "offset": 0, @@ -3097,7 +3097,7 @@ "type": "t_uint256" }, { - "astId": 33239, + "astId": 33266, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_lockedConsensusList", "offset": 0, @@ -3105,15 +3105,15 @@ "type": "t_array(t_address)dyn_storage" }, { - "astId": 33245, + "astId": 33272, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_exitInfo", "offset": 0, "slot": "232", - "type": "t_mapping(t_address,t_struct(EmergencyExitInfo)12033_storage)" + "type": "t_mapping(t_address,t_struct(EmergencyExitInfo)12039_storage)" }, { - "astId": 33250, + "astId": 33277, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "_lockedFundReleased", "offset": 0, @@ -3121,7 +3121,7 @@ "type": "t_mapping(t_address,t_bool)" }, { - "astId": 33255, + "astId": 33282, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "______gap", "offset": 0, @@ -3195,7 +3195,7 @@ "label": "contract ISlashIndicator", "numberOfBytes": "20" }, - "t_contract(IStaking)11483": { + "t_contract(IStaking)11489": { "encoding": "inplace", "label": "contract IStaking", "numberOfBytes": "20" @@ -3205,7 +3205,7 @@ "label": "contract IStakingVesting", "numberOfBytes": "20" }, - "t_enum(ValidatorFlag)12612": { + "t_enum(ValidatorFlag)12618": { "encoding": "inplace", "label": "enum EnumFlags.ValidatorFlag", "numberOfBytes": "1" @@ -3217,12 +3217,12 @@ "numberOfBytes": "32", "value": "t_bool" }, - "t_mapping(t_address,t_enum(ValidatorFlag)12612)": { + "t_mapping(t_address,t_enum(ValidatorFlag)12618)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => enum EnumFlags.ValidatorFlag)", "numberOfBytes": "32", - "value": "t_enum(ValidatorFlag)12612" + "value": "t_enum(ValidatorFlag)12618" }, "t_mapping(t_address,t_mapping(t_uint256,t_bool))": { "encoding": "mapping", @@ -3231,26 +3231,26 @@ "numberOfBytes": "32", "value": "t_mapping(t_uint256,t_bool)" }, - "t_mapping(t_address,t_struct(CommissionSchedule)11505_storage)": { + "t_mapping(t_address,t_struct(CommissionSchedule)11511_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct ICandidateManager.CommissionSchedule)", "numberOfBytes": "32", - "value": "t_struct(CommissionSchedule)11505_storage" + "value": "t_struct(CommissionSchedule)11511_storage" }, - "t_mapping(t_address,t_struct(EmergencyExitInfo)12033_storage)": { + "t_mapping(t_address,t_struct(EmergencyExitInfo)12039_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct ICommonInfo.EmergencyExitInfo)", "numberOfBytes": "32", - "value": "t_struct(EmergencyExitInfo)12033_storage" + "value": "t_struct(EmergencyExitInfo)12039_storage" }, - "t_mapping(t_address,t_struct(ValidatorCandidate)11500_storage)": { + "t_mapping(t_address,t_struct(ValidatorCandidate)11506_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct ICandidateManager.ValidatorCandidate)", "numberOfBytes": "32", - "value": "t_struct(ValidatorCandidate)11500_storage" + "value": "t_struct(ValidatorCandidate)11506_storage" }, "t_mapping(t_address,t_uint256)": { "encoding": "mapping", @@ -3280,12 +3280,12 @@ "numberOfBytes": "32", "value": "t_uint256" }, - "t_struct(CommissionSchedule)11505_storage": { + "t_struct(CommissionSchedule)11511_storage": { "encoding": "inplace", "label": "struct ICandidateManager.CommissionSchedule", "members": [ { - "astId": 11502, + "astId": 11508, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "effectiveTimestamp", "offset": 0, @@ -3293,7 +3293,7 @@ "type": "t_uint256" }, { - "astId": 11504, + "astId": 11510, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "commissionRate", "offset": 0, @@ -3303,12 +3303,12 @@ ], "numberOfBytes": "64" }, - "t_struct(EmergencyExitInfo)12033_storage": { + "t_struct(EmergencyExitInfo)12039_storage": { "encoding": "inplace", "label": "struct ICommonInfo.EmergencyExitInfo", "members": [ { - "astId": 12030, + "astId": 12036, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "lockedAmount", "offset": 0, @@ -3316,7 +3316,7 @@ "type": "t_uint256" }, { - "astId": 12032, + "astId": 12038, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "recyclingAt", "offset": 0, @@ -3326,12 +3326,12 @@ ], "numberOfBytes": "64" }, - "t_struct(ValidatorCandidate)11500_storage": { + "t_struct(ValidatorCandidate)11506_storage": { "encoding": "inplace", "label": "struct ICandidateManager.ValidatorCandidate", "members": [ { - "astId": 11487, + "astId": 11493, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "admin", "offset": 0, @@ -3339,7 +3339,7 @@ "type": "t_address" }, { - "astId": 11489, + "astId": 11495, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "consensusAddr", "offset": 0, @@ -3347,7 +3347,7 @@ "type": "t_address" }, { - "astId": 11491, + "astId": 11497, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "treasuryAddr", "offset": 0, @@ -3355,7 +3355,7 @@ "type": "t_address_payable" }, { - "astId": 11493, + "astId": 11499, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "bridgeOperatorAddr", "offset": 0, @@ -3363,7 +3363,7 @@ "type": "t_address" }, { - "astId": 11495, + "astId": 11501, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "commissionRate", "offset": 0, @@ -3371,7 +3371,7 @@ "type": "t_uint256" }, { - "astId": 11497, + "astId": 11503, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "revokingTimestamp", "offset": 0, @@ -3379,7 +3379,7 @@ "type": "t_uint256" }, { - "astId": 11499, + "astId": 11505, "contract": "contracts/ronin/validator/RoninValidatorSet.sol:RoninValidatorSet", "label": "topupDeadline", "offset": 0, diff --git a/deployments/ronin-mainnet/StakingLogic.json b/deployments/ronin-mainnet/StakingLogic.json index 43b9cbb47..03532a5fa 100644 --- a/deployments/ronin-mainnet/StakingLogic.json +++ b/deployments/ronin-mainnet/StakingLogic.json @@ -1,5 +1,5 @@ { - "address": "0xe84C84C1e6c488a7947d21027CDd6674821348A1", + "address": "0x9B0E61e629EB44875CFf534DE0c176078CaC502f", "abi": [ { "inputs": [], @@ -144,6 +144,25 @@ "name": "ErrZeroValue", "type": "error" }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "minRate", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "maxRate", + "type": "uint256" + } + ], + "name": "CommissionRateRangeUpdated", + "type": "event" + }, { "anonymous": false, "inputs": [ @@ -195,19 +214,6 @@ "name": "Initialized", "type": "event" }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "maxRate", - "type": "uint256" - } - ], - "name": "MaxCommissionRateUpdated", - "type": "event" - }, { "anonymous": false, "inputs": [ @@ -769,6 +775,24 @@ "stateMutability": "payable", "type": "function" }, + { + "inputs": [], + "name": "getCommissionRateRange", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -1022,19 +1046,6 @@ "stateMutability": "view", "type": "function" }, - { - "inputs": [], - "name": "maxCommissionRate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, { "inputs": [], "name": "minValidatorStakingAmount", @@ -1124,11 +1135,16 @@ "inputs": [ { "internalType": "uint256", - "name": "_cooldownSecs", + "name": "_minRate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxRate", "type": "uint256" } ], - "name": "setCooldownSecsToUndelegate", + "name": "setCommissionRateRange", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1137,11 +1153,11 @@ "inputs": [ { "internalType": "uint256", - "name": "_maxRate", + "name": "_cooldownSecs", "type": "uint256" } ], - "name": "setMaxCommissionRate", + "name": "setCooldownSecsToUndelegate", "outputs": [], "stateMutability": "nonpayable", "type": "function" @@ -1265,41 +1281,41 @@ "type": "receive" } ], - "transactionHash": "0xec6aa9d9938342e29fe2640d7095a83fdc90822306bd5e85e1cc63fe5ee4f331", + "transactionHash": "0x444895ac6c2bb77d6e40f8c5c62ac2ed1fb1035d50ebb54188e765f07bc92c3c", "receipt": { "to": null, - "from": "0x0F68eDBE14C8f68481771016d7E2871d6a35DE11", - "contractAddress": "0xe84C84C1e6c488a7947d21027CDd6674821348A1", - "transactionIndex": 2, - "gasUsed": "3289965", - "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000002000000000000000000000000000000000000000000000000000040000020000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000", - "blockHash": "0xd6a1dce3c8be31eb87d4c2d85c8efc810fdb35c695e5ebb12875e3fd8a667301", - "transactionHash": "0xec6aa9d9938342e29fe2640d7095a83fdc90822306bd5e85e1cc63fe5ee4f331", + "from": "0x4d58Ea7231c394d5804e8B06B1365915f906E27F", + "contractAddress": "0x9B0E61e629EB44875CFf534DE0c176078CaC502f", + "transactionIndex": 4, + "gasUsed": "3401979", + "logsBloom": "0x00000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000", + "blockHash": "0x0b85db7e156f579d042f91eb71f83c63530f4639abec4ec1acba3fc61e3c0ec2", + "transactionHash": "0x444895ac6c2bb77d6e40f8c5c62ac2ed1fb1035d50ebb54188e765f07bc92c3c", "logs": [ { - "transactionIndex": 2, - "blockNumber": 22608291, - "transactionHash": "0xec6aa9d9938342e29fe2640d7095a83fdc90822306bd5e85e1cc63fe5ee4f331", - "address": "0xe84C84C1e6c488a7947d21027CDd6674821348A1", + "transactionIndex": 4, + "blockNumber": 24127462, + "transactionHash": "0x444895ac6c2bb77d6e40f8c5c62ac2ed1fb1035d50ebb54188e765f07bc92c3c", + "address": "0x9B0E61e629EB44875CFf534DE0c176078CaC502f", "topics": [ "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" ], "data": "0x00000000000000000000000000000000000000000000000000000000000000ff", "logIndex": 6, - "blockHash": "0xd6a1dce3c8be31eb87d4c2d85c8efc810fdb35c695e5ebb12875e3fd8a667301" + "blockHash": "0x0b85db7e156f579d042f91eb71f83c63530f4639abec4ec1acba3fc61e3c0ec2" } ], - "blockNumber": 22608291, - "cumulativeGasUsed": "3635861", + "blockNumber": 24127462, + "cumulativeGasUsed": "5056208", "status": 1, "byzantium": true }, "args": [], - "numDeployments": 1, - "solcInputHash": "a50a3f056fa24c0b5a230a9cb29a1cb4", - "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"ErrAdminOfAnyActivePoolForbidden\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"extraInfo\",\"type\":\"string\"}],\"name\":\"ErrCannotInitTransferRON\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCannotTransferRON\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"}],\"name\":\"ErrInactivePool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientDelegatingAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientStakingAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidArrays\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidPoolShare\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrOnlyPoolAdminAllowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrPoolAdminForbidden\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrStakingAmountLeft\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrThreeInteractionAddrsNotEqual\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrThreeOperationAddrsNotDistinct\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUndelegateTooEarly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUndelegateZeroAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnstakeTooEarly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnstakeZeroAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroValue\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minSecs\",\"type\":\"uint256\"}],\"name\":\"CooldownSecsToUndelegateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxRate\",\"type\":\"uint256\"}],\"name\":\"MaxCommissionRateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"MinValidatorStakingAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"PoolApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"PoolSharesUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"validator\",\"type\":\"address[]\"}],\"name\":\"PoolsDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"}],\"name\":\"PoolsUpdateConflicted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"rewards\",\"type\":\"uint256[]\"}],\"name\":\"PoolsUpdateFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"aRps\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"shares\",\"type\":\"uint256[]\"}],\"name\":\"PoolsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingAmountDeductFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingAmountTransferFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Undelegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debited\",\"type\":\"uint256\"}],\"name\":\"UserRewardUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"secs\",\"type\":\"uint256\"}],\"name\":\"WaitingSecsToRevokeUpdated\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADDITION_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERIOD_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"applyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"bulkUndelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrList\",\"type\":\"address[]\"}],\"name\":\"claimRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownSecsToUndelegate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrList\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"_consensusAddrDst\",\"type\":\"address\"}],\"name\":\"delegateRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"execDeductStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_actualDeductingAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_pools\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_newPeriod\",\"type\":\"uint256\"}],\"name\":\"execDeprecatePools\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_rewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"execRecordRewards\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_pools\",\"type\":\"address[]\"}],\"name\":\"getManySelfStakings\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_selfStakings\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddrs\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_userList\",\"type\":\"address[]\"}],\"name\":\"getManyStakingAmounts\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_stakingAmounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolList\",\"type\":\"address[]\"}],\"name\":\"getManyStakingTotals\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_stakingAmounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAdminAddr\",\"type\":\"address\"}],\"name\":\"getPoolAddressOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"}],\"name\":\"getPoolDetail\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_stakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_stakingTotal\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_poolAddrList\",\"type\":\"address[]\"}],\"name\":\"getRewards\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_rewards\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"}],\"name\":\"getStakingTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__minValidatorStakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxCommissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__cooldownSecsToUndelegate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__waitingSecsToRevoke\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAdminAddr\",\"type\":\"address\"}],\"name\":\"isAdminOfActivePool\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"maxCommissionRate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minValidatorStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddrSrc\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddrDst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"redelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"requestEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"requestRenounce\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_effectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"requestUpdateCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_cooldownSecs\",\"type\":\"uint256\"}],\"name\":\"setCooldownSecsToUndelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_maxRate\",\"type\":\"uint256\"}],\"name\":\"setMaxCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_threshold\",\"type\":\"uint256\"}],\"name\":\"setMinValidatorStakingAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_secs\",\"type\":\"uint256\"}],\"name\":\"setWaitingSecsToRevoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"undelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"waitingSecsToRevoke\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrAdminOfAnyActivePoolForbidden(address)\":[{\"details\":\"Error of admin of any active pool cannot delegate.\"}],\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrCannotInitTransferRON(address,string)\":[{\"details\":\"Error of cannot transfer RON to specified target.\"}],\"ErrCannotTransferRON()\":[{\"details\":\"Error of cannot transfer RON.\"}],\"ErrInactivePool(address)\":[{\"details\":\"Error of querying inactive pool.\"}],\"ErrInsufficientBalance()\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrInsufficientDelegatingAmount()\":[{\"details\":\"Error of undelegating insufficient amount.\"}],\"ErrInsufficientStakingAmount()\":[{\"details\":\"Error of insufficient staking amount for unstaking.\"}],\"ErrInvalidArrays()\":[{\"details\":\"Error of length of input arrays are not of the same.\"}],\"ErrInvalidCommissionRate()\":[{\"details\":\"Error of setting commission rate exceeds max allowed.\"}],\"ErrInvalidPoolShare()\":[{\"details\":\"Error of invalid pool share.\"}],\"ErrOnlyPoolAdminAllowed()\":[{\"details\":\"Error of no one is allowed to call but the pool's admin.\"}],\"ErrPoolAdminForbidden()\":[{\"details\":\"Error of pool admin is not allowed to call.\"}],\"ErrRecipientRevert()\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrStakingAmountLeft()\":[{\"details\":\"Error of invalid staking amount left after deducted.\"}],\"ErrThreeInteractionAddrsNotEqual()\":[{\"details\":\"Error of three interaction addresses must be of the same in applying for validator candidate.\"}],\"ErrThreeOperationAddrsNotDistinct()\":[{\"details\":\"Error of three operation addresses must be distinct in applying for validator candidate.\"}],\"ErrUndelegateTooEarly()\":[{\"details\":\"Error of undelegating too early.\"}],\"ErrUndelegateZeroAmount()\":[{\"details\":\"Error of undelegating zero amount.\"}],\"ErrUnstakeTooEarly()\":[{\"details\":\"Error of unstaking too early.\"}],\"ErrUnstakeZeroAmount()\":[{\"details\":\"Error of unstaking zero amount.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}],\"ErrZeroValue()\":[{\"details\":\"Error of receiving zero message value.\"}]},\"kind\":\"dev\",\"methods\":{\"applyValidatorCandidate(address,address,address,address,uint256)\":{\"details\":\"Proposes a candidate to become a validator. Requirements: - The method caller is able to receive RON. - The treasury is able to receive RON. - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`. Emits the event `PoolApproved`.\",\"params\":{\"_candidateAdmin\":\"the candidate admin will be stored in the validator contract, used for calling function that affects to its candidate, e.g. scheduling maintenance.\"}},\"bulkUndelegate(address[],uint256[])\":{\"details\":\"Bulk unstakes from a list of candidates. Requirements: - The method caller is not the pool admin. Emits the events `Undelegated`.\"},\"claimRewards(address[])\":{\"details\":\"Claims the reward of method caller. Emits the `RewardClaimed` event.\"},\"cooldownSecsToUndelegate()\":{\"details\":\"Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\"},\"delegate(address)\":{\"details\":\"Stakes for a validator candidate `_consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is not the pool admin. Emits the `Delegated` event.\"},\"delegateRewards(address[],address)\":{\"details\":\"Claims the rewards and delegates them to the consensus address. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `RewardClaimed` event and the `Delegated` event.\"},\"execDeductStakingAmount(address,uint256)\":{\"details\":\"Deducts from staking amount of the validator `_consensusAddr` for `_amount`. Requirements: - The method caller must be validator contract. Emits the event `Unstaked`.\"},\"execDeprecatePools(address[],uint256)\":{\"details\":\"Deprecates the pool. - Deduct self-staking amount of the pool admin to zero. - Transfer the deducted amount to the pool admin. - Deactivate the pool admin address in the mapping of active pool admins Requirements: - The method caller is validator contract. Emits the event `PoolsDeprecated` and `Unstaked` events. Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\"},\"execRecordRewards(address[],uint256[],uint256)\":{\"details\":\"Records the amount of rewards `_rewards` for the pools `_consensusAddrs`. Requirements: - The method caller must be validator contract. Emits the event `PoolsUpdated` once the contract recorded the rewards successfully. Emits the event `PoolsUpdateFailed` once the input array lengths are not equal. Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period. Note: This method should be called once at the period ending.\"},\"getManySelfStakings(address[])\":{\"details\":\"Returns the self-staking amounts of the pools.\"},\"getManyStakingAmounts(address[],address[])\":{\"details\":\"Returns the staking amounts of the users.\"},\"getManyStakingTotals(address[])\":{\"details\":\"Returns the total staking amounts of all users for the pools `_poolAddrs`.\"},\"getPoolAddressOf(address)\":{\"details\":\"Returns the consensus address corresponding to the pool admin.\"},\"getPoolDetail(address)\":{\"details\":\"Returns the staking pool detail.\"},\"getReward(address,address)\":{\"details\":\"Returns the reward amount that user claimable.\"},\"getRewards(address,address[])\":{\"details\":\"Returns the claimable reward of the user `_user`.\"},\"getStakingAmount(address,address)\":{\"details\":\"Returns the staking amount of an user.\"},\"getStakingTotal(address)\":{\"details\":\"Returns the total staking amount of all users for a pool.\"},\"initialize(address,uint256,uint256,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"isAdminOfActivePool(address)\":{\"details\":\"Returns whether the `_poolAdminAddr` is currently active.\"},\"maxCommissionRate()\":{\"details\":\"Returns the max commission rate that the candidate can set.\"},\"minValidatorStakingAmount()\":{\"details\":\"Returns the minimum threshold for being a validator candidate.\"},\"redelegate(address,address,uint256)\":{\"details\":\"Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `Undelegated` event and the `Delegated` event.\"},\"requestEmergencyExit(address)\":{\"details\":\"Renounces being a validator candidate and takes back the delegating/staking amount. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin.\"},\"requestRenounce(address)\":{\"details\":\"Renounces being a validator candidate and takes back the delegating/staking amount. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin.\"},\"requestUpdateCommissionRate(address,uint256,uint256)\":{\"details\":\"Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}. - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdated`.\"},\"setCooldownSecsToUndelegate(uint256)\":{\"details\":\"Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated. Requirements: - The method caller is admin. Emits the event `CooldownSecsToUndelegateUpdated`.\"},\"setMaxCommissionRate(uint256)\":{\"details\":\"Sets the max commission rate that a candidate can set. Requirements: - The method caller is admin. Emits the `MaxCommissionRateUpdated` event.\"},\"setMinValidatorStakingAmount(uint256)\":{\"details\":\"Sets the minimum threshold for being a validator candidate. Requirements: - The method caller is admin. Emits the `MinValidatorStakingAmountUpdated` event.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"setWaitingSecsToRevoke(uint256)\":{\"details\":\"Sets the number of seconds that a candidate must wait to be revoked. Requirements: - The method caller is admin. Emits the event `WaitingSecsToRevokeUpdated`.\"},\"stake(address)\":{\"details\":\"Self-delegates to the validator candidate `_consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `msg.value` is larger than 0. Emits the event `Staked`.\"},\"undelegate(address,uint256)\":{\"details\":\"Unstakes from a validator candidate `_consensusAddr` for `_amount`. Requirements: - The method caller is not the pool admin. Emits the `Undelegated` event.\"},\"unstake(address,uint256)\":{\"details\":\"Unstakes from the validator candidate `_consensusAddr` for `_amount`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. Emits the event `Unstaked`.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"},\"waitingSecsToRevoke()\":{\"details\":\"Returns the number of seconds that a candidate must wait for the renounce request gets affected.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/staking/Staking.sol\":\"Staking\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x0e9621f60b2faabe65549f7ed0f24e8853a45c1b7990d47e8160e523683f3935\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/RONTransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract RONTransferHelper {\\n /// @dev Error of recipient not accepting RON when transfer RON.\\n error ErrRecipientRevert();\\n /// @dev Error of sender has insufficient balance.\\n error ErrInsufficientBalance();\\n\\n /**\\n * @dev See `_sendRON`.\\n * Reverts if the recipient does not receive RON.\\n */\\n function _transferRON(address payable _recipient, uint256 _amount) internal {\\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\\n }\\n\\n /**\\n * @dev Send `_amount` RON to the address `_recipient`.\\n * Returns whether the recipient receives RON or not.\\n * Reverts once the contract balance is insufficient.\\n *\\n * Note: consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\\n return _unsafeSendRON(_recipient, _amount);\\n }\\n\\n /**\\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\\n * the call does not revert.\\n *\\n * Note:\\n * - Does not assert whether the balance of sender is sufficient.\\n * - Does not assert whether the recipient accepts RON.\\n * - Consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount }(\\\"\\\");\\n }\\n\\n /**\\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\\n */\\n function _unsafeSendRON(\\n address payable _recipient,\\n uint256 _amount,\\n uint256 _gas\\n ) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbf47d40b2431cf190fa737b803e4cb6fb55aee3f8804470da57a9e340f7914f8\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/extensions/consumers/GlobalConfigConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract GlobalConfigConsumer {\\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\\n /// @dev The length of a period in second.\\n uint256 public constant PERIOD_DURATION = 1 days;\\n}\\n\",\"keccak256\":\"0x96d6b1ea4c8e126a8c2468683e7513d195f8e05456d85dd8f259ab049347b527\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface PeriodWrapperConsumer {\\n struct PeriodWrapper {\\n // Inner value.\\n uint256 inner;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n}\\n\",\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseStaking {\\n struct PoolDetail {\\n // Address of the pool i.e. consensus address of the validator\\n address addr;\\n // Pool admin address\\n address admin;\\n // Self-staking amount\\n uint256 stakingAmount;\\n // Total number of RON staking for the pool\\n uint256 stakingTotal;\\n // Mapping from delegator => delegating amount\\n mapping(address => uint256) delegatingAmount;\\n // Mapping from delegator => the last timestamp that delegator staked\\n mapping(address => uint256) lastDelegatingTimestamp;\\n }\\n\\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\\n event WaitingSecsToRevokeUpdated(uint256 secs);\\n\\n /// @dev Error of cannot transfer RON.\\n error ErrCannotTransferRON();\\n /// @dev Error of receiving zero message value.\\n error ErrZeroValue();\\n /// @dev Error of pool admin is not allowed to call.\\n error ErrPoolAdminForbidden();\\n /// @dev Error of no one is allowed to call but the pool's admin.\\n error ErrOnlyPoolAdminAllowed();\\n /// @dev Error of admin of any active pool cannot delegate.\\n error ErrAdminOfAnyActivePoolForbidden(address admin);\\n /// @dev Error of querying inactive pool.\\n error ErrInactivePool(address poolAddr);\\n /// @dev Error of length of input arrays are not of the same.\\n error ErrInvalidArrays();\\n\\n /**\\n * @dev Returns whether the `_poolAdminAddr` is currently active.\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the consensus address corresponding to the pool admin.\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\\n\\n /**\\n * @dev Returns the staking pool detail.\\n */\\n function getPoolDetail(address)\\n external\\n view\\n returns (\\n address _admin,\\n uint256 _stakingAmount,\\n uint256 _stakingTotal\\n );\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\\n */\\n function waitingSecsToRevoke() external view returns (uint256);\\n\\n /**\\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external;\\n}\\n\",\"keccak256\":\"0x008b3d42a3104820de7b7edb5ea4b21c75d4417767fc0791f89f00ac9a2cce8d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface ICandidateStaking is IRewardPool {\\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\\n event MinValidatorStakingAmountUpdated(uint256 threshold);\\n /// @dev Emitted when the max commission rate is updated.\\n event MaxCommissionRateUpdated(uint256 maxRate);\\n\\n /// @dev Emitted when the pool admin staked for themself.\\n event Staked(address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\\n event Unstaked(address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Emitted when the validator pool is approved.\\n event PoolApproved(address indexed validator, address indexed admin);\\n /// @dev Emitted when the validator pool is deprecated.\\n event PoolsDeprecated(address[] validator);\\n /// @dev Emitted when the staking amount transfer failed.\\n event StakingAmountTransferFailed(\\n address indexed validator,\\n address indexed admin,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\\n event StakingAmountDeductFailed(\\n address indexed validator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Error of cannot transfer RON to specified target.\\n error ErrCannotInitTransferRON(address addr, string extraInfo);\\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\\n error ErrThreeInteractionAddrsNotEqual();\\n /// @dev Error of three operation addresses must be distinct in applying for validator candidate.\\n error ErrThreeOperationAddrsNotDistinct();\\n /// @dev Error of unstaking zero amount.\\n error ErrUnstakeZeroAmount();\\n /// @dev Error of invalid staking amount left after deducted.\\n error ErrStakingAmountLeft();\\n /// @dev Error of insufficient staking amount for unstaking.\\n error ErrInsufficientStakingAmount();\\n /// @dev Error of unstaking too early.\\n error ErrUnstakeTooEarly();\\n /// @dev Error of setting commission rate exceeds max allowed.\\n error ErrInvalidCommissionRate();\\n\\n /**\\n * @dev Returns the minimum threshold for being a validator candidate.\\n */\\n function minValidatorStakingAmount() external view returns (uint256);\\n\\n /**\\n * @dev Returns the max commission rate that the candidate can set.\\n */\\n function maxCommissionRate() external view returns (uint256);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function setMinValidatorStakingAmount(uint256) external;\\n\\n /**\\n * @dev Sets the max commission rate that a candidate can set.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxCommissionRateUpdated` event.\\n *\\n */\\n function setMaxCommissionRate(uint256 _maxRate) external;\\n\\n /**\\n * @dev Proposes a candidate to become a validator.\\n *\\n * Requirements:\\n * - The method caller is able to receive RON.\\n * - The treasury is able to receive RON.\\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\\n *\\n * Emits the event `PoolApproved`.\\n *\\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\\n * to its candidate, e.g. scheduling maintenance.\\n *\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external payable;\\n\\n /**\\n * @dev Deprecates the pool.\\n * - Deduct self-staking amount of the pool admin to zero.\\n * - Transfer the deducted amount to the pool admin.\\n * - Deactivate the pool admin address in the mapping of active pool admins\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\\n *\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\\n\\n /**\\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `msg.value` is larger than 0.\\n *\\n * Emits the event `Staked`.\\n *\\n */\\n function stake(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function unstake(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdated`.\\n *\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestRenounce(address _consensusAddr) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestEmergencyExit(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x4160e8b8dc00df59a35823589d69dcbf5655d7024f5d8e17e823e243ffb44b9d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface IDelegatorStaking is IRewardPool {\\n /// @dev Emitted when the delegator staked for a validator candidate.\\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the delegator unstaked from a validator candidate.\\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Error of undelegating zero amount.\\n error ErrUndelegateZeroAmount();\\n /// @dev Error of undelegating insufficient amount.\\n error ErrInsufficientDelegatingAmount();\\n /// @dev Error of undelegating too early.\\n error ErrUndelegateTooEarly();\\n\\n /**\\n * @dev Stakes for a validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n */\\n function delegate(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Undelegated` event.\\n *\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Bulk unstakes from a list of candidates.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the events `Undelegated`.\\n *\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\\n\\n /**\\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `Undelegated` event and the `Delegated` event.\\n *\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external;\\n\\n /**\\n * @dev Returns the claimable reward of the user `_user`.\\n */\\n function getRewards(address _user, address[] calldata _poolAddrList)\\n external\\n view\\n returns (uint256[] memory _rewards);\\n\\n /**\\n * @dev Claims the reward of method caller.\\n *\\n * Emits the `RewardClaimed` event.\\n *\\n */\\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `RewardClaimed` event and the `Delegated` event.\\n *\\n */\\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\\n external\\n returns (uint256 _amount);\\n}\\n\",\"keccak256\":\"0x5ce840a920ed06139f9e33d306c8ee50b2a81e4bd2ac6ed24b47297c348576b8\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IRewardPool.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/consumers/PeriodWrapperConsumer.sol\\\";\\n\\ninterface IRewardPool is PeriodWrapperConsumer {\\n struct UserRewardFields {\\n // Recorded reward amount.\\n uint256 debited;\\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\\n uint256 aRps;\\n // Lowest staking amount in the period.\\n uint256 lowestAmount;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n\\n struct PoolFields {\\n // Accumulated of the amount rewards per share (one unit staking).\\n uint256 aRps;\\n // The staking total to share reward of the current period.\\n PeriodWrapper shares;\\n }\\n\\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\\n /// @dev Emitted when the user claimed their reward\\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\\n\\n /// @dev Emitted when the pool shares are updated\\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\\n /// @dev Emitted when the pools are updated\\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\\n /// @dev Emitted when the contract fails when updating the pools\\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\\n /// @dev Emitted when the contract fails when updating the pools that already set\\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\\n\\n /// @dev Error of invalid pool share.\\n error ErrInvalidPoolShare();\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amount of an user.\\n */\\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amounts of the users.\\n */\\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total staking amount of all users for a pool.\\n */\\n function getStakingTotal(address _poolAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\\n */\\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\\n}\\n\",\"keccak256\":\"0x92315ca9d6d93f55a7752adf2567adb86745f708198bfcd74b9a626b6570208f\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseStaking.sol\\\";\\nimport \\\"./ICandidateStaking.sol\\\";\\nimport \\\"./IDelegatorStaking.sol\\\";\\n\\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable;\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\\n external\\n returns (uint256 _actualDeductingAmount);\\n}\\n\",\"keccak256\":\"0xb7942c5032c16ea567ac0bfc07ecacd84840d6de134735ea538aa22fc6da05a5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool) {\\n bytes32 _thisHash;\\n bytes32 _otherHash;\\n\\n assembly {\\n _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n }\\n\\n return _thisHash == _otherHash;\\n }\\n}\\n\",\"keccak256\":\"0xea4ac2b0783926a0e6ae257bc069fa37ea864ce77bfb25dd327d4727a38ad0ea\",\"license\":\"UNLICENSED\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a - min(a, b);\\n }\\n}\\n\",\"keccak256\":\"0xa9e2a3ad43d7999a3cdbfb040b0f2dec282eae91ff8fe6ad26fdd19087121ce7\",\"license\":\"UNLICENSED\"},\"contracts/ronin/staking/BaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/staking/IBaseStaking.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"./RewardCalculation.sol\\\";\\n\\nabstract contract BaseStaking is\\n RONTransferHelper,\\n ReentrancyGuard,\\n RewardCalculation,\\n HasValidatorContract,\\n IBaseStaking\\n{\\n /// @dev Mapping from pool address => staking pool detail\\n mapping(address => PoolDetail) internal _stakingPool;\\n\\n /// @dev The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n uint256 internal _cooldownSecsToUndelegate;\\n /// @dev The number of seconds that a candidate must wait to be revoked and take the self-staking amount back.\\n uint256 internal _waitingSecsToRevoke;\\n\\n /// @dev Mapping from admin address of an active pool => consensus address.\\n mapping(address => address) internal _adminOfActivePoolMapping;\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] private ______gap;\\n\\n modifier noEmptyValue() {\\n if (msg.value == 0) revert ErrZeroValue();\\n _;\\n }\\n\\n modifier notPoolAdmin(PoolDetail storage _pool, address _delegator) {\\n if (_pool.admin == _delegator) revert ErrPoolAdminForbidden();\\n _;\\n }\\n\\n modifier onlyPoolAdmin(PoolDetail storage _pool, address _requester) {\\n if (_pool.admin != _requester) revert ErrOnlyPoolAdminAllowed();\\n _;\\n }\\n\\n modifier poolIsActive(address _poolAddr) {\\n if (!_validatorContract.isValidatorCandidate(_poolAddr)) revert ErrInactivePool(_poolAddr);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) public view override returns (bool) {\\n return _adminOfActivePoolMapping[_poolAdminAddr] != address(0);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view override returns (address) {\\n return _adminOfActivePoolMapping[_poolAdminAddr];\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getPoolDetail(address _poolAddr)\\n external\\n view\\n returns (\\n address _admin,\\n uint256 _stakingAmount,\\n uint256 _stakingTotal\\n )\\n {\\n PoolDetail storage _pool = _stakingPool[_poolAddr];\\n return (_pool.admin, _pool.stakingAmount, _pool.stakingTotal);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getManySelfStakings(address[] calldata _pools) external view returns (uint256[] memory _selfStakings) {\\n _selfStakings = new uint256[](_pools.length);\\n for (uint _i = 0; _i < _pools.length; _i++) {\\n _selfStakings[_i] = _stakingPool[_pools[_i]].stakingAmount;\\n }\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingTotal(address _poolAddr) public view override returns (uint256) {\\n return _stakingPool[_poolAddr].stakingTotal;\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingTotals(address[] calldata _poolList)\\n public\\n view\\n override\\n returns (uint256[] memory _stakingAmounts)\\n {\\n _stakingAmounts = new uint256[](_poolList.length);\\n for (uint _i = 0; _i < _poolList.length; _i++) {\\n _stakingAmounts[_i] = getStakingTotal(_poolList[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingAmount(address _poolAddr, address _user) public view override returns (uint256) {\\n return _stakingPool[_poolAddr].delegatingAmount[_user];\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\\n external\\n view\\n override\\n returns (uint256[] memory _stakingAmounts)\\n {\\n if (_poolAddrs.length != _userList.length) revert ErrInvalidArrays();\\n _stakingAmounts = new uint256[](_poolAddrs.length);\\n for (uint _i = 0; _i < _stakingAmounts.length; _i++) {\\n _stakingAmounts[_i] = _stakingPool[_poolAddrs[_i]].delegatingAmount[_userList[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256) {\\n return _cooldownSecsToUndelegate;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function waitingSecsToRevoke() external view returns (uint256) {\\n return _waitingSecsToRevoke;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external override onlyAdmin {\\n _setCooldownSecsToUndelegate(_cooldownSecs);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external override onlyAdmin {\\n _setWaitingSecsToRevoke(_secs);\\n }\\n\\n /**\\n * @dev Sets the minium number of seconds to undelegate.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function _setCooldownSecsToUndelegate(uint256 _cooldownSecs) internal {\\n _cooldownSecsToUndelegate = _cooldownSecs;\\n emit CooldownSecsToUndelegateUpdated(_cooldownSecs);\\n }\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function _setWaitingSecsToRevoke(uint256 _secs) internal {\\n _waitingSecsToRevoke = _secs;\\n emit WaitingSecsToRevokeUpdated(_secs);\\n }\\n\\n /**\\n * @dev Changes the delegate amount.\\n */\\n function _changeDelegatingAmount(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _newDelegatingAmount,\\n uint256 _newStakingTotal\\n ) internal {\\n _syncUserReward(_pool.addr, _delegator, _newDelegatingAmount);\\n _pool.stakingTotal = _newStakingTotal;\\n _pool.delegatingAmount[_delegator] = _newDelegatingAmount;\\n }\\n}\\n\",\"keccak256\":\"0xdf7889af5ad6b206a2d4eceb8947fcc26f90b7c8411806ec76eb19bc3363afd0\",\"license\":\"MIT\"},\"contracts/ronin/staking/CandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/consumers/GlobalConfigConsumer.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../libraries/AddressArrayUtils.sol\\\";\\nimport \\\"../../interfaces/staking/ICandidateStaking.sol\\\";\\nimport \\\"./BaseStaking.sol\\\";\\n\\nabstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConfigConsumer, PercentageConsumer {\\n /// @dev The minimum threshold for being a validator candidate.\\n uint256 internal _minValidatorStakingAmount;\\n\\n /// @dev The max commission rate that the validator can set (in range of [0;100_00] means [0-100%])\\n uint256 internal _maxCommissionRate;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] ______gap;\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function minValidatorStakingAmount() public view override returns (uint256) {\\n return _minValidatorStakingAmount;\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function maxCommissionRate() external view override returns (uint256) {\\n return _maxCommissionRate;\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function setMinValidatorStakingAmount(uint256 _threshold) external override onlyAdmin {\\n _setMinValidatorStakingAmount(_threshold);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function setMaxCommissionRate(uint256 _maxRate) external override onlyAdmin {\\n _setMaxCommissionRate(_maxRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external payable override nonReentrant {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n if (_commissionRate > _maxCommissionRate) revert ErrInvalidCommissionRate();\\n\\n uint256 _amount = msg.value;\\n address payable _poolAdmin = payable(msg.sender);\\n _applyValidatorCandidate(\\n _poolAdmin,\\n _candidateAdmin,\\n _consensusAddr,\\n _treasuryAddr,\\n _bridgeOperatorAddr,\\n _commissionRate,\\n _amount\\n );\\n\\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\\n _pool.admin = _poolAdmin;\\n _pool.addr = _consensusAddr;\\n _adminOfActivePoolMapping[_poolAdmin] = _consensusAddr;\\n\\n _stake(_stakingPool[_consensusAddr], _poolAdmin, _amount);\\n emit PoolApproved(_consensusAddr, _poolAdmin);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) {\\n if (_commissionRate > _maxCommissionRate) revert ErrInvalidCommissionRate();\\n _validatorContract.execRequestUpdateCommissionRate(_consensusAddr, _effectiveDaysOnwards, _commissionRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _newPeriod) external override onlyValidatorContract {\\n if (_pools.length == 0) {\\n return;\\n }\\n\\n for (uint _i = 0; _i < _pools.length; _i++) {\\n PoolDetail storage _pool = _stakingPool[_pools[_i]];\\n // Deactivate the pool admin in the active mapping.\\n delete _adminOfActivePoolMapping[_pool.admin];\\n\\n // Deduct and transfer the self staking amount to the pool admin.\\n uint256 _deductingAmount = _pool.stakingAmount;\\n if (_deductingAmount > 0) {\\n _deductStakingAmount(_pool, _deductingAmount);\\n if (!_unsafeSendRON(payable(_pool.admin), _deductingAmount, DEFAULT_ADDITION_GAS)) {\\n emit StakingAmountTransferFailed(_pool.addr, _pool.admin, _deductingAmount, address(this).balance);\\n }\\n }\\n\\n // Settle the unclaimed reward and transfer to the pool admin.\\n uint256 _lastRewardAmount = _claimReward(_pools[_i], _pool.admin, _newPeriod);\\n if (_lastRewardAmount > 0) {\\n _unsafeSendRON(payable(_pool.admin), _lastRewardAmount, DEFAULT_ADDITION_GAS);\\n }\\n }\\n\\n emit PoolsDeprecated(_pools);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function stake(address _consensusAddr) external payable override noEmptyValue poolIsActive(_consensusAddr) {\\n _stake(_stakingPool[_consensusAddr], msg.sender, msg.value);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function unstake(address _consensusAddr, uint256 _amount)\\n external\\n override\\n nonReentrant\\n poolIsActive(_consensusAddr)\\n {\\n if (_amount == 0) revert ErrUnstakeZeroAmount();\\n address _requester = msg.sender;\\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\\n uint256 _remainAmount = _pool.stakingAmount - _amount;\\n if (_remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft();\\n\\n _unstake(_pool, _requester, _amount);\\n if (!_unsafeSendRON(payable(_requester), _amount, DEFAULT_ADDITION_GAS)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestRenounce(address _consensusAddr)\\n external\\n override\\n poolIsActive(_consensusAddr)\\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\\n {\\n _validatorContract.execRequestRenounceCandidate(_consensusAddr, _waitingSecsToRevoke);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestEmergencyExit(address _consensusAddr)\\n external\\n override\\n poolIsActive(_consensusAddr)\\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\\n {\\n _validatorContract.execEmergencyExit(_consensusAddr, _waitingSecsToRevoke);\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-applyValidatorCandidate`\\n */\\n function _applyValidatorCandidate(\\n address payable _poolAdmin,\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate,\\n uint256 _amount\\n ) internal {\\n if (!_unsafeSendRON(_poolAdmin, 0)) revert ErrCannotInitTransferRON(_poolAdmin, \\\"pool admin\\\");\\n if (!_unsafeSendRON(_treasuryAddr, 0)) revert ErrCannotInitTransferRON(_treasuryAddr, \\\"treasury\\\");\\n if (_amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount();\\n if (_commissionRate > _maxCommissionRate) revert ErrInvalidCommissionRate();\\n\\n if (_poolAdmin != _candidateAdmin || _candidateAdmin != _treasuryAddr) revert ErrThreeInteractionAddrsNotEqual();\\n\\n address[] memory _diffAddrs = new address[](3);\\n _diffAddrs[0] = _poolAdmin;\\n _diffAddrs[1] = _consensusAddr;\\n _diffAddrs[2] = _bridgeOperatorAddr;\\n if (AddressArrayUtils.hasDuplicate(_diffAddrs)) revert ErrThreeOperationAddrsNotDistinct();\\n\\n _validatorContract.execApplyValidatorCandidate(\\n _candidateAdmin,\\n _consensusAddr,\\n _treasuryAddr,\\n _bridgeOperatorAddr,\\n _commissionRate\\n );\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-stake`\\n */\\n function _stake(\\n PoolDetail storage _pool,\\n address _requester,\\n uint256 _amount\\n ) internal onlyPoolAdmin(_pool, _requester) {\\n _pool.stakingAmount += _amount;\\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal + _amount);\\n _pool.lastDelegatingTimestamp[_requester] = block.timestamp;\\n emit Staked(_pool.addr, _amount);\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-unstake`\\n */\\n function _unstake(\\n PoolDetail storage _pool,\\n address _requester,\\n uint256 _amount\\n ) internal onlyPoolAdmin(_pool, _requester) {\\n if (_amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount();\\n if (_pool.lastDelegatingTimestamp[_requester] + _cooldownSecsToUndelegate > block.timestamp) {\\n revert ErrUnstakeTooEarly();\\n }\\n\\n _pool.stakingAmount -= _amount;\\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal - _amount);\\n emit Unstaked(_pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Emits the event `Unstaked`.\\n *\\n * @return The actual deducted amount\\n */\\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount) internal virtual returns (uint256);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function _setMinValidatorStakingAmount(uint256 _threshold) internal {\\n _minValidatorStakingAmount = _threshold;\\n emit MinValidatorStakingAmountUpdated(_threshold);\\n }\\n\\n /**\\n * @dev Sets the max commission rate that a candidate can set.\\n *\\n * Emits the `MaxCommissionRateUpdated` event.\\n *\\n */\\n function _setMaxCommissionRate(uint256 _maxRate) internal {\\n if (_maxRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\\n _maxCommissionRate = _maxRate;\\n emit MaxCommissionRateUpdated(_maxRate);\\n }\\n}\\n\",\"keccak256\":\"0xa12b3a48e5fba51a0da182bb6bde660c07ac137e7a3b46e055a01634325407f9\",\"license\":\"MIT\"},\"contracts/ronin/staking/DelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/staking/IDelegatorStaking.sol\\\";\\nimport \\\"./BaseStaking.sol\\\";\\n\\nabstract contract DelegatorStaking is BaseStaking, IDelegatorStaking {\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function delegate(address _consensusAddr) external payable noEmptyValue poolIsActive(_consensusAddr) {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n _delegate(_stakingPool[_consensusAddr], msg.sender, msg.value);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external nonReentrant {\\n address payable _delegator = payable(msg.sender);\\n _undelegate(_stakingPool[_consensusAddr], _delegator, _amount);\\n if (!_sendRON(_delegator, _amount)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external nonReentrant {\\n if (_consensusAddrs.length == 0 || _consensusAddrs.length != _amounts.length) revert ErrInvalidArrays();\\n\\n address payable _delegator = payable(msg.sender);\\n uint256 _total;\\n\\n for (uint _i = 0; _i < _consensusAddrs.length; _i++) {\\n _total += _amounts[_i];\\n _undelegate(_stakingPool[_consensusAddrs[_i]], _delegator, _amounts[_i]);\\n }\\n\\n if (!_sendRON(_delegator, _total)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external nonReentrant poolIsActive(_consensusAddrDst) {\\n address _delegator = msg.sender;\\n _undelegate(_stakingPool[_consensusAddrSrc], _delegator, _amount);\\n _delegate(_stakingPool[_consensusAddrDst], _delegator, _amount);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function claimRewards(address[] calldata _consensusAddrList)\\n external\\n override\\n nonReentrant\\n returns (uint256 _amount)\\n {\\n _amount = _claimRewards(msg.sender, _consensusAddrList);\\n _transferRON(payable(msg.sender), _amount);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\\n external\\n override\\n nonReentrant\\n poolIsActive(_consensusAddrDst)\\n returns (uint256 _amount)\\n {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n return _delegateRewards(msg.sender, _consensusAddrList, _consensusAddrDst);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function getRewards(address _user, address[] calldata _poolAddrList)\\n external\\n view\\n returns (uint256[] memory _rewards)\\n {\\n address _consensusAddr;\\n uint256 _period = _validatorContract.currentPeriod();\\n _rewards = new uint256[](_poolAddrList.length);\\n\\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\\n _consensusAddr = _poolAddrList[_i];\\n _rewards[_i] = _getReward(_consensusAddr, _user, _period, getStakingAmount(_consensusAddr, _user));\\n }\\n }\\n\\n /**\\n * @dev Delegates from a validator address.\\n *\\n * Requirements:\\n * - The delegator is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n * Note: This function does not verify the `msg.value` with the amount.\\n *\\n */\\n function _delegate(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _amount\\n ) internal notPoolAdmin(_pool, _delegator) {\\n _changeDelegatingAmount(\\n _pool,\\n _delegator,\\n _pool.delegatingAmount[_delegator] + _amount,\\n _pool.stakingTotal + _amount\\n );\\n _pool.lastDelegatingTimestamp[_delegator] = block.timestamp;\\n emit Delegated(_delegator, _pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Undelegates from a validator address.\\n *\\n * Requirements:\\n * - The delegator is not the pool admin.\\n * - The amount is larger than 0.\\n * - The delegating amount is larger than or equal to the undelegating amount.\\n *\\n * Emits the `Undelegated` event.\\n *\\n * Note: Consider transferring back the amount of RON after calling this function.\\n *\\n */\\n function _undelegate(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _amount\\n ) private notPoolAdmin(_pool, _delegator) {\\n if (_amount == 0) revert ErrUndelegateZeroAmount();\\n if (_pool.delegatingAmount[_delegator] < _amount) revert ErrInsufficientDelegatingAmount();\\n if (_pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp) {\\n revert ErrUndelegateTooEarly();\\n }\\n\\n _changeDelegatingAmount(\\n _pool,\\n _delegator,\\n _pool.delegatingAmount[_delegator] - _amount,\\n _pool.stakingTotal - _amount\\n );\\n emit Undelegated(_delegator, _pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Claims rewards from the pools `_poolAddrList`.\\n * Note: This function does not transfer reward to user.\\n */\\n function _claimRewards(address _user, address[] memory _poolAddrList) internal returns (uint256 _amount) {\\n uint256 _period = _currentPeriod();\\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\\n _amount += _claimReward(_poolAddrList[_i], _user, _period);\\n }\\n }\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n */\\n function _delegateRewards(\\n address _user,\\n address[] calldata _poolAddrList,\\n address _poolAddrDst\\n ) internal returns (uint256 _amount) {\\n _amount = _claimRewards(_user, _poolAddrList);\\n _delegate(_stakingPool[_poolAddrDst], _user, _amount);\\n }\\n}\\n\",\"keccak256\":\"0x4bd0b183ac8838e8800b2768ef2f854fd8ee75327f0933f895816794d556fbb0\",\"license\":\"MIT\"},\"contracts/ronin/staking/RewardCalculation.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/staking/IRewardPool.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\n\\n/**\\n * @title RewardCalculation contract\\n * @dev This contract mainly contains the methods to calculate reward for staking contract.\\n */\\nabstract contract RewardCalculation is IRewardPool {\\n /// @dev Mapping from pool address => period number => accumulated rewards per share (one unit staking)\\n mapping(address => mapping(uint256 => PeriodWrapper)) private _accumulatedRps;\\n /// @dev Mapping from the pool address => user address => the reward info of the user\\n mapping(address => mapping(address => UserRewardFields)) private _userReward;\\n /// @dev Mapping from the pool address => reward pool fields\\n mapping(address => PoolFields) private _stakingPool;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256) {\\n return _getReward(_poolAddr, _user, _currentPeriod(), getStakingAmount(_poolAddr, _user));\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingAmount(address _poolAddr, address _user) public view virtual returns (uint256);\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingTotal(address _poolAddr) public view virtual returns (uint256);\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function _getReward(\\n address _poolAddr,\\n address _user,\\n uint256 _latestPeriod,\\n uint256 _latestStakingAmount\\n ) internal view returns (uint256) {\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n\\n if (_reward.lastPeriod == _latestPeriod) {\\n return _reward.debited;\\n }\\n\\n uint256 _aRps;\\n uint256 _lastPeriodReward;\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n PeriodWrapper storage _wrappedArps = _accumulatedRps[_poolAddr][_reward.lastPeriod];\\n\\n if (_wrappedArps.lastPeriod > 0) {\\n // Calculates the last period reward if the aRps at the period is set\\n _aRps = _wrappedArps.inner;\\n _lastPeriodReward = _reward.lowestAmount * (_aRps - _reward.aRps);\\n } else {\\n // Fallbacks to the previous aRps in case the aRps is not set\\n _aRps = _reward.aRps;\\n }\\n\\n uint256 _newPeriodsReward = _latestStakingAmount * (_pool.aRps - _aRps);\\n return _reward.debited + (_lastPeriodReward + _newPeriodsReward) / 1e18;\\n }\\n\\n /**\\n * @dev Syncs the user reward.\\n *\\n * Emits the event `UserRewardUpdated` once the debit amount is updated.\\n * Emits the event `PoolSharesUpdated` once the pool share is updated.\\n *\\n * Note: The method should be called whenever the user's staking amount changes.\\n *\\n */\\n function _syncUserReward(\\n address _poolAddr,\\n address _user,\\n uint256 _newStakingAmount\\n ) internal {\\n uint256 _period = _currentPeriod();\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n uint256 _lastShares = _pool.shares.inner;\\n\\n // Updates the pool shares if it is outdated\\n if (_pool.shares.lastPeriod < _period) {\\n _pool.shares = PeriodWrapper(getStakingTotal(_poolAddr), _period);\\n }\\n\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\\n uint256 _debited = _getReward(_poolAddr, _user, _period, _currentStakingAmount);\\n\\n if (_reward.debited != _debited) {\\n _reward.debited = _debited;\\n emit UserRewardUpdated(_poolAddr, _user, _debited);\\n }\\n\\n _syncMinStakingAmount(_pool, _reward, _period, _newStakingAmount, _currentStakingAmount);\\n _reward.aRps = _pool.aRps;\\n _reward.lastPeriod = _period;\\n\\n if (_pool.shares.inner != _lastShares) {\\n emit PoolSharesUpdated(_period, _poolAddr, _pool.shares.inner);\\n }\\n }\\n\\n /**\\n * @dev Syncs the minimum staking amount of an user in the current period.\\n */\\n function _syncMinStakingAmount(\\n PoolFields storage _pool,\\n UserRewardFields storage _reward,\\n uint256 _latestPeriod,\\n uint256 _newStakingAmount,\\n uint256 _currentStakingAmount\\n ) internal {\\n if (_reward.lastPeriod < _latestPeriod) {\\n _reward.lowestAmount = _currentStakingAmount;\\n }\\n\\n uint256 _lowestAmount = Math.min(_reward.lowestAmount, _newStakingAmount);\\n uint256 _diffAmount = _reward.lowestAmount - _lowestAmount;\\n if (_diffAmount > 0) {\\n _reward.lowestAmount = _lowestAmount;\\n if (_pool.shares.inner < _diffAmount) revert ErrInvalidPoolShare();\\n _pool.shares.inner -= _diffAmount;\\n }\\n }\\n\\n /**\\n * @dev Claims the settled reward for a specific user.\\n *\\n * @param _lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or\\n * `_currentPeriod + 1` in case of calculating the reward for revoked validators.\\n *\\n * Emits the `RewardClaimed` event and the `UserRewardUpdated` event.\\n *\\n * Note: This method should be called before transferring rewards for the user.\\n *\\n */\\n function _claimReward(\\n address _poolAddr,\\n address _user,\\n uint256 _lastPeriod\\n ) internal returns (uint256 _amount) {\\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\\n _amount = _getReward(_poolAddr, _user, _lastPeriod, _currentStakingAmount);\\n emit RewardClaimed(_poolAddr, _user, _amount);\\n\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n _reward.debited = 0;\\n _syncMinStakingAmount(_stakingPool[_poolAddr], _reward, _lastPeriod, _currentStakingAmount, _currentStakingAmount);\\n _reward.lastPeriod = _lastPeriod;\\n _reward.aRps = _stakingPool[_poolAddr].aRps;\\n emit UserRewardUpdated(_poolAddr, _user, 0);\\n }\\n\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_poolAddrs`.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolUpdateConflicted` when the pool is already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function _recordRewards(\\n address[] memory _poolAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) internal {\\n if (_poolAddrs.length != _rewards.length) {\\n emit PoolsUpdateFailed(_period, _poolAddrs, _rewards);\\n return;\\n }\\n\\n uint256 _rps;\\n uint256 _count;\\n address _poolAddr;\\n uint256 _stakingTotal;\\n uint256[] memory _aRps = new uint256[](_poolAddrs.length);\\n uint256[] memory _shares = new uint256[](_poolAddrs.length);\\n address[] memory _conflicted = new address[](_poolAddrs.length);\\n\\n for (uint _i = 0; _i < _poolAddrs.length; _i++) {\\n _poolAddr = _poolAddrs[_i];\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n _stakingTotal = getStakingTotal(_poolAddr);\\n\\n if (_accumulatedRps[_poolAddr][_period].lastPeriod == _period) {\\n _conflicted[_count++] = _poolAddr;\\n continue;\\n }\\n\\n // Updates the pool shares if it is outdated\\n if (_pool.shares.lastPeriod < _period) {\\n _pool.shares = PeriodWrapper(_stakingTotal, _period);\\n }\\n\\n // The rps is 0 if no one stakes for the pool\\n _rps = _pool.shares.inner == 0 ? 0 : (_rewards[_i] * 1e18) / _pool.shares.inner;\\n _aRps[_i - _count] = _pool.aRps += _rps;\\n _accumulatedRps[_poolAddr][_period] = PeriodWrapper(_pool.aRps, _period);\\n _pool.shares.inner = _stakingTotal;\\n _shares[_i - _count] = _pool.shares.inner;\\n _poolAddrs[_i - _count] = _poolAddr;\\n }\\n\\n if (_count > 0) {\\n assembly {\\n mstore(_conflicted, _count)\\n mstore(_poolAddrs, sub(mload(_poolAddrs), _count))\\n }\\n emit PoolsUpdateConflicted(_period, _conflicted);\\n }\\n\\n if (_poolAddrs.length > 0) {\\n emit PoolsUpdated(_period, _poolAddrs, _aRps, _shares);\\n }\\n }\\n\\n /**\\n * @dev Returns the current period.\\n */\\n function _currentPeriod() internal view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x492fc376e3a866dca702f22f25fe30d3005c28cace7503822ac7e73606611278\",\"license\":\"MIT\"},\"contracts/ronin/staking/Staking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"./CandidateStaking.sol\\\";\\nimport \\\"./DelegatorStaking.sol\\\";\\n\\ncontract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable {\\n constructor() {\\n _disableInitializers();\\n }\\n\\n receive() external payable onlyValidatorContract {}\\n\\n fallback() external payable onlyValidatorContract {}\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 __minValidatorStakingAmount,\\n uint256 __maxCommissionRate,\\n uint256 __cooldownSecsToUndelegate,\\n uint256 __waitingSecsToRevoke\\n ) external initializer {\\n _setValidatorContract(__validatorContract);\\n _setMinValidatorStakingAmount(__minValidatorStakingAmount);\\n _setMaxCommissionRate(__maxCommissionRate);\\n _setCooldownSecsToUndelegate(__cooldownSecsToUndelegate);\\n _setWaitingSecsToRevoke(__waitingSecsToRevoke);\\n }\\n\\n /**\\n * @inheritdoc IStaking\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable override onlyValidatorContract {\\n _recordRewards(_consensusAddrs, _rewards, _period);\\n }\\n\\n /**\\n * @inheritdoc IStaking\\n */\\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\\n external\\n override\\n onlyValidatorContract\\n returns (uint256 _actualDeductingAmount)\\n {\\n _actualDeductingAmount = _deductStakingAmount(_stakingPool[_consensusAddr], _amount);\\n address payable _validatorContractAddr = payable(validatorContract());\\n if (!_unsafeSendRON(_validatorContractAddr, _actualDeductingAmount)) {\\n emit StakingAmountDeductFailed(\\n _consensusAddr,\\n _validatorContractAddr,\\n _actualDeductingAmount,\\n address(this).balance\\n );\\n }\\n }\\n\\n /**\\n * @inheritdoc RewardCalculation\\n */\\n function _currentPeriod() internal view virtual override returns (uint256) {\\n return _validatorContract.currentPeriod();\\n }\\n\\n /**\\n * @inheritdoc CandidateStaking\\n */\\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount)\\n internal\\n override\\n returns (uint256 _actualDeductingAmount)\\n {\\n _actualDeductingAmount = Math.min(_pool.stakingAmount, _amount);\\n\\n _pool.stakingAmount -= _actualDeductingAmount;\\n _changeDelegatingAmount(\\n _pool,\\n _pool.admin,\\n _pool.stakingAmount,\\n Math.subNonNegative(_pool.stakingTotal, _actualDeductingAmount)\\n );\\n emit Unstaked(_pool.addr, _actualDeductingAmount);\\n }\\n}\\n\",\"keccak256\":\"0x1b779c04bad529defd792a4198db8f00e2074a8091989f265ca0ec3c6fe9ea10\",\"license\":\"MIT\"}},\"version\":1}", - "bytecode": "0x60806040523480156200001157600080fd5b5060016000556200002162000027565b620000e9565b60d154610100900460ff1615620000945760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60d15460ff9081161015620000e75760d1805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6139b180620000f96000396000f3fe6080604052600436106101b95760003560e01c806303827884146101f95780630682e8fa14610222578063095f647514610237578063097e4a9d146102645780631658c86e1461028457806326476204146102a45780632715805e146102b75780633d8e846e146102d757806342e0c408146102f757806342ef3c34146103275780634d99dd16146103475780635c19a95c146103675780636558954f1461037a578063679a6e43146103915780636b091695146103b15780636bd8f804146103d157806376664b65146103f1578063888b9ae914610411578063895ab74214610431578063909791dd1461045157806391f8723f14610466578063924f081e146104865780639488e4e9146104a6578063969ffc14146104c657806399439089146104e6578063aa15a6fd14610508578063acd79c4614610528578063af2454291461053b578063b78b5e4114610550578063c2a672e014610570578063c508700314610590578063c673316c146105c9578063cdf64a76146105de578063d01b8eed146105fe578063e22d1c9d14610659578063e5376f5414610679578063f92ad2191461068c578063f9f031df146106ac576101f0565b366101f057336101c76106cc565b6001600160a01b0316146101ee57604051630e6444a160e31b815260040160405180910390fd5b005b336101c76106cc565b34801561020557600080fd5b5061020f6104b081565b6040519081526020015b60405180910390f35b34801561022e57600080fd5b5060385461020f565b34801561024357600080fd5b50610257610252366004613221565b6106db565b60405161021991906132c7565b34801561027057600080fd5b5061020f61027f3660046132ef565b61081d565b34801561029057600080fd5b506101ee61029f366004613345565b610922565b6101ee6102b2366004613345565b610a60565b3480156102c357600080fd5b5061020f6102d2366004613369565b610b38565b3480156102e357600080fd5b506102576102f2366004613395565b610bf8565b34801561030357600080fd5b50610317610312366004613345565b610d3c565b6040519015158152602001610219565b34801561033357600080fd5b506102576103423660046133e9565b610d5c565b34801561035357600080fd5b506101ee610362366004613369565b610e2b565b6101ee610375366004613345565b610ea7565b34801561038657600080fd5b5061020f6201518081565b34801561039d57600080fd5b506101ee6103ac36600461342a565b610fa4565b3480156103bd57600080fd5b5061020f6103cc366004613443565b610fe8565b3480156103dd57600080fd5b506101ee6103ec36600461347c565b61100a565b3480156103fd57600080fd5b5061020f61040c366004613443565b611115565b34801561041d57600080fd5b506101ee61042c36600461342a565b611144565b34801561043d57600080fd5b5061020f61044c366004613345565b611185565b34801561045d57600080fd5b50606c5461020f565b34801561047257600080fd5b506102576104813660046133e9565b6111a3565b34801561049257600080fd5b506101ee6104a13660046134bd565b61124d565b3480156104b257600080fd5b506101ee6104c1366004613221565b6113b0565b3480156104d257600080fd5b506101ee6104e136600461342a565b6114e9565b3480156104f257600080fd5b506104fb6106cc565b60405161021991906134f2565b34801561051457600080fd5b506101ee610523366004613345565b61152a565b6101ee610536366004613506565b611630565b34801561054757600080fd5b5060395461020f565b34801561055c57600080fd5b506101ee61056b36600461342a565b6116a8565b34801561057c57600080fd5b506101ee61058b366004613369565b6116e9565b34801561059c57600080fd5b506104fb6105ab366004613345565b6001600160a01b039081166000908152603a60205260409020541690565b3480156105d557600080fd5b50606d5461020f565b3480156105ea57600080fd5b506101ee6105f9366004613345565b611829565b34801561060a57600080fd5b5061064a610619366004613345565b6001600160a01b03808216600090815260376020526040902060018101546002820154600390920154921693909250565b60405161021993929190613579565b34801561066557600080fd5b506101ee61067436600461359a565b611895565b6101ee6106873660046135e5565b611a85565b34801561069857600080fd5b506101ee6106a7366004613649565b611bba565b3480156106b857600080fd5b5061020f6106c73660046133e9565b611cf5565b6036546001600160a01b031690565b60608382146106fd576040516376081a7b60e11b815260040160405180910390fd5b836001600160401b038111156107155761071561368d565b60405190808252806020026020018201604052801561073e578160200160208202803683370190505b50905060005b81518110156108145760376000878784818110610763576107636136a3565b90506020020160208101906107789190613345565b6001600160a01b03166001600160a01b0316815260200190815260200160002060040160008585848181106107af576107af6136a3565b90506020020160208101906107c49190613345565b6001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106107f7576107f76136a3565b60209081029190910101528061080c816136cf565b915050610744565b50949350505050565b600060026000540361084a5760405162461bcd60e51b8152600401610841906136e8565b60405180910390fd5b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d29061087f9084906004016134f2565b602060405180830381865afa15801561089c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c0919061371f565b6108df5780604051630fd0c64560e11b815260040161084191906134f2565b6108e833610d3c565b156109085733604051632fc6bfb160e21b815260040161084191906134f2565b61091433868686611d75565b600160005595945050505050565b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d2906109529084906004016134f2565b602060405180830381865afa15801561096f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610993919061371f565b6109b25780604051630fd0c64560e11b815260040161084191906134f2565b6001600160a01b0380831660009081526037602052604090206001810154909133911681146109f457604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163dd716ad360e01b81526001600160a01b039092169163dd716ad391610a2891889190600401613741565b600060405180830381600087803b158015610a4257600080fd5b505af1158015610a56573d6000803e3d6000fd5b5050505050505050565b34600003610a8157604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d290610ab19084906004016134f2565b602060405180830381865afa158015610ace573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af2919061371f565b610b115780604051630fd0c64560e11b815260040161084191906134f2565b6001600160a01b0382166000908152603760205260409020610b34903334611de2565b5050565b600033610b436106cc565b6001600160a01b031614610b6a57604051630e6444a160e31b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260409020610b8c9083611eb5565b90506000610b986106cc565b9050610ba48183611f40565b610bf157604080518381524760208201526001600160a01b0380841692908716917f63701cd972aa3c7f87898aab145c972e52185beab07d6e39380a998d334cf6c8910160405180910390a35b5092915050565b6060600080603660009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c74919061375a565b9050836001600160401b03811115610c8e57610c8e61368d565b604051908082528060200260200182016040528015610cb7578160200160208202803683370190505b50925060005b84811015610d3257858582818110610cd757610cd76136a3565b9050602002016020810190610cec9190613345565b9250610d03838884610cfe878c611115565b611f9c565b848281518110610d1557610d156136a3565b602090810291909101015280610d2a816136cf565b915050610cbd565b5050509392505050565b6001600160a01b039081166000908152603a602052604090205416151590565b6060816001600160401b03811115610d7657610d7661368d565b604051908082528060200260200182016040528015610d9f578160200160208202803683370190505b50905060005b82811015610bf15760376000858584818110610dc357610dc36136a3565b9050602002016020810190610dd89190613345565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020154828281518110610e0e57610e0e6136a3565b602090810291909101015280610e23816136cf565b915050610da5565b600260005403610e4d5760405162461bcd60e51b8152600401610841906136e8565b600260009081556001600160a01b03831681526037602052604090203390610e76908284612098565b610e8081836121f9565b610e9d57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550565b34600003610ec857604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d290610ef89084906004016134f2565b602060405180830381865afa158015610f15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f39919061371f565b610f585780604051630fd0c64560e11b815260040161084191906134f2565b610f6133610d3c565b15610f815733604051632fc6bfb160e21b815260040161084191906134f2565b6001600160a01b0382166000908152603760205260409020610b34903334612226565b610fac6122ee565b6001600160a01b0316336001600160a01b031614610fdc5760405162461bcd60e51b815260040161084190613773565b610fe58161231c565b50565b60006110018383610ff7612358565b610cfe8787611115565b90505b92915050565b60026000540361102c5760405162461bcd60e51b8152600401610841906136e8565b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d2906110619084906004016134f2565b602060405180830381865afa15801561107e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a2919061371f565b6110c15780604051630fd0c64560e11b815260040161084191906134f2565b6001600160a01b038416600090815260376020526040902033906110e6908285612098565b6001600160a01b0384166000908152603760205260409020611109908285612226565b50506001600055505050565b6001600160a01b0391821660009081526037602090815260408083209390941682526004909201909152205490565b61114c6122ee565b6001600160a01b0316336001600160a01b03161461117c5760405162461bcd60e51b815260040161084190613773565b610fe5816123ca565b6001600160a01b031660009081526037602052604090206003015490565b6060816001600160401b038111156111bd576111bd61368d565b6040519080825280602002602001820160405280156111e6578160200160208202803683370190505b50905060005b82811015610bf15761121e848483818110611209576112096136a3565b905060200201602081019061044c9190613345565b828281518110611230576112306136a3565b602090810291909101015280611245816136cf565b9150506111ec565b603654604051635061f96960e11b815284916001600160a01b03169063a0c3f2d29061127d9084906004016134f2565b602060405180830381865afa15801561129a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112be919061371f565b6112dd5780604051630fd0c64560e11b815260040161084191906134f2565b6001600160a01b03808516600090815260376020526040902060018101549091339116811461131f57604051637bc65bd760e11b815260040160405180910390fd5b606d5484111561134257604051631b8454a360e21b815260040160405180910390fd5b60365460405163e5125a1d60e01b81526001600160a01b039091169063e5125a1d9061137690899089908990600401613579565b600060405180830381600087803b15801561139057600080fd5b505af11580156113a4573d6000803e3d6000fd5b50505050505050505050565b6002600054036113d25760405162461bcd60e51b8152600401610841906136e8565b60026000558215806113e45750828114155b15611402576040516376081a7b60e11b815260040160405180910390fd5b336000805b858110156114b457848482818110611421576114216136a3565b905060200201358261143391906137b5565b91506114a26037600089898581811061144e5761144e6136a3565b90506020020160208101906114639190613345565b6001600160a01b03166001600160a01b0316815260200190815260200160002084878785818110611496576114966136a3565b90506020020135612098565b806114ac816136cf565b915050611407565b506114bf82826121f9565b6114dc57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550505050565b6114f16122ee565b6001600160a01b0316336001600160a01b0316146115215760405162461bcd60e51b815260040161084190613773565b610fe5816123ff565b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d29061155a9084906004016134f2565b602060405180830381865afa158015611577573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159b919061371f565b6115ba5780604051630fd0c64560e11b815260040161084191906134f2565b6001600160a01b0380831660009081526037602052604090206001810154909133911681146115fc57604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163a7c2f11960e01b81526001600160a01b039092169163a7c2f11991610a2891889190600401613741565b336116396106cc565b6001600160a01b03161461166057604051630e6444a160e31b815260040160405180910390fd5b6116a1858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250879250869150859050612434565b5050505050565b6116b06122ee565b6001600160a01b0316336001600160a01b0316146116e05760405162461bcd60e51b815260040161084190613773565b610fe581612872565b60026000540361170b5760405162461bcd60e51b8152600401610841906136e8565b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d2906117409084906004016134f2565b602060405180830381865afa15801561175d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611781919061371f565b6117a05780604051630fd0c64560e11b815260040161084191906134f2565b816000036117c1576040516331d9f7d760e01b815260040160405180910390fd5b6001600160a01b038316600090815260376020526040812060028101543392906117ec9086906137c8565b9050606c548110156118115760405163ef0a995760e01b815260040160405180910390fd5b61181c8284876128ca565b6114bf83866104b06129cc565b6118316122ee565b6001600160a01b0316336001600160a01b0316146118615760405162461bcd60e51b815260040161084190613773565b806001600160a01b03163b60000361188c57604051637bcd509160e01b815260040160405180910390fd5b610fe581612a2c565b3361189e6106cc565b6001600160a01b0316146118c557604051630e6444a160e31b815260040160405180910390fd5b8115611a805760005b82811015611a45576000603760008686858181106118ee576118ee6136a3565b90506020020160208101906119039190613345565b6001600160a01b0390811682526020808301939093526040918201600090812060018101549092168152603a909352912080546001600160a01b0319169055600281015490915080156119ca5761195a8282611eb5565b506001820154611976906001600160a01b0316826104b06129cc565b6119ca5760018201548254604080518481524760208201526001600160a01b0393841693909216917f7dc5115a5aba081f5a174f56a3d02eea582824783322a4ac03f7bd388f444194910160405180910390a35b6000611a0a8787868181106119e1576119e16136a3565b90506020020160208101906119f69190613345565b60018501546001600160a01b031687612a77565b90508015611a2f576001830154611a2d906001600160a01b0316826104b06129cc565b505b5050508080611a3d906136cf565b9150506118ce565b507f4f257d3ba23679d338f1d94296086bba5724af341b7fa31aa0ff297bfcdc62d88383604051611a779291906137db565b60405180910390a15b505050565b600260005403611aa75760405162461bcd60e51b8152600401610841906136e8565b6002600055611ab533610d3c565b15611ad55733604051632fc6bfb160e21b815260040161084191906134f2565b606d54811115611af857604051631b8454a360e21b815260040160405180910390fd5b3433611b0981888888888888612b77565b6001600160a01b0380871660008181526037602081815260408084206001810180549789166001600160a01b0319988916811790915581548816871782558552603a835290842080549096168517909555929091529052611b6b818385611de2565b816001600160a01b0316876001600160a01b03167ffc1f1e73948cbc47c5b7f90e5601b7daccd9ad7173218486ccc74bdd051d05e860405160405180910390a350506001600055505050505050565b60d154610100900460ff1615808015611bda575060d154600160ff909116105b80611bf45750303b158015611bf4575060d15460ff166001145b611c575760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610841565b60d1805460ff191660011790558015611c7a5760d1805461ff0019166101001790555b611c8386612a2c565b611c8c8561231c565b611c9584612872565b611c9e836123ca565b611ca7826123ff565b8015611ced5760d1805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6000600260005403611d195760405162461bcd60e51b8152600401610841906136e8565b6002600081905550611d5e33848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612e2692505050565b9050611d6a3382612e89565b600160005592915050565b6000611db485858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612e2692505050565b6001600160a01b0383166000908152603760205260409020909150611dda908683612226565b949350505050565b6001830154839083906001600160a01b03808316911614611e1657604051637bc65bd760e11b815260040160405180910390fd5b82856002016000828254611e2a91906137b5565b92505081905550611e5085858760020154868960030154611e4b91906137b5565b612eb0565b6001600160a01b03808516600090815260058701602052604090819020429055865490519116907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611ea69086815260200190565b60405180910390a25050505050565b6000611ec5836002015483612eeb565b905080836002016000828254611edb91906137c8565b9091555050600183015460028401546003850154611f0b9286926001600160a01b0390911691611e4b9086612f01565b82546040518281526001600160a01b039091169060008051602061393c8339815191529060200160405180910390a292915050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f8d576040519150601f19603f3d011682016040523d82523d6000602084013e611f92565b606091505b5090949350505050565b6001600160a01b03808516600090815260026020908152604080832093871683529290529081206003810154849003611fd757549050611dda565b6001600160a01b03861660009081526003602081815260408084206001808452828620948701548652939092528320918201548392901561203c578054600186015490945061202690856137c8565b85600201546120359190613829565b9250612044565b846001015493505b81546000906120549086906137c8565b61205e9089613829565b9050670de0b6b3a764000061207382866137b5565b61207d9190613840565b865461208991906137b5565b9b9a5050505050505050505050565b6001830154839083906001600160a01b038083169116036120cc57604051639feb934760e01b815260040160405180910390fd5b826000036120ed57604051637ab0c6ad60e11b815260040160405180910390fd5b6001600160a01b038416600090815260048601602052604090205483111561212857604051630695534560e31b815260040160405180910390fd5b6038546001600160a01b03851660009081526005870160205260409020544291612151916137b5565b1061216f5760405163f19f52bd60e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546121ad908690869061219d9087906137c8565b868960030154611e4b91906137c8565b84546040518481526001600160a01b03918216918616907f4d10bd049775c77bd7f255195afba5088028ecb3c7c277d393ccff7934f2f92c906020015b60405180910390a35050505050565b60008147101561221c576040516304611a4560e11b815260040160405180910390fd5b6110018383611f40565b6001830154839083906001600160a01b0380831691160361225a57604051639feb934760e01b815260040160405180910390fd5b6001600160a01b038416600090815260048601602052604090205461229890869086906122889087906137b5565b868960030154611e4b91906137b5565b6001600160a01b03808516600081815260058801602052604090819020429055875490519216917fe5541a6b6103d4fa7e021ed54fad39c66f27a76bd13d374cf6240ae6bd0bb72b906121ea9087815260200190565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b606c8190556040518181527f372bbdb8d72373b0012f84ee5a11671e5fb72b8bea902ebca93a19cb45d32be2906020015b60405180910390a150565b6036546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa1580156123a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c5919061375a565b905090565b60388190556040518181527f4956b65267b8f1e642284bcb5037116c69a9c78d9ca576beeae0974737a4872a9060200161234d565b60398190556040518181527f02be0b73b597f2c0f138aebee162b3b0e25d5b5a26854c15dcf79176e9a1c6789060200161234d565b8351821461247d57807fae52c603227f64e4c6101dde593aa9790a16b3ac77546bd746d758511e9560a58585856040516124709392919061389b565b60405180910390a261286c565b600080600080600088516001600160401b0381111561249e5761249e61368d565b6040519080825280602002602001820160405280156124c7578160200160208202803683370190505b509050600089516001600160401b038111156124e5576124e561368d565b60405190808252806020026020018201604052801561250e578160200160208202803683370190505b50905060008a516001600160401b0381111561252c5761252c61368d565b604051908082528060200260200182016040528015612555578160200160208202803683370190505b50905060005b8b518110156127d7578b8181518110612576576125766136a3565b60200260200101519550600060036000886001600160a01b03166001600160a01b0316815260200190815260200160002090506125b287611185565b6001600160a01b03881660009081526001602081815260408084208f855290915290912001549096508a9003612626578683896125ee816136cf565b9a5081518110612600576126006136a3565b60200260200101906001600160a01b031690816001600160a01b031681525050506127c5565b60028101548a111561265457604080518082019091528681526020018a905260018101869055600281018a90555b60018101541561269e5760018101548c8c84818110612675576126756136a3565b90506020020135670de0b6b3a764000061268f9190613829565b6126999190613840565b6126a1565b60005b9850888160000160008282546126b791906137b5565b91829055509050856126c98a856137c8565b815181106126d9576126d96136a3565b6020026020010181815250506040518060400160405280826000015481526020018b81525060016000896001600160a01b03166001600160a01b0316815260200190815260200160002060008c81526020019081526020016000206000820151816000015560208201518160010155905050858160010160000181905550806001016000015484898461276c91906137c8565b8151811061277c5761277c6136a3565b6020908102919091010152868d6127938a856137c8565b815181106127a3576127a36136a3565b60200260200101906001600160a01b031690816001600160a01b031681525050505b806127cf816136cf565b91505061255b565b50851561282057858152858b51038b52877fee74f10cc50bf4b7e57fd36be7d46288795f3a9151dae97505b718b392ba14a38260405161281791906138e5565b60405180910390a25b8a511561286457877f0e54e0485f70f0f63bc25889ddbf01ce1269ad6f07fdb2df573a0fbdb4d66f888c858560405161285b939291906138f8565b60405180910390a25b505050505050505b50505050565b61271081111561289557604051631b8454a360e21b815260040160405180910390fd5b606d8190556040518181527f774069781371d65424b3b0b101c1d40014532cac040f979595b99a3fcf8ce08c9060200161234d565b6001830154839083906001600160a01b038083169116146128fe57604051637bc65bd760e11b815260040160405180910390fd5b846002015483111561292357604051630a8d7fa760e21b815260040160405180910390fd5b6038546001600160a01b0385166000908152600587016020526040902054429161294c916137b5565b111561296b576040516303db082960e11b815260040160405180910390fd5b8285600201600082825461297f91906137c8565b925050819055506129a085858760020154868960030154611e4b91906137c8565b84546040518481526001600160a01b039091169060008051602061393c83398151915290602001611ea6565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d8060008114612a1c576040519150601f19603f3d011682016040523d82523d6000602084013e612a21565b606091505b509095945050505050565b603680546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b68361699061234d9083906134f2565b600080612a848585611115565b9050612a9285858584611f9c565b9150836001600160a01b0316856001600160a01b03167f0aa4d283470c904c551d18bb894d37e17674920f3261a7f854be501e25f421b784604051612ad991815260200190565b60405180910390a36001600160a01b03808616600081815260026020908152604080832094891683529381528382208281559282526003905291909120612b239082868580612f17565b60038181018590556001600160a01b038781166000818152602093845260408082205460018701555190815291881692909160008051602061395c833981519152910160405180910390a350509392505050565b612b82876000611f40565b612bcd576040805163338f030160e01b81526001600160a01b03891660048201526024810191909152600a6044820152693837b7b61030b236b4b760b11b6064820152608401610841565b612bd8846000611f40565b612c21576040805163338f030160e01b81526001600160a01b038616600482015260248101919091526008604482015267747265617375727960c01b6064820152608401610841565b606c54811015612c4457604051630a8d7fa760e21b815260040160405180910390fd5b606d54821115612c6757604051631b8454a360e21b815260040160405180910390fd5b856001600160a01b0316876001600160a01b0316141580612c9a5750836001600160a01b0316866001600160a01b031614155b15612cb85760405163dc1d04ff60e01b815260040160405180910390fd5b60408051600380825260808201909252600091602082016060803683370190505090508781600081518110612cef57612cef6136a3565b60200260200101906001600160a01b031690816001600160a01b0316815250508581600181518110612d2357612d236136a3565b60200260200101906001600160a01b031690816001600160a01b0316815250508381600281518110612d5757612d576136a3565b60200260200101906001600160a01b031690816001600160a01b031681525050612d8081612fa9565b15612d9e576040516329d55f9360e11b815260040160405180910390fd5b6036546040516302209ca560e31b81526001600160a01b0389811660048301528881166024830152878116604483015286811660648301526084820186905290911690631104e5289060a401600060405180830381600087803b158015612e0457600080fd5b505af1158015612e18573d6000803e3d6000fd5b505050505050505050505050565b600080612e31612358565b905060005b8351811015612e8157612e63848281518110612e5457612e546136a3565b60200260200101518684612a77565b612e6d90846137b5565b925080612e79816136cf565b915050612e36565b505092915050565b612e9382826121f9565b610b3457604051630c3e69bb60e11b815260040160405180910390fd5b8354612ec6906001600160a01b03168484613070565b60038401556001600160a01b0390911660009081526004909201602052604090912055565b6000818310612efa5781611001565b5090919050565b6000612f0d8383612eeb565b61100190846137c8565b8284600301541015612f2b57600284018190555b6000612f3b856002015484612eeb565b90506000818660020154612f4f91906137c8565b90508015612fa057600286018290556001870154811115612f83576040516352e521bf60e11b815260040160405180910390fd5b80876001016000016000828254612f9a91906137c8565b90915550505b50505050505050565b60008151600003612fbc57506000919050565b60005b60018351612fcd91906137c8565b811015613067576000612fe18260016137b5565b90505b835181101561305457838181518110612fff57612fff6136a3565b60200260200101516001600160a01b0316848381518110613022576130226136a3565b60200260200101516001600160a01b031603613042575060019392505050565b8061304c816136cf565b915050612fe4565b508061305f816136cf565b915050612fbf565b50600092915050565b600061307a612358565b6001600160a01b03851660009081526003602052604090206001810154600282015492935090918311156130d55760405180604001604052806130bc88611185565b8152602090810185905281516001850155015160028301555b6001600160a01b0380871660009081526002602090815260408083209389168352929052908120906131078888611115565b9050600061311789898885611f9c565b83549091508114613157578083556040518181526001600160a01b0389811691908b169060008051602061395c8339815191529060200160405180910390a35b6131648584888a86612f17565b84546001808501919091556003840187905585015484146131cb57886001600160a01b0316867f81faf50e2aaf52eaba2ab841071efb9f6f0850a3e7d008b1336e6001d3d4963c87600101600001546040516131c291815260200190565b60405180910390a35b505050505050505050565b60008083601f8401126131e857600080fd5b5081356001600160401b038111156131ff57600080fd5b6020830191508360208260051b850101111561321a57600080fd5b9250929050565b6000806000806040858703121561323757600080fd5b84356001600160401b038082111561324e57600080fd5b61325a888389016131d6565b9096509450602087013591508082111561327357600080fd5b50613280878288016131d6565b95989497509550505050565b600081518084526020808501945080840160005b838110156132bc578151875295820195908201906001016132a0565b509495945050505050565b602081526000611001602083018461328c565b6001600160a01b0381168114610fe557600080fd5b60008060006040848603121561330457600080fd5b83356001600160401b0381111561331a57600080fd5b613326868287016131d6565b909450925050602084013561333a816132da565b809150509250925092565b60006020828403121561335757600080fd5b8135613362816132da565b9392505050565b6000806040838503121561337c57600080fd5b8235613387816132da565b946020939093013593505050565b6000806000604084860312156133aa57600080fd5b83356133b5816132da565b925060208401356001600160401b038111156133d057600080fd5b6133dc868287016131d6565b9497909650939450505050565b600080602083850312156133fc57600080fd5b82356001600160401b0381111561341257600080fd5b61341e858286016131d6565b90969095509350505050565b60006020828403121561343c57600080fd5b5035919050565b6000806040838503121561345657600080fd5b8235613461816132da565b91506020830135613471816132da565b809150509250929050565b60008060006060848603121561349157600080fd5b833561349c816132da565b925060208401356134ac816132da565b929592945050506040919091013590565b6000806000606084860312156134d257600080fd5b83356134dd816132da565b95602085013595506040909401359392505050565b6001600160a01b0391909116815260200190565b60008060008060006060868803121561351e57600080fd5b85356001600160401b038082111561353557600080fd5b61354189838a016131d6565b9097509550602088013591508082111561355a57600080fd5b50613567888289016131d6565b96999598509660400135949350505050565b6001600160a01b039390931683526020830191909152604082015260600190565b6000806000604084860312156135af57600080fd5b83356001600160401b038111156135c557600080fd5b6135d1868287016131d6565b909790965060209590950135949350505050565b600080600080600060a086880312156135fd57600080fd5b8535613608816132da565b94506020860135613618816132da565b93506040860135613628816132da565b92506060860135613638816132da565b949793965091946080013592915050565b600080600080600060a0868803121561366157600080fd5b853561366c816132da565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016136e1576136e16136b9565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561373157600080fd5b8151801515811461336257600080fd5b6001600160a01b03929092168252602082015260400190565b60006020828403121561376c57600080fd5b5051919050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b80820180821115611004576110046136b9565b81810381811115611004576110046136b9565b60208082528181018390526000908460408401835b8681101561381e578235613803816132da565b6001600160a01b0316825291830191908301906001016137f0565b509695505050505050565b8082028115828204841417611004576110046136b9565b60008261385d57634e487b7160e01b600052601260045260246000fd5b500490565b600081518084526020808501945080840160005b838110156132bc5781516001600160a01b031687529582019590820190600101613876565b6040815260006138ae6040830186613862565b82810360208401528381526001600160fb1b038411156138cd57600080fd5b8360051b808660208401370160200195945050505050565b6020815260006110016020830184613862565b60608152600061390b6060830186613862565b828103602084015261391d818661328c565b90508281036040840152613931818561328c565b969550505050505056fe0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75aa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ada2646970667358221220bc6c01b7b360a07ad68428236e0f2ad27b2e686168d0907c1141a3336c536d1c64736f6c63430008110033", - "deployedBytecode": "0x6080604052600436106101b95760003560e01c806303827884146101f95780630682e8fa14610222578063095f647514610237578063097e4a9d146102645780631658c86e1461028457806326476204146102a45780632715805e146102b75780633d8e846e146102d757806342e0c408146102f757806342ef3c34146103275780634d99dd16146103475780635c19a95c146103675780636558954f1461037a578063679a6e43146103915780636b091695146103b15780636bd8f804146103d157806376664b65146103f1578063888b9ae914610411578063895ab74214610431578063909791dd1461045157806391f8723f14610466578063924f081e146104865780639488e4e9146104a6578063969ffc14146104c657806399439089146104e6578063aa15a6fd14610508578063acd79c4614610528578063af2454291461053b578063b78b5e4114610550578063c2a672e014610570578063c508700314610590578063c673316c146105c9578063cdf64a76146105de578063d01b8eed146105fe578063e22d1c9d14610659578063e5376f5414610679578063f92ad2191461068c578063f9f031df146106ac576101f0565b366101f057336101c76106cc565b6001600160a01b0316146101ee57604051630e6444a160e31b815260040160405180910390fd5b005b336101c76106cc565b34801561020557600080fd5b5061020f6104b081565b6040519081526020015b60405180910390f35b34801561022e57600080fd5b5060385461020f565b34801561024357600080fd5b50610257610252366004613221565b6106db565b60405161021991906132c7565b34801561027057600080fd5b5061020f61027f3660046132ef565b61081d565b34801561029057600080fd5b506101ee61029f366004613345565b610922565b6101ee6102b2366004613345565b610a60565b3480156102c357600080fd5b5061020f6102d2366004613369565b610b38565b3480156102e357600080fd5b506102576102f2366004613395565b610bf8565b34801561030357600080fd5b50610317610312366004613345565b610d3c565b6040519015158152602001610219565b34801561033357600080fd5b506102576103423660046133e9565b610d5c565b34801561035357600080fd5b506101ee610362366004613369565b610e2b565b6101ee610375366004613345565b610ea7565b34801561038657600080fd5b5061020f6201518081565b34801561039d57600080fd5b506101ee6103ac36600461342a565b610fa4565b3480156103bd57600080fd5b5061020f6103cc366004613443565b610fe8565b3480156103dd57600080fd5b506101ee6103ec36600461347c565b61100a565b3480156103fd57600080fd5b5061020f61040c366004613443565b611115565b34801561041d57600080fd5b506101ee61042c36600461342a565b611144565b34801561043d57600080fd5b5061020f61044c366004613345565b611185565b34801561045d57600080fd5b50606c5461020f565b34801561047257600080fd5b506102576104813660046133e9565b6111a3565b34801561049257600080fd5b506101ee6104a13660046134bd565b61124d565b3480156104b257600080fd5b506101ee6104c1366004613221565b6113b0565b3480156104d257600080fd5b506101ee6104e136600461342a565b6114e9565b3480156104f257600080fd5b506104fb6106cc565b60405161021991906134f2565b34801561051457600080fd5b506101ee610523366004613345565b61152a565b6101ee610536366004613506565b611630565b34801561054757600080fd5b5060395461020f565b34801561055c57600080fd5b506101ee61056b36600461342a565b6116a8565b34801561057c57600080fd5b506101ee61058b366004613369565b6116e9565b34801561059c57600080fd5b506104fb6105ab366004613345565b6001600160a01b039081166000908152603a60205260409020541690565b3480156105d557600080fd5b50606d5461020f565b3480156105ea57600080fd5b506101ee6105f9366004613345565b611829565b34801561060a57600080fd5b5061064a610619366004613345565b6001600160a01b03808216600090815260376020526040902060018101546002820154600390920154921693909250565b60405161021993929190613579565b34801561066557600080fd5b506101ee61067436600461359a565b611895565b6101ee6106873660046135e5565b611a85565b34801561069857600080fd5b506101ee6106a7366004613649565b611bba565b3480156106b857600080fd5b5061020f6106c73660046133e9565b611cf5565b6036546001600160a01b031690565b60608382146106fd576040516376081a7b60e11b815260040160405180910390fd5b836001600160401b038111156107155761071561368d565b60405190808252806020026020018201604052801561073e578160200160208202803683370190505b50905060005b81518110156108145760376000878784818110610763576107636136a3565b90506020020160208101906107789190613345565b6001600160a01b03166001600160a01b0316815260200190815260200160002060040160008585848181106107af576107af6136a3565b90506020020160208101906107c49190613345565b6001600160a01b03166001600160a01b03168152602001908152602001600020548282815181106107f7576107f76136a3565b60209081029190910101528061080c816136cf565b915050610744565b50949350505050565b600060026000540361084a5760405162461bcd60e51b8152600401610841906136e8565b60405180910390fd5b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d29061087f9084906004016134f2565b602060405180830381865afa15801561089c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108c0919061371f565b6108df5780604051630fd0c64560e11b815260040161084191906134f2565b6108e833610d3c565b156109085733604051632fc6bfb160e21b815260040161084191906134f2565b61091433868686611d75565b600160005595945050505050565b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d2906109529084906004016134f2565b602060405180830381865afa15801561096f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610993919061371f565b6109b25780604051630fd0c64560e11b815260040161084191906134f2565b6001600160a01b0380831660009081526037602052604090206001810154909133911681146109f457604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163dd716ad360e01b81526001600160a01b039092169163dd716ad391610a2891889190600401613741565b600060405180830381600087803b158015610a4257600080fd5b505af1158015610a56573d6000803e3d6000fd5b5050505050505050565b34600003610a8157604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d290610ab19084906004016134f2565b602060405180830381865afa158015610ace573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610af2919061371f565b610b115780604051630fd0c64560e11b815260040161084191906134f2565b6001600160a01b0382166000908152603760205260409020610b34903334611de2565b5050565b600033610b436106cc565b6001600160a01b031614610b6a57604051630e6444a160e31b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260409020610b8c9083611eb5565b90506000610b986106cc565b9050610ba48183611f40565b610bf157604080518381524760208201526001600160a01b0380841692908716917f63701cd972aa3c7f87898aab145c972e52185beab07d6e39380a998d334cf6c8910160405180910390a35b5092915050565b6060600080603660009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c74919061375a565b9050836001600160401b03811115610c8e57610c8e61368d565b604051908082528060200260200182016040528015610cb7578160200160208202803683370190505b50925060005b84811015610d3257858582818110610cd757610cd76136a3565b9050602002016020810190610cec9190613345565b9250610d03838884610cfe878c611115565b611f9c565b848281518110610d1557610d156136a3565b602090810291909101015280610d2a816136cf565b915050610cbd565b5050509392505050565b6001600160a01b039081166000908152603a602052604090205416151590565b6060816001600160401b03811115610d7657610d7661368d565b604051908082528060200260200182016040528015610d9f578160200160208202803683370190505b50905060005b82811015610bf15760376000858584818110610dc357610dc36136a3565b9050602002016020810190610dd89190613345565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020154828281518110610e0e57610e0e6136a3565b602090810291909101015280610e23816136cf565b915050610da5565b600260005403610e4d5760405162461bcd60e51b8152600401610841906136e8565b600260009081556001600160a01b03831681526037602052604090203390610e76908284612098565b610e8081836121f9565b610e9d57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550565b34600003610ec857604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d290610ef89084906004016134f2565b602060405180830381865afa158015610f15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f39919061371f565b610f585780604051630fd0c64560e11b815260040161084191906134f2565b610f6133610d3c565b15610f815733604051632fc6bfb160e21b815260040161084191906134f2565b6001600160a01b0382166000908152603760205260409020610b34903334612226565b610fac6122ee565b6001600160a01b0316336001600160a01b031614610fdc5760405162461bcd60e51b815260040161084190613773565b610fe58161231c565b50565b60006110018383610ff7612358565b610cfe8787611115565b90505b92915050565b60026000540361102c5760405162461bcd60e51b8152600401610841906136e8565b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d2906110619084906004016134f2565b602060405180830381865afa15801561107e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a2919061371f565b6110c15780604051630fd0c64560e11b815260040161084191906134f2565b6001600160a01b038416600090815260376020526040902033906110e6908285612098565b6001600160a01b0384166000908152603760205260409020611109908285612226565b50506001600055505050565b6001600160a01b0391821660009081526037602090815260408083209390941682526004909201909152205490565b61114c6122ee565b6001600160a01b0316336001600160a01b03161461117c5760405162461bcd60e51b815260040161084190613773565b610fe5816123ca565b6001600160a01b031660009081526037602052604090206003015490565b6060816001600160401b038111156111bd576111bd61368d565b6040519080825280602002602001820160405280156111e6578160200160208202803683370190505b50905060005b82811015610bf15761121e848483818110611209576112096136a3565b905060200201602081019061044c9190613345565b828281518110611230576112306136a3565b602090810291909101015280611245816136cf565b9150506111ec565b603654604051635061f96960e11b815284916001600160a01b03169063a0c3f2d29061127d9084906004016134f2565b602060405180830381865afa15801561129a573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112be919061371f565b6112dd5780604051630fd0c64560e11b815260040161084191906134f2565b6001600160a01b03808516600090815260376020526040902060018101549091339116811461131f57604051637bc65bd760e11b815260040160405180910390fd5b606d5484111561134257604051631b8454a360e21b815260040160405180910390fd5b60365460405163e5125a1d60e01b81526001600160a01b039091169063e5125a1d9061137690899089908990600401613579565b600060405180830381600087803b15801561139057600080fd5b505af11580156113a4573d6000803e3d6000fd5b50505050505050505050565b6002600054036113d25760405162461bcd60e51b8152600401610841906136e8565b60026000558215806113e45750828114155b15611402576040516376081a7b60e11b815260040160405180910390fd5b336000805b858110156114b457848482818110611421576114216136a3565b905060200201358261143391906137b5565b91506114a26037600089898581811061144e5761144e6136a3565b90506020020160208101906114639190613345565b6001600160a01b03166001600160a01b0316815260200190815260200160002084878785818110611496576114966136a3565b90506020020135612098565b806114ac816136cf565b915050611407565b506114bf82826121f9565b6114dc57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550505050565b6114f16122ee565b6001600160a01b0316336001600160a01b0316146115215760405162461bcd60e51b815260040161084190613773565b610fe5816123ff565b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d29061155a9084906004016134f2565b602060405180830381865afa158015611577573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061159b919061371f565b6115ba5780604051630fd0c64560e11b815260040161084191906134f2565b6001600160a01b0380831660009081526037602052604090206001810154909133911681146115fc57604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163a7c2f11960e01b81526001600160a01b039092169163a7c2f11991610a2891889190600401613741565b336116396106cc565b6001600160a01b03161461166057604051630e6444a160e31b815260040160405180910390fd5b6116a1858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250879250869150859050612434565b5050505050565b6116b06122ee565b6001600160a01b0316336001600160a01b0316146116e05760405162461bcd60e51b815260040161084190613773565b610fe581612872565b60026000540361170b5760405162461bcd60e51b8152600401610841906136e8565b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d2906117409084906004016134f2565b602060405180830381865afa15801561175d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611781919061371f565b6117a05780604051630fd0c64560e11b815260040161084191906134f2565b816000036117c1576040516331d9f7d760e01b815260040160405180910390fd5b6001600160a01b038316600090815260376020526040812060028101543392906117ec9086906137c8565b9050606c548110156118115760405163ef0a995760e01b815260040160405180910390fd5b61181c8284876128ca565b6114bf83866104b06129cc565b6118316122ee565b6001600160a01b0316336001600160a01b0316146118615760405162461bcd60e51b815260040161084190613773565b806001600160a01b03163b60000361188c57604051637bcd509160e01b815260040160405180910390fd5b610fe581612a2c565b3361189e6106cc565b6001600160a01b0316146118c557604051630e6444a160e31b815260040160405180910390fd5b8115611a805760005b82811015611a45576000603760008686858181106118ee576118ee6136a3565b90506020020160208101906119039190613345565b6001600160a01b0390811682526020808301939093526040918201600090812060018101549092168152603a909352912080546001600160a01b0319169055600281015490915080156119ca5761195a8282611eb5565b506001820154611976906001600160a01b0316826104b06129cc565b6119ca5760018201548254604080518481524760208201526001600160a01b0393841693909216917f7dc5115a5aba081f5a174f56a3d02eea582824783322a4ac03f7bd388f444194910160405180910390a35b6000611a0a8787868181106119e1576119e16136a3565b90506020020160208101906119f69190613345565b60018501546001600160a01b031687612a77565b90508015611a2f576001830154611a2d906001600160a01b0316826104b06129cc565b505b5050508080611a3d906136cf565b9150506118ce565b507f4f257d3ba23679d338f1d94296086bba5724af341b7fa31aa0ff297bfcdc62d88383604051611a779291906137db565b60405180910390a15b505050565b600260005403611aa75760405162461bcd60e51b8152600401610841906136e8565b6002600055611ab533610d3c565b15611ad55733604051632fc6bfb160e21b815260040161084191906134f2565b606d54811115611af857604051631b8454a360e21b815260040160405180910390fd5b3433611b0981888888888888612b77565b6001600160a01b0380871660008181526037602081815260408084206001810180549789166001600160a01b0319988916811790915581548816871782558552603a835290842080549096168517909555929091529052611b6b818385611de2565b816001600160a01b0316876001600160a01b03167ffc1f1e73948cbc47c5b7f90e5601b7daccd9ad7173218486ccc74bdd051d05e860405160405180910390a350506001600055505050505050565b60d154610100900460ff1615808015611bda575060d154600160ff909116105b80611bf45750303b158015611bf4575060d15460ff166001145b611c575760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610841565b60d1805460ff191660011790558015611c7a5760d1805461ff0019166101001790555b611c8386612a2c565b611c8c8561231c565b611c9584612872565b611c9e836123ca565b611ca7826123ff565b8015611ced5760d1805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6000600260005403611d195760405162461bcd60e51b8152600401610841906136e8565b6002600081905550611d5e33848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612e2692505050565b9050611d6a3382612e89565b600160005592915050565b6000611db485858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612e2692505050565b6001600160a01b0383166000908152603760205260409020909150611dda908683612226565b949350505050565b6001830154839083906001600160a01b03808316911614611e1657604051637bc65bd760e11b815260040160405180910390fd5b82856002016000828254611e2a91906137b5565b92505081905550611e5085858760020154868960030154611e4b91906137b5565b612eb0565b6001600160a01b03808516600090815260058701602052604090819020429055865490519116907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611ea69086815260200190565b60405180910390a25050505050565b6000611ec5836002015483612eeb565b905080836002016000828254611edb91906137c8565b9091555050600183015460028401546003850154611f0b9286926001600160a01b0390911691611e4b9086612f01565b82546040518281526001600160a01b039091169060008051602061393c8339815191529060200160405180910390a292915050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611f8d576040519150601f19603f3d011682016040523d82523d6000602084013e611f92565b606091505b5090949350505050565b6001600160a01b03808516600090815260026020908152604080832093871683529290529081206003810154849003611fd757549050611dda565b6001600160a01b03861660009081526003602081815260408084206001808452828620948701548652939092528320918201548392901561203c578054600186015490945061202690856137c8565b85600201546120359190613829565b9250612044565b846001015493505b81546000906120549086906137c8565b61205e9089613829565b9050670de0b6b3a764000061207382866137b5565b61207d9190613840565b865461208991906137b5565b9b9a5050505050505050505050565b6001830154839083906001600160a01b038083169116036120cc57604051639feb934760e01b815260040160405180910390fd5b826000036120ed57604051637ab0c6ad60e11b815260040160405180910390fd5b6001600160a01b038416600090815260048601602052604090205483111561212857604051630695534560e31b815260040160405180910390fd5b6038546001600160a01b03851660009081526005870160205260409020544291612151916137b5565b1061216f5760405163f19f52bd60e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546121ad908690869061219d9087906137c8565b868960030154611e4b91906137c8565b84546040518481526001600160a01b03918216918616907f4d10bd049775c77bd7f255195afba5088028ecb3c7c277d393ccff7934f2f92c906020015b60405180910390a35050505050565b60008147101561221c576040516304611a4560e11b815260040160405180910390fd5b6110018383611f40565b6001830154839083906001600160a01b0380831691160361225a57604051639feb934760e01b815260040160405180910390fd5b6001600160a01b038416600090815260048601602052604090205461229890869086906122889087906137b5565b868960030154611e4b91906137b5565b6001600160a01b03808516600081815260058801602052604090819020429055875490519216917fe5541a6b6103d4fa7e021ed54fad39c66f27a76bd13d374cf6240ae6bd0bb72b906121ea9087815260200190565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b606c8190556040518181527f372bbdb8d72373b0012f84ee5a11671e5fb72b8bea902ebca93a19cb45d32be2906020015b60405180910390a150565b6036546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa1580156123a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123c5919061375a565b905090565b60388190556040518181527f4956b65267b8f1e642284bcb5037116c69a9c78d9ca576beeae0974737a4872a9060200161234d565b60398190556040518181527f02be0b73b597f2c0f138aebee162b3b0e25d5b5a26854c15dcf79176e9a1c6789060200161234d565b8351821461247d57807fae52c603227f64e4c6101dde593aa9790a16b3ac77546bd746d758511e9560a58585856040516124709392919061389b565b60405180910390a261286c565b600080600080600088516001600160401b0381111561249e5761249e61368d565b6040519080825280602002602001820160405280156124c7578160200160208202803683370190505b509050600089516001600160401b038111156124e5576124e561368d565b60405190808252806020026020018201604052801561250e578160200160208202803683370190505b50905060008a516001600160401b0381111561252c5761252c61368d565b604051908082528060200260200182016040528015612555578160200160208202803683370190505b50905060005b8b518110156127d7578b8181518110612576576125766136a3565b60200260200101519550600060036000886001600160a01b03166001600160a01b0316815260200190815260200160002090506125b287611185565b6001600160a01b03881660009081526001602081815260408084208f855290915290912001549096508a9003612626578683896125ee816136cf565b9a5081518110612600576126006136a3565b60200260200101906001600160a01b031690816001600160a01b031681525050506127c5565b60028101548a111561265457604080518082019091528681526020018a905260018101869055600281018a90555b60018101541561269e5760018101548c8c84818110612675576126756136a3565b90506020020135670de0b6b3a764000061268f9190613829565b6126999190613840565b6126a1565b60005b9850888160000160008282546126b791906137b5565b91829055509050856126c98a856137c8565b815181106126d9576126d96136a3565b6020026020010181815250506040518060400160405280826000015481526020018b81525060016000896001600160a01b03166001600160a01b0316815260200190815260200160002060008c81526020019081526020016000206000820151816000015560208201518160010155905050858160010160000181905550806001016000015484898461276c91906137c8565b8151811061277c5761277c6136a3565b6020908102919091010152868d6127938a856137c8565b815181106127a3576127a36136a3565b60200260200101906001600160a01b031690816001600160a01b031681525050505b806127cf816136cf565b91505061255b565b50851561282057858152858b51038b52877fee74f10cc50bf4b7e57fd36be7d46288795f3a9151dae97505b718b392ba14a38260405161281791906138e5565b60405180910390a25b8a511561286457877f0e54e0485f70f0f63bc25889ddbf01ce1269ad6f07fdb2df573a0fbdb4d66f888c858560405161285b939291906138f8565b60405180910390a25b505050505050505b50505050565b61271081111561289557604051631b8454a360e21b815260040160405180910390fd5b606d8190556040518181527f774069781371d65424b3b0b101c1d40014532cac040f979595b99a3fcf8ce08c9060200161234d565b6001830154839083906001600160a01b038083169116146128fe57604051637bc65bd760e11b815260040160405180910390fd5b846002015483111561292357604051630a8d7fa760e21b815260040160405180910390fd5b6038546001600160a01b0385166000908152600587016020526040902054429161294c916137b5565b111561296b576040516303db082960e11b815260040160405180910390fd5b8285600201600082825461297f91906137c8565b925050819055506129a085858760020154868960030154611e4b91906137c8565b84546040518481526001600160a01b039091169060008051602061393c83398151915290602001611ea6565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d8060008114612a1c576040519150601f19603f3d011682016040523d82523d6000602084013e612a21565b606091505b509095945050505050565b603680546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b68361699061234d9083906134f2565b600080612a848585611115565b9050612a9285858584611f9c565b9150836001600160a01b0316856001600160a01b03167f0aa4d283470c904c551d18bb894d37e17674920f3261a7f854be501e25f421b784604051612ad991815260200190565b60405180910390a36001600160a01b03808616600081815260026020908152604080832094891683529381528382208281559282526003905291909120612b239082868580612f17565b60038181018590556001600160a01b038781166000818152602093845260408082205460018701555190815291881692909160008051602061395c833981519152910160405180910390a350509392505050565b612b82876000611f40565b612bcd576040805163338f030160e01b81526001600160a01b03891660048201526024810191909152600a6044820152693837b7b61030b236b4b760b11b6064820152608401610841565b612bd8846000611f40565b612c21576040805163338f030160e01b81526001600160a01b038616600482015260248101919091526008604482015267747265617375727960c01b6064820152608401610841565b606c54811015612c4457604051630a8d7fa760e21b815260040160405180910390fd5b606d54821115612c6757604051631b8454a360e21b815260040160405180910390fd5b856001600160a01b0316876001600160a01b0316141580612c9a5750836001600160a01b0316866001600160a01b031614155b15612cb85760405163dc1d04ff60e01b815260040160405180910390fd5b60408051600380825260808201909252600091602082016060803683370190505090508781600081518110612cef57612cef6136a3565b60200260200101906001600160a01b031690816001600160a01b0316815250508581600181518110612d2357612d236136a3565b60200260200101906001600160a01b031690816001600160a01b0316815250508381600281518110612d5757612d576136a3565b60200260200101906001600160a01b031690816001600160a01b031681525050612d8081612fa9565b15612d9e576040516329d55f9360e11b815260040160405180910390fd5b6036546040516302209ca560e31b81526001600160a01b0389811660048301528881166024830152878116604483015286811660648301526084820186905290911690631104e5289060a401600060405180830381600087803b158015612e0457600080fd5b505af1158015612e18573d6000803e3d6000fd5b505050505050505050505050565b600080612e31612358565b905060005b8351811015612e8157612e63848281518110612e5457612e546136a3565b60200260200101518684612a77565b612e6d90846137b5565b925080612e79816136cf565b915050612e36565b505092915050565b612e9382826121f9565b610b3457604051630c3e69bb60e11b815260040160405180910390fd5b8354612ec6906001600160a01b03168484613070565b60038401556001600160a01b0390911660009081526004909201602052604090912055565b6000818310612efa5781611001565b5090919050565b6000612f0d8383612eeb565b61100190846137c8565b8284600301541015612f2b57600284018190555b6000612f3b856002015484612eeb565b90506000818660020154612f4f91906137c8565b90508015612fa057600286018290556001870154811115612f83576040516352e521bf60e11b815260040160405180910390fd5b80876001016000016000828254612f9a91906137c8565b90915550505b50505050505050565b60008151600003612fbc57506000919050565b60005b60018351612fcd91906137c8565b811015613067576000612fe18260016137b5565b90505b835181101561305457838181518110612fff57612fff6136a3565b60200260200101516001600160a01b0316848381518110613022576130226136a3565b60200260200101516001600160a01b031603613042575060019392505050565b8061304c816136cf565b915050612fe4565b508061305f816136cf565b915050612fbf565b50600092915050565b600061307a612358565b6001600160a01b03851660009081526003602052604090206001810154600282015492935090918311156130d55760405180604001604052806130bc88611185565b8152602090810185905281516001850155015160028301555b6001600160a01b0380871660009081526002602090815260408083209389168352929052908120906131078888611115565b9050600061311789898885611f9c565b83549091508114613157578083556040518181526001600160a01b0389811691908b169060008051602061395c8339815191529060200160405180910390a35b6131648584888a86612f17565b84546001808501919091556003840187905585015484146131cb57886001600160a01b0316867f81faf50e2aaf52eaba2ab841071efb9f6f0850a3e7d008b1336e6001d3d4963c87600101600001546040516131c291815260200190565b60405180910390a35b505050505050505050565b60008083601f8401126131e857600080fd5b5081356001600160401b038111156131ff57600080fd5b6020830191508360208260051b850101111561321a57600080fd5b9250929050565b6000806000806040858703121561323757600080fd5b84356001600160401b038082111561324e57600080fd5b61325a888389016131d6565b9096509450602087013591508082111561327357600080fd5b50613280878288016131d6565b95989497509550505050565b600081518084526020808501945080840160005b838110156132bc578151875295820195908201906001016132a0565b509495945050505050565b602081526000611001602083018461328c565b6001600160a01b0381168114610fe557600080fd5b60008060006040848603121561330457600080fd5b83356001600160401b0381111561331a57600080fd5b613326868287016131d6565b909450925050602084013561333a816132da565b809150509250925092565b60006020828403121561335757600080fd5b8135613362816132da565b9392505050565b6000806040838503121561337c57600080fd5b8235613387816132da565b946020939093013593505050565b6000806000604084860312156133aa57600080fd5b83356133b5816132da565b925060208401356001600160401b038111156133d057600080fd5b6133dc868287016131d6565b9497909650939450505050565b600080602083850312156133fc57600080fd5b82356001600160401b0381111561341257600080fd5b61341e858286016131d6565b90969095509350505050565b60006020828403121561343c57600080fd5b5035919050565b6000806040838503121561345657600080fd5b8235613461816132da565b91506020830135613471816132da565b809150509250929050565b60008060006060848603121561349157600080fd5b833561349c816132da565b925060208401356134ac816132da565b929592945050506040919091013590565b6000806000606084860312156134d257600080fd5b83356134dd816132da565b95602085013595506040909401359392505050565b6001600160a01b0391909116815260200190565b60008060008060006060868803121561351e57600080fd5b85356001600160401b038082111561353557600080fd5b61354189838a016131d6565b9097509550602088013591508082111561355a57600080fd5b50613567888289016131d6565b96999598509660400135949350505050565b6001600160a01b039390931683526020830191909152604082015260600190565b6000806000604084860312156135af57600080fd5b83356001600160401b038111156135c557600080fd5b6135d1868287016131d6565b909790965060209590950135949350505050565b600080600080600060a086880312156135fd57600080fd5b8535613608816132da565b94506020860135613618816132da565b93506040860135613628816132da565b92506060860135613638816132da565b949793965091946080013592915050565b600080600080600060a0868803121561366157600080fd5b853561366c816132da565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600182016136e1576136e16136b9565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561373157600080fd5b8151801515811461336257600080fd5b6001600160a01b03929092168252602082015260400190565b60006020828403121561376c57600080fd5b5051919050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b80820180821115611004576110046136b9565b81810381811115611004576110046136b9565b60208082528181018390526000908460408401835b8681101561381e578235613803816132da565b6001600160a01b0316825291830191908301906001016137f0565b509695505050505050565b8082028115828204841417611004576110046136b9565b60008261385d57634e487b7160e01b600052601260045260246000fd5b500490565b600081518084526020808501945080840160005b838110156132bc5781516001600160a01b031687529582019590820190600101613876565b6040815260006138ae6040830186613862565b82810360208401528381526001600160fb1b038411156138cd57600080fd5b8360051b808660208401370160200195945050505050565b6020815260006110016020830184613862565b60608152600061390b6060830186613862565b828103602084015261391d818661328c565b90508281036040840152613931818561328c565b969550505050505056fe0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75aa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ada2646970667358221220bc6c01b7b360a07ad68428236e0f2ad27b2e686168d0907c1141a3336c536d1c64736f6c63430008110033", + "numDeployments": 2, + "solcInputHash": "85b953b22882c536a643bf4b61b3153b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"ErrAdminOfAnyActivePoolForbidden\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCallerMustBeValidatorContract\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"addr\",\"type\":\"address\"},{\"internalType\":\"string\",\"name\":\"extraInfo\",\"type\":\"string\"}],\"name\":\"ErrCannotInitTransferRON\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrCannotTransferRON\",\"type\":\"error\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"}],\"name\":\"ErrInactivePool\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientBalance\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientDelegatingAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInsufficientStakingAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidArrays\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidCommissionRate\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrInvalidPoolShare\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrOnlyPoolAdminAllowed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrPoolAdminForbidden\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrRecipientRevert\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrStakingAmountLeft\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrThreeInteractionAddrsNotEqual\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrThreeOperationAddrsNotDistinct\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUndelegateTooEarly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUndelegateZeroAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnstakeTooEarly\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrUnstakeZeroAmount\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroCodeContract\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ErrZeroValue\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minRate\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"maxRate\",\"type\":\"uint256\"}],\"name\":\"CommissionRateRangeUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"minSecs\",\"type\":\"uint256\"}],\"name\":\"CooldownSecsToUndelegateUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Delegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"threshold\",\"type\":\"uint256\"}],\"name\":\"MinValidatorStakingAmountUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"}],\"name\":\"PoolApproved\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"}],\"name\":\"PoolSharesUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"validator\",\"type\":\"address[]\"}],\"name\":\"PoolsDeprecated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"}],\"name\":\"PoolsUpdateConflicted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"rewards\",\"type\":\"uint256[]\"}],\"name\":\"PoolsUpdateFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"address[]\",\"name\":\"poolAddrs\",\"type\":\"address[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"aRps\",\"type\":\"uint256[]\"},{\"indexed\":false,\"internalType\":\"uint256[]\",\"name\":\"shares\",\"type\":\"uint256[]\"}],\"name\":\"PoolsUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"RewardClaimed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Staked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"recipient\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingAmountDeductFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"validator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"admin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"contractBalance\",\"type\":\"uint256\"}],\"name\":\"StakingAmountTransferFailed\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"delegator\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Undelegated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"consensuAddr\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"Unstaked\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"poolAddr\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"user\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"debited\",\"type\":\"uint256\"}],\"name\":\"UserRewardUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"ValidatorContractUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"secs\",\"type\":\"uint256\"}],\"name\":\"WaitingSecsToRevokeUpdated\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"DEFAULT_ADDITION_GAS\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"PERIOD_DURATION\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_candidateAdmin\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"address payable\",\"name\":\"_treasuryAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_bridgeOperatorAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"applyValidatorCandidate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_amounts\",\"type\":\"uint256[]\"}],\"name\":\"bulkUndelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrList\",\"type\":\"address[]\"}],\"name\":\"claimRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"cooldownSecsToUndelegate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"delegate\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrList\",\"type\":\"address[]\"},{\"internalType\":\"address\",\"name\":\"_consensusAddrDst\",\"type\":\"address\"}],\"name\":\"delegateRewards\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"execDeductStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"_actualDeductingAmount\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_pools\",\"type\":\"address[]\"},{\"internalType\":\"uint256\",\"name\":\"_newPeriod\",\"type\":\"uint256\"}],\"name\":\"execDeprecatePools\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_consensusAddrs\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"_rewards\",\"type\":\"uint256[]\"},{\"internalType\":\"uint256\",\"name\":\"_period\",\"type\":\"uint256\"}],\"name\":\"execRecordRewards\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"getCommissionRateRange\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_pools\",\"type\":\"address[]\"}],\"name\":\"getManySelfStakings\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_selfStakings\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolAddrs\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"_userList\",\"type\":\"address[]\"}],\"name\":\"getManyStakingAmounts\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_stakingAmounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"_poolList\",\"type\":\"address[]\"}],\"name\":\"getManyStakingTotals\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_stakingAmounts\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAdminAddr\",\"type\":\"address\"}],\"name\":\"getPoolAddressOf\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"}],\"name\":\"getPoolDetail\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_admin\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_stakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_stakingTotal\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getReward\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"},{\"internalType\":\"address[]\",\"name\":\"_poolAddrList\",\"type\":\"address[]\"}],\"name\":\"getRewards\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"_rewards\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"getStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAddr\",\"type\":\"address\"}],\"name\":\"getStakingTotal\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"__validatorContract\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"__minValidatorStakingAmount\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__maxCommissionRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__cooldownSecsToUndelegate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"__waitingSecsToRevoke\",\"type\":\"uint256\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_poolAdminAddr\",\"type\":\"address\"}],\"name\":\"isAdminOfActivePool\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"minValidatorStakingAmount\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddrSrc\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_consensusAddrDst\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"redelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"requestEmergencyExit\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"requestRenounce\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_effectiveDaysOnwards\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_commissionRate\",\"type\":\"uint256\"}],\"name\":\"requestUpdateCommissionRate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_minRate\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxRate\",\"type\":\"uint256\"}],\"name\":\"setCommissionRateRange\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_cooldownSecs\",\"type\":\"uint256\"}],\"name\":\"setCooldownSecsToUndelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_threshold\",\"type\":\"uint256\"}],\"name\":\"setMinValidatorStakingAmount\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_addr\",\"type\":\"address\"}],\"name\":\"setValidatorContract\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_secs\",\"type\":\"uint256\"}],\"name\":\"setWaitingSecsToRevoke\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"}],\"name\":\"stake\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"undelegate\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_consensusAddr\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"_amount\",\"type\":\"uint256\"}],\"name\":\"unstake\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"validatorContract\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"waitingSecsToRevoke\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"errors\":{\"ErrAdminOfAnyActivePoolForbidden(address)\":[{\"details\":\"Error of admin of any active pool cannot delegate.\"}],\"ErrCallerMustBeValidatorContract()\":[{\"details\":\"Error of method caller must be validator contract.\"}],\"ErrCannotInitTransferRON(address,string)\":[{\"details\":\"Error of cannot transfer RON to specified target.\"}],\"ErrCannotTransferRON()\":[{\"details\":\"Error of cannot transfer RON.\"}],\"ErrInactivePool(address)\":[{\"details\":\"Error of querying inactive pool.\"}],\"ErrInsufficientBalance()\":[{\"details\":\"Error of sender has insufficient balance.\"}],\"ErrInsufficientDelegatingAmount()\":[{\"details\":\"Error of undelegating insufficient amount.\"}],\"ErrInsufficientStakingAmount()\":[{\"details\":\"Error of insufficient staking amount for unstaking.\"}],\"ErrInvalidArrays()\":[{\"details\":\"Error of length of input arrays are not of the same.\"}],\"ErrInvalidCommissionRate()\":[{\"details\":\"Error of setting commission rate exceeds max allowed.\"}],\"ErrInvalidPoolShare()\":[{\"details\":\"Error of invalid pool share.\"}],\"ErrOnlyPoolAdminAllowed()\":[{\"details\":\"Error of no one is allowed to call but the pool's admin.\"}],\"ErrPoolAdminForbidden()\":[{\"details\":\"Error of pool admin is not allowed to call.\"}],\"ErrRecipientRevert()\":[{\"details\":\"Error of recipient not accepting RON when transfer RON.\"}],\"ErrStakingAmountLeft()\":[{\"details\":\"Error of invalid staking amount left after deducted.\"}],\"ErrThreeInteractionAddrsNotEqual()\":[{\"details\":\"Error of three interaction addresses must be of the same in applying for validator candidate.\"}],\"ErrThreeOperationAddrsNotDistinct()\":[{\"details\":\"Error of three operation addresses must be distinct in applying for validator candidate.\"}],\"ErrUndelegateTooEarly()\":[{\"details\":\"Error of undelegating too early.\"}],\"ErrUndelegateZeroAmount()\":[{\"details\":\"Error of undelegating zero amount.\"}],\"ErrUnstakeTooEarly()\":[{\"details\":\"Error of unstaking too early.\"}],\"ErrUnstakeZeroAmount()\":[{\"details\":\"Error of unstaking zero amount.\"}],\"ErrZeroCodeContract()\":[{\"details\":\"Error of set to non-contract.\"}],\"ErrZeroValue()\":[{\"details\":\"Error of receiving zero message value.\"}]},\"kind\":\"dev\",\"methods\":{\"applyValidatorCandidate(address,address,address,address,uint256)\":{\"details\":\"Proposes a candidate to become a validator. Requirements: - The method caller is able to receive RON. - The treasury is able to receive RON. - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`. Emits the event `PoolApproved`.\",\"params\":{\"_candidateAdmin\":\"the candidate admin will be stored in the validator contract, used for calling function that affects to its candidate, e.g. scheduling maintenance.\"}},\"bulkUndelegate(address[],uint256[])\":{\"details\":\"Bulk unstakes from a list of candidates. Requirements: - The method caller is not the pool admin. Emits the events `Undelegated`.\"},\"claimRewards(address[])\":{\"details\":\"Claims the reward of method caller. Emits the `RewardClaimed` event.\"},\"cooldownSecsToUndelegate()\":{\"details\":\"Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\"},\"delegate(address)\":{\"details\":\"Stakes for a validator candidate `_consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is not the pool admin. Emits the `Delegated` event.\"},\"delegateRewards(address[],address)\":{\"details\":\"Claims the rewards and delegates them to the consensus address. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `RewardClaimed` event and the `Delegated` event.\"},\"execDeductStakingAmount(address,uint256)\":{\"details\":\"Deducts from staking amount of the validator `_consensusAddr` for `_amount`. Requirements: - The method caller must be validator contract. Emits the event `Unstaked`.\"},\"execDeprecatePools(address[],uint256)\":{\"details\":\"Deprecates the pool. - Deduct self-staking amount of the pool admin to zero. - Transfer the deducted amount to the pool admin. - Deactivate the pool admin address in the mapping of active pool admins Requirements: - The method caller is validator contract. Emits the event `PoolsDeprecated` and `Unstaked` events. Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\"},\"execRecordRewards(address[],uint256[],uint256)\":{\"details\":\"Records the amount of rewards `_rewards` for the pools `_consensusAddrs`. Requirements: - The method caller must be validator contract. Emits the event `PoolsUpdated` once the contract recorded the rewards successfully. Emits the event `PoolsUpdateFailed` once the input array lengths are not equal. Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period. Note: This method should be called once at the period ending.\"},\"getCommissionRateRange()\":{\"details\":\"Returns the commission rate range that the candidate can set.\"},\"getManySelfStakings(address[])\":{\"details\":\"Returns the self-staking amounts of the pools.\"},\"getManyStakingAmounts(address[],address[])\":{\"details\":\"Returns the staking amounts of the users.\"},\"getManyStakingTotals(address[])\":{\"details\":\"Returns the total staking amounts of all users for the pools `_poolAddrs`.\"},\"getPoolAddressOf(address)\":{\"details\":\"Returns the consensus address corresponding to the pool admin.\"},\"getPoolDetail(address)\":{\"details\":\"Returns the staking pool detail.\"},\"getReward(address,address)\":{\"details\":\"Returns the reward amount that user claimable.\"},\"getRewards(address,address[])\":{\"details\":\"Returns the claimable reward of the user `_user`.\"},\"getStakingAmount(address,address)\":{\"details\":\"Returns the staking amount of an user.\"},\"getStakingTotal(address)\":{\"details\":\"Returns the total staking amount of all users for a pool.\"},\"initialize(address,uint256,uint256,uint256,uint256)\":{\"details\":\"Initializes the contract storage.\"},\"isAdminOfActivePool(address)\":{\"details\":\"Returns whether the `_poolAdminAddr` is currently active.\"},\"minValidatorStakingAmount()\":{\"details\":\"Returns the minimum threshold for being a validator candidate.\"},\"redelegate(address,address,uint256)\":{\"details\":\"Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`. Requirements: - The method caller is not the pool admin. - The consensus address `_consensusAddrDst` is a validator candidate. Emits the `Undelegated` event and the `Delegated` event.\"},\"requestEmergencyExit(address)\":{\"details\":\"Renounces being a validator candidate and takes back the delegating/staking amount. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin.\"},\"requestRenounce(address)\":{\"details\":\"Renounces being a validator candidate and takes back the delegating/staking amount. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin.\"},\"requestUpdateCommissionRate(address,uint256,uint256)\":{\"details\":\"Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}. - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdated`.\"},\"setCommissionRateRange(uint256,uint256)\":{\"details\":\"Sets the commission rate range that a candidate can set. Requirements: - The method caller is admin. Emits the `CommissionRateRangeUpdated` event.\"},\"setCooldownSecsToUndelegate(uint256)\":{\"details\":\"Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated. Requirements: - The method caller is admin. Emits the event `CooldownSecsToUndelegateUpdated`.\"},\"setMinValidatorStakingAmount(uint256)\":{\"details\":\"Sets the minimum threshold for being a validator candidate. Requirements: - The method caller is admin. Emits the `MinValidatorStakingAmountUpdated` event.\"},\"setValidatorContract(address)\":{\"details\":\"Sets the validator contract. Requirements: - The method caller is admin. - The new address is a contract. Emits the event `ValidatorContractUpdated`.\"},\"setWaitingSecsToRevoke(uint256)\":{\"details\":\"Sets the number of seconds that a candidate must wait to be revoked. Requirements: - The method caller is admin. Emits the event `WaitingSecsToRevokeUpdated`.\"},\"stake(address)\":{\"details\":\"Self-delegates to the validator candidate `_consensusAddr`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `msg.value` is larger than 0. Emits the event `Staked`.\"},\"undelegate(address,uint256)\":{\"details\":\"Unstakes from a validator candidate `_consensusAddr` for `_amount`. Requirements: - The method caller is not the pool admin. Emits the `Undelegated` event.\"},\"unstake(address,uint256)\":{\"details\":\"Unstakes from the validator candidate `_consensusAddr` for `_amount`. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. Emits the event `Unstaked`.\"},\"validatorContract()\":{\"details\":\"Returns the validator contract.\"},\"waitingSecsToRevoke()\":{\"details\":\"Returns the number of seconds that a candidate must wait for the renounce request gets affected.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/ronin/staking/Staking.sol\":\"Staking\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":10},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/Address.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x2a21b14ff90012878752f230d3ffd5c3405e5938d06c97a7d89c0a64561d0d66\",\"license\":\"MIT\"},\"@openzeppelin/contracts/security/ReentrancyGuard.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Contract module that helps prevent reentrant calls to a function.\\n *\\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\\n * available, which can be applied to functions to make sure there are no nested\\n * (reentrant) calls to them.\\n *\\n * Note that because there is a single `nonReentrant` guard, functions marked as\\n * `nonReentrant` may not call one another. This can be worked around by making\\n * those functions `private`, and then adding `external` `nonReentrant` entry\\n * points to them.\\n *\\n * TIP: If you would like to learn more about reentrancy and alternative ways\\n * to protect against it, check out our blog post\\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\\n */\\nabstract contract ReentrancyGuard {\\n // Booleans are more expensive than uint256 or any type that takes up a full\\n // word because each write operation emits an extra SLOAD to first read the\\n // slot's contents, replace the bits taken up by the boolean, and then write\\n // back. This is the compiler's defense against contract upgrades and\\n // pointer aliasing, and it cannot be disabled.\\n\\n // The values being non-zero value makes deployment a bit more expensive,\\n // but in exchange the refund on every call to nonReentrant will be lower in\\n // amount. Since refunds are capped to a percentage of the total\\n // transaction's gas, it is best to keep them low in cases like this one, to\\n // increase the likelihood of the full refund coming into effect.\\n uint256 private constant _NOT_ENTERED = 1;\\n uint256 private constant _ENTERED = 2;\\n\\n uint256 private _status;\\n\\n constructor() {\\n _status = _NOT_ENTERED;\\n }\\n\\n /**\\n * @dev Prevents a contract from calling itself, directly or indirectly.\\n * Calling a `nonReentrant` function from another `nonReentrant`\\n * function is not supported. It is possible to prevent this from happening\\n * by making the `nonReentrant` function external, and making it call a\\n * `private` function that does the actual work.\\n */\\n modifier nonReentrant() {\\n // On the first call to nonReentrant, _notEntered will be true\\n require(_status != _ENTERED, \\\"ReentrancyGuard: reentrant call\\\");\\n\\n // Any calls to nonReentrant after this point will fail\\n _status = _ENTERED;\\n\\n _;\\n\\n // By storing the original value once again, a refund is triggered (see\\n // https://eips.ethereum.org/EIPS/eip-2200)\\n _status = _NOT_ENTERED;\\n }\\n}\\n\",\"keccak256\":\"0x0e9621f60b2faabe65549f7ed0f24e8853a45c1b7990d47e8160e523683f3935\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary Address {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/extensions/RONTransferHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract RONTransferHelper {\\n /// @dev Error of recipient not accepting RON when transfer RON.\\n error ErrRecipientRevert();\\n /// @dev Error of sender has insufficient balance.\\n error ErrInsufficientBalance();\\n\\n /**\\n * @dev See `_sendRON`.\\n * Reverts if the recipient does not receive RON.\\n */\\n function _transferRON(address payable _recipient, uint256 _amount) internal {\\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\\n }\\n\\n /**\\n * @dev Send `_amount` RON to the address `_recipient`.\\n * Returns whether the recipient receives RON or not.\\n * Reverts once the contract balance is insufficient.\\n *\\n * Note: consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\\n return _unsafeSendRON(_recipient, _amount);\\n }\\n\\n /**\\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\\n * the call does not revert.\\n *\\n * Note:\\n * - Does not assert whether the balance of sender is sufficient.\\n * - Does not assert whether the recipient accepts RON.\\n * - Consider using `ReentrancyGuard` before calling this function.\\n *\\n */\\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount }(\\\"\\\");\\n }\\n\\n /**\\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\\n */\\n function _unsafeSendRON(\\n address payable _recipient,\\n uint256 _amount,\\n uint256 _gas\\n ) internal returns (bool _success) {\\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\\\"\\\");\\n }\\n}\\n\",\"keccak256\":\"0xbf47d40b2431cf190fa737b803e4cb6fb55aee3f8804470da57a9e340f7914f8\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasProxyAdmin.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"@openzeppelin/contracts/utils/StorageSlot.sol\\\";\\n\\nabstract contract HasProxyAdmin {\\n // bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n modifier onlyAdmin() {\\n require(msg.sender == _getAdmin(), \\\"HasProxyAdmin: unauthorized sender\\\");\\n _;\\n }\\n\\n /**\\n * @dev Returns proxy admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n}\\n\",\"keccak256\":\"0x0c2fcf25290180e8cd733691b113464cdde671dc019e6c343e9eb3e16c6ca24a\",\"license\":\"MIT\"},\"contracts/extensions/collections/HasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nimport \\\"./HasProxyAdmin.sol\\\";\\nimport \\\"../../interfaces/collections/IHasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\n\\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\\n IRoninValidatorSet internal _validatorContract;\\n\\n modifier onlyValidatorContract() {\\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\\n _;\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function validatorContract() public view override returns (address) {\\n return address(_validatorContract);\\n }\\n\\n /**\\n * @inheritdoc IHasValidatorContract\\n */\\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\\n _setValidatorContract(_addr);\\n }\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function _setValidatorContract(address _addr) internal {\\n _validatorContract = IRoninValidatorSet(_addr);\\n emit ValidatorContractUpdated(_addr);\\n }\\n}\\n\",\"keccak256\":\"0xf0a7c4c2165ede118c6ba219ee1a20d293d94049b18aa6fc86a2c48661eb654d\",\"license\":\"MIT\"},\"contracts/extensions/consumers/GlobalConfigConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nabstract contract GlobalConfigConsumer {\\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\\n /// @dev The length of a period in second.\\n uint256 public constant PERIOD_DURATION = 1 days;\\n}\\n\",\"keccak256\":\"0x96d6b1ea4c8e126a8c2468683e7513d195f8e05456d85dd8f259ab049347b527\",\"license\":\"MIT\"},\"contracts/extensions/consumers/PercentageConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\nabstract contract PercentageConsumer {\\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\\n}\\n\",\"keccak256\":\"0x5dc54a24348c5d614de1b4805dddeab4dda72f9f0636b27bf0ed295fee017dcf\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IHasContract {\\n /// @dev Error of set to non-contract.\\n error ErrZeroCodeContract();\\n}\\n\",\"keccak256\":\"0x8a17785d841137fcae5b5d542f1714de0492c85b54ca074f0b9c1c490ad3f342\",\"license\":\"MIT\"},\"contracts/interfaces/collections/IHasValidatorContract.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IHasContract.sol\\\";\\n\\ninterface IHasValidatorContract is IHasContract {\\n /// @dev Emitted when the validator contract is updated.\\n event ValidatorContractUpdated(address);\\n\\n /// @dev Error of method caller must be validator contract.\\n error ErrCallerMustBeValidatorContract();\\n\\n /**\\n * @dev Returns the validator contract.\\n */\\n function validatorContract() external view returns (address);\\n\\n /**\\n * @dev Sets the validator contract.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n * - The new address is a contract.\\n *\\n * Emits the event `ValidatorContractUpdated`.\\n *\\n */\\n function setValidatorContract(address) external;\\n}\\n\",\"keccak256\":\"0x35a715f123b0c5dc296d13583f946bef4e485201e122b5170988a7535f114559\",\"license\":\"MIT\"},\"contracts/interfaces/consumers/PeriodWrapperConsumer.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.8.0;\\n\\ninterface PeriodWrapperConsumer {\\n struct PeriodWrapper {\\n // Inner value.\\n uint256 inner;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n}\\n\",\"keccak256\":\"0xb6777e3c364306eb8d5355583c1aca44de9d351cb40ddf1cea832206d4aad272\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IBaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IBaseStaking {\\n struct PoolDetail {\\n // Address of the pool i.e. consensus address of the validator\\n address addr;\\n // Pool admin address\\n address admin;\\n // Self-staking amount\\n uint256 stakingAmount;\\n // Total number of RON staking for the pool\\n uint256 stakingTotal;\\n // Mapping from delegator => delegating amount\\n mapping(address => uint256) delegatingAmount;\\n // Mapping from delegator => the last timestamp that delegator staked\\n mapping(address => uint256) lastDelegatingTimestamp;\\n }\\n\\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\\n event WaitingSecsToRevokeUpdated(uint256 secs);\\n\\n /// @dev Error of cannot transfer RON.\\n error ErrCannotTransferRON();\\n /// @dev Error of receiving zero message value.\\n error ErrZeroValue();\\n /// @dev Error of pool admin is not allowed to call.\\n error ErrPoolAdminForbidden();\\n /// @dev Error of no one is allowed to call but the pool's admin.\\n error ErrOnlyPoolAdminAllowed();\\n /// @dev Error of admin of any active pool cannot delegate.\\n error ErrAdminOfAnyActivePoolForbidden(address admin);\\n /// @dev Error of querying inactive pool.\\n error ErrInactivePool(address poolAddr);\\n /// @dev Error of length of input arrays are not of the same.\\n error ErrInvalidArrays();\\n\\n /**\\n * @dev Returns whether the `_poolAdminAddr` is currently active.\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns the consensus address corresponding to the pool admin.\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\\n\\n /**\\n * @dev Returns the staking pool detail.\\n */\\n function getPoolDetail(address)\\n external\\n view\\n returns (\\n address _admin,\\n uint256 _stakingAmount,\\n uint256 _stakingTotal\\n );\\n\\n /**\\n * @dev Returns the self-staking amounts of the pools.\\n */\\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\\n\\n /**\\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\\n */\\n function waitingSecsToRevoke() external view returns (uint256);\\n\\n /**\\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external;\\n}\\n\",\"keccak256\":\"0x008b3d42a3104820de7b7edb5ea4b21c75d4417767fc0791f89f00ac9a2cce8d\",\"license\":\"MIT\"},\"contracts/interfaces/staking/ICandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface ICandidateStaking is IRewardPool {\\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\\n event MinValidatorStakingAmountUpdated(uint256 threshold);\\n /// @dev Emitted when the commission rate range is updated.\\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\\n\\n /// @dev Emitted when the pool admin staked for themself.\\n event Staked(address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\\n event Unstaked(address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Emitted when the validator pool is approved.\\n event PoolApproved(address indexed validator, address indexed admin);\\n /// @dev Emitted when the validator pool is deprecated.\\n event PoolsDeprecated(address[] validator);\\n /// @dev Emitted when the staking amount transfer failed.\\n event StakingAmountTransferFailed(\\n address indexed validator,\\n address indexed admin,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\\n event StakingAmountDeductFailed(\\n address indexed validator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Error of cannot transfer RON to specified target.\\n error ErrCannotInitTransferRON(address addr, string extraInfo);\\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\\n error ErrThreeInteractionAddrsNotEqual();\\n /// @dev Error of three operation addresses must be distinct in applying for validator candidate.\\n error ErrThreeOperationAddrsNotDistinct();\\n /// @dev Error of unstaking zero amount.\\n error ErrUnstakeZeroAmount();\\n /// @dev Error of invalid staking amount left after deducted.\\n error ErrStakingAmountLeft();\\n /// @dev Error of insufficient staking amount for unstaking.\\n error ErrInsufficientStakingAmount();\\n /// @dev Error of unstaking too early.\\n error ErrUnstakeTooEarly();\\n /// @dev Error of setting commission rate exceeds max allowed.\\n error ErrInvalidCommissionRate();\\n\\n /**\\n * @dev Returns the minimum threshold for being a validator candidate.\\n */\\n function minValidatorStakingAmount() external view returns (uint256);\\n\\n /**\\n * @dev Returns the commission rate range that the candidate can set.\\n */\\n function getCommissionRateRange() external view returns (uint256 _minRange, uint256 _maxRange);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function setMinValidatorStakingAmount(uint256) external;\\n\\n /**\\n * @dev Sets the commission rate range that a candidate can set.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `CommissionRateRangeUpdated` event.\\n *\\n */\\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external;\\n\\n /**\\n * @dev Proposes a candidate to become a validator.\\n *\\n * Requirements:\\n * - The method caller is able to receive RON.\\n * - The treasury is able to receive RON.\\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\\n *\\n * Emits the event `PoolApproved`.\\n *\\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\\n * to its candidate, e.g. scheduling maintenance.\\n *\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external payable;\\n\\n /**\\n * @dev Deprecates the pool.\\n * - Deduct self-staking amount of the pool admin to zero.\\n * - Transfer the deducted amount to the pool admin.\\n * - Deactivate the pool admin address in the mapping of active pool admins\\n *\\n * Requirements:\\n * - The method caller is validator contract.\\n *\\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\\n *\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\\n\\n /**\\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `msg.value` is larger than 0.\\n *\\n * Emits the event `Staked`.\\n *\\n */\\n function stake(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function unstake(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdated`.\\n *\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestRenounce(address _consensusAddr) external;\\n\\n /**\\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is the pool admin.\\n *\\n */\\n function requestEmergencyExit(address _consensusAddr) external;\\n}\\n\",\"keccak256\":\"0x5681cd641c0014aa2cc0ae336e110ebd9a5b28419ae387acd720683ba54ca89f\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IDelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IRewardPool.sol\\\";\\n\\ninterface IDelegatorStaking is IRewardPool {\\n /// @dev Emitted when the delegator staked for a validator candidate.\\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n /// @dev Emitted when the delegator unstaked from a validator candidate.\\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\\n\\n /// @dev Error of undelegating zero amount.\\n error ErrUndelegateZeroAmount();\\n /// @dev Error of undelegating insufficient amount.\\n error ErrInsufficientDelegatingAmount();\\n /// @dev Error of undelegating too early.\\n error ErrUndelegateTooEarly();\\n\\n /**\\n * @dev Stakes for a validator candidate `_consensusAddr`.\\n *\\n * Requirements:\\n * - The consensus address is a validator candidate.\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n */\\n function delegate(address _consensusAddr) external payable;\\n\\n /**\\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the `Undelegated` event.\\n *\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external;\\n\\n /**\\n * @dev Bulk unstakes from a list of candidates.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n *\\n * Emits the events `Undelegated`.\\n *\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\\n\\n /**\\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `Undelegated` event and the `Delegated` event.\\n *\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external;\\n\\n /**\\n * @dev Returns the claimable reward of the user `_user`.\\n */\\n function getRewards(address _user, address[] calldata _poolAddrList)\\n external\\n view\\n returns (uint256[] memory _rewards);\\n\\n /**\\n * @dev Claims the reward of method caller.\\n *\\n * Emits the `RewardClaimed` event.\\n *\\n */\\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n *\\n * Requirements:\\n * - The method caller is not the pool admin.\\n * - The consensus address `_consensusAddrDst` is a validator candidate.\\n *\\n * Emits the `RewardClaimed` event and the `Delegated` event.\\n *\\n */\\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\\n external\\n returns (uint256 _amount);\\n}\\n\",\"keccak256\":\"0x5ce840a920ed06139f9e33d306c8ee50b2a81e4bd2ac6ed24b47297c348576b8\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IRewardPool.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/consumers/PeriodWrapperConsumer.sol\\\";\\n\\ninterface IRewardPool is PeriodWrapperConsumer {\\n struct UserRewardFields {\\n // Recorded reward amount.\\n uint256 debited;\\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\\n uint256 aRps;\\n // Lowest staking amount in the period.\\n uint256 lowestAmount;\\n // Last period number that the info updated.\\n uint256 lastPeriod;\\n }\\n\\n struct PoolFields {\\n // Accumulated of the amount rewards per share (one unit staking).\\n uint256 aRps;\\n // The staking total to share reward of the current period.\\n PeriodWrapper shares;\\n }\\n\\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\\n /// @dev Emitted when the user claimed their reward\\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\\n\\n /// @dev Emitted when the pool shares are updated\\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\\n /// @dev Emitted when the pools are updated\\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\\n /// @dev Emitted when the contract fails when updating the pools\\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\\n /// @dev Emitted when the contract fails when updating the pools that already set\\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\\n\\n /// @dev Error of invalid pool share.\\n error ErrInvalidPoolShare();\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amount of an user.\\n */\\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\\n\\n /**\\n * @dev Returns the staking amounts of the users.\\n */\\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\\n external\\n view\\n returns (uint256[] memory);\\n\\n /**\\n * @dev Returns the total staking amount of all users for a pool.\\n */\\n function getStakingTotal(address _poolAddr) external view returns (uint256);\\n\\n /**\\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\\n */\\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\\n}\\n\",\"keccak256\":\"0x92315ca9d6d93f55a7752adf2567adb86745f708198bfcd74b9a626b6570208f\",\"license\":\"MIT\"},\"contracts/interfaces/staking/IStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IBaseStaking.sol\\\";\\nimport \\\"./ICandidateStaking.sol\\\";\\nimport \\\"./IDelegatorStaking.sol\\\";\\n\\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable;\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Requirements:\\n * - The method caller must be validator contract.\\n *\\n * Emits the event `Unstaked`.\\n *\\n */\\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\\n external\\n returns (uint256 _actualDeductingAmount);\\n}\\n\",\"keccak256\":\"0xb7942c5032c16ea567ac0bfc07ecacd84840d6de134735ea538aa22fc6da05a5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICandidateManager.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ICandidateManager {\\n struct ValidatorCandidate {\\n // Admin of the candidate\\n address admin;\\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\\n address consensusAddr;\\n // Address that receives mining reward of the validator\\n address payable treasuryAddr;\\n // Address of the bridge operator corresponding to the candidate\\n address bridgeOperatorAddr;\\n // The percentage of reward that validators can be received, the rest goes to the delegators.\\n // Values in range [0; 100_00] stands for 0-100%\\n uint256 commissionRate;\\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\\n uint256 revokingTimestamp;\\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\\n uint256 topupDeadline;\\n }\\n\\n struct CommissionSchedule {\\n // The timestamp that the commission schedule gets affected (no schedule=0).\\n uint256 effectiveTimestamp;\\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\\n uint256 commissionRate;\\n }\\n\\n /// @dev Emitted when the maximum number of validator candidates is updated.\\n event MaxValidatorCandidateUpdated(uint256 threshold);\\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\\n /// @dev Emitted when the validator candidate is granted.\\n event CandidateGranted(\\n address indexed consensusAddr,\\n address indexed treasuryAddr,\\n address indexed admin,\\n address bridgeOperator\\n );\\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\\n /// @dev Emitted when the topup deadline of a candidate is updated.\\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\\n /// @dev Emitted when the validator candidate is revoked.\\n event CandidatesRevoked(address[] consensusAddrs);\\n\\n /// @dev Emitted when a schedule for updating commission rate is set.\\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\\n /// @dev Emitted when the commission rate of a validator is updated.\\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\\n\\n /// @dev Error of exceeding maximum number of candidates.\\n error ErrExceedsMaxNumberOfCandidate();\\n /// @dev Error of querying for already existent candidate.\\n error ErrExistentCandidate();\\n /// @dev Error of querying for non-existent candidate.\\n error ErrNonExistentCandidate();\\n /// @dev Error of candidate admin already exists.\\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\\n /// @dev Error of treasury already exists.\\n error ErrExistentTreasury(address _treasuryAddr);\\n /// @dev Error of bridge operator already exists.\\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\\n /// @dev Error of invalid commission rate.\\n error ErrInvalidCommissionRate();\\n /// @dev Error of invalid effective days onwards.\\n error ErrInvalidEffectiveDaysOnwards();\\n /// @dev Error of invalid min effective days onwards.\\n error ErrInvalidMinEffectiveDaysOnwards();\\n /// @dev Error of already requested revoking candidate before.\\n error ErrAlreadyRequestedRevokingCandidate();\\n /// @dev Error of commission change schedule exists.\\n error ErrAlreadyRequestedUpdatingCommissionRate();\\n /// @dev Error of trusted org cannot renounce.\\n error ErrTrustedOrgCannotRenounce();\\n\\n /**\\n * @dev Returns the maximum number of validator candidate.\\n */\\n function maxValidatorCandidate() external view returns (uint256);\\n\\n /**\\n * @dev Returns the minimum number of days to the effective date of commission rate change.\\n */\\n function minEffectiveDaysOnwards() external view returns (uint256);\\n\\n /**\\n * @dev Sets the maximum number of validator candidate.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MaxValidatorCandidateUpdated` event.\\n *\\n */\\n function setMaxValidatorCandidate(uint256) external;\\n\\n /**\\n * @dev Sets the minimum number of days to the effective date of commision rate change.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\\n *\\n */\\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\\n\\n /**\\n * @dev Grants a validator candidate.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateGranted`.\\n *\\n */\\n function execApplyValidatorCandidate(\\n address _admin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external;\\n\\n /**\\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n * Emits the event `CandidateRevokingTimestampUpdated`.\\n *\\n */\\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\\n\\n /**\\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\\n *\\n * Requirements:\\n * - The method caller is the staking contract.\\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\\n * - The `_rate` must be in range of [0_00; 100_00].\\n *\\n * Emits the event `CommissionRateUpdateScheduled`.\\n *\\n */\\n function execRequestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveTimestamp,\\n uint256 _rate\\n ) external;\\n\\n /**\\n * @dev Returns whether the address is a validator (candidate).\\n */\\n function isValidatorCandidate(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the validator candidate.\\n */\\n function getValidatorCandidates() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns all candidate info.\\n */\\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\\n\\n /**\\n * @dev Returns the info of a candidate.\\n */\\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\\n\\n /**\\n * @dev Returns whether the address is the candidate admin.\\n */\\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\\n\\n /**\\n * @dev Returns the schedule of changing commission rate of a candidate address.\\n */\\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\\n}\\n\",\"keccak256\":\"0xc382bd50ca507308ec23826308bc9ff0a22cfb9b3fcd09c7ac7a63c37729d33e\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ICoinbaseExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ISlashingExecution.sol\\\";\\n\\ninterface ICoinbaseExecution is ISlashingExecution {\\n enum BlockRewardDeprecatedType {\\n UNKNOWN,\\n UNAVAILABILITY,\\n AFTER_BAILOUT\\n }\\n\\n /// @dev Emitted when the validator set is updated\\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\\n /// @dev Emitted when the bridge operator set is updated.\\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\\n\\n /// @dev Emitted when the reward of the block producer is deprecated.\\n event BlockRewardDeprecated(\\n address indexed coinbaseAddr,\\n uint256 rewardAmount,\\n BlockRewardDeprecatedType deprecatedType\\n );\\n /// @dev Emitted when the block reward is submitted.\\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\\n\\n /// @dev Emitted when the block producer reward is distributed.\\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\\n /// @dev Emitted when the contract fails when distributing the block producer reward.\\n event MiningRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the bridge operator reward is distributed.\\n event BridgeOperatorRewardDistributed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipientAddr,\\n uint256 amount\\n );\\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\\n event BridgeOperatorRewardDistributionFailed(\\n address indexed consensusAddr,\\n address indexed bridgeOperator,\\n address indexed recipient,\\n uint256 amount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\\n event StakingRewardDistributionFailed(\\n uint256 totalAmount,\\n address[] consensusAddrs,\\n uint256[] amounts,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the epoch is wrapped up.\\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\\n /// @dev Emitted when the bridge tracking contract's response is incorrect\\n event BridgeTrackingIncorrectlyResponded();\\n\\n /// @dev Error of method caller must be coinbase\\n error ErrCallerMustBeCoinbase();\\n /// @dev Error of only allowed at the end of epoch\\n error ErrAtEndOfEpochOnly();\\n /// @dev Error of query for already wrapped up epoch\\n error ErrAlreadyWrappedEpoch();\\n\\n /**\\n * @dev Submits reward of the current block.\\n *\\n * Requirements:\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\\n * Emits the event `BlockRewardSubmitted` for the valid call.\\n *\\n */\\n function submitBlockReward() external payable;\\n\\n /**\\n * @dev Wraps up the current epoch.\\n *\\n * Requirements:\\n * - The method must be called when the current epoch is ending.\\n * - The epoch is not wrapped yet.\\n * - The method caller is coinbase.\\n *\\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\\n * Emits the event `WrappedUpEpoch`.\\n *\\n */\\n function wrapUpEpoch() external payable;\\n}\\n\",\"keccak256\":\"0x42ed0bff5f8233dc6de28bd3283f98a0c16df6abc26655fc777bdc07a83ff3f5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IEmergencyExit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IEmergencyExit {\\n /// @dev Emitted when the fund is locked from an emergency exit request\\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\\n event EmergencyExitLockedFundReleased(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount\\n );\\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\\n event EmergencyExitLockedFundReleasingFailed(\\n address indexed consensusAddr,\\n address indexed recipient,\\n uint256 unlockedAmount,\\n uint256 contractBalance\\n );\\n\\n /// @dev Emitted when the emergency exit locked amount is updated.\\n event EmergencyExitLockedAmountUpdated(uint256 amount);\\n /// @dev Emitted when the emergency expiry duration is updated.\\n event EmergencyExpiryDurationUpdated(uint256 amount);\\n\\n /// @dev Error of already requested emergency exit before.\\n error ErrAlreadyRequestedEmergencyExit();\\n\\n /**\\n * @dev Returns the amount of RON to lock from a consensus address.\\n */\\n function emergencyExitLockedAmount() external returns (uint256);\\n\\n /**\\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\\n */\\n function emergencyExpiryDuration() external returns (uint256);\\n\\n /**\\n * @dev Sets the amount of RON to lock from a consensus address.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedAmountUpdated`.\\n *\\n */\\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\\n\\n /**\\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExpiryDurationUpdated`.\\n *\\n */\\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\\n\\n /**\\n * @dev Unlocks fund for emergency exit request.\\n *\\n * Requirements:\\n * - The method caller is admin.\\n *\\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\\n *\\n */\\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\\n\\n /**\\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\\n *\\n * Requirements:\\n * - The method caller is staking contract.\\n *\\n */\\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\\n}\\n\",\"keccak256\":\"0x45161abd1e3db83052a06889a0e3a7a5e7ee3306478601d58ac4ed32ccaa75ad\",\"license\":\"MIT\"},\"contracts/interfaces/validator/IRoninValidatorSet.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./ICandidateManager.sol\\\";\\nimport \\\"./info-fragments/ICommonInfo.sol\\\";\\nimport \\\"./ICoinbaseExecution.sol\\\";\\nimport \\\"./ISlashingExecution.sol\\\";\\nimport \\\"./IEmergencyExit.sol\\\";\\n\\ninterface IRoninValidatorSet is\\n ICandidateManager,\\n ICommonInfo,\\n ISlashingExecution,\\n ICoinbaseExecution,\\n IEmergencyExit\\n{}\\n\",\"keccak256\":\"0x813f34747aea4dfb53bbc147abf8dbe5999ce73111c2db99bcb3efb4cf75bb3d\",\"license\":\"MIT\"},\"contracts/interfaces/validator/ISlashingExecution.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ISlashingExecution {\\n /// @dev Emitted when the validator is punished.\\n event ValidatorPunished(\\n address indexed consensusAddr,\\n uint256 indexed period,\\n uint256 jailedUntil,\\n uint256 deductedStakingAmount,\\n bool blockProducerRewardDeprecated,\\n bool bridgeOperatorRewardDeprecated\\n );\\n /// @dev Emitted when the validator get out of jail by bailout.\\n event ValidatorUnjailed(address indexed validator, uint256 period);\\n\\n /// @dev Error of cannot bailout due to high tier slash.\\n error ErrCannotBailout(address validator);\\n\\n /**\\n * @dev Finalize the slash request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorPunished`.\\n *\\n */\\n function execSlash(\\n address _validatorAddr,\\n uint256 _newJailedUntil,\\n uint256 _slashAmount,\\n bool _cannotBailout\\n ) external;\\n\\n /**\\n * @dev Finalize the bailout request from slash indicator contract.\\n *\\n * Requirements:\\n * - The method caller is slash indicator contract.\\n *\\n * Emits the event `ValidatorUnjailed`.\\n *\\n */\\n function execBailOut(address _validatorAddr, uint256 _period) external;\\n}\\n\",\"keccak256\":\"0x80362c42fdc0ee06543a2abbffee961fe51c15a7c5e18933a9c34897e50d07fe\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ICommonInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"./IJailingInfo.sol\\\";\\nimport \\\"./ITimingInfo.sol\\\";\\nimport \\\"./IValidatorInfo.sol\\\";\\n\\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\\n struct EmergencyExitInfo {\\n uint256 lockedAmount;\\n // The timestamp that this locked amount will be recycled to staking vesting contract\\n uint256 recyclingAt;\\n }\\n\\n /// @dev Emitted when the deprecated reward is withdrawn.\\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\\n /// @dev Emitted when the deprecated reward withdrawal is failed\\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\\n\\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\\n error ErrUnauthorizedReceiveRON();\\n /// @dev Error thrown when queries for a non existent info.\\n error NonExistentRecyclingInfo();\\n\\n /**\\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\\n */\\n function totalDeprecatedReward() external view returns (uint256);\\n\\n /**\\n * @dev Returns the emergency exit request.\\n */\\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\\n}\\n\",\"keccak256\":\"0xc00b1bda0c6076c9aa0631dc0c01e849d8f42cc616fe4c036f73cda0a9afe9ef\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IJailingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface IJailingInfo {\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkJailed(address) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeft(address _addr)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\\n */\\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\\n */\\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\\n external\\n view\\n returns (\\n bool isJailed_,\\n uint256 blockLeft_,\\n uint256 epochLeft_\\n );\\n\\n /**\\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\\n */\\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\\n */\\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\\n */\\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\\n */\\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\\n\\n /**\\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\\n */\\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\\n external\\n view\\n returns (bool _result);\\n}\\n\",\"keccak256\":\"0x19b85ce95caf9deb4aff9614d1ca2d89712b89e8609dc6ab772e989164a51139\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/ITimingInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\ninterface ITimingInfo {\\n /**\\n * @dev Returns the block that validator set was updated.\\n */\\n function getLastUpdatedBlock() external view returns (uint256);\\n\\n /**\\n * @dev Returns the number of blocks in a epoch.\\n */\\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\\n\\n /**\\n * @dev Returns the epoch index from the block number.\\n */\\n function epochOf(uint256 _block) external view returns (uint256);\\n\\n /**\\n * @dev Returns whether the epoch ending is at the block number `_block`.\\n */\\n function epochEndingAt(uint256 _block) external view returns (bool);\\n\\n /**\\n * @dev Tries to get the period index from the epoch number.\\n */\\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\\n\\n /**\\n * @dev Returns whether the period ending at the current block number.\\n */\\n function isPeriodEnding() external view returns (bool);\\n\\n /**\\n * @dev Returns the period index from the current block.\\n */\\n function currentPeriod() external view returns (uint256);\\n\\n /**\\n * @dev Returns the block number that the current period starts at.\\n */\\n function currentPeriodStartAtBlock() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x77b86a68149389fed0eb0c5b8d56f278d3bd103ba64f504697d709b24c3212d5\",\"license\":\"MIT\"},\"contracts/interfaces/validator/info-fragments/IValidatorInfo.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../../libraries/EnumFlags.sol\\\";\\n\\ninterface IValidatorInfo {\\n /// @dev Emitted when the number of max validator is updated.\\n event MaxValidatorNumberUpdated(uint256);\\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\\n event MaxPrioritizedValidatorNumberUpdated(uint256);\\n\\n /// @dev Error of number of prioritized greater than number of max validators.\\n error ErrInvalidMaxPrioritizedValidatorNumber();\\n\\n /**\\n * @dev Returns the maximum number of validators in the epoch.\\n */\\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\\n\\n /**\\n * @dev Returns the number of reserved slots for prioritized validators.\\n */\\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\\n\\n /**\\n * @dev Returns the current validator list.\\n */\\n function getValidators()\\n external\\n view\\n returns (\\n address[] memory _validatorList,\\n address[] memory _bridgeOperators,\\n EnumFlags.ValidatorFlag[] memory _flags\\n );\\n\\n /**\\n * @dev Returns whether the address is either a bridge operator or a block producer.\\n */\\n function isValidator(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns the current block producer list.\\n */\\n function getBlockProducers() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is block producer or not.\\n */\\n function isBlockProducer(address _addr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the block producers.\\n */\\n function totalBlockProducers() external view returns (uint256);\\n\\n /**\\n * @dev Returns the current bridge operator list.\\n */\\n function getBridgeOperators() external view returns (address[] memory);\\n\\n /**\\n * @dev Returns the bridge operator list corresponding to validator address list.\\n */\\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\\n\\n /**\\n * @dev Returns whether the address is bridge operator.\\n */\\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\\n\\n /**\\n * @dev Returns whether the consensus address is operating the bridge or not.\\n */\\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\\n\\n /**\\n * @dev Returns total numbers of the bridge operators.\\n */\\n function totalBridgeOperators() external view returns (uint256);\\n\\n /**\\n * @dev Updates the max validator number\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxValidatorNumberUpdated`\\n *\\n */\\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\\n\\n /**\\n * @dev Updates the number of reserved slots for prioritized validators\\n *\\n * Requirements:\\n * - The method caller is admin\\n *\\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\\n *\\n */\\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\\n}\\n\",\"keccak256\":\"0x86189a2fee2e5dccba27728db15e1bd19f647cdb97c02b52d9ab07c5d98a2a75\",\"license\":\"MIT\"},\"contracts/libraries/AddressArrayUtils.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary AddressArrayUtils {\\n /**\\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\\n * @param A Array to search\\n * @return Returns true if duplicate, false otherwise\\n */\\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\\n if (A.length == 0) {\\n return false;\\n }\\n for (uint256 i = 0; i < A.length - 1; i++) {\\n for (uint256 j = i + 1; j < A.length; j++) {\\n if (A[i] == A[j]) {\\n return true;\\n }\\n }\\n }\\n return false;\\n }\\n\\n /**\\n * @dev Returns whether two arrays of addresses are equal or not.\\n */\\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool) {\\n bytes32 _thisHash;\\n bytes32 _otherHash;\\n\\n assembly {\\n _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\\n _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\\n }\\n\\n return _thisHash == _otherHash;\\n }\\n}\\n\",\"keccak256\":\"0xea4ac2b0783926a0e6ae257bc069fa37ea864ce77bfb25dd327d4727a38ad0ea\",\"license\":\"UNLICENSED\"},\"contracts/libraries/EnumFlags.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This library implements checking flag of an enumerated value.\\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\\n */\\nlibrary EnumFlags {\\n enum ValidatorFlag {\\n None, // bit(00)\\n BlockProducer, // bit(01)\\n BridgeOperator, // bit(10)\\n Both // bit(11)\\n }\\n\\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\\n return uint8(_value) == 0;\\n }\\n\\n /**\\n * @dev Checks if `_value` has `_flag`.\\n */\\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\\n return (uint8(_value) & uint8(_flag)) != 0;\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after adding `_flag`.\\n */\\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) | uint8(_flag));\\n }\\n\\n /**\\n * @dev Calculate new value of `_value` after remove `_flag`.\\n */\\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\\n }\\n}\\n\",\"keccak256\":\"0xa6c77f9d704c57854a30e57e16467a1b70b76be5331d9e53a3f9ec5e57542533\",\"license\":\"UNLICENSED\"},\"contracts/libraries/Math.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\n\\npragma solidity ^0.8.0;\\n\\nlibrary Math {\\n /**\\n * @dev Returns the largest of two numbers.\\n */\\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a >= b ? a : b;\\n }\\n\\n /**\\n * @dev Returns the smallest of two numbers.\\n */\\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a < b ? a : b;\\n }\\n\\n /**\\n * @dev Returns whether the number `c` is in range of [a; b].\\n */\\n function inRange(\\n uint256 c,\\n uint256 a,\\n uint256 b\\n ) internal pure returns (bool) {\\n return a <= c && c <= b;\\n }\\n\\n /**\\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\\n */\\n function twoRangeOverlap(\\n uint256 x1,\\n uint256 x2,\\n uint256 y1,\\n uint256 y2\\n ) internal pure returns (bool) {\\n return x1 <= y2 && y1 <= x2;\\n }\\n\\n /**\\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\\n */\\n function addWithUpperbound(\\n uint256 a,\\n uint256 b,\\n uint256 upperbound\\n ) internal pure returns (uint256) {\\n return min(a + b, upperbound);\\n }\\n\\n /**\\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\\n */\\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\\n return a > b ? a - b : 0;\\n }\\n\\n /**\\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\\n */\\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\\n return zeroable != 0 ? a + zeroable : 0;\\n }\\n}\\n\",\"keccak256\":\"0xf719e74bc39be7aceb4e5cc455260f81b2b21e83aa693e0b50c390c9909e08c4\",\"license\":\"UNLICENSED\"},\"contracts/ronin/staking/BaseStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/security/ReentrancyGuard.sol\\\";\\nimport \\\"../../extensions/RONTransferHelper.sol\\\";\\nimport \\\"../../extensions/collections/HasValidatorContract.sol\\\";\\nimport \\\"../../interfaces/staking/IBaseStaking.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"./RewardCalculation.sol\\\";\\n\\nabstract contract BaseStaking is\\n RONTransferHelper,\\n ReentrancyGuard,\\n RewardCalculation,\\n HasValidatorContract,\\n IBaseStaking\\n{\\n /// @dev Mapping from pool address => staking pool detail\\n mapping(address => PoolDetail) internal _stakingPool;\\n\\n /// @dev The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\\n uint256 internal _cooldownSecsToUndelegate;\\n /// @dev The number of seconds that a candidate must wait to be revoked and take the self-staking amount back.\\n uint256 internal _waitingSecsToRevoke;\\n\\n /// @dev Mapping from admin address of an active pool => consensus address.\\n mapping(address => address) internal _adminOfActivePoolMapping;\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[49] private ______gap;\\n\\n modifier noEmptyValue() {\\n if (msg.value == 0) revert ErrZeroValue();\\n _;\\n }\\n\\n modifier notPoolAdmin(PoolDetail storage _pool, address _delegator) {\\n if (_pool.admin == _delegator) revert ErrPoolAdminForbidden();\\n _;\\n }\\n\\n modifier onlyPoolAdmin(PoolDetail storage _pool, address _requester) {\\n if (_pool.admin != _requester) revert ErrOnlyPoolAdminAllowed();\\n _;\\n }\\n\\n modifier poolIsActive(address _poolAddr) {\\n if (!_validatorContract.isValidatorCandidate(_poolAddr)) revert ErrInactivePool(_poolAddr);\\n _;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function isAdminOfActivePool(address _poolAdminAddr) public view override returns (bool) {\\n return _adminOfActivePoolMapping[_poolAdminAddr] != address(0);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getPoolAddressOf(address _poolAdminAddr) external view override returns (address) {\\n return _adminOfActivePoolMapping[_poolAdminAddr];\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getPoolDetail(address _poolAddr)\\n external\\n view\\n returns (\\n address _admin,\\n uint256 _stakingAmount,\\n uint256 _stakingTotal\\n )\\n {\\n PoolDetail storage _pool = _stakingPool[_poolAddr];\\n return (_pool.admin, _pool.stakingAmount, _pool.stakingTotal);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function getManySelfStakings(address[] calldata _pools) external view returns (uint256[] memory _selfStakings) {\\n _selfStakings = new uint256[](_pools.length);\\n for (uint _i = 0; _i < _pools.length; _i++) {\\n _selfStakings[_i] = _stakingPool[_pools[_i]].stakingAmount;\\n }\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingTotal(address _poolAddr) public view override returns (uint256) {\\n return _stakingPool[_poolAddr].stakingTotal;\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingTotals(address[] calldata _poolList)\\n public\\n view\\n override\\n returns (uint256[] memory _stakingAmounts)\\n {\\n _stakingAmounts = new uint256[](_poolList.length);\\n for (uint _i = 0; _i < _poolList.length; _i++) {\\n _stakingAmounts[_i] = getStakingTotal(_poolList[_i]);\\n }\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingAmount(address _poolAddr, address _user) public view override returns (uint256) {\\n return _stakingPool[_poolAddr].delegatingAmount[_user];\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\\n external\\n view\\n override\\n returns (uint256[] memory _stakingAmounts)\\n {\\n if (_poolAddrs.length != _userList.length) revert ErrInvalidArrays();\\n _stakingAmounts = new uint256[](_poolAddrs.length);\\n for (uint _i = 0; _i < _stakingAmounts.length; _i++) {\\n _stakingAmounts[_i] = _stakingPool[_poolAddrs[_i]].delegatingAmount[_userList[_i]];\\n }\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function cooldownSecsToUndelegate() external view returns (uint256) {\\n return _cooldownSecsToUndelegate;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function waitingSecsToRevoke() external view returns (uint256) {\\n return _waitingSecsToRevoke;\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external override onlyAdmin {\\n _setCooldownSecsToUndelegate(_cooldownSecs);\\n }\\n\\n /**\\n * @inheritdoc IBaseStaking\\n */\\n function setWaitingSecsToRevoke(uint256 _secs) external override onlyAdmin {\\n _setWaitingSecsToRevoke(_secs);\\n }\\n\\n /**\\n * @dev Sets the minium number of seconds to undelegate.\\n *\\n * Emits the event `CooldownSecsToUndelegateUpdated`.\\n *\\n */\\n function _setCooldownSecsToUndelegate(uint256 _cooldownSecs) internal {\\n _cooldownSecsToUndelegate = _cooldownSecs;\\n emit CooldownSecsToUndelegateUpdated(_cooldownSecs);\\n }\\n\\n /**\\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\\n *\\n * Emits the event `WaitingSecsToRevokeUpdated`.\\n *\\n */\\n function _setWaitingSecsToRevoke(uint256 _secs) internal {\\n _waitingSecsToRevoke = _secs;\\n emit WaitingSecsToRevokeUpdated(_secs);\\n }\\n\\n /**\\n * @dev Changes the delegate amount.\\n */\\n function _changeDelegatingAmount(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _newDelegatingAmount,\\n uint256 _newStakingTotal\\n ) internal {\\n _syncUserReward(_pool.addr, _delegator, _newDelegatingAmount);\\n _pool.stakingTotal = _newStakingTotal;\\n _pool.delegatingAmount[_delegator] = _newDelegatingAmount;\\n }\\n}\\n\",\"keccak256\":\"0xdf7889af5ad6b206a2d4eceb8947fcc26f90b7c8411806ec76eb19bc3363afd0\",\"license\":\"MIT\"},\"contracts/ronin/staking/CandidateStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../extensions/consumers/GlobalConfigConsumer.sol\\\";\\nimport \\\"../../extensions/consumers/PercentageConsumer.sol\\\";\\nimport \\\"../../libraries/AddressArrayUtils.sol\\\";\\nimport \\\"../../interfaces/staking/ICandidateStaking.sol\\\";\\nimport \\\"./BaseStaking.sol\\\";\\n\\nabstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConfigConsumer, PercentageConsumer {\\n /// @dev The minimum threshold for being a validator candidate.\\n uint256 internal _minValidatorStakingAmount;\\n\\n /// @dev The max commission rate that the validator can set (in range of [0;100_00] means [0-100%])\\n uint256 internal _maxCommissionRate;\\n /// @dev The min commission rate that the validator can set (in range of [0;100_00] means [0-100%])\\n uint256 internal _minCommissionRate;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[48] ______gap;\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function minValidatorStakingAmount() public view override returns (uint256) {\\n return _minValidatorStakingAmount;\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function getCommissionRateRange() external view override returns (uint256, uint256) {\\n return (_minCommissionRate, _maxCommissionRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function setMinValidatorStakingAmount(uint256 _threshold) external override onlyAdmin {\\n _setMinValidatorStakingAmount(_threshold);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external override onlyAdmin {\\n _setCommissionRateRange(_minRate, _maxRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function applyValidatorCandidate(\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate\\n ) external payable override nonReentrant {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\\n\\n uint256 _amount = msg.value;\\n address payable _poolAdmin = payable(msg.sender);\\n _applyValidatorCandidate(\\n _poolAdmin,\\n _candidateAdmin,\\n _consensusAddr,\\n _treasuryAddr,\\n _bridgeOperatorAddr,\\n _commissionRate,\\n _amount\\n );\\n\\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\\n _pool.admin = _poolAdmin;\\n _pool.addr = _consensusAddr;\\n _adminOfActivePoolMapping[_poolAdmin] = _consensusAddr;\\n\\n _stake(_stakingPool[_consensusAddr], _poolAdmin, _amount);\\n emit PoolApproved(_consensusAddr, _poolAdmin);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestUpdateCommissionRate(\\n address _consensusAddr,\\n uint256 _effectiveDaysOnwards,\\n uint256 _commissionRate\\n ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) {\\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\\n _validatorContract.execRequestUpdateCommissionRate(_consensusAddr, _effectiveDaysOnwards, _commissionRate);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function execDeprecatePools(address[] calldata _pools, uint256 _newPeriod) external override onlyValidatorContract {\\n if (_pools.length == 0) {\\n return;\\n }\\n\\n for (uint _i = 0; _i < _pools.length; _i++) {\\n PoolDetail storage _pool = _stakingPool[_pools[_i]];\\n // Deactivate the pool admin in the active mapping.\\n delete _adminOfActivePoolMapping[_pool.admin];\\n\\n // Deduct and transfer the self staking amount to the pool admin.\\n uint256 _deductingAmount = _pool.stakingAmount;\\n if (_deductingAmount > 0) {\\n _deductStakingAmount(_pool, _deductingAmount);\\n if (!_unsafeSendRON(payable(_pool.admin), _deductingAmount, DEFAULT_ADDITION_GAS)) {\\n emit StakingAmountTransferFailed(_pool.addr, _pool.admin, _deductingAmount, address(this).balance);\\n }\\n }\\n\\n // Settle the unclaimed reward and transfer to the pool admin.\\n uint256 _lastRewardAmount = _claimReward(_pools[_i], _pool.admin, _newPeriod);\\n if (_lastRewardAmount > 0) {\\n _unsafeSendRON(payable(_pool.admin), _lastRewardAmount, DEFAULT_ADDITION_GAS);\\n }\\n }\\n\\n emit PoolsDeprecated(_pools);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function stake(address _consensusAddr) external payable override noEmptyValue poolIsActive(_consensusAddr) {\\n _stake(_stakingPool[_consensusAddr], msg.sender, msg.value);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function unstake(address _consensusAddr, uint256 _amount)\\n external\\n override\\n nonReentrant\\n poolIsActive(_consensusAddr)\\n {\\n if (_amount == 0) revert ErrUnstakeZeroAmount();\\n address _requester = msg.sender;\\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\\n uint256 _remainAmount = _pool.stakingAmount - _amount;\\n if (_remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft();\\n\\n _unstake(_pool, _requester, _amount);\\n if (!_unsafeSendRON(payable(_requester), _amount, DEFAULT_ADDITION_GAS)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestRenounce(address _consensusAddr)\\n external\\n override\\n poolIsActive(_consensusAddr)\\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\\n {\\n _validatorContract.execRequestRenounceCandidate(_consensusAddr, _waitingSecsToRevoke);\\n }\\n\\n /**\\n * @inheritdoc ICandidateStaking\\n */\\n function requestEmergencyExit(address _consensusAddr)\\n external\\n override\\n poolIsActive(_consensusAddr)\\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\\n {\\n _validatorContract.execEmergencyExit(_consensusAddr, _waitingSecsToRevoke);\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-applyValidatorCandidate`\\n */\\n function _applyValidatorCandidate(\\n address payable _poolAdmin,\\n address _candidateAdmin,\\n address _consensusAddr,\\n address payable _treasuryAddr,\\n address _bridgeOperatorAddr,\\n uint256 _commissionRate,\\n uint256 _amount\\n ) internal {\\n if (!_unsafeSendRON(_poolAdmin, 0)) revert ErrCannotInitTransferRON(_poolAdmin, \\\"pool admin\\\");\\n if (!_unsafeSendRON(_treasuryAddr, 0)) revert ErrCannotInitTransferRON(_treasuryAddr, \\\"treasury\\\");\\n if (_amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount();\\n if (_poolAdmin != _candidateAdmin || _candidateAdmin != _treasuryAddr) revert ErrThreeInteractionAddrsNotEqual();\\n\\n address[] memory _diffAddrs = new address[](3);\\n _diffAddrs[0] = _poolAdmin;\\n _diffAddrs[1] = _consensusAddr;\\n _diffAddrs[2] = _bridgeOperatorAddr;\\n if (AddressArrayUtils.hasDuplicate(_diffAddrs)) revert ErrThreeOperationAddrsNotDistinct();\\n\\n _validatorContract.execApplyValidatorCandidate(\\n _candidateAdmin,\\n _consensusAddr,\\n _treasuryAddr,\\n _bridgeOperatorAddr,\\n _commissionRate\\n );\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-stake`\\n */\\n function _stake(\\n PoolDetail storage _pool,\\n address _requester,\\n uint256 _amount\\n ) internal onlyPoolAdmin(_pool, _requester) {\\n _pool.stakingAmount += _amount;\\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal + _amount);\\n _pool.lastDelegatingTimestamp[_requester] = block.timestamp;\\n emit Staked(_pool.addr, _amount);\\n }\\n\\n /**\\n * @dev See `ICandidateStaking-unstake`\\n */\\n function _unstake(\\n PoolDetail storage _pool,\\n address _requester,\\n uint256 _amount\\n ) internal onlyPoolAdmin(_pool, _requester) {\\n if (_amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount();\\n if (_pool.lastDelegatingTimestamp[_requester] + _cooldownSecsToUndelegate > block.timestamp) {\\n revert ErrUnstakeTooEarly();\\n }\\n\\n _pool.stakingAmount -= _amount;\\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal - _amount);\\n emit Unstaked(_pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\\n *\\n * Emits the event `Unstaked`.\\n *\\n * @return The actual deducted amount\\n */\\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount) internal virtual returns (uint256);\\n\\n /**\\n * @dev Sets the minimum threshold for being a validator candidate.\\n *\\n * Emits the `MinValidatorStakingAmountUpdated` event.\\n *\\n */\\n function _setMinValidatorStakingAmount(uint256 _threshold) internal {\\n _minValidatorStakingAmount = _threshold;\\n emit MinValidatorStakingAmountUpdated(_threshold);\\n }\\n\\n /**\\n * @dev Sets the max commission rate that a candidate can set.\\n *\\n * Emits the `MaxCommissionRateUpdated` event.\\n *\\n */\\n function _setCommissionRateRange(uint256 _minRate, uint256 _maxRate) internal {\\n if (_maxRate > _MAX_PERCENTAGE || _minRate > _maxRate) revert ErrInvalidCommissionRate();\\n _maxCommissionRate = _maxRate;\\n _minCommissionRate = _minRate;\\n emit CommissionRateRangeUpdated(_minRate, _maxRate);\\n }\\n}\\n\",\"keccak256\":\"0x324360faf9e3da3b7a83824c8d0e383da16902965abbee3cb7bf8a7e398dffac\",\"license\":\"MIT\"},\"contracts/ronin/staking/DelegatorStaking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/staking/IDelegatorStaking.sol\\\";\\nimport \\\"./BaseStaking.sol\\\";\\n\\nabstract contract DelegatorStaking is BaseStaking, IDelegatorStaking {\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function delegate(address _consensusAddr) external payable noEmptyValue poolIsActive(_consensusAddr) {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n _delegate(_stakingPool[_consensusAddr], msg.sender, msg.value);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function undelegate(address _consensusAddr, uint256 _amount) external nonReentrant {\\n address payable _delegator = payable(msg.sender);\\n _undelegate(_stakingPool[_consensusAddr], _delegator, _amount);\\n if (!_sendRON(_delegator, _amount)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external nonReentrant {\\n if (_consensusAddrs.length == 0 || _consensusAddrs.length != _amounts.length) revert ErrInvalidArrays();\\n\\n address payable _delegator = payable(msg.sender);\\n uint256 _total;\\n\\n for (uint _i = 0; _i < _consensusAddrs.length; _i++) {\\n _total += _amounts[_i];\\n _undelegate(_stakingPool[_consensusAddrs[_i]], _delegator, _amounts[_i]);\\n }\\n\\n if (!_sendRON(_delegator, _total)) revert ErrCannotTransferRON();\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function redelegate(\\n address _consensusAddrSrc,\\n address _consensusAddrDst,\\n uint256 _amount\\n ) external nonReentrant poolIsActive(_consensusAddrDst) {\\n address _delegator = msg.sender;\\n _undelegate(_stakingPool[_consensusAddrSrc], _delegator, _amount);\\n _delegate(_stakingPool[_consensusAddrDst], _delegator, _amount);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function claimRewards(address[] calldata _consensusAddrList)\\n external\\n override\\n nonReentrant\\n returns (uint256 _amount)\\n {\\n _amount = _claimRewards(msg.sender, _consensusAddrList);\\n _transferRON(payable(msg.sender), _amount);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\\n external\\n override\\n nonReentrant\\n poolIsActive(_consensusAddrDst)\\n returns (uint256 _amount)\\n {\\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\\n return _delegateRewards(msg.sender, _consensusAddrList, _consensusAddrDst);\\n }\\n\\n /**\\n * @inheritdoc IDelegatorStaking\\n */\\n function getRewards(address _user, address[] calldata _poolAddrList)\\n external\\n view\\n returns (uint256[] memory _rewards)\\n {\\n address _consensusAddr;\\n uint256 _period = _validatorContract.currentPeriod();\\n _rewards = new uint256[](_poolAddrList.length);\\n\\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\\n _consensusAddr = _poolAddrList[_i];\\n _rewards[_i] = _getReward(_consensusAddr, _user, _period, getStakingAmount(_consensusAddr, _user));\\n }\\n }\\n\\n /**\\n * @dev Delegates from a validator address.\\n *\\n * Requirements:\\n * - The delegator is not the pool admin.\\n *\\n * Emits the `Delegated` event.\\n *\\n * Note: This function does not verify the `msg.value` with the amount.\\n *\\n */\\n function _delegate(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _amount\\n ) internal notPoolAdmin(_pool, _delegator) {\\n _changeDelegatingAmount(\\n _pool,\\n _delegator,\\n _pool.delegatingAmount[_delegator] + _amount,\\n _pool.stakingTotal + _amount\\n );\\n _pool.lastDelegatingTimestamp[_delegator] = block.timestamp;\\n emit Delegated(_delegator, _pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Undelegates from a validator address.\\n *\\n * Requirements:\\n * - The delegator is not the pool admin.\\n * - The amount is larger than 0.\\n * - The delegating amount is larger than or equal to the undelegating amount.\\n *\\n * Emits the `Undelegated` event.\\n *\\n * Note: Consider transferring back the amount of RON after calling this function.\\n *\\n */\\n function _undelegate(\\n PoolDetail storage _pool,\\n address _delegator,\\n uint256 _amount\\n ) private notPoolAdmin(_pool, _delegator) {\\n if (_amount == 0) revert ErrUndelegateZeroAmount();\\n if (_pool.delegatingAmount[_delegator] < _amount) revert ErrInsufficientDelegatingAmount();\\n\\n if (\\n _validatorContract.isValidatorCandidate(_pool.addr) &&\\n _validatorContract.getCandidateInfo(_pool.addr).revokingTimestamp == 0 && // if candidate is not on renunciation\\n _pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp // delegator is still in cooldown\\n ) revert ErrUndelegateTooEarly();\\n\\n _changeDelegatingAmount(\\n _pool,\\n _delegator,\\n _pool.delegatingAmount[_delegator] - _amount,\\n _pool.stakingTotal - _amount\\n );\\n emit Undelegated(_delegator, _pool.addr, _amount);\\n }\\n\\n /**\\n * @dev Claims rewards from the pools `_poolAddrList`.\\n * Note: This function does not transfer reward to user.\\n */\\n function _claimRewards(address _user, address[] memory _poolAddrList) internal returns (uint256 _amount) {\\n uint256 _period = _currentPeriod();\\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\\n _amount += _claimReward(_poolAddrList[_i], _user, _period);\\n }\\n }\\n\\n /**\\n * @dev Claims the rewards and delegates them to the consensus address.\\n */\\n function _delegateRewards(\\n address _user,\\n address[] calldata _poolAddrList,\\n address _poolAddrDst\\n ) internal returns (uint256 _amount) {\\n _amount = _claimRewards(_user, _poolAddrList);\\n _delegate(_stakingPool[_poolAddrDst], _user, _amount);\\n }\\n}\\n\",\"keccak256\":\"0xbc60590d1ae7fab32f9fddee11cb4a2b39f53d059fb4682d19ead9341f1f7f14\",\"license\":\"MIT\"},\"contracts/ronin/staking/RewardCalculation.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"../../interfaces/staking/IRewardPool.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\n\\n/**\\n * @title RewardCalculation contract\\n * @dev This contract mainly contains the methods to calculate reward for staking contract.\\n */\\nabstract contract RewardCalculation is IRewardPool {\\n /// @dev Mapping from pool address => period number => accumulated rewards per share (one unit staking)\\n mapping(address => mapping(uint256 => PeriodWrapper)) private _accumulatedRps;\\n /// @dev Mapping from the pool address => user address => the reward info of the user\\n mapping(address => mapping(address => UserRewardFields)) private _userReward;\\n /// @dev Mapping from the pool address => reward pool fields\\n mapping(address => PoolFields) private _stakingPool;\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n */\\n uint256[50] private ______gap;\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getReward(address _poolAddr, address _user) external view returns (uint256) {\\n return _getReward(_poolAddr, _user, _currentPeriod(), getStakingAmount(_poolAddr, _user));\\n }\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingAmount(address _poolAddr, address _user) public view virtual returns (uint256);\\n\\n /**\\n * @inheritdoc IRewardPool\\n */\\n function getStakingTotal(address _poolAddr) public view virtual returns (uint256);\\n\\n /**\\n * @dev Returns the reward amount that user claimable.\\n */\\n function _getReward(\\n address _poolAddr,\\n address _user,\\n uint256 _latestPeriod,\\n uint256 _latestStakingAmount\\n ) internal view returns (uint256) {\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n\\n if (_reward.lastPeriod == _latestPeriod) {\\n return _reward.debited;\\n }\\n\\n uint256 _aRps;\\n uint256 _lastPeriodReward;\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n PeriodWrapper storage _wrappedArps = _accumulatedRps[_poolAddr][_reward.lastPeriod];\\n\\n if (_wrappedArps.lastPeriod > 0) {\\n // Calculates the last period reward if the aRps at the period is set\\n _aRps = _wrappedArps.inner;\\n _lastPeriodReward = _reward.lowestAmount * (_aRps - _reward.aRps);\\n } else {\\n // Fallbacks to the previous aRps in case the aRps is not set\\n _aRps = _reward.aRps;\\n }\\n\\n uint256 _newPeriodsReward = _latestStakingAmount * (_pool.aRps - _aRps);\\n return _reward.debited + (_lastPeriodReward + _newPeriodsReward) / 1e18;\\n }\\n\\n /**\\n * @dev Syncs the user reward.\\n *\\n * Emits the event `UserRewardUpdated` once the debit amount is updated.\\n * Emits the event `PoolSharesUpdated` once the pool share is updated.\\n *\\n * Note: The method should be called whenever the user's staking amount changes.\\n *\\n */\\n function _syncUserReward(\\n address _poolAddr,\\n address _user,\\n uint256 _newStakingAmount\\n ) internal {\\n uint256 _period = _currentPeriod();\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n uint256 _lastShares = _pool.shares.inner;\\n\\n // Updates the pool shares if it is outdated\\n if (_pool.shares.lastPeriod < _period) {\\n _pool.shares = PeriodWrapper(getStakingTotal(_poolAddr), _period);\\n }\\n\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\\n uint256 _debited = _getReward(_poolAddr, _user, _period, _currentStakingAmount);\\n\\n if (_reward.debited != _debited) {\\n _reward.debited = _debited;\\n emit UserRewardUpdated(_poolAddr, _user, _debited);\\n }\\n\\n _syncMinStakingAmount(_pool, _reward, _period, _newStakingAmount, _currentStakingAmount);\\n _reward.aRps = _pool.aRps;\\n _reward.lastPeriod = _period;\\n\\n if (_pool.shares.inner != _lastShares) {\\n emit PoolSharesUpdated(_period, _poolAddr, _pool.shares.inner);\\n }\\n }\\n\\n /**\\n * @dev Syncs the minimum staking amount of an user in the current period.\\n */\\n function _syncMinStakingAmount(\\n PoolFields storage _pool,\\n UserRewardFields storage _reward,\\n uint256 _latestPeriod,\\n uint256 _newStakingAmount,\\n uint256 _currentStakingAmount\\n ) internal {\\n if (_reward.lastPeriod < _latestPeriod) {\\n _reward.lowestAmount = _currentStakingAmount;\\n }\\n\\n uint256 _lowestAmount = Math.min(_reward.lowestAmount, _newStakingAmount);\\n uint256 _diffAmount = _reward.lowestAmount - _lowestAmount;\\n if (_diffAmount > 0) {\\n _reward.lowestAmount = _lowestAmount;\\n if (_pool.shares.inner < _diffAmount) revert ErrInvalidPoolShare();\\n _pool.shares.inner -= _diffAmount;\\n }\\n }\\n\\n /**\\n * @dev Claims the settled reward for a specific user.\\n *\\n * @param _lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or\\n * `_currentPeriod + 1` in case of calculating the reward for revoked validators.\\n *\\n * Emits the `RewardClaimed` event and the `UserRewardUpdated` event.\\n *\\n * Note: This method should be called before transferring rewards for the user.\\n *\\n */\\n function _claimReward(\\n address _poolAddr,\\n address _user,\\n uint256 _lastPeriod\\n ) internal returns (uint256 _amount) {\\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\\n _amount = _getReward(_poolAddr, _user, _lastPeriod, _currentStakingAmount);\\n emit RewardClaimed(_poolAddr, _user, _amount);\\n\\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\\n _reward.debited = 0;\\n _syncMinStakingAmount(_stakingPool[_poolAddr], _reward, _lastPeriod, _currentStakingAmount, _currentStakingAmount);\\n _reward.lastPeriod = _lastPeriod;\\n _reward.aRps = _stakingPool[_poolAddr].aRps;\\n emit UserRewardUpdated(_poolAddr, _user, 0);\\n }\\n\\n /**\\n * @dev Records the amount of rewards `_rewards` for the pools `_poolAddrs`.\\n *\\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\\n * Emits the event `PoolUpdateConflicted` when the pool is already updated in the period.\\n *\\n * Note: This method should be called once at the period ending.\\n *\\n */\\n function _recordRewards(\\n address[] memory _poolAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) internal {\\n if (_poolAddrs.length != _rewards.length) {\\n emit PoolsUpdateFailed(_period, _poolAddrs, _rewards);\\n return;\\n }\\n\\n uint256 _rps;\\n uint256 _count;\\n address _poolAddr;\\n uint256 _stakingTotal;\\n uint256[] memory _aRps = new uint256[](_poolAddrs.length);\\n uint256[] memory _shares = new uint256[](_poolAddrs.length);\\n address[] memory _conflicted = new address[](_poolAddrs.length);\\n\\n for (uint _i = 0; _i < _poolAddrs.length; _i++) {\\n _poolAddr = _poolAddrs[_i];\\n PoolFields storage _pool = _stakingPool[_poolAddr];\\n _stakingTotal = getStakingTotal(_poolAddr);\\n\\n if (_accumulatedRps[_poolAddr][_period].lastPeriod == _period) {\\n _conflicted[_count++] = _poolAddr;\\n continue;\\n }\\n\\n // Updates the pool shares if it is outdated\\n if (_pool.shares.lastPeriod < _period) {\\n _pool.shares = PeriodWrapper(_stakingTotal, _period);\\n }\\n\\n // The rps is 0 if no one stakes for the pool\\n _rps = _pool.shares.inner == 0 ? 0 : (_rewards[_i] * 1e18) / _pool.shares.inner;\\n _aRps[_i - _count] = _pool.aRps += _rps;\\n _accumulatedRps[_poolAddr][_period] = PeriodWrapper(_pool.aRps, _period);\\n _pool.shares.inner = _stakingTotal;\\n _shares[_i - _count] = _pool.shares.inner;\\n _poolAddrs[_i - _count] = _poolAddr;\\n }\\n\\n if (_count > 0) {\\n assembly {\\n mstore(_conflicted, _count)\\n mstore(_poolAddrs, sub(mload(_poolAddrs), _count))\\n }\\n emit PoolsUpdateConflicted(_period, _conflicted);\\n }\\n\\n if (_poolAddrs.length > 0) {\\n emit PoolsUpdated(_period, _poolAddrs, _aRps, _shares);\\n }\\n }\\n\\n /**\\n * @dev Returns the current period.\\n */\\n function _currentPeriod() internal view virtual returns (uint256);\\n}\\n\",\"keccak256\":\"0x492fc376e3a866dca702f22f25fe30d3005c28cace7503822ac7e73606611278\",\"license\":\"MIT\"},\"contracts/ronin/staking/Staking.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n\\npragma solidity ^0.8.9;\\n\\nimport \\\"@openzeppelin/contracts/proxy/utils/Initializable.sol\\\";\\nimport \\\"../../libraries/Math.sol\\\";\\nimport \\\"../../interfaces/staking/IStaking.sol\\\";\\nimport \\\"../../interfaces/validator/IRoninValidatorSet.sol\\\";\\nimport \\\"./CandidateStaking.sol\\\";\\nimport \\\"./DelegatorStaking.sol\\\";\\n\\ncontract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable {\\n constructor() {\\n _disableInitializers();\\n }\\n\\n receive() external payable onlyValidatorContract {}\\n\\n fallback() external payable onlyValidatorContract {}\\n\\n /**\\n * @dev Initializes the contract storage.\\n */\\n function initialize(\\n address __validatorContract,\\n uint256 __minValidatorStakingAmount,\\n uint256 __maxCommissionRate,\\n uint256 __cooldownSecsToUndelegate,\\n uint256 __waitingSecsToRevoke\\n ) external initializer {\\n _setValidatorContract(__validatorContract);\\n _setMinValidatorStakingAmount(__minValidatorStakingAmount);\\n _setCommissionRateRange(0, __maxCommissionRate);\\n _setCooldownSecsToUndelegate(__cooldownSecsToUndelegate);\\n _setWaitingSecsToRevoke(__waitingSecsToRevoke);\\n }\\n\\n /**\\n * @inheritdoc IStaking\\n */\\n function execRecordRewards(\\n address[] calldata _consensusAddrs,\\n uint256[] calldata _rewards,\\n uint256 _period\\n ) external payable override onlyValidatorContract {\\n _recordRewards(_consensusAddrs, _rewards, _period);\\n }\\n\\n /**\\n * @inheritdoc IStaking\\n */\\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\\n external\\n override\\n onlyValidatorContract\\n returns (uint256 _actualDeductingAmount)\\n {\\n _actualDeductingAmount = _deductStakingAmount(_stakingPool[_consensusAddr], _amount);\\n address payable _validatorContractAddr = payable(validatorContract());\\n if (!_unsafeSendRON(_validatorContractAddr, _actualDeductingAmount)) {\\n emit StakingAmountDeductFailed(\\n _consensusAddr,\\n _validatorContractAddr,\\n _actualDeductingAmount,\\n address(this).balance\\n );\\n }\\n }\\n\\n /**\\n * @inheritdoc RewardCalculation\\n */\\n function _currentPeriod() internal view virtual override returns (uint256) {\\n return _validatorContract.currentPeriod();\\n }\\n\\n /**\\n * @inheritdoc CandidateStaking\\n */\\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount)\\n internal\\n override\\n returns (uint256 _actualDeductingAmount)\\n {\\n _actualDeductingAmount = Math.min(_pool.stakingAmount, _amount);\\n\\n _pool.stakingAmount -= _actualDeductingAmount;\\n _changeDelegatingAmount(\\n _pool,\\n _pool.admin,\\n _pool.stakingAmount,\\n Math.subNonNegative(_pool.stakingTotal, _actualDeductingAmount)\\n );\\n emit Unstaked(_pool.addr, _actualDeductingAmount);\\n }\\n}\\n\",\"keccak256\":\"0x6c126a036c4cc2b6946b3ffa83b6620e517eef682b6415dd76763d341e321c8a\",\"license\":\"MIT\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b5060016000556200002162000027565b620000e9565b60d154610100900460ff1615620000945760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60d15460ff9081161015620000e75760d1805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b613bb880620000f96000396000f3fe6080604052600436106101b95760003560e01c806303827884146101f95780630682e8fa14610222578063095f647514610237578063097e4a9d146102645780631658c86e1461028457806326476204146102a45780632715805e146102b75780633d8e846e146102d757806342e0c408146102f757806342ef3c34146103275780634530d202146103475780634d99dd161461036f578063574734471461038f5780635c19a95c146103af5780636558954f146103c2578063679a6e43146103d95780636b091695146103f95780636bd8f8041461041957806376664b6514610439578063888b9ae914610459578063895ab74214610479578063909791dd1461049957806391f8723f146104ae578063924f081e146104ce5780639488e4e9146104ee578063969ffc141461050e578063994390891461052e578063aa15a6fd14610550578063acd79c4614610570578063af24542914610583578063c2a672e014610598578063c5087003146105b8578063cdf64a76146105f1578063d01b8eed14610611578063e22d1c9d1461066c578063e5376f541461068c578063f92ad2191461069f578063f9f031df146106bf576101f0565b366101f057336101c76106df565b6001600160a01b0316146101ee57604051630e6444a160e31b815260040160405180910390fd5b005b336101c76106df565b34801561020557600080fd5b5061020f6104b081565b6040519081526020015b60405180910390f35b34801561022e57600080fd5b5060385461020f565b34801561024357600080fd5b5061025761025236600461334b565b6106ee565b60405161021991906133f1565b34801561027057600080fd5b5061020f61027f366004613419565b610830565b34801561029057600080fd5b506101ee61029f36600461346f565b610935565b6101ee6102b236600461346f565b610a73565b3480156102c357600080fd5b5061020f6102d2366004613493565b610b4b565b3480156102e357600080fd5b506102576102f23660046134bf565b610c0b565b34801561030357600080fd5b5061031761031236600461346f565b610d4f565b6040519015158152602001610219565b34801561033357600080fd5b50610257610342366004613513565b610d6f565b34801561035357600080fd5b50606e54606d5460408051928352602083019190915201610219565b34801561037b57600080fd5b506101ee61038a366004613493565b610e3e565b34801561039b57600080fd5b506101ee6103aa366004613554565b610eba565b6101ee6103bd36600461346f565b610efc565b3480156103ce57600080fd5b5061020f6201518081565b3480156103e557600080fd5b506101ee6103f4366004613576565b610ff9565b34801561040557600080fd5b5061020f61041436600461358f565b61103d565b34801561042557600080fd5b506101ee6104343660046135c8565b61105f565b34801561044557600080fd5b5061020f61045436600461358f565b61116a565b34801561046557600080fd5b506101ee610474366004613576565b611199565b34801561048557600080fd5b5061020f61049436600461346f565b6111da565b3480156104a557600080fd5b50606c5461020f565b3480156104ba57600080fd5b506102576104c9366004613513565b6111f8565b3480156104da57600080fd5b506101ee6104e9366004613609565b6112a2565b3480156104fa57600080fd5b506101ee61050936600461334b565b611411565b34801561051a57600080fd5b506101ee610529366004613576565b61154a565b34801561053a57600080fd5b506105436106df565b604051610219919061363e565b34801561055c57600080fd5b506101ee61056b36600461346f565b61158b565b6101ee61057e366004613652565b611691565b34801561058f57600080fd5b5060395461020f565b3480156105a457600080fd5b506101ee6105b3366004613493565b611709565b3480156105c457600080fd5b506105436105d336600461346f565b6001600160a01b039081166000908152603a60205260409020541690565b3480156105fd57600080fd5b506101ee61060c36600461346f565b611849565b34801561061d57600080fd5b5061065d61062c36600461346f565b6001600160a01b03808216600090815260376020526040902060018101546002820154600390920154921693909250565b604051610219939291906136c5565b34801561067857600080fd5b506101ee6106873660046136e6565b6118b5565b6101ee61069a366004613731565b611aa5565b3480156106ab57600080fd5b506101ee6106ba366004613795565b611be6565b3480156106cb57600080fd5b5061020f6106da366004613513565b611d23565b6036546001600160a01b031690565b6060838214610710576040516376081a7b60e11b815260040160405180910390fd5b836001600160401b03811115610728576107286137d9565b604051908082528060200260200182016040528015610751578160200160208202803683370190505b50905060005b81518110156108275760376000878784818110610776576107766137ef565b905060200201602081019061078b919061346f565b6001600160a01b03166001600160a01b0316815260200190815260200160002060040160008585848181106107c2576107c26137ef565b90506020020160208101906107d7919061346f565b6001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061080a5761080a6137ef565b60209081029190910101528061081f8161381b565b915050610757565b50949350505050565b600060026000540361085d5760405162461bcd60e51b815260040161085490613834565b60405180910390fd5b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d29061089290849060040161363e565b602060405180830381865afa1580156108af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d3919061386b565b6108f25780604051630fd0c64560e11b8152600401610854919061363e565b6108fb33610d4f565b1561091b5733604051632fc6bfb160e21b8152600401610854919061363e565b61092733868686611da3565b600160005595945050505050565b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d29061096590849060040161363e565b602060405180830381865afa158015610982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a6919061386b565b6109c55780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b038083166000908152603760205260409020600181015490913391168114610a0757604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163dd716ad360e01b81526001600160a01b039092169163dd716ad391610a3b9188919060040161388d565b600060405180830381600087803b158015610a5557600080fd5b505af1158015610a69573d6000803e3d6000fd5b5050505050505050565b34600003610a9457604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d290610ac490849060040161363e565b602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b05919061386b565b610b245780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b0382166000908152603760205260409020610b47903334611e10565b5050565b600033610b566106df565b6001600160a01b031614610b7d57604051630e6444a160e31b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260409020610b9f9083611ee3565b90506000610bab6106df565b9050610bb78183611f6e565b610c0457604080518381524760208201526001600160a01b0380841692908716917f63701cd972aa3c7f87898aab145c972e52185beab07d6e39380a998d334cf6c8910160405180910390a35b5092915050565b6060600080603660009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8791906138a6565b9050836001600160401b03811115610ca157610ca16137d9565b604051908082528060200260200182016040528015610cca578160200160208202803683370190505b50925060005b84811015610d4557858582818110610cea57610cea6137ef565b9050602002016020810190610cff919061346f565b9250610d16838884610d11878c61116a565b611fca565b848281518110610d2857610d286137ef565b602090810291909101015280610d3d8161381b565b915050610cd0565b5050509392505050565b6001600160a01b039081166000908152603a602052604090205416151590565b6060816001600160401b03811115610d8957610d896137d9565b604051908082528060200260200182016040528015610db2578160200160208202803683370190505b50905060005b82811015610c045760376000858584818110610dd657610dd66137ef565b9050602002016020810190610deb919061346f565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020154828281518110610e2157610e216137ef565b602090810291909101015280610e368161381b565b915050610db8565b600260005403610e605760405162461bcd60e51b815260040161085490613834565b600260009081556001600160a01b03831681526037602052604090203390610e899082846120c6565b610e938183612326565b610eb057604051635ff7115760e11b815260040160405180910390fd5b5050600160005550565b610ec2612353565b6001600160a01b0316336001600160a01b031614610ef25760405162461bcd60e51b8152600401610854906138bf565b610b478282612381565b34600003610f1d57604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d290610f4d90849060040161363e565b602060405180830381865afa158015610f6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8e919061386b565b610fad5780604051630fd0c64560e11b8152600401610854919061363e565b610fb633610d4f565b15610fd65733604051632fc6bfb160e21b8152600401610854919061363e565b6001600160a01b0382166000908152603760205260409020610b479033346123f5565b611001612353565b6001600160a01b0316336001600160a01b0316146110315760405162461bcd60e51b8152600401610854906138bf565b61103a816124bd565b50565b6000611056838361104c6124f9565b610d11878761116a565b90505b92915050565b6002600054036110815760405162461bcd60e51b815260040161085490613834565b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d2906110b690849060040161363e565b602060405180830381865afa1580156110d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f7919061386b565b6111165780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b0384166000908152603760205260409020339061113b9082856120c6565b6001600160a01b038416600090815260376020526040902061115e9082856123f5565b50506001600055505050565b6001600160a01b0391821660009081526037602090815260408083209390941682526004909201909152205490565b6111a1612353565b6001600160a01b0316336001600160a01b0316146111d15760405162461bcd60e51b8152600401610854906138bf565b61103a8161256b565b6001600160a01b031660009081526037602052604090206003015490565b6060816001600160401b03811115611212576112126137d9565b60405190808252806020026020018201604052801561123b578160200160208202803683370190505b50905060005b82811015610c045761127384848381811061125e5761125e6137ef565b9050602002016020810190610494919061346f565b828281518110611285576112856137ef565b60209081029190910101528061129a8161381b565b915050611241565b603654604051635061f96960e11b815284916001600160a01b03169063a0c3f2d2906112d290849060040161363e565b602060405180830381865afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611313919061386b565b6113325780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b03808516600090815260376020526040902060018101549091339116811461137457604051637bc65bd760e11b815260040160405180910390fd5b606d548411806113855750606e5484105b156113a357604051631b8454a360e21b815260040160405180910390fd5b60365460405163e5125a1d60e01b81526001600160a01b039091169063e5125a1d906113d7908990899089906004016136c5565b600060405180830381600087803b1580156113f157600080fd5b505af1158015611405573d6000803e3d6000fd5b50505050505050505050565b6002600054036114335760405162461bcd60e51b815260040161085490613834565b60026000558215806114455750828114155b15611463576040516376081a7b60e11b815260040160405180910390fd5b336000805b8581101561151557848482818110611482576114826137ef565b90506020020135826114949190613901565b9150611503603760008989858181106114af576114af6137ef565b90506020020160208101906114c4919061346f565b6001600160a01b03166001600160a01b03168152602001908152602001600020848787858181106114f7576114f76137ef565b905060200201356120c6565b8061150d8161381b565b915050611468565b506115208282612326565b61153d57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550505050565b611552612353565b6001600160a01b0316336001600160a01b0316146115825760405162461bcd60e51b8152600401610854906138bf565b61103a816125a0565b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d2906115bb90849060040161363e565b602060405180830381865afa1580156115d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115fc919061386b565b61161b5780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b03808316600090815260376020526040902060018101549091339116811461165d57604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163a7c2f11960e01b81526001600160a01b039092169163a7c2f11991610a3b9188919060040161388d565b3361169a6106df565b6001600160a01b0316146116c157604051630e6444a160e31b815260040160405180910390fd5b6117028585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508792508691508590506125d5565b5050505050565b60026000540361172b5760405162461bcd60e51b815260040161085490613834565b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d29061176090849060040161363e565b602060405180830381865afa15801561177d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a1919061386b565b6117c05780604051630fd0c64560e11b8152600401610854919061363e565b816000036117e1576040516331d9f7d760e01b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260408120600281015433929061180c908690613914565b9050606c548110156118315760405163ef0a995760e01b815260040160405180910390fd5b61183c828487612a13565b61152083866104b0612b15565b611851612353565b6001600160a01b0316336001600160a01b0316146118815760405162461bcd60e51b8152600401610854906138bf565b806001600160a01b03163b6000036118ac57604051637bcd509160e01b815260040160405180910390fd5b61103a81612b75565b336118be6106df565b6001600160a01b0316146118e557604051630e6444a160e31b815260040160405180910390fd5b8115611aa05760005b82811015611a655760006037600086868581811061190e5761190e6137ef565b9050602002016020810190611923919061346f565b6001600160a01b0390811682526020808301939093526040918201600090812060018101549092168152603a909352912080546001600160a01b0319169055600281015490915080156119ea5761197a8282611ee3565b506001820154611996906001600160a01b0316826104b0612b15565b6119ea5760018201548254604080518481524760208201526001600160a01b0393841693909216917f7dc5115a5aba081f5a174f56a3d02eea582824783322a4ac03f7bd388f444194910160405180910390a35b6000611a2a878786818110611a0157611a016137ef565b9050602002016020810190611a16919061346f565b60018501546001600160a01b031687612bc0565b90508015611a4f576001830154611a4d906001600160a01b0316826104b0612b15565b505b5050508080611a5d9061381b565b9150506118ee565b507f4f257d3ba23679d338f1d94296086bba5724af341b7fa31aa0ff297bfcdc62d88383604051611a97929190613927565b60405180910390a15b505050565b600260005403611ac75760405162461bcd60e51b815260040161085490613834565b6002600055611ad533610d4f565b15611af55733604051632fc6bfb160e21b8152600401610854919061363e565b606d54811180611b065750606e5481105b15611b2457604051631b8454a360e21b815260040160405180910390fd5b3433611b3581888888888888612cc0565b6001600160a01b0380871660008181526037602081815260408084206001810180549789166001600160a01b0319988916811790915581548816871782558552603a835290842080549096168517909555929091529052611b97818385611e10565b816001600160a01b0316876001600160a01b03167ffc1f1e73948cbc47c5b7f90e5601b7daccd9ad7173218486ccc74bdd051d05e860405160405180910390a350506001600055505050505050565b60d154610100900460ff1615808015611c06575060d154600160ff909116105b80611c205750303b158015611c20575060d15460ff166001145b611c835760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610854565b60d1805460ff191660011790558015611ca65760d1805461ff0019166101001790555b611caf86612b75565b611cb8856124bd565b611cc3600085612381565b611ccc8361256b565b611cd5826125a0565b8015611d1b5760d1805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6000600260005403611d475760405162461bcd60e51b815260040161085490613834565b6002600081905550611d8c33848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612f4c92505050565b9050611d983382612faf565b600160005592915050565b6000611de285858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612f4c92505050565b6001600160a01b0383166000908152603760205260409020909150611e089086836123f5565b949350505050565b6001830154839083906001600160a01b03808316911614611e4457604051637bc65bd760e11b815260040160405180910390fd5b82856002016000828254611e589190613901565b92505081905550611e7e85858760020154868960030154611e799190613901565b612fd6565b6001600160a01b03808516600090815260058701602052604090819020429055865490519116907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611ed49086815260200190565b60405180910390a25050505050565b6000611ef3836002015483613011565b905080836002016000828254611f099190613914565b9091555050600183015460028401546003850154611f399286926001600160a01b0390911691611e799086613027565b82546040518281526001600160a01b0390911690600080516020613b438339815191529060200160405180910390a292915050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611fbb576040519150601f19603f3d011682016040523d82523d6000602084013e611fc0565b606091505b5090949350505050565b6001600160a01b0380851660009081526002602090815260408083209387168352929052908120600381015484900361200557549050611e08565b6001600160a01b03861660009081526003602081815260408084206001808452828620948701548652939092528320918201548392901561206a57805460018601549094506120549085613914565b85600201546120639190613975565b9250612072565b846001015493505b8154600090612082908690613914565b61208c9089613975565b9050670de0b6b3a76400006120a18286613901565b6120ab919061398c565b86546120b79190613901565b9b9a5050505050505050505050565b6001830154839083906001600160a01b038083169116036120fa57604051639feb934760e01b815260040160405180910390fd5b8260000361211b57604051637ab0c6ad60e11b815260040160405180910390fd5b6001600160a01b038416600090815260048601602052604090205483111561215657604051630695534560e31b815260040160405180910390fd5b6036548554604051635061f96960e11b81526001600160a01b039283169263a0c3f2d2926121899291169060040161363e565b602060405180830381865afa1580156121a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ca919061386b565b801561224b575060365485546040516328bde1e160e01b81526001600160a01b03928316926328bde1e1926122049291169060040161363e565b60e060405180830381865afa158015612221573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224591906139be565b60a00151155b801561227e57506038546001600160a01b0385166000908152600587016020526040902054429161227b91613901565b10155b1561229c5760405163f19f52bd60e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546122da90869086906122ca908790613914565b868960030154611e799190613914565b84546040518481526001600160a01b03918216918616907f4d10bd049775c77bd7f255195afba5088028ecb3c7c277d393ccff7934f2f92c906020015b60405180910390a35050505050565b600081471015612349576040516304611a4560e11b815260040160405180910390fd5b6110568383611f6e565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b61271081118061239057508082115b156123ae57604051631b8454a360e21b815260040160405180910390fd5b606d819055606e82905560408051838152602081018390527f677752f5bf9541b14288833909e5ec5a478103131c1ec08c4638943be5826c14910160405180910390a15050565b6001830154839083906001600160a01b0380831691160361242957604051639feb934760e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546124679086908690612457908790613901565b868960030154611e799190613901565b6001600160a01b03808516600081815260058801602052604090819020429055875490519216917fe5541a6b6103d4fa7e021ed54fad39c66f27a76bd13d374cf6240ae6bd0bb72b906123179087815260200190565b606c8190556040518181527f372bbdb8d72373b0012f84ee5a11671e5fb72b8bea902ebca93a19cb45d32be2906020015b60405180910390a150565b6036546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa158015612542573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256691906138a6565b905090565b60388190556040518181527f4956b65267b8f1e642284bcb5037116c69a9c78d9ca576beeae0974737a4872a906020016124ee565b60398190556040518181527f02be0b73b597f2c0f138aebee162b3b0e25d5b5a26854c15dcf79176e9a1c678906020016124ee565b8351821461261e57807fae52c603227f64e4c6101dde593aa9790a16b3ac77546bd746d758511e9560a585858560405161261193929190613aa2565b60405180910390a2612a0d565b600080600080600088516001600160401b0381111561263f5761263f6137d9565b604051908082528060200260200182016040528015612668578160200160208202803683370190505b509050600089516001600160401b03811115612686576126866137d9565b6040519080825280602002602001820160405280156126af578160200160208202803683370190505b50905060008a516001600160401b038111156126cd576126cd6137d9565b6040519080825280602002602001820160405280156126f6578160200160208202803683370190505b50905060005b8b51811015612978578b8181518110612717576127176137ef565b60200260200101519550600060036000886001600160a01b03166001600160a01b031681526020019081526020016000209050612753876111da565b6001600160a01b03881660009081526001602081815260408084208f855290915290912001549096508a90036127c75786838961278f8161381b565b9a50815181106127a1576127a16137ef565b60200260200101906001600160a01b031690816001600160a01b03168152505050612966565b60028101548a11156127f557604080518082019091528681526020018a905260018101869055600281018a90555b60018101541561283f5760018101548c8c84818110612816576128166137ef565b90506020020135670de0b6b3a76400006128309190613975565b61283a919061398c565b612842565b60005b9850888160000160008282546128589190613901565b918290555090508561286a8a85613914565b8151811061287a5761287a6137ef565b6020026020010181815250506040518060400160405280826000015481526020018b81525060016000896001600160a01b03166001600160a01b0316815260200190815260200160002060008c81526020019081526020016000206000820151816000015560208201518160010155905050858160010160000181905550806001016000015484898461290d9190613914565b8151811061291d5761291d6137ef565b6020908102919091010152868d6129348a85613914565b81518110612944576129446137ef565b60200260200101906001600160a01b031690816001600160a01b031681525050505b806129708161381b565b9150506126fc565b5085156129c157858152858b51038b52877fee74f10cc50bf4b7e57fd36be7d46288795f3a9151dae97505b718b392ba14a3826040516129b89190613aec565b60405180910390a25b8a5115612a0557877f0e54e0485f70f0f63bc25889ddbf01ce1269ad6f07fdb2df573a0fbdb4d66f888c85856040516129fc93929190613aff565b60405180910390a25b505050505050505b50505050565b6001830154839083906001600160a01b03808316911614612a4757604051637bc65bd760e11b815260040160405180910390fd5b8460020154831115612a6c57604051630a8d7fa760e21b815260040160405180910390fd5b6038546001600160a01b03851660009081526005870160205260409020544291612a9591613901565b1115612ab4576040516303db082960e11b815260040160405180910390fd5b82856002016000828254612ac89190613914565b92505081905550612ae985858760020154868960030154611e799190613914565b84546040518481526001600160a01b0390911690600080516020613b4383398151915290602001611ed4565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d8060008114612b65576040519150601f19603f3d011682016040523d82523d6000602084013e612b6a565b606091505b509095945050505050565b603680546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906124ee90839061363e565b600080612bcd858561116a565b9050612bdb85858584611fca565b9150836001600160a01b0316856001600160a01b03167f0aa4d283470c904c551d18bb894d37e17674920f3261a7f854be501e25f421b784604051612c2291815260200190565b60405180910390a36001600160a01b03808616600081815260026020908152604080832094891683529381528382208281559282526003905291909120612c6c9082868580613041565b60038181018590556001600160a01b0387811660008181526020938452604080822054600187015551908152918816929091600080516020613b63833981519152910160405180910390a350509392505050565b612ccb876000611f6e565b612d16576040805163338f030160e01b81526001600160a01b03891660048201526024810191909152600a6044820152693837b7b61030b236b4b760b11b6064820152608401610854565b612d21846000611f6e565b612d6a576040805163338f030160e01b81526001600160a01b038616600482015260248101919091526008604482015267747265617375727960c01b6064820152608401610854565b606c54811015612d8d57604051630a8d7fa760e21b815260040160405180910390fd5b856001600160a01b0316876001600160a01b0316141580612dc05750836001600160a01b0316866001600160a01b031614155b15612dde5760405163dc1d04ff60e01b815260040160405180910390fd5b60408051600380825260808201909252600091602082016060803683370190505090508781600081518110612e1557612e156137ef565b60200260200101906001600160a01b031690816001600160a01b0316815250508581600181518110612e4957612e496137ef565b60200260200101906001600160a01b031690816001600160a01b0316815250508381600281518110612e7d57612e7d6137ef565b60200260200101906001600160a01b031690816001600160a01b031681525050612ea6816130d3565b15612ec4576040516329d55f9360e11b815260040160405180910390fd5b6036546040516302209ca560e31b81526001600160a01b0389811660048301528881166024830152878116604483015286811660648301526084820186905290911690631104e5289060a401600060405180830381600087803b158015612f2a57600080fd5b505af1158015612f3e573d6000803e3d6000fd5b505050505050505050505050565b600080612f576124f9565b905060005b8351811015612fa757612f89848281518110612f7a57612f7a6137ef565b60200260200101518684612bc0565b612f939084613901565b925080612f9f8161381b565b915050612f5c565b505092915050565b612fb98282612326565b610b4757604051630c3e69bb60e11b815260040160405180910390fd5b8354612fec906001600160a01b0316848461319a565b60038401556001600160a01b0390911660009081526004909201602052604090912055565b60008183106130205781611056565b5090919050565b6000818311613037576000611056565b6110568284613914565b828460030154101561305557600284018190555b6000613065856002015484613011565b905060008186600201546130799190613914565b905080156130ca576002860182905560018701548111156130ad576040516352e521bf60e11b815260040160405180910390fd5b808760010160000160008282546130c49190613914565b90915550505b50505050505050565b600081516000036130e657506000919050565b60005b600183516130f79190613914565b81101561319157600061310b826001613901565b90505b835181101561317e57838181518110613129576131296137ef565b60200260200101516001600160a01b031684838151811061314c5761314c6137ef565b60200260200101516001600160a01b03160361316c575060019392505050565b806131768161381b565b91505061310e565b50806131898161381b565b9150506130e9565b50600092915050565b60006131a46124f9565b6001600160a01b03851660009081526003602052604090206001810154600282015492935090918311156131ff5760405180604001604052806131e6886111da565b8152602090810185905281516001850155015160028301555b6001600160a01b038087166000908152600260209081526040808320938916835292905290812090613231888861116a565b9050600061324189898885611fca565b83549091508114613281578083556040518181526001600160a01b0389811691908b1690600080516020613b638339815191529060200160405180910390a35b61328e8584888a86613041565b84546001808501919091556003840187905585015484146132f557886001600160a01b0316867f81faf50e2aaf52eaba2ab841071efb9f6f0850a3e7d008b1336e6001d3d4963c87600101600001546040516132ec91815260200190565b60405180910390a35b505050505050505050565b60008083601f84011261331257600080fd5b5081356001600160401b0381111561332957600080fd5b6020830191508360208260051b850101111561334457600080fd5b9250929050565b6000806000806040858703121561336157600080fd5b84356001600160401b038082111561337857600080fd5b61338488838901613300565b9096509450602087013591508082111561339d57600080fd5b506133aa87828801613300565b95989497509550505050565b600081518084526020808501945080840160005b838110156133e6578151875295820195908201906001016133ca565b509495945050505050565b60208152600061105660208301846133b6565b6001600160a01b038116811461103a57600080fd5b60008060006040848603121561342e57600080fd5b83356001600160401b0381111561344457600080fd5b61345086828701613300565b909450925050602084013561346481613404565b809150509250925092565b60006020828403121561348157600080fd5b813561348c81613404565b9392505050565b600080604083850312156134a657600080fd5b82356134b181613404565b946020939093013593505050565b6000806000604084860312156134d457600080fd5b83356134df81613404565b925060208401356001600160401b038111156134fa57600080fd5b61350686828701613300565b9497909650939450505050565b6000806020838503121561352657600080fd5b82356001600160401b0381111561353c57600080fd5b61354885828601613300565b90969095509350505050565b6000806040838503121561356757600080fd5b50508035926020909101359150565b60006020828403121561358857600080fd5b5035919050565b600080604083850312156135a257600080fd5b82356135ad81613404565b915060208301356135bd81613404565b809150509250929050565b6000806000606084860312156135dd57600080fd5b83356135e881613404565b925060208401356135f881613404565b929592945050506040919091013590565b60008060006060848603121561361e57600080fd5b833561362981613404565b95602085013595506040909401359392505050565b6001600160a01b0391909116815260200190565b60008060008060006060868803121561366a57600080fd5b85356001600160401b038082111561368157600080fd5b61368d89838a01613300565b909750955060208801359150808211156136a657600080fd5b506136b388828901613300565b96999598509660400135949350505050565b6001600160a01b039390931683526020830191909152604082015260600190565b6000806000604084860312156136fb57600080fd5b83356001600160401b0381111561371157600080fd5b61371d86828701613300565b909790965060209590950135949350505050565b600080600080600060a0868803121561374957600080fd5b853561375481613404565b9450602086013561376481613404565b9350604086013561377481613404565b9250606086013561378481613404565b949793965091946080013592915050565b600080600080600060a086880312156137ad57600080fd5b85356137b881613404565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161382d5761382d613805565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561387d57600080fd5b8151801515811461348c57600080fd5b6001600160a01b03929092168252602082015260400190565b6000602082840312156138b857600080fd5b5051919050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b8082018082111561105957611059613805565b8181038181111561105957611059613805565b60208082528181018390526000908460408401835b8681101561396a57823561394f81613404565b6001600160a01b03168252918301919083019060010161393c565b509695505050505050565b808202811582820484141761105957611059613805565b6000826139a957634e487b7160e01b600052601260045260246000fd5b500490565b80516139b981613404565b919050565b600060e082840312156139d057600080fd5b60405160e081016001600160401b0381118282101715613a0057634e487b7160e01b600052604160045260246000fd5b604052613a0c836139ae565b8152613a1a602084016139ae565b6020820152613a2b604084016139ae565b6040820152613a3c606084016139ae565b60608201526080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b600081518084526020808501945080840160005b838110156133e65781516001600160a01b031687529582019590820190600101613a7d565b604081526000613ab56040830186613a69565b82810360208401528381526001600160fb1b03841115613ad457600080fd5b8360051b808660208401370160200195945050505050565b6020815260006110566020830184613a69565b606081526000613b126060830186613a69565b8281036020840152613b2481866133b6565b90508281036040840152613b3881856133b6565b969550505050505056fe0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75aa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ada264697066735822122084a2646a7e3b284e947649e3c4cea51c75829bcabae922a4d19175bd5ef9292564736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106101b95760003560e01c806303827884146101f95780630682e8fa14610222578063095f647514610237578063097e4a9d146102645780631658c86e1461028457806326476204146102a45780632715805e146102b75780633d8e846e146102d757806342e0c408146102f757806342ef3c34146103275780634530d202146103475780634d99dd161461036f578063574734471461038f5780635c19a95c146103af5780636558954f146103c2578063679a6e43146103d95780636b091695146103f95780636bd8f8041461041957806376664b6514610439578063888b9ae914610459578063895ab74214610479578063909791dd1461049957806391f8723f146104ae578063924f081e146104ce5780639488e4e9146104ee578063969ffc141461050e578063994390891461052e578063aa15a6fd14610550578063acd79c4614610570578063af24542914610583578063c2a672e014610598578063c5087003146105b8578063cdf64a76146105f1578063d01b8eed14610611578063e22d1c9d1461066c578063e5376f541461068c578063f92ad2191461069f578063f9f031df146106bf576101f0565b366101f057336101c76106df565b6001600160a01b0316146101ee57604051630e6444a160e31b815260040160405180910390fd5b005b336101c76106df565b34801561020557600080fd5b5061020f6104b081565b6040519081526020015b60405180910390f35b34801561022e57600080fd5b5060385461020f565b34801561024357600080fd5b5061025761025236600461334b565b6106ee565b60405161021991906133f1565b34801561027057600080fd5b5061020f61027f366004613419565b610830565b34801561029057600080fd5b506101ee61029f36600461346f565b610935565b6101ee6102b236600461346f565b610a73565b3480156102c357600080fd5b5061020f6102d2366004613493565b610b4b565b3480156102e357600080fd5b506102576102f23660046134bf565b610c0b565b34801561030357600080fd5b5061031761031236600461346f565b610d4f565b6040519015158152602001610219565b34801561033357600080fd5b50610257610342366004613513565b610d6f565b34801561035357600080fd5b50606e54606d5460408051928352602083019190915201610219565b34801561037b57600080fd5b506101ee61038a366004613493565b610e3e565b34801561039b57600080fd5b506101ee6103aa366004613554565b610eba565b6101ee6103bd36600461346f565b610efc565b3480156103ce57600080fd5b5061020f6201518081565b3480156103e557600080fd5b506101ee6103f4366004613576565b610ff9565b34801561040557600080fd5b5061020f61041436600461358f565b61103d565b34801561042557600080fd5b506101ee6104343660046135c8565b61105f565b34801561044557600080fd5b5061020f61045436600461358f565b61116a565b34801561046557600080fd5b506101ee610474366004613576565b611199565b34801561048557600080fd5b5061020f61049436600461346f565b6111da565b3480156104a557600080fd5b50606c5461020f565b3480156104ba57600080fd5b506102576104c9366004613513565b6111f8565b3480156104da57600080fd5b506101ee6104e9366004613609565b6112a2565b3480156104fa57600080fd5b506101ee61050936600461334b565b611411565b34801561051a57600080fd5b506101ee610529366004613576565b61154a565b34801561053a57600080fd5b506105436106df565b604051610219919061363e565b34801561055c57600080fd5b506101ee61056b36600461346f565b61158b565b6101ee61057e366004613652565b611691565b34801561058f57600080fd5b5060395461020f565b3480156105a457600080fd5b506101ee6105b3366004613493565b611709565b3480156105c457600080fd5b506105436105d336600461346f565b6001600160a01b039081166000908152603a60205260409020541690565b3480156105fd57600080fd5b506101ee61060c36600461346f565b611849565b34801561061d57600080fd5b5061065d61062c36600461346f565b6001600160a01b03808216600090815260376020526040902060018101546002820154600390920154921693909250565b604051610219939291906136c5565b34801561067857600080fd5b506101ee6106873660046136e6565b6118b5565b6101ee61069a366004613731565b611aa5565b3480156106ab57600080fd5b506101ee6106ba366004613795565b611be6565b3480156106cb57600080fd5b5061020f6106da366004613513565b611d23565b6036546001600160a01b031690565b6060838214610710576040516376081a7b60e11b815260040160405180910390fd5b836001600160401b03811115610728576107286137d9565b604051908082528060200260200182016040528015610751578160200160208202803683370190505b50905060005b81518110156108275760376000878784818110610776576107766137ef565b905060200201602081019061078b919061346f565b6001600160a01b03166001600160a01b0316815260200190815260200160002060040160008585848181106107c2576107c26137ef565b90506020020160208101906107d7919061346f565b6001600160a01b03166001600160a01b031681526020019081526020016000205482828151811061080a5761080a6137ef565b60209081029190910101528061081f8161381b565b915050610757565b50949350505050565b600060026000540361085d5760405162461bcd60e51b815260040161085490613834565b60405180910390fd5b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d29061089290849060040161363e565b602060405180830381865afa1580156108af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108d3919061386b565b6108f25780604051630fd0c64560e11b8152600401610854919061363e565b6108fb33610d4f565b1561091b5733604051632fc6bfb160e21b8152600401610854919061363e565b61092733868686611da3565b600160005595945050505050565b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d29061096590849060040161363e565b602060405180830381865afa158015610982573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109a6919061386b565b6109c55780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b038083166000908152603760205260409020600181015490913391168114610a0757604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163dd716ad360e01b81526001600160a01b039092169163dd716ad391610a3b9188919060040161388d565b600060405180830381600087803b158015610a5557600080fd5b505af1158015610a69573d6000803e3d6000fd5b5050505050505050565b34600003610a9457604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d290610ac490849060040161363e565b602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b05919061386b565b610b245780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b0382166000908152603760205260409020610b47903334611e10565b5050565b600033610b566106df565b6001600160a01b031614610b7d57604051630e6444a160e31b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260409020610b9f9083611ee3565b90506000610bab6106df565b9050610bb78183611f6e565b610c0457604080518381524760208201526001600160a01b0380841692908716917f63701cd972aa3c7f87898aab145c972e52185beab07d6e39380a998d334cf6c8910160405180910390a35b5092915050565b6060600080603660009054906101000a90046001600160a01b03166001600160a01b031663060406186040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c63573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c8791906138a6565b9050836001600160401b03811115610ca157610ca16137d9565b604051908082528060200260200182016040528015610cca578160200160208202803683370190505b50925060005b84811015610d4557858582818110610cea57610cea6137ef565b9050602002016020810190610cff919061346f565b9250610d16838884610d11878c61116a565b611fca565b848281518110610d2857610d286137ef565b602090810291909101015280610d3d8161381b565b915050610cd0565b5050509392505050565b6001600160a01b039081166000908152603a602052604090205416151590565b6060816001600160401b03811115610d8957610d896137d9565b604051908082528060200260200182016040528015610db2578160200160208202803683370190505b50905060005b82811015610c045760376000858584818110610dd657610dd66137ef565b9050602002016020810190610deb919061346f565b6001600160a01b03166001600160a01b0316815260200190815260200160002060020154828281518110610e2157610e216137ef565b602090810291909101015280610e368161381b565b915050610db8565b600260005403610e605760405162461bcd60e51b815260040161085490613834565b600260009081556001600160a01b03831681526037602052604090203390610e899082846120c6565b610e938183612326565b610eb057604051635ff7115760e11b815260040160405180910390fd5b5050600160005550565b610ec2612353565b6001600160a01b0316336001600160a01b031614610ef25760405162461bcd60e51b8152600401610854906138bf565b610b478282612381565b34600003610f1d57604051636dfcbde560e11b815260040160405180910390fd5b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d290610f4d90849060040161363e565b602060405180830381865afa158015610f6a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f8e919061386b565b610fad5780604051630fd0c64560e11b8152600401610854919061363e565b610fb633610d4f565b15610fd65733604051632fc6bfb160e21b8152600401610854919061363e565b6001600160a01b0382166000908152603760205260409020610b479033346123f5565b611001612353565b6001600160a01b0316336001600160a01b0316146110315760405162461bcd60e51b8152600401610854906138bf565b61103a816124bd565b50565b6000611056838361104c6124f9565b610d11878761116a565b90505b92915050565b6002600054036110815760405162461bcd60e51b815260040161085490613834565b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d2906110b690849060040161363e565b602060405180830381865afa1580156110d3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110f7919061386b565b6111165780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b0384166000908152603760205260409020339061113b9082856120c6565b6001600160a01b038416600090815260376020526040902061115e9082856123f5565b50506001600055505050565b6001600160a01b0391821660009081526037602090815260408083209390941682526004909201909152205490565b6111a1612353565b6001600160a01b0316336001600160a01b0316146111d15760405162461bcd60e51b8152600401610854906138bf565b61103a8161256b565b6001600160a01b031660009081526037602052604090206003015490565b6060816001600160401b03811115611212576112126137d9565b60405190808252806020026020018201604052801561123b578160200160208202803683370190505b50905060005b82811015610c045761127384848381811061125e5761125e6137ef565b9050602002016020810190610494919061346f565b828281518110611285576112856137ef565b60209081029190910101528061129a8161381b565b915050611241565b603654604051635061f96960e11b815284916001600160a01b03169063a0c3f2d2906112d290849060040161363e565b602060405180830381865afa1580156112ef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611313919061386b565b6113325780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b03808516600090815260376020526040902060018101549091339116811461137457604051637bc65bd760e11b815260040160405180910390fd5b606d548411806113855750606e5484105b156113a357604051631b8454a360e21b815260040160405180910390fd5b60365460405163e5125a1d60e01b81526001600160a01b039091169063e5125a1d906113d7908990899089906004016136c5565b600060405180830381600087803b1580156113f157600080fd5b505af1158015611405573d6000803e3d6000fd5b50505050505050505050565b6002600054036114335760405162461bcd60e51b815260040161085490613834565b60026000558215806114455750828114155b15611463576040516376081a7b60e11b815260040160405180910390fd5b336000805b8581101561151557848482818110611482576114826137ef565b90506020020135826114949190613901565b9150611503603760008989858181106114af576114af6137ef565b90506020020160208101906114c4919061346f565b6001600160a01b03166001600160a01b03168152602001908152602001600020848787858181106114f7576114f76137ef565b905060200201356120c6565b8061150d8161381b565b915050611468565b506115208282612326565b61153d57604051635ff7115760e11b815260040160405180910390fd5b5050600160005550505050565b611552612353565b6001600160a01b0316336001600160a01b0316146115825760405162461bcd60e51b8152600401610854906138bf565b61103a816125a0565b603654604051635061f96960e11b815282916001600160a01b03169063a0c3f2d2906115bb90849060040161363e565b602060405180830381865afa1580156115d8573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115fc919061386b565b61161b5780604051630fd0c64560e11b8152600401610854919061363e565b6001600160a01b03808316600090815260376020526040902060018101549091339116811461165d57604051637bc65bd760e11b815260040160405180910390fd5b60365460395460405163a7c2f11960e01b81526001600160a01b039092169163a7c2f11991610a3b9188919060040161388d565b3361169a6106df565b6001600160a01b0316146116c157604051630e6444a160e31b815260040160405180910390fd5b6117028585808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508792508691508590506125d5565b5050505050565b60026000540361172b5760405162461bcd60e51b815260040161085490613834565b6002600055603654604051635061f96960e11b815283916001600160a01b03169063a0c3f2d29061176090849060040161363e565b602060405180830381865afa15801561177d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a1919061386b565b6117c05780604051630fd0c64560e11b8152600401610854919061363e565b816000036117e1576040516331d9f7d760e01b815260040160405180910390fd5b6001600160a01b0383166000908152603760205260408120600281015433929061180c908690613914565b9050606c548110156118315760405163ef0a995760e01b815260040160405180910390fd5b61183c828487612a13565b61152083866104b0612b15565b611851612353565b6001600160a01b0316336001600160a01b0316146118815760405162461bcd60e51b8152600401610854906138bf565b806001600160a01b03163b6000036118ac57604051637bcd509160e01b815260040160405180910390fd5b61103a81612b75565b336118be6106df565b6001600160a01b0316146118e557604051630e6444a160e31b815260040160405180910390fd5b8115611aa05760005b82811015611a655760006037600086868581811061190e5761190e6137ef565b9050602002016020810190611923919061346f565b6001600160a01b0390811682526020808301939093526040918201600090812060018101549092168152603a909352912080546001600160a01b0319169055600281015490915080156119ea5761197a8282611ee3565b506001820154611996906001600160a01b0316826104b0612b15565b6119ea5760018201548254604080518481524760208201526001600160a01b0393841693909216917f7dc5115a5aba081f5a174f56a3d02eea582824783322a4ac03f7bd388f444194910160405180910390a35b6000611a2a878786818110611a0157611a016137ef565b9050602002016020810190611a16919061346f565b60018501546001600160a01b031687612bc0565b90508015611a4f576001830154611a4d906001600160a01b0316826104b0612b15565b505b5050508080611a5d9061381b565b9150506118ee565b507f4f257d3ba23679d338f1d94296086bba5724af341b7fa31aa0ff297bfcdc62d88383604051611a97929190613927565b60405180910390a15b505050565b600260005403611ac75760405162461bcd60e51b815260040161085490613834565b6002600055611ad533610d4f565b15611af55733604051632fc6bfb160e21b8152600401610854919061363e565b606d54811180611b065750606e5481105b15611b2457604051631b8454a360e21b815260040160405180910390fd5b3433611b3581888888888888612cc0565b6001600160a01b0380871660008181526037602081815260408084206001810180549789166001600160a01b0319988916811790915581548816871782558552603a835290842080549096168517909555929091529052611b97818385611e10565b816001600160a01b0316876001600160a01b03167ffc1f1e73948cbc47c5b7f90e5601b7daccd9ad7173218486ccc74bdd051d05e860405160405180910390a350506001600055505050505050565b60d154610100900460ff1615808015611c06575060d154600160ff909116105b80611c205750303b158015611c20575060d15460ff166001145b611c835760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610854565b60d1805460ff191660011790558015611ca65760d1805461ff0019166101001790555b611caf86612b75565b611cb8856124bd565b611cc3600085612381565b611ccc8361256b565b611cd5826125a0565b8015611d1b5760d1805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050505050565b6000600260005403611d475760405162461bcd60e51b815260040161085490613834565b6002600081905550611d8c33848480806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612f4c92505050565b9050611d983382612faf565b600160005592915050565b6000611de285858580806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250612f4c92505050565b6001600160a01b0383166000908152603760205260409020909150611e089086836123f5565b949350505050565b6001830154839083906001600160a01b03808316911614611e4457604051637bc65bd760e11b815260040160405180910390fd5b82856002016000828254611e589190613901565b92505081905550611e7e85858760020154868960030154611e799190613901565b612fd6565b6001600160a01b03808516600090815260058701602052604090819020429055865490519116907f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d90611ed49086815260200190565b60405180910390a25050505050565b6000611ef3836002015483613011565b905080836002016000828254611f099190613914565b9091555050600183015460028401546003850154611f399286926001600160a01b0390911691611e799086613027565b82546040518281526001600160a01b0390911690600080516020613b438339815191529060200160405180910390a292915050565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114611fbb576040519150601f19603f3d011682016040523d82523d6000602084013e611fc0565b606091505b5090949350505050565b6001600160a01b0380851660009081526002602090815260408083209387168352929052908120600381015484900361200557549050611e08565b6001600160a01b03861660009081526003602081815260408084206001808452828620948701548652939092528320918201548392901561206a57805460018601549094506120549085613914565b85600201546120639190613975565b9250612072565b846001015493505b8154600090612082908690613914565b61208c9089613975565b9050670de0b6b3a76400006120a18286613901565b6120ab919061398c565b86546120b79190613901565b9b9a5050505050505050505050565b6001830154839083906001600160a01b038083169116036120fa57604051639feb934760e01b815260040160405180910390fd5b8260000361211b57604051637ab0c6ad60e11b815260040160405180910390fd5b6001600160a01b038416600090815260048601602052604090205483111561215657604051630695534560e31b815260040160405180910390fd5b6036548554604051635061f96960e11b81526001600160a01b039283169263a0c3f2d2926121899291169060040161363e565b602060405180830381865afa1580156121a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121ca919061386b565b801561224b575060365485546040516328bde1e160e01b81526001600160a01b03928316926328bde1e1926122049291169060040161363e565b60e060405180830381865afa158015612221573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061224591906139be565b60a00151155b801561227e57506038546001600160a01b0385166000908152600587016020526040902054429161227b91613901565b10155b1561229c5760405163f19f52bd60e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546122da90869086906122ca908790613914565b868960030154611e799190613914565b84546040518481526001600160a01b03918216918616907f4d10bd049775c77bd7f255195afba5088028ecb3c7c277d393ccff7934f2f92c906020015b60405180910390a35050505050565b600081471015612349576040516304611a4560e11b815260040160405180910390fd5b6110568383611f6e565b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103546001600160a01b031690565b61271081118061239057508082115b156123ae57604051631b8454a360e21b815260040160405180910390fd5b606d819055606e82905560408051838152602081018390527f677752f5bf9541b14288833909e5ec5a478103131c1ec08c4638943be5826c14910160405180910390a15050565b6001830154839083906001600160a01b0380831691160361242957604051639feb934760e01b815260040160405180910390fd5b6001600160a01b03841660009081526004860160205260409020546124679086908690612457908790613901565b868960030154611e799190613901565b6001600160a01b03808516600081815260058801602052604090819020429055875490519216917fe5541a6b6103d4fa7e021ed54fad39c66f27a76bd13d374cf6240ae6bd0bb72b906123179087815260200190565b606c8190556040518181527f372bbdb8d72373b0012f84ee5a11671e5fb72b8bea902ebca93a19cb45d32be2906020015b60405180910390a150565b6036546040805162c080c360e31b815290516000926001600160a01b03169163060406189160048083019260209291908290030181865afa158015612542573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061256691906138a6565b905090565b60388190556040518181527f4956b65267b8f1e642284bcb5037116c69a9c78d9ca576beeae0974737a4872a906020016124ee565b60398190556040518181527f02be0b73b597f2c0f138aebee162b3b0e25d5b5a26854c15dcf79176e9a1c678906020016124ee565b8351821461261e57807fae52c603227f64e4c6101dde593aa9790a16b3ac77546bd746d758511e9560a585858560405161261193929190613aa2565b60405180910390a2612a0d565b600080600080600088516001600160401b0381111561263f5761263f6137d9565b604051908082528060200260200182016040528015612668578160200160208202803683370190505b509050600089516001600160401b03811115612686576126866137d9565b6040519080825280602002602001820160405280156126af578160200160208202803683370190505b50905060008a516001600160401b038111156126cd576126cd6137d9565b6040519080825280602002602001820160405280156126f6578160200160208202803683370190505b50905060005b8b51811015612978578b8181518110612717576127176137ef565b60200260200101519550600060036000886001600160a01b03166001600160a01b031681526020019081526020016000209050612753876111da565b6001600160a01b03881660009081526001602081815260408084208f855290915290912001549096508a90036127c75786838961278f8161381b565b9a50815181106127a1576127a16137ef565b60200260200101906001600160a01b031690816001600160a01b03168152505050612966565b60028101548a11156127f557604080518082019091528681526020018a905260018101869055600281018a90555b60018101541561283f5760018101548c8c84818110612816576128166137ef565b90506020020135670de0b6b3a76400006128309190613975565b61283a919061398c565b612842565b60005b9850888160000160008282546128589190613901565b918290555090508561286a8a85613914565b8151811061287a5761287a6137ef565b6020026020010181815250506040518060400160405280826000015481526020018b81525060016000896001600160a01b03166001600160a01b0316815260200190815260200160002060008c81526020019081526020016000206000820151816000015560208201518160010155905050858160010160000181905550806001016000015484898461290d9190613914565b8151811061291d5761291d6137ef565b6020908102919091010152868d6129348a85613914565b81518110612944576129446137ef565b60200260200101906001600160a01b031690816001600160a01b031681525050505b806129708161381b565b9150506126fc565b5085156129c157858152858b51038b52877fee74f10cc50bf4b7e57fd36be7d46288795f3a9151dae97505b718b392ba14a3826040516129b89190613aec565b60405180910390a25b8a5115612a0557877f0e54e0485f70f0f63bc25889ddbf01ce1269ad6f07fdb2df573a0fbdb4d66f888c85856040516129fc93929190613aff565b60405180910390a25b505050505050505b50505050565b6001830154839083906001600160a01b03808316911614612a4757604051637bc65bd760e11b815260040160405180910390fd5b8460020154831115612a6c57604051630a8d7fa760e21b815260040160405180910390fd5b6038546001600160a01b03851660009081526005870160205260409020544291612a9591613901565b1115612ab4576040516303db082960e11b815260040160405180910390fd5b82856002016000828254612ac89190613914565b92505081905550612ae985858760020154868960030154611e799190613914565b84546040518481526001600160a01b0390911690600080516020613b4383398151915290602001611ed4565b6000836001600160a01b0316838390604051600060405180830381858888f193505050503d8060008114612b65576040519150601f19603f3d011682016040523d82523d6000602084013e612b6a565b606091505b509095945050505050565b603680546001600160a01b0319166001600160a01b0383161790556040517fef40dc07567635f84f5edbd2f8dbc16b40d9d282dd8e7e6f4ff58236b6836169906124ee90839061363e565b600080612bcd858561116a565b9050612bdb85858584611fca565b9150836001600160a01b0316856001600160a01b03167f0aa4d283470c904c551d18bb894d37e17674920f3261a7f854be501e25f421b784604051612c2291815260200190565b60405180910390a36001600160a01b03808616600081815260026020908152604080832094891683529381528382208281559282526003905291909120612c6c9082868580613041565b60038181018590556001600160a01b0387811660008181526020938452604080822054600187015551908152918816929091600080516020613b63833981519152910160405180910390a350509392505050565b612ccb876000611f6e565b612d16576040805163338f030160e01b81526001600160a01b03891660048201526024810191909152600a6044820152693837b7b61030b236b4b760b11b6064820152608401610854565b612d21846000611f6e565b612d6a576040805163338f030160e01b81526001600160a01b038616600482015260248101919091526008604482015267747265617375727960c01b6064820152608401610854565b606c54811015612d8d57604051630a8d7fa760e21b815260040160405180910390fd5b856001600160a01b0316876001600160a01b0316141580612dc05750836001600160a01b0316866001600160a01b031614155b15612dde5760405163dc1d04ff60e01b815260040160405180910390fd5b60408051600380825260808201909252600091602082016060803683370190505090508781600081518110612e1557612e156137ef565b60200260200101906001600160a01b031690816001600160a01b0316815250508581600181518110612e4957612e496137ef565b60200260200101906001600160a01b031690816001600160a01b0316815250508381600281518110612e7d57612e7d6137ef565b60200260200101906001600160a01b031690816001600160a01b031681525050612ea6816130d3565b15612ec4576040516329d55f9360e11b815260040160405180910390fd5b6036546040516302209ca560e31b81526001600160a01b0389811660048301528881166024830152878116604483015286811660648301526084820186905290911690631104e5289060a401600060405180830381600087803b158015612f2a57600080fd5b505af1158015612f3e573d6000803e3d6000fd5b505050505050505050505050565b600080612f576124f9565b905060005b8351811015612fa757612f89848281518110612f7a57612f7a6137ef565b60200260200101518684612bc0565b612f939084613901565b925080612f9f8161381b565b915050612f5c565b505092915050565b612fb98282612326565b610b4757604051630c3e69bb60e11b815260040160405180910390fd5b8354612fec906001600160a01b0316848461319a565b60038401556001600160a01b0390911660009081526004909201602052604090912055565b60008183106130205781611056565b5090919050565b6000818311613037576000611056565b6110568284613914565b828460030154101561305557600284018190555b6000613065856002015484613011565b905060008186600201546130799190613914565b905080156130ca576002860182905560018701548111156130ad576040516352e521bf60e11b815260040160405180910390fd5b808760010160000160008282546130c49190613914565b90915550505b50505050505050565b600081516000036130e657506000919050565b60005b600183516130f79190613914565b81101561319157600061310b826001613901565b90505b835181101561317e57838181518110613129576131296137ef565b60200260200101516001600160a01b031684838151811061314c5761314c6137ef565b60200260200101516001600160a01b03160361316c575060019392505050565b806131768161381b565b91505061310e565b50806131898161381b565b9150506130e9565b50600092915050565b60006131a46124f9565b6001600160a01b03851660009081526003602052604090206001810154600282015492935090918311156131ff5760405180604001604052806131e6886111da565b8152602090810185905281516001850155015160028301555b6001600160a01b038087166000908152600260209081526040808320938916835292905290812090613231888861116a565b9050600061324189898885611fca565b83549091508114613281578083556040518181526001600160a01b0389811691908b1690600080516020613b638339815191529060200160405180910390a35b61328e8584888a86613041565b84546001808501919091556003840187905585015484146132f557886001600160a01b0316867f81faf50e2aaf52eaba2ab841071efb9f6f0850a3e7d008b1336e6001d3d4963c87600101600001546040516132ec91815260200190565b60405180910390a35b505050505050505050565b60008083601f84011261331257600080fd5b5081356001600160401b0381111561332957600080fd5b6020830191508360208260051b850101111561334457600080fd5b9250929050565b6000806000806040858703121561336157600080fd5b84356001600160401b038082111561337857600080fd5b61338488838901613300565b9096509450602087013591508082111561339d57600080fd5b506133aa87828801613300565b95989497509550505050565b600081518084526020808501945080840160005b838110156133e6578151875295820195908201906001016133ca565b509495945050505050565b60208152600061105660208301846133b6565b6001600160a01b038116811461103a57600080fd5b60008060006040848603121561342e57600080fd5b83356001600160401b0381111561344457600080fd5b61345086828701613300565b909450925050602084013561346481613404565b809150509250925092565b60006020828403121561348157600080fd5b813561348c81613404565b9392505050565b600080604083850312156134a657600080fd5b82356134b181613404565b946020939093013593505050565b6000806000604084860312156134d457600080fd5b83356134df81613404565b925060208401356001600160401b038111156134fa57600080fd5b61350686828701613300565b9497909650939450505050565b6000806020838503121561352657600080fd5b82356001600160401b0381111561353c57600080fd5b61354885828601613300565b90969095509350505050565b6000806040838503121561356757600080fd5b50508035926020909101359150565b60006020828403121561358857600080fd5b5035919050565b600080604083850312156135a257600080fd5b82356135ad81613404565b915060208301356135bd81613404565b809150509250929050565b6000806000606084860312156135dd57600080fd5b83356135e881613404565b925060208401356135f881613404565b929592945050506040919091013590565b60008060006060848603121561361e57600080fd5b833561362981613404565b95602085013595506040909401359392505050565b6001600160a01b0391909116815260200190565b60008060008060006060868803121561366a57600080fd5b85356001600160401b038082111561368157600080fd5b61368d89838a01613300565b909750955060208801359150808211156136a657600080fd5b506136b388828901613300565b96999598509660400135949350505050565b6001600160a01b039390931683526020830191909152604082015260600190565b6000806000604084860312156136fb57600080fd5b83356001600160401b0381111561371157600080fd5b61371d86828701613300565b909790965060209590950135949350505050565b600080600080600060a0868803121561374957600080fd5b853561375481613404565b9450602086013561376481613404565b9350604086013561377481613404565b9250606086013561378481613404565b949793965091946080013592915050565b600080600080600060a086880312156137ad57600080fd5b85356137b881613404565b97602087013597506040870135966060810135965060800135945092505050565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60006001820161382d5761382d613805565b5060010190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60006020828403121561387d57600080fd5b8151801515811461348c57600080fd5b6001600160a01b03929092168252602082015260400190565b6000602082840312156138b857600080fd5b5051919050565b60208082526022908201527f48617350726f787941646d696e3a20756e617574686f72697a65642073656e6460408201526132b960f11b606082015260800190565b8082018082111561105957611059613805565b8181038181111561105957611059613805565b60208082528181018390526000908460408401835b8681101561396a57823561394f81613404565b6001600160a01b03168252918301919083019060010161393c565b509695505050505050565b808202811582820484141761105957611059613805565b6000826139a957634e487b7160e01b600052601260045260246000fd5b500490565b80516139b981613404565b919050565b600060e082840312156139d057600080fd5b60405160e081016001600160401b0381118282101715613a0057634e487b7160e01b600052604160045260246000fd5b604052613a0c836139ae565b8152613a1a602084016139ae565b6020820152613a2b604084016139ae565b6040820152613a3c606084016139ae565b60608201526080830151608082015260a083015160a082015260c083015160c08201528091505092915050565b600081518084526020808501945080840160005b838110156133e65781516001600160a01b031687529582019590820190600101613a7d565b604081526000613ab56040830186613a69565b82810360208401528381526001600160fb1b03841115613ad457600080fd5b8360051b808660208401370160200195945050505050565b6020815260006110566020830184613a69565b606081526000613b126060830186613a69565b8281036020840152613b2481866133b6565b90508281036040840152613b3881856133b6565b969550505050505056fe0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f75aa7c29611027fd4be148712bb54960253b7a7d5998c17769bfc424c2f5f185ada264697066735822122084a2646a7e3b284e947649e3c4cea51c75829bcabae922a4d19175bd5ef9292564736f6c63430008110033", "devdoc": { "errors": { "ErrAdminOfAnyActivePoolForbidden(address)": [ @@ -1450,6 +1466,9 @@ "execRecordRewards(address[],uint256[],uint256)": { "details": "Records the amount of rewards `_rewards` for the pools `_consensusAddrs`. Requirements: - The method caller must be validator contract. Emits the event `PoolsUpdated` once the contract recorded the rewards successfully. Emits the event `PoolsUpdateFailed` once the input array lengths are not equal. Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period. Note: This method should be called once at the period ending." }, + "getCommissionRateRange()": { + "details": "Returns the commission rate range that the candidate can set." + }, "getManySelfStakings(address[])": { "details": "Returns the self-staking amounts of the pools." }, @@ -1483,9 +1502,6 @@ "isAdminOfActivePool(address)": { "details": "Returns whether the `_poolAdminAddr` is currently active." }, - "maxCommissionRate()": { - "details": "Returns the max commission rate that the candidate can set." - }, "minValidatorStakingAmount()": { "details": "Returns the minimum threshold for being a validator candidate." }, @@ -1501,12 +1517,12 @@ "requestUpdateCommissionRate(address,uint256,uint256)": { "details": "Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}. Requirements: - The consensus address is a validator candidate. - The method caller is the pool admin. - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}. - The `_rate` must be in range of [0_00; 100_00]. Emits the event `CommissionRateUpdated`." }, + "setCommissionRateRange(uint256,uint256)": { + "details": "Sets the commission rate range that a candidate can set. Requirements: - The method caller is admin. Emits the `CommissionRateRangeUpdated` event." + }, "setCooldownSecsToUndelegate(uint256)": { "details": "Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated. Requirements: - The method caller is admin. Emits the event `CooldownSecsToUndelegateUpdated`." }, - "setMaxCommissionRate(uint256)": { - "details": "Sets the max commission rate that a candidate can set. Requirements: - The method caller is admin. Emits the `MaxCommissionRateUpdated` event." - }, "setMinValidatorStakingAmount(uint256)": { "details": "Sets the minimum threshold for being a validator candidate. Requirements: - The method caller is admin. Emits the `MinValidatorStakingAmountUpdated` event." }, @@ -1550,7 +1566,7 @@ "type": "t_uint256" }, { - "astId": 29125, + "astId": 29207, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_accumulatedRps", "offset": 0, @@ -1558,23 +1574,23 @@ "type": "t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10552_storage))" }, { - "astId": 29133, + "astId": 29215, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_userReward", "offset": 0, "slot": "2", - "type": "t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11326_storage))" + "type": "t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11332_storage))" }, { - "astId": 29139, + "astId": 29221, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_stakingPool", "offset": 0, "slot": "3", - "type": "t_mapping(t_address,t_struct(PoolFields)11332_storage)" + "type": "t_mapping(t_address,t_struct(PoolFields)11338_storage)" }, { - "astId": 29144, + "astId": 29226, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "______gap", "offset": 0, @@ -1587,10 +1603,10 @@ "label": "_validatorContract", "offset": 0, "slot": "54", - "type": "t_contract(IRoninValidatorSet)11967" + "type": "t_contract(IRoninValidatorSet)11973" }, { - "astId": 27429, + "astId": 27475, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_stakingPool", "offset": 0, @@ -1598,7 +1614,7 @@ "type": "t_mapping(t_address,t_struct(PoolDetail)10939_storage)" }, { - "astId": 27432, + "astId": 27478, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_cooldownSecsToUndelegate", "offset": 0, @@ -1606,7 +1622,7 @@ "type": "t_uint256" }, { - "astId": 27435, + "astId": 27481, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_waitingSecsToRevoke", "offset": 0, @@ -1614,7 +1630,7 @@ "type": "t_uint256" }, { - "astId": 27440, + "astId": 27486, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_adminOfActivePoolMapping", "offset": 0, @@ -1622,7 +1638,7 @@ "type": "t_mapping(t_address,t_address)" }, { - "astId": 27445, + "astId": 27491, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "______gap", "offset": 0, @@ -1630,7 +1646,7 @@ "type": "t_array(t_uint256)49_storage" }, { - "astId": 27881, + "astId": 27927, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_minValidatorStakingAmount", "offset": 0, @@ -1638,7 +1654,7 @@ "type": "t_uint256" }, { - "astId": 27884, + "astId": 27930, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "_maxCommissionRate", "offset": 0, @@ -1646,15 +1662,23 @@ "type": "t_uint256" }, { - "astId": 27889, + "astId": 27933, "contract": "contracts/ronin/staking/Staking.sol:Staking", - "label": "______gap", + "label": "_minCommissionRate", "offset": 0, "slot": "110", - "type": "t_array(t_uint256)49_storage" + "type": "t_uint256" }, { - "astId": 28612, + "astId": 27938, + "contract": "contracts/ronin/staking/Staking.sol:Staking", + "label": "______gap", + "offset": 0, + "slot": "111", + "type": "t_array(t_uint256)48_storage" + }, + { + "astId": 28680, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "______gap", "offset": 0, @@ -1684,6 +1708,12 @@ "label": "address", "numberOfBytes": "20" }, + "t_array(t_uint256)48_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[48]", + "numberOfBytes": "1536" + }, "t_array(t_uint256)49_storage": { "base": "t_uint256", "encoding": "inplace", @@ -1701,7 +1731,7 @@ "label": "bool", "numberOfBytes": "1" }, - "t_contract(IRoninValidatorSet)11967": { + "t_contract(IRoninValidatorSet)11973": { "encoding": "inplace", "label": "contract IRoninValidatorSet", "numberOfBytes": "20" @@ -1713,12 +1743,12 @@ "numberOfBytes": "32", "value": "t_address" }, - "t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11326_storage))": { + "t_mapping(t_address,t_mapping(t_address,t_struct(UserRewardFields)11332_storage))": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => mapping(address => struct IRewardPool.UserRewardFields))", "numberOfBytes": "32", - "value": "t_mapping(t_address,t_struct(UserRewardFields)11326_storage)" + "value": "t_mapping(t_address,t_struct(UserRewardFields)11332_storage)" }, "t_mapping(t_address,t_mapping(t_uint256,t_struct(PeriodWrapper)10552_storage))": { "encoding": "mapping", @@ -1734,19 +1764,19 @@ "numberOfBytes": "32", "value": "t_struct(PoolDetail)10939_storage" }, - "t_mapping(t_address,t_struct(PoolFields)11332_storage)": { + "t_mapping(t_address,t_struct(PoolFields)11338_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct IRewardPool.PoolFields)", "numberOfBytes": "32", - "value": "t_struct(PoolFields)11332_storage" + "value": "t_struct(PoolFields)11338_storage" }, - "t_mapping(t_address,t_struct(UserRewardFields)11326_storage)": { + "t_mapping(t_address,t_struct(UserRewardFields)11332_storage)": { "encoding": "mapping", "key": "t_address", "label": "mapping(address => struct IRewardPool.UserRewardFields)", "numberOfBytes": "32", - "value": "t_struct(UserRewardFields)11326_storage" + "value": "t_struct(UserRewardFields)11332_storage" }, "t_mapping(t_address,t_uint256)": { "encoding": "mapping", @@ -1840,12 +1870,12 @@ ], "numberOfBytes": "192" }, - "t_struct(PoolFields)11332_storage": { + "t_struct(PoolFields)11338_storage": { "encoding": "inplace", "label": "struct IRewardPool.PoolFields", "members": [ { - "astId": 11328, + "astId": 11334, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "aRps", "offset": 0, @@ -1853,7 +1883,7 @@ "type": "t_uint256" }, { - "astId": 11331, + "astId": 11337, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "shares", "offset": 0, @@ -1863,12 +1893,12 @@ ], "numberOfBytes": "96" }, - "t_struct(UserRewardFields)11326_storage": { + "t_struct(UserRewardFields)11332_storage": { "encoding": "inplace", "label": "struct IRewardPool.UserRewardFields", "members": [ { - "astId": 11319, + "astId": 11325, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "debited", "offset": 0, @@ -1876,7 +1906,7 @@ "type": "t_uint256" }, { - "astId": 11321, + "astId": 11327, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "aRps", "offset": 0, @@ -1884,7 +1914,7 @@ "type": "t_uint256" }, { - "astId": 11323, + "astId": 11329, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "lowestAmount", "offset": 0, @@ -1892,7 +1922,7 @@ "type": "t_uint256" }, { - "astId": 11325, + "astId": 11331, "contract": "contracts/ronin/staking/Staking.sol:Staking", "label": "lastPeriod", "offset": 0, diff --git a/deployments/ronin-mainnet/solcInputs/2a8db5de0d3bfe0cb40ba15ae8460f16.json b/deployments/ronin-mainnet/solcInputs/2a8db5de0d3bfe0cb40ba15ae8460f16.json new file mode 100644 index 000000000..7f59df0b6 --- /dev/null +++ b/deployments/ronin-mainnet/solcInputs/2a8db5de0d3bfe0cb40ba15ae8460f16.json @@ -0,0 +1,525 @@ +{ + "language": "Solidity", + "sources": { + "contracts/extensions/bridge-operator-governance/BOsGovernanceProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../libraries/BridgeOperatorsBallot.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\n\nabstract contract BOsGovernanceProposal is SignatureConsumer, IRoninGovernanceAdmin {\n using IsolatedGovernance for IsolatedGovernance.Vote;\n\n /// @dev The last the brige operator set info.\n BridgeOperatorsBallot.BridgeOperatorSet internal _lastSyncedBridgeOperatorSetInfo;\n /// @dev Mapping from period index => epoch index => bridge operators vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) internal _bridgeOperatorVote;\n /// @dev Mapping from bridge voter address => last block that the address voted\n mapping(address => uint256) internal _lastVotedBlock;\n /// @dev Mapping from period index => epoch index => voter => bridge voter signatures\n mapping(uint256 => mapping(uint256 => mapping(address => Signature))) internal _bridgeVoterSig;\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256) {\n return _lastVotedBlock[_bridgeVoter];\n }\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function lastSyncedBridgeOperatorSetInfo() external view returns (BridgeOperatorsBallot.BridgeOperatorSet memory) {\n return _lastSyncedBridgeOperatorSetInfo;\n }\n\n /**\n * @dev Votes for a set of bridge operators by signatures.\n *\n * Requirements:\n * - The period of voting is larger than the last synced period.\n * - The arrays are not empty.\n * - The signature signers are in order.\n *\n */\n function _castBOVotesBySignatures(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures,\n uint256 _minimumVoteWeight,\n bytes32 _domainSeperator\n ) internal {\n require(\n _ballot.period >= _lastSyncedBridgeOperatorSetInfo.period &&\n _ballot.epoch >= _lastSyncedBridgeOperatorSetInfo.epoch,\n \"BOsGovernanceProposal: query for outdated bridge operator set\"\n );\n BridgeOperatorsBallot.verifyBallot(_ballot);\n require(_signatures.length > 0, \"BOsGovernanceProposal: invalid array length\");\n\n address _signer;\n address _lastSigner;\n bytes32 _hash = BridgeOperatorsBallot.hash(_ballot);\n bytes32 _digest = ECDSA.toTypedDataHash(_domainSeperator, _hash);\n IsolatedGovernance.Vote storage _v = _bridgeOperatorVote[_ballot.period][_ballot.epoch];\n mapping(address => Signature) storage _sigMap = _bridgeVoterSig[_ballot.period][_ballot.epoch];\n bool _hasValidVotes;\n\n for (uint256 _i; _i < _signatures.length; _i++) {\n // Avoids stack too deeps\n {\n Signature calldata _sig = _signatures[_i];\n _signer = ECDSA.recover(_digest, _sig.v, _sig.r, _sig.s);\n require(_lastSigner < _signer, \"BOsGovernanceProposal: invalid signer order\");\n _lastSigner = _signer;\n }\n\n if (_isBridgeVoter(_signer)) {\n _hasValidVotes = true;\n _lastVotedBlock[_signer] = block.number;\n _sigMap[_signer] = _signatures[_i];\n _v.castVote(_signer, _hash);\n }\n }\n\n require(_hasValidVotes, \"BOsGovernanceProposal: invalid signatures\");\n address[] memory _filteredVoters = _v.filterByHash(_hash);\n _v.syncVoteStatus(_minimumVoteWeight, _sumBridgeVoterWeights(_filteredVoters), 0, 0, _hash);\n }\n\n /**\n * @dev Returns whether the address is the bridge voter.\n */\n function _isBridgeVoter(address) internal view virtual returns (bool);\n\n /**\n * @dev Returns the weight of many bridge voters.\n */\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual returns (uint256);\n}\n" + }, + "contracts/interfaces/consumers/SignatureConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface SignatureConsumer {\n struct Signature {\n uint8 v;\n bytes32 r;\n bytes32 s;\n }\n}\n" + }, + "contracts/libraries/BridgeOperatorsBallot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary BridgeOperatorsBallot {\n struct BridgeOperatorSet {\n uint256 period;\n uint256 epoch;\n address[] operators;\n }\n\n // keccak256(\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\");\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\n\n /**\n * @dev Verifies whether the ballot is valid or not.\n *\n * Requirements:\n * - The ballot is not for an empty operator set.\n * - The operator address list is in order.\n *\n */\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\n require(_ballot.operators.length > 0, \"BridgeOperatorsBallot: invalid array length\");\n address _addr = _ballot.operators[0];\n for (uint _i = 1; _i < _ballot.operators.length; _i++) {\n require(_addr < _ballot.operators[_i], \"BridgeOperatorsBallot: invalid order of bridge operators\");\n _addr = _ballot.operators[_i];\n }\n }\n\n /**\n * @dev Returns hash of the ballot.\n */\n function hash(BridgeOperatorSet calldata _ballot) internal pure returns (bytes32) {\n bytes32 _operatorsHash;\n address[] memory _operators = _ballot.operators;\n\n assembly {\n _operatorsHash := keccak256(add(_operators, 32), mul(mload(_operators), 32))\n }\n\n return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\n }\n}\n" + }, + "contracts/interfaces/IRoninGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/BridgeOperatorsBallot.sol\";\n\ninterface IRoninGovernanceAdmin {\n /// @dev Emitted when the bridge operators are approved.\n event BridgeOperatorsApproved(uint256 _period, uint256 _epoch, address[] _operators);\n /// @dev Emitted when an emergency exit poll is created.\n event EmergencyExitPollCreated(\n bytes32 _voteHash,\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n );\n /// @dev Emitted when an emergency exit poll is approved.\n event EmergencyExitPollApproved(bytes32 _voteHash);\n /// @dev Emitted when an emergency exit poll is expired.\n event EmergencyExitPollExpired(bytes32 _voteHash);\n\n /**\n * @dev Returns the last voted block of the bridge voter.\n */\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256);\n\n /**\n * @dev Returns the synced bridge operator set info.\n */\n function lastSyncedBridgeOperatorSetInfo()\n external\n view\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory _bridgeOperatorSetInfo);\n\n /**\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n */\n function createEmergencyExitPoll(\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) external;\n}\n" + }, + "contracts/libraries/IsolatedGovernance.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../interfaces/consumers/VoteStatusConsumer.sol\";\n\nlibrary IsolatedGovernance {\n struct Vote {\n VoteStatusConsumer.VoteStatus status;\n bytes32 finalHash;\n /// @dev Mapping from voter => receipt hash\n mapping(address => bytes32) voteHashOf;\n /// @dev The timestamp that voting is expired (no expiration=0)\n uint256 expiredAt;\n /// @dev The timestamp that voting is created\n uint256 createdAt;\n /// @dev The list of voters\n address[] voters;\n }\n\n /**\n * @dev Casts vote for the receipt with the receipt hash `_hash`.\n *\n * Requirements:\n * - The voter has not voted for the round.\n *\n */\n function castVote(\n Vote storage _v,\n address _voter,\n bytes32 _hash\n ) internal {\n if (_v.expiredAt > 0 && _v.expiredAt <= block.timestamp) {\n _v.status = VoteStatusConsumer.VoteStatus.Expired;\n }\n\n if (voted(_v, _voter)) {\n revert(\n string(abi.encodePacked(\"IsolatedGovernance: \", Strings.toHexString(uint160(_voter), 20), \" already voted\"))\n );\n }\n\n _v.voteHashOf[_voter] = _hash;\n _v.voters.push(_voter);\n }\n\n /**\n * @dev Updates vote with the requirement of minimum vote weight.\n */\n function syncVoteStatus(\n Vote storage _v,\n uint256 _minimumVoteWeight,\n uint256 _votedWeightForHash,\n uint256 _minimumTrustedVoteWeight,\n uint256 _trustedVotedWeightForHash,\n bytes32 _hash\n ) internal returns (VoteStatusConsumer.VoteStatus _status) {\n if (\n _votedWeightForHash >= _minimumVoteWeight &&\n _trustedVotedWeightForHash >= _minimumTrustedVoteWeight &&\n _v.status == VoteStatusConsumer.VoteStatus.Pending\n ) {\n _v.status = VoteStatusConsumer.VoteStatus.Approved;\n _v.finalHash = _hash;\n }\n\n return _v.status;\n }\n\n /**\n * @dev Returns the list of vote's addresses that voted for the hash `_hash`.\n */\n function filterByHash(Vote storage _v, bytes32 _hash) internal view returns (address[] memory _voters) {\n uint256 _count;\n _voters = new address[](_v.voters.length);\n\n for (uint _i; _i < _voters.length; _i++) {\n address _voter = _v.voters[_i];\n if (_v.voteHashOf[_voter] == _hash) {\n _voters[_count++] = _voter;\n }\n }\n\n assembly {\n mstore(_voters, _count)\n }\n }\n\n /**\n * @dev Returns whether the voter casted for the proposal.\n */\n function voted(Vote storage _v, address _voter) internal view returns (bool) {\n return _v.voteHashOf[_voter] != bytes32(0);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/interfaces/consumers/VoteStatusConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface VoteStatusConsumer {\n enum VoteStatus {\n Pending,\n Approved,\n Executed,\n Rejected,\n Expired\n }\n}\n" + }, + "contracts/ronin/RoninGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../extensions/bridge-operator-governance/BOsGovernanceProposal.sol\";\nimport \"../extensions/sequential-governance/GovernanceProposal.sol\";\nimport \"../extensions/collections/HasValidatorContract.sol\";\nimport \"../extensions/GovernanceAdmin.sol\";\nimport \"../libraries/EmergencyExitBallot.sol\";\nimport \"../interfaces/IRoninGovernanceAdmin.sol\";\n\ncontract RoninGovernanceAdmin is\n IRoninGovernanceAdmin,\n GovernanceAdmin,\n GovernanceProposal,\n BOsGovernanceProposal,\n HasValidatorContract\n{\n using Proposal for Proposal.ProposalDetail;\n using IsolatedGovernance for IsolatedGovernance.Vote;\n\n /// @dev Mapping from request hash => emergency poll\n mapping(bytes32 => IsolatedGovernance.Vote) internal _emergencyExitPoll;\n\n modifier onlyGovernor() {\n require(_getWeight(msg.sender) > 0, \"RoninGovernanceAdmin: sender is not governor\");\n _;\n }\n\n constructor(\n uint256 _roninChainId,\n address _roninTrustedOrganizationContract,\n address _bridgeContract,\n address _validatorContract,\n uint256 _proposalExpiryDuration\n ) GovernanceAdmin(_roninChainId, _roninTrustedOrganizationContract, _bridgeContract, _proposalExpiryDuration) {\n _setValidatorContract(_validatorContract);\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function setValidatorContract(address _addr) external override onlySelfCall {\n require(_addr.code.length > 0, \"RoninGovernanceAdmin: set to non-contract\");\n _setValidatorContract(_addr);\n }\n\n /**\n * @dev Returns the voted signatures for the proposals.\n *\n * Note: The signatures can be empty in case the proposal is voted on the current network.\n *\n */\n function getProposalSignatures(uint256 _chainId, uint256 _round)\n external\n view\n returns (\n address[] memory _voters,\n Ballot.VoteType[] memory _supports,\n Signature[] memory _signatures\n )\n {\n ProposalVote storage _vote = vote[_chainId][_round];\n\n uint256 _forLength = _vote.forVoteds.length;\n uint256 _againstLength = _vote.againstVoteds.length;\n uint256 _voterLength = _forLength + _againstLength;\n\n _supports = new Ballot.VoteType[](_voterLength);\n _signatures = new Signature[](_voterLength);\n _voters = new address[](_voterLength);\n for (uint256 _i; _i < _forLength; _i++) {\n _supports[_i] = Ballot.VoteType.For;\n _signatures[_i] = vote[_chainId][_round].sig[_vote.forVoteds[_i]];\n _voters[_i] = _vote.forVoteds[_i];\n }\n for (uint256 _i; _i < _againstLength; _i++) {\n _supports[_i + _forLength] = Ballot.VoteType.Against;\n _signatures[_i + _forLength] = vote[_chainId][_round].sig[_vote.againstVoteds[_i]];\n _voters[_i + _forLength] = _vote.againstVoteds[_i];\n }\n }\n\n /**\n * @dev Returns the voted signatures for bridge operators at a specific period.\n */\n function getBridgeOperatorVotingSignatures(uint256 _period, uint256 _epoch)\n external\n view\n returns (address[] memory _voters, Signature[] memory _signatures)\n {\n mapping(address => Signature) storage _sigMap = _bridgeVoterSig[_period][_epoch];\n _voters = _bridgeOperatorVote[_period][_epoch].voters;\n _signatures = new Signature[](_voters.length);\n for (uint _i; _i < _voters.length; _i++) {\n _signatures[_i] = _sigMap[_voters[_i]];\n }\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for the proposal.\n */\n function proposalVoted(\n uint256 _chainId,\n uint256 _round,\n address _voter\n ) external view returns (bool) {\n return _voted(vote[_chainId][_round], _voter);\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for bridge operators at a specific period.\n */\n function bridgeOperatorsVoted(\n uint256 _period,\n uint256 _epoch,\n address _voter\n ) external view returns (bool) {\n return _bridgeOperatorVote[_period][_epoch].voted(_voter);\n }\n\n /**\n * @dev Returns whether the voter casted vote for emergency exit poll.\n */\n function emergencyPollVoted(bytes32 _voteHash, address _voter) external view returns (bool) {\n return _emergencyExitPoll[_voteHash].voted(_voter);\n }\n\n /**\n * @dev See `CoreGovernance-_proposeProposal`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function propose(\n uint256 _chainId,\n uint256 _expiryTimestamp,\n address[] calldata _targets,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts\n ) external onlyGovernor {\n _proposeProposal(_chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts, msg.sender);\n }\n\n /**\n * @dev See `GovernanceProposal-_proposeProposalStructAndCastVotes`.\n *\n * Requirements:\n * - The method caller is governor.\n * - The proposal is for the current network.\n *\n */\n function proposeProposalStructAndCastVotes(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyGovernor {\n _proposeProposalStructAndCastVotes(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender);\n }\n\n /**\n * @dev Proposes and casts vote for a proposal on the current network.\n *\n * Requirements:\n * - The method caller is governor.\n * - The proposal is for the current network.\n *\n */\n function proposeProposalForCurrentNetwork(\n uint256 _expiryTimestamp,\n address[] calldata _targets,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts,\n Ballot.VoteType _support\n ) external onlyGovernor {\n address _voter = msg.sender;\n Proposal.ProposalDetail memory _proposal = _proposeProposal(\n block.chainid,\n _expiryTimestamp,\n _targets,\n _values,\n _calldatas,\n _gasAmounts,\n _voter\n );\n _castProposalVoteForCurrentNetwork(_voter, _proposal, _support);\n }\n\n /**\n * @dev Casts vote for a proposal on the current network.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function castProposalVoteForCurrentNetwork(Proposal.ProposalDetail calldata _proposal, Ballot.VoteType _support)\n external\n onlyGovernor\n {\n _castProposalVoteForCurrentNetwork(msg.sender, _proposal, _support);\n }\n\n /**\n * @dev See `GovernanceProposal-_castProposalBySignatures`.\n */\n function castProposalBySignatures(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external {\n _castProposalBySignatures(_proposal, _supports, _signatures, DOMAIN_SEPARATOR);\n }\n\n /**\n * @dev See `CoreGovernance-_proposeGlobal`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function proposeGlobal(\n uint256 _expiryTimestamp,\n GlobalProposal.TargetOption[] calldata _targetOptions,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts\n ) external onlyGovernor {\n _proposeGlobal(\n _expiryTimestamp,\n _targetOptions,\n _values,\n _calldatas,\n _gasAmounts,\n roninTrustedOrganizationContract(),\n bridgeContract(),\n msg.sender\n );\n }\n\n /**\n * @dev See `GovernanceProposal-_proposeGlobalProposalStructAndCastVotes`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function proposeGlobalProposalStructAndCastVotes(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyGovernor {\n _proposeGlobalProposalStructAndCastVotes(\n _globalProposal,\n _supports,\n _signatures,\n DOMAIN_SEPARATOR,\n roninTrustedOrganizationContract(),\n bridgeContract(),\n msg.sender\n );\n }\n\n /**\n * @dev See `GovernanceProposal-_castGlobalProposalBySignatures`.\n */\n function castGlobalProposalBySignatures(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external {\n _castGlobalProposalBySignatures(\n _globalProposal,\n _supports,\n _signatures,\n DOMAIN_SEPARATOR,\n roninTrustedOrganizationContract(),\n bridgeContract()\n );\n }\n\n /**\n * @dev Deletes the expired proposal by its chainId and nonce, without creating a new proposal.\n *\n * Requirements:\n * - The proposal is already created.\n *\n */\n function deleteExpired(uint256 _chainId, uint256 _round) external {\n ProposalVote storage _vote = vote[_chainId][_round];\n require(_vote.hash != bytes32(0), \"RoninGovernanceAdmin: query for empty voting\");\n _tryDeleteExpiredVotingRound(_vote);\n }\n\n /**\n * @dev See `BOsGovernanceProposal-_castVotesBySignatures`.\n */\n function voteBridgeOperatorsBySignatures(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures\n ) external {\n _castBOVotesBySignatures(_ballot, _signatures, _getMinimumVoteWeight(), DOMAIN_SEPARATOR);\n IsolatedGovernance.Vote storage _v = _bridgeOperatorVote[_ballot.period][_ballot.epoch];\n if (_v.status == VoteStatus.Approved) {\n _lastSyncedBridgeOperatorSetInfo = _ballot;\n emit BridgeOperatorsApproved(_ballot.period, _ballot.epoch, _ballot.operators);\n _v.status = VoteStatus.Executed;\n }\n }\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function createEmergencyExitPoll(\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) external onlyValidatorContract {\n bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\n IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash];\n _v.createdAt = block.timestamp;\n _v.expiredAt = _expiredAt;\n emit EmergencyExitPollCreated(_hash, _consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\n }\n\n /**\n * @dev Votes for an emergency exit. Executes to unlock fund for the emergency exit's requester.\n *\n * Requirements:\n * - The voter is governor.\n * - The voting is existent.\n * - The voting is not expired yet.\n *\n */\n function voteEmergencyExit(\n bytes32 _voteHash,\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) external onlyGovernor {\n address _voter = msg.sender;\n bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\n require(_voteHash == _hash, \"RoninGovernanceAdmin: invalid vote hash\");\n\n IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash];\n require(_v.createdAt > 0, \"RoninGovernanceAdmin: query for non-existent vote\");\n require(_v.status != VoteStatus.Expired, \"RoninGovernanceAdmin: query for expired vote\");\n\n _v.castVote(_voter, _hash);\n address[] memory _voters = _v.filterByHash(_hash);\n VoteStatus _stt = _v.syncVoteStatus(_getMinimumVoteWeight(), _sumGovernorWeights(_voters), 0, 0, _hash);\n if (_stt == VoteStatus.Approved) {\n _execReleaseLockedFundForEmergencyExitRequest(_consensusAddr, _recipientAfterUnlockedFund);\n emit EmergencyExitPollApproved(_hash);\n _v.status = VoteStatus.Executed;\n } else if (_stt == VoteStatus.Expired) {\n emit EmergencyExitPollExpired(_hash);\n }\n }\n\n /**\n * @inheritdoc GovernanceProposal\n */\n function _getWeight(address _governor) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.getGovernorWeight.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governor)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Returns the total weight of a list address of governors.\n */\n function _sumGovernorWeights(address[] memory _governors) internal view virtual returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumGovernorWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governors)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Returns the bridge voter weight.\n */\n function _getBridgeVoterWeight(address _governor) internal view virtual returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.getBridgeVoterWeight.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governor)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @inheritdoc BOsGovernanceProposal\n */\n function _isBridgeVoter(address _addr) internal view virtual override returns (bool) {\n return _getBridgeVoterWeight(_addr) > 0;\n }\n\n /**\n * @inheritdoc BOsGovernanceProposal\n */\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumBridgeVoterWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _bridgeVoters)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Trigger function from validator contract to unlock fund for emeregency exit request.\n */\n function _execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address _recipientAfterUnlockedFund)\n internal\n virtual\n {\n bytes4 _selector = _validatorContract.execReleaseLockedFundForEmergencyExitRequest.selector;\n (bool _success, ) = validatorContract().call(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _consensusAddr, _recipientAfterUnlockedFund)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n }\n\n /**\n * @dev See `CoreGovernance-_getChainType`.\n */\n function _getChainType() internal pure override returns (ChainType) {\n return ChainType.RoninChain;\n }\n\n /**\n * @dev See `castProposalVoteForCurrentNetwork`.\n */\n function _castProposalVoteForCurrentNetwork(\n address _voter,\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType _support\n ) internal {\n require(_proposal.chainId == block.chainid, \"RoninGovernanceAdmin: invalid chain id\");\n require(\n vote[_proposal.chainId][_proposal.nonce].hash == _proposal.hash(),\n \"RoninGovernanceAdmin: cast vote for invalid proposal\"\n );\n\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\n Signature memory _emptySignature;\n _castVote(\n _proposal,\n _support,\n _minimumForVoteWeight,\n _minimumAgainstVoteWeight,\n _voter,\n _emptySignature,\n _getWeight(_voter)\n );\n }\n}\n" + }, + "contracts/extensions/sequential-governance/GovernanceProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./CoreGovernance.sol\";\n\nabstract contract GovernanceProposal is CoreGovernance {\n using Proposal for Proposal.ProposalDetail;\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\n\n /**\n * @dev Casts votes by signatures.\n *\n * Note: This method does not verify the proposal hash with the vote hash. Please consider checking it before.\n *\n */\n function _castVotesBySignatures(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _forDigest,\n bytes32 _againstDigest\n ) internal {\n require(_supports.length > 0 && _supports.length == _signatures.length, \"GovernanceProposal: invalid array length\");\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\n\n address _lastSigner;\n address _signer;\n Signature calldata _sig;\n bool _hasValidVotes;\n for (uint256 _i; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n\n if (_supports[_i] == Ballot.VoteType.For) {\n _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s);\n } else if (_supports[_i] == Ballot.VoteType.Against) {\n _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s);\n } else {\n revert(\"GovernanceProposal: query for unsupported vote type\");\n }\n\n require(_lastSigner < _signer, \"GovernanceProposal: invalid order\");\n _lastSigner = _signer;\n\n uint256 _weight = _getWeight(_signer);\n if (_weight > 0) {\n _hasValidVotes = true;\n if (\n _castVote(_proposal, _supports[_i], _minimumForVoteWeight, _minimumAgainstVoteWeight, _signer, _sig, _weight)\n ) {\n return;\n }\n }\n }\n\n require(_hasValidVotes, \"GovernanceProposal: invalid signatures\");\n }\n\n /**\n * @dev Proposes a proposal struct and casts votes by signature.\n */\n function _proposeProposalStructAndCastVotes(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _creator\n ) internal {\n _proposeProposalStruct(_proposal, _creator);\n bytes32 _proposalHash = _proposal.hash();\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes a proposal struct and casts votes by signature.\n */\n function _castProposalBySignatures(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator\n ) internal {\n bytes32 _proposalHash = _proposal.hash();\n require(\n vote[_proposal.chainId][_proposal.nonce].hash == _proposalHash,\n \"GovernanceAdmin: cast vote for invalid proposal\"\n );\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes and votes by signature.\n */\n function _proposeGlobalProposalStructAndCastVotes(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal returns (Proposal.ProposalDetail memory _proposal) {\n _proposal = _proposeGlobalStruct(_globalProposal, _roninTrustedOrganizationContract, _gatewayContract, _creator);\n bytes32 _globalProposalHash = _globalProposal.hash();\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes a global proposal struct and casts votes by signature.\n */\n function _castGlobalProposalBySignatures(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _roninTrustedOrganizationContract,\n address _gatewayContract\n ) internal {\n Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail(\n _roninTrustedOrganizationContract,\n _gatewayContract\n );\n bytes32 _globalProposalHash = _globalProposal.hash();\n require(vote[0][_proposal.nonce].hash == _proposal.hash(), \"GovernanceAdmin: cast vote for invalid proposal\");\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Returns the weight of a governor.\n */\n function _getWeight(address _governor) internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/collections/HasValidatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasValidatorContract.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\n\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\n IRoninValidatorSet internal _validatorContract;\n\n modifier onlyValidatorContract() {\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\n _;\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function validatorContract() public view override returns (address) {\n return address(_validatorContract);\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setValidatorContract(_addr);\n }\n\n /**\n * @dev Sets the validator contract.\n *\n * Emits the event `ValidatorContractUpdated`.\n *\n */\n function _setValidatorContract(address _addr) internal {\n _validatorContract = IRoninValidatorSet(_addr);\n emit ValidatorContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/GovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../extensions/sequential-governance/CoreGovernance.sol\";\nimport \"../extensions/collections/HasRoninTrustedOrganizationContract.sol\";\nimport \"../extensions/collections/HasBridgeContract.sol\";\nimport \"../interfaces/IRoninTrustedOrganization.sol\";\n\nabstract contract GovernanceAdmin is CoreGovernance, HasRoninTrustedOrganizationContract, HasBridgeContract {\n uint256 public roninChainId;\n /// @dev Domain separator\n bytes32 public DOMAIN_SEPARATOR;\n\n error ErrProxyCallFailed(bytes4 methodSignature);\n\n modifier onlySelfCall() {\n require(msg.sender == address(this), \"GovernanceAdmin: only allowed self-call\");\n _;\n }\n\n constructor(\n uint256 _roninChainId,\n address _roninTrustedOrganizationContract,\n address _bridgeContract,\n uint256 _proposalExpiryDuration\n ) CoreGovernance(_proposalExpiryDuration) {\n roninChainId = _roninChainId;\n DOMAIN_SEPARATOR = keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,bytes32 salt)\"),\n keccak256(\"GovernanceAdmin\"), // name hash\n keccak256(\"2\"), // version hash\n keccak256(abi.encode(\"RONIN_GOVERNANCE_ADMIN\", _roninChainId)) // salt\n )\n );\n _setRoninTrustedOrganizationContract(_roninTrustedOrganizationContract);\n _setBridgeContract(_bridgeContract);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function setRoninTrustedOrganizationContract(address _addr) external override onlySelfCall {\n require(_addr.code.length > 0, \"GovernanceAdmin: set to non-contract\");\n _setRoninTrustedOrganizationContract(_addr);\n }\n\n /**\n * @inheritdoc IHasBridgeContract\n */\n function setBridgeContract(address _addr) external override onlySelfCall {\n require(_addr.code.length > 0, \"GovernanceAdmin: set to non-contract\");\n _setBridgeContract(_addr);\n }\n\n /**\n * @dev Sets the expiry duration for a new proposal.\n *\n * Requirements:\n * - Only allowing self-call to this method, since this contract does not have admin.\n *\n */\n function setProposalExpiryDuration(uint256 _expiryDuration) external onlySelfCall {\n _setProposalExpiryDuration(_expiryDuration);\n }\n\n /**\n * @dev Returns the current implementation of `_proxy`.\n *\n * Requirements:\n * - This contract must be the admin of `_proxy`.\n *\n */\n function getProxyImplementation(address _proxy) external view returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n bytes4 _selector = 0x5c60da1b;\n (bool _success, bytes memory _returndata) = _proxy.staticcall(abi.encodeWithSelector(_selector));\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (address));\n }\n\n /**\n * @dev Returns the proposal expiry duration.\n */\n function getProposalExpiryDuration() external view returns (uint256) {\n return super._getProposalExpiryDuration();\n }\n\n /**\n * @dev Returns the current admin of `_proxy`.\n *\n * Requirements:\n * - This contract must be the admin of `_proxy`.\n *\n */\n function getProxyAdmin(address _proxy) external view returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n bytes4 _selector = 0xf851a440;\n (bool _success, bytes memory _returndata) = _proxy.staticcall(abi.encodeWithSelector(_selector));\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `_proxy` to `newAdmin`.\n *\n * Requirements:\n * - This contract must be the current admin of `_proxy`.\n *\n */\n function changeProxyAdmin(address _proxy, address _newAdmin) external onlySelfCall {\n // bytes4(keccak256(\"changeAdmin(address)\"))\n bytes4 _selector = 0x8f283970;\n (bool _success, ) = _proxy.call(abi.encodeWithSelector(_selector, _newAdmin));\n if (!_success) revert ErrProxyCallFailed(_selector);\n }\n\n /**\n * @dev Override `CoreGovernance-_getMinimumVoteWeight`.\n */\n function _getMinimumVoteWeight() internal view virtual override returns (uint256) {\n bytes4 _selector = IQuorum.minimumVoteWeight.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Override `CoreGovernance-_getTotalWeights`.\n */\n function _getTotalWeights() internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.totalWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n}\n" + }, + "contracts/libraries/EmergencyExitBallot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary EmergencyExitBallot {\n // keccak256(\"EmergencyExitBallot(address consensusAddress,address recipientAfterUnlockedFund,uint256 requestedAt,uint256 expiredAt)\");\n bytes32 public constant EMERGENCY_EXIT_BALLOT_TYPEHASH =\n 0x697acba4deaf1a718d8c2d93e42860488cb7812696f28ca10eed17bac41e7027;\n\n /**\n * @dev Returns hash of the ballot.\n */\n function hash(\n address _consensusAddress,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n EMERGENCY_EXIT_BALLOT_TYPEHASH,\n _consensusAddress,\n _recipientAfterUnlockedFund,\n _requestedAt,\n _expiredAt\n )\n );\n }\n}\n" + }, + "contracts/extensions/sequential-governance/CoreGovernance.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../../libraries/Proposal.sol\";\nimport \"../../libraries/GlobalProposal.sol\";\nimport \"../../libraries/Ballot.sol\";\nimport \"../../interfaces/consumers/ChainTypeConsumer.sol\";\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\n\nabstract contract CoreGovernance is SignatureConsumer, VoteStatusConsumer, ChainTypeConsumer {\n using Proposal for Proposal.ProposalDetail;\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\n\n struct ProposalVote {\n VoteStatus status;\n bytes32 hash;\n uint256 againstVoteWeight; // Total weight of against votes\n uint256 forVoteWeight; // Total weight of for votes\n address[] forVoteds; // Array of addresses voting for\n address[] againstVoteds; // Array of addresses voting against\n uint256 expiryTimestamp;\n mapping(address => Signature) sig;\n mapping(address => bool) voted;\n }\n\n /// @dev Emitted when a proposal is created\n event ProposalCreated(\n uint256 indexed chainId,\n uint256 indexed round,\n bytes32 indexed proposalHash,\n Proposal.ProposalDetail proposal,\n address creator\n );\n /// @dev Emitted when a proposal is created\n event GlobalProposalCreated(\n uint256 indexed round,\n bytes32 indexed proposalHash,\n Proposal.ProposalDetail proposal,\n bytes32 globalProposalHash,\n GlobalProposal.GlobalProposalDetail globalProposal,\n address creator\n );\n /// @dev Emitted when the proposal is voted\n event ProposalVoted(bytes32 indexed proposalHash, address indexed voter, Ballot.VoteType support, uint256 weight);\n /// @dev Emitted when the proposal is approved\n event ProposalApproved(bytes32 indexed proposalHash);\n /// @dev Emitted when the vote is reject\n event ProposalRejected(bytes32 indexed proposalHash);\n /// @dev Emitted when the vote is expired\n event ProposalExpired(bytes32 indexed proposalHash);\n /// @dev Emitted when the proposal is executed\n event ProposalExecuted(bytes32 indexed proposalHash, bool[] successCalls, bytes[] returnDatas);\n\n /// @dev Mapping from chain id => vote round\n /// @notice chain id = 0 for global proposal\n mapping(uint256 => uint256) public round;\n /// @dev Mapping from chain id => vote round => proposal vote\n mapping(uint256 => mapping(uint256 => ProposalVote)) public vote;\n\n uint256 private _proposalExpiryDuration;\n\n constructor(uint256 _expiryDuration) {\n _setProposalExpiryDuration(_expiryDuration);\n }\n\n /**\n * @dev Creates new voting round by calculating the `_round` number of chain `_chainId`.\n * Increases the `_round` number if the previous one is not expired. Delete the previous proposal\n * if it is expired and not increase the `_round`.\n */\n function _createVotingRound(uint256 _chainId) internal returns (uint256 _round) {\n _round = round[_chainId];\n // Skip checking for the first ever round\n if (_round == 0) {\n _round = round[_chainId] = 1;\n } else {\n ProposalVote storage _latestProposalVote = vote[_chainId][_round];\n bool _isExpired = _tryDeleteExpiredVotingRound(_latestProposalVote);\n // Skip increasing round number if the latest round is expired, allow the vote to be overridden\n if (!_isExpired) {\n require(_latestProposalVote.status != VoteStatus.Pending, \"CoreGovernance: current proposal is not completed\");\n _round = ++round[_chainId];\n }\n }\n }\n\n /**\n * @dev Saves new round voting for the proposal `_proposalHash` of chain `_chainId`.\n */\n function _saveVotingRound(\n ProposalVote storage _vote,\n bytes32 _proposalHash,\n uint256 _expiryTimestamp\n ) internal {\n _vote.hash = _proposalHash;\n _vote.expiryTimestamp = _expiryTimestamp;\n }\n\n /**\n * @dev Proposes for a new proposal.\n *\n * Requirements:\n * - The chain id is not equal to 0.\n *\n * Emits the `ProposalCreated` event.\n *\n */\n function _proposeProposal(\n uint256 _chainId,\n uint256 _expiryTimestamp,\n address[] memory _targets,\n uint256[] memory _values,\n bytes[] memory _calldatas,\n uint256[] memory _gasAmounts,\n address _creator\n ) internal virtual returns (Proposal.ProposalDetail memory _proposal) {\n require(_chainId != 0, \"CoreGovernance: invalid chain id\");\n uint256 _round = _createVotingRound(_chainId);\n\n _proposal = Proposal.ProposalDetail(_round, _chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts);\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n _saveVotingRound(vote[_chainId][_round], _proposalHash, _expiryTimestamp);\n emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator);\n }\n\n /**\n * @dev Proposes proposal struct.\n *\n * Requirements:\n * - The chain id is not equal to 0.\n * - The proposal nonce is equal to the new round.\n *\n * Emits the `ProposalCreated` event.\n *\n */\n function _proposeProposalStruct(Proposal.ProposalDetail memory _proposal, address _creator)\n internal\n virtual\n returns (uint256 _round)\n {\n uint256 _chainId = _proposal.chainId;\n require(_chainId != 0, \"CoreGovernance: invalid chain id\");\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n _round = _createVotingRound(_chainId);\n _saveVotingRound(vote[_chainId][_round], _proposalHash, _proposal.expiryTimestamp);\n require(_round == _proposal.nonce, \"CoreGovernance: invalid proposal nonce\");\n emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator);\n }\n\n /**\n * @dev Proposes for a global proposal.\n *\n * Emits the `GlobalProposalCreated` event.\n *\n */\n function _proposeGlobal(\n uint256 _expiryTimestamp,\n GlobalProposal.TargetOption[] calldata _targetOptions,\n uint256[] memory _values,\n bytes[] memory _calldatas,\n uint256[] memory _gasAmounts,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal virtual {\n uint256 _round = _createVotingRound(0);\n GlobalProposal.GlobalProposalDetail memory _globalProposal = GlobalProposal.GlobalProposalDetail(\n _round,\n _expiryTimestamp,\n _targetOptions,\n _values,\n _calldatas,\n _gasAmounts\n );\n Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail(\n _roninTrustedOrganizationContract,\n _gatewayContract\n );\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n _saveVotingRound(vote[0][_round], _proposalHash, _expiryTimestamp);\n emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator);\n }\n\n /**\n * @dev Proposes global proposal struct.\n *\n * Requirements:\n * - The proposal nonce is equal to the new round.\n *\n * Emits the `GlobalProposalCreated` event.\n *\n */\n function _proposeGlobalStruct(\n GlobalProposal.GlobalProposalDetail memory _globalProposal,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal virtual returns (Proposal.ProposalDetail memory _proposal) {\n _proposal = _globalProposal.into_proposal_detail(_roninTrustedOrganizationContract, _gatewayContract);\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n uint256 _round = _createVotingRound(0);\n _saveVotingRound(vote[0][_round], _proposalHash, _globalProposal.expiryTimestamp);\n require(_round == _proposal.nonce, \"CoreGovernance: invalid proposal nonce\");\n emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator);\n }\n\n /**\n * @dev Casts vote for the proposal with data and returns whether the voting is done.\n *\n * Requirements:\n * - The proposal nonce is equal to the round.\n * - The vote is not finalized.\n * - The voter has not voted for the round.\n *\n * Emits the `ProposalVoted` event. Emits the `ProposalApproved`, `ProposalExecuted` or `ProposalRejected` once the\n * proposal is approved, executed or rejected.\n *\n */\n function _castVote(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType _support,\n uint256 _minimumForVoteWeight,\n uint256 _minimumAgainstVoteWeight,\n address _voter,\n Signature memory _signature,\n uint256 _voterWeight\n ) internal virtual returns (bool _done) {\n uint256 _chainId = _proposal.chainId;\n uint256 _round = _proposal.nonce;\n ProposalVote storage _vote = vote[_chainId][_round];\n\n if (_tryDeleteExpiredVotingRound(_vote)) {\n return true;\n }\n\n require(round[_proposal.chainId] == _round, \"CoreGovernance: query for invalid proposal nonce\");\n require(_vote.status == VoteStatus.Pending, \"CoreGovernance: the vote is finalized\");\n if (_voted(_vote, _voter)) {\n revert(string(abi.encodePacked(\"CoreGovernance: \", Strings.toHexString(uint160(_voter), 20), \" already voted\")));\n }\n\n _vote.voted[_voter] = true;\n // Stores the signature if it is not empty\n if (_signature.r > 0 || _signature.s > 0 || _signature.v > 0) {\n _vote.sig[_voter] = _signature;\n }\n emit ProposalVoted(_vote.hash, _voter, _support, _voterWeight);\n\n uint256 _forVoteWeight;\n uint256 _againstVoteWeight;\n if (_support == Ballot.VoteType.For) {\n _vote.forVoteds.push(_voter);\n _forVoteWeight = _vote.forVoteWeight += _voterWeight;\n } else if (_support == Ballot.VoteType.Against) {\n _vote.againstVoteds.push(_voter);\n _againstVoteWeight = _vote.againstVoteWeight += _voterWeight;\n } else {\n revert(\"CoreGovernance: unsupported vote type\");\n }\n\n if (_forVoteWeight >= _minimumForVoteWeight) {\n _done = true;\n _vote.status = VoteStatus.Approved;\n emit ProposalApproved(_vote.hash);\n _tryExecute(_vote, _proposal);\n } else if (_againstVoteWeight >= _minimumAgainstVoteWeight) {\n _done = true;\n _vote.status = VoteStatus.Rejected;\n emit ProposalRejected(_vote.hash);\n }\n }\n\n /**\n * @dev When the contract is on Ronin chain, checks whether the proposal is expired and delete it if is expired.\n *\n * Emits the event `ProposalExpired` if the vote is expired.\n *\n * Note: This function assumes the vote `_proposalVote` is already created, consider verifying the vote's existence\n * before or it will emit an unexpected event of `ProposalExpired`.\n */\n function _tryDeleteExpiredVotingRound(ProposalVote storage _proposalVote) internal returns (bool _isExpired) {\n _isExpired =\n _getChainType() == ChainType.RoninChain &&\n _proposalVote.status == VoteStatus.Pending &&\n _proposalVote.expiryTimestamp <= block.timestamp;\n\n if (_isExpired) {\n emit ProposalExpired(_proposalVote.hash);\n\n for (uint256 _i; _i < _proposalVote.forVoteds.length; _i++) {\n delete _proposalVote.voted[_proposalVote.forVoteds[_i]];\n delete _proposalVote.sig[_proposalVote.forVoteds[_i]];\n }\n for (uint256 _i; _i < _proposalVote.againstVoteds.length; _i++) {\n delete _proposalVote.voted[_proposalVote.againstVoteds[_i]];\n delete _proposalVote.sig[_proposalVote.againstVoteds[_i]];\n }\n delete _proposalVote.status;\n delete _proposalVote.hash;\n delete _proposalVote.againstVoteWeight;\n delete _proposalVote.forVoteWeight;\n delete _proposalVote.forVoteds;\n delete _proposalVote.againstVoteds;\n delete _proposalVote.expiryTimestamp;\n }\n }\n\n /**\n * @dev Executes the proposal and update the vote status once the proposal is executable.\n */\n function _tryExecute(ProposalVote storage _vote, Proposal.ProposalDetail memory _proposal) internal {\n if (_proposal.executable()) {\n _vote.status = VoteStatus.Executed;\n (bool[] memory _successCalls, bytes[] memory _returnDatas) = _proposal.execute();\n emit ProposalExecuted(_vote.hash, _successCalls, _returnDatas);\n }\n }\n\n /**\n * @dev Sets the expiry duration for a new proposal.\n */\n function _setProposalExpiryDuration(uint256 _expiryDuration) internal {\n _proposalExpiryDuration = _expiryDuration;\n }\n\n /**\n * @dev Returns whether the voter casted for the proposal.\n */\n function _voted(ProposalVote storage _vote, address _voter) internal view returns (bool) {\n return _vote.voted[_voter];\n }\n\n /**\n * @dev Returns the expiry duration for a new proposal.\n */\n function _getProposalExpiryDuration() internal view returns (uint256) {\n return _proposalExpiryDuration;\n }\n\n /**\n * @dev Returns total weight from validators.\n */\n function _getTotalWeights() internal view virtual returns (uint256);\n\n /**\n * @dev Returns minimum vote to pass a proposal.\n */\n function _getMinimumVoteWeight() internal view virtual returns (uint256);\n\n /**\n * @dev Returns current context is running on whether Ronin chain or on mainchain.\n */\n function _getChainType() internal view virtual returns (ChainType);\n}\n" + }, + "contracts/libraries/Proposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary Proposal {\n struct ProposalDetail {\n // Nonce to make sure proposals are executed in order\n uint256 nonce;\n // Value 0: all chain should run this proposal\n // Other values: only specifc chain has to execute\n uint256 chainId;\n uint256 expiryTimestamp;\n address[] targets;\n uint256[] values;\n bytes[] calldatas;\n uint256[] gasAmounts;\n }\n\n // keccak256(\"ProposalDetail(uint256 nonce,uint256 chainId,uint256 expiryTimestamp,address[] targets,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\");\n bytes32 public constant TYPE_HASH = 0xd051578048e6ff0bbc9fca3b65a42088dbde10f36ca841de566711087ad9b08a;\n\n /**\n * @dev Validates the proposal.\n */\n function validate(ProposalDetail memory _proposal, uint256 _maxExpiryDuration) internal view {\n require(\n _proposal.targets.length > 0 &&\n _proposal.targets.length == _proposal.values.length &&\n _proposal.targets.length == _proposal.calldatas.length &&\n _proposal.targets.length == _proposal.gasAmounts.length,\n \"Proposal: invalid array length\"\n );\n require(_proposal.expiryTimestamp <= block.timestamp + _maxExpiryDuration, \"Proposal: invalid expiry timestamp\");\n }\n\n /**\n * @dev Returns struct hash of the proposal.\n */\n function hash(ProposalDetail memory _proposal) internal pure returns (bytes32) {\n bytes32 _targetsHash;\n bytes32 _valuesHash;\n bytes32 _calldatasHash;\n bytes32 _gasAmountsHash;\n\n uint256[] memory _values = _proposal.values;\n address[] memory _targets = _proposal.targets;\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _calldataHashList.length; _i++) {\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\n }\n\n assembly {\n _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32))\n _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32))\n _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32))\n _gasAmountsHash := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32))\n }\n\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _proposal.nonce,\n _proposal.chainId,\n _proposal.expiryTimestamp,\n _targetsHash,\n _valuesHash,\n _calldatasHash,\n _gasAmountsHash\n )\n );\n }\n\n /**\n * @dev Returns whether the proposal is executable for the current chain.\n *\n * @notice Does not check whether the call result is successful or not. Please use `execute` instead.\n *\n */\n function executable(ProposalDetail memory _proposal) internal view returns (bool _result) {\n return _proposal.chainId == 0 || _proposal.chainId == block.chainid;\n }\n\n /**\n * @dev Executes the proposal.\n */\n function execute(ProposalDetail memory _proposal)\n internal\n returns (bool[] memory _successCalls, bytes[] memory _returnDatas)\n {\n require(executable(_proposal), \"Proposal: query for invalid chainId\");\n _successCalls = new bool[](_proposal.targets.length);\n _returnDatas = new bytes[](_proposal.targets.length);\n for (uint256 _i = 0; _i < _proposal.targets.length; ++_i) {\n require(gasleft() > _proposal.gasAmounts[_i], \"Proposal: insufficient gas\");\n\n (_successCalls[_i], _returnDatas[_i]) = _proposal.targets[_i].call{\n value: _proposal.values[_i],\n gas: _proposal.gasAmounts[_i]\n }(_proposal.calldatas[_i]);\n }\n }\n}\n" + }, + "contracts/libraries/GlobalProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Proposal.sol\";\n\nlibrary GlobalProposal {\n enum TargetOption {\n RoninTrustedOrganizationContract,\n GatewayContract\n }\n\n struct GlobalProposalDetail {\n // Nonce to make sure proposals are executed in order\n uint256 nonce;\n uint256 expiryTimestamp;\n TargetOption[] targetOptions;\n uint256[] values;\n bytes[] calldatas;\n uint256[] gasAmounts;\n }\n\n // keccak256(\"GlobalProposalDetail(uint256 nonce,uint256 expiryTimestamp,uint8[] targetOptions,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\");\n bytes32 public constant TYPE_HASH = 0x1463f426c05aff2c1a7a0957a71c9898bc8b47142540538e79ee25ee91141350;\n\n /**\n * @dev Returns struct hash of the proposal.\n */\n function hash(GlobalProposalDetail memory _proposal) internal pure returns (bytes32) {\n bytes32 _targetsHash;\n bytes32 _valuesHash;\n bytes32 _calldatasHash;\n bytes32 _gasAmountsHash;\n\n uint256[] memory _values = _proposal.values;\n TargetOption[] memory _targets = _proposal.targetOptions;\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _calldataHashList.length; _i++) {\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\n }\n\n assembly {\n _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32))\n _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32))\n _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32))\n _gasAmountsHash := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32))\n }\n\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _proposal.nonce,\n _proposal.expiryTimestamp,\n _targetsHash,\n _valuesHash,\n _calldatasHash,\n _gasAmountsHash\n )\n );\n }\n\n /**\n * @dev Converts into the normal proposal.\n */\n function into_proposal_detail(\n GlobalProposalDetail memory _proposal,\n address _roninTrustedOrganizationContract,\n address _gatewayContract\n ) internal pure returns (Proposal.ProposalDetail memory _detail) {\n _detail.nonce = _proposal.nonce;\n _detail.expiryTimestamp = _proposal.expiryTimestamp;\n _detail.chainId = 0;\n _detail.targets = new address[](_proposal.targetOptions.length);\n _detail.values = _proposal.values;\n _detail.calldatas = _proposal.calldatas;\n _detail.gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _proposal.targetOptions.length; _i++) {\n if (_proposal.targetOptions[_i] == TargetOption.GatewayContract) {\n _detail.targets[_i] = _gatewayContract;\n } else if (_proposal.targetOptions[_i] == TargetOption.RoninTrustedOrganizationContract) {\n _detail.targets[_i] = _roninTrustedOrganizationContract;\n } else {\n revert(\"GlobalProposal: unsupported target\");\n }\n }\n }\n}\n" + }, + "contracts/libraries/Ballot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary Ballot {\n using ECDSA for bytes32;\n\n enum VoteType {\n For,\n Against\n }\n\n // keccak256(\"Ballot(bytes32 proposalHash,uint8 support)\");\n bytes32 public constant BALLOT_TYPEHASH = 0xd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c2;\n\n function hash(bytes32 _proposalHash, VoteType _support) internal pure returns (bytes32) {\n return keccak256(abi.encode(BALLOT_TYPEHASH, _proposalHash, _support));\n }\n}\n" + }, + "contracts/interfaces/consumers/ChainTypeConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface ChainTypeConsumer {\n enum ChainType {\n RoninChain,\n Mainchain\n }\n}\n" + }, + "contracts/extensions/collections/HasProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/StorageSlot.sol\";\n\nabstract contract HasProxyAdmin {\n // bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n modifier onlyAdmin() {\n require(msg.sender == _getAdmin(), \"HasProxyAdmin: unauthorized sender\");\n _;\n }\n\n /**\n * @dev Returns proxy admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n}\n" + }, + "contracts/interfaces/collections/IHasValidatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasValidatorContract is IHasContract {\n /// @dev Emitted when the validator contract is updated.\n event ValidatorContractUpdated(address);\n\n /// @dev Error of method caller must be validator contract.\n error ErrCallerMustBeValidatorContract();\n\n /**\n * @dev Returns the validator contract.\n */\n function validatorContract() external view returns (address);\n\n /**\n * @dev Sets the validator contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `ValidatorContractUpdated`.\n *\n */\n function setValidatorContract(address) external;\n}\n" + }, + "contracts/interfaces/validator/IRoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ICandidateManager.sol\";\nimport \"./info-fragments/ICommonInfo.sol\";\nimport \"./ICoinbaseExecution.sol\";\nimport \"./ISlashingExecution.sol\";\nimport \"./IEmergencyExit.sol\";\n\ninterface IRoninValidatorSet is\n ICandidateManager,\n ICommonInfo,\n ISlashingExecution,\n ICoinbaseExecution,\n IEmergencyExit\n{}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "contracts/interfaces/collections/IHasContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IHasContract {\n /// @dev Error of set to non-contract.\n error ErrZeroCodeContract();\n}\n" + }, + "contracts/interfaces/validator/ICandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ICandidateManager {\n struct ValidatorCandidate {\n // Admin of the candidate\n address admin;\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n address consensusAddr;\n // Address that receives mining reward of the validator\n address payable treasuryAddr;\n // Address of the bridge operator corresponding to the candidate\n address bridgeOperatorAddr;\n // The percentage of reward that validators can be received, the rest goes to the delegators.\n // Values in range [0; 100_00] stands for 0-100%\n uint256 commissionRate;\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\n uint256 revokingTimestamp;\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\n uint256 topupDeadline;\n }\n\n struct CommissionSchedule {\n // The timestamp that the commission schedule gets affected (no schedule=0).\n uint256 effectiveTimestamp;\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\n uint256 commissionRate;\n }\n\n /// @dev Emitted when the maximum number of validator candidates is updated.\n event MaxValidatorCandidateUpdated(uint256 threshold);\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\n /// @dev Emitted when the validator candidate is granted.\n event CandidateGranted(\n address indexed consensusAddr,\n address indexed treasuryAddr,\n address indexed admin,\n address bridgeOperator\n );\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\n /// @dev Emitted when the topup deadline of a candidate is updated.\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\n /// @dev Emitted when the validator candidate is revoked.\n event CandidatesRevoked(address[] consensusAddrs);\n\n /// @dev Emitted when a schedule for updating commission rate is set.\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\n /// @dev Emitted when the commission rate of a validator is updated.\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\n\n /// @dev Error of exceeding maximum number of candidates.\n error ErrExceedsMaxNumberOfCandidate();\n /// @dev Error of querying for already existent candidate.\n error ErrExistentCandidate();\n /// @dev Error of querying for non-existent candidate.\n error ErrNonExistentCandidate();\n /// @dev Error of candidate admin already exists.\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\n /// @dev Error of treasury already exists.\n error ErrExistentTreasury(address _treasuryAddr);\n /// @dev Error of bridge operator already exists.\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\n /// @dev Error of invalid commission rate.\n error ErrInvalidCommissionRate();\n /// @dev Error of invalid effective days onwards.\n error ErrInvalidEffectiveDaysOnwards();\n /// @dev Error of invalid min effective days onwards.\n error ErrInvalidMinEffectiveDaysOnwards();\n /// @dev Error of already requested revoking candidate before.\n error ErrAlreadyRequestedRevokingCandidate();\n /// @dev Error of commission change schedule exists.\n error ErrAlreadyRequestedUpdatingCommissionRate();\n /// @dev Error of trusted org cannot renounce.\n error ErrTrustedOrgCannotRenounce();\n\n /**\n * @dev Returns the maximum number of validator candidate.\n */\n function maxValidatorCandidate() external view returns (uint256);\n\n /**\n * @dev Returns the minimum number of days to the effective date of commission rate change.\n */\n function minEffectiveDaysOnwards() external view returns (uint256);\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function setMaxValidatorCandidate(uint256) external;\n\n /**\n * @dev Sets the minimum number of days to the effective date of commision rate change.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\n\n /**\n * @dev Grants a validator candidate.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateGranted`.\n *\n */\n function execApplyValidatorCandidate(\n address _admin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external;\n\n /**\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateRevokingTimestampUpdated`.\n *\n */\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\n\n /**\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\n *\n * Requirements:\n * - The method caller is the staking contract.\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\n * - The `_rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdateScheduled`.\n *\n */\n function execRequestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveTimestamp,\n uint256 _rate\n ) external;\n\n /**\n * @dev Returns whether the address is a validator (candidate).\n */\n function isValidatorCandidate(address _addr) external view returns (bool);\n\n /**\n * @dev Returns the validator candidate.\n */\n function getValidatorCandidates() external view returns (address[] memory);\n\n /**\n * @dev Returns all candidate info.\n */\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\n\n /**\n * @dev Returns the info of a candidate.\n */\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\n\n /**\n * @dev Returns whether the address is the candidate admin.\n */\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\n\n /**\n * @dev Returns the schedule of changing commission rate of a candidate address.\n */\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ICommonInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IJailingInfo.sol\";\nimport \"./ITimingInfo.sol\";\nimport \"./IValidatorInfo.sol\";\n\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\n struct EmergencyExitInfo {\n uint256 lockedAmount;\n // The timestamp that this locked amount will be recycled to staking vesting contract\n uint256 recyclingAt;\n }\n\n /// @dev Emitted when the deprecated reward is withdrawn.\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\n /// @dev Emitted when the deprecated reward withdrawal is failed\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\n\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\n error ErrUnauthorizedReceiveRON();\n /// @dev Error thrown when queries for a non existent info.\n error NonExistentRecyclingInfo();\n\n /**\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\n */\n function totalDeprecatedReward() external view returns (uint256);\n\n /**\n * @dev Returns the emergency exit request.\n */\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\n}\n" + }, + "contracts/interfaces/validator/ICoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashingExecution.sol\";\n\ninterface ICoinbaseExecution is ISlashingExecution {\n enum BlockRewardDeprecatedType {\n UNKNOWN,\n UNAVAILABILITY,\n AFTER_BAILOUT\n }\n\n /// @dev Emitted when the validator set is updated\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated.\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\n\n /// @dev Emitted when the reward of the block producer is deprecated.\n event BlockRewardDeprecated(\n address indexed coinbaseAddr,\n uint256 rewardAmount,\n BlockRewardDeprecatedType deprecatedType\n );\n /// @dev Emitted when the block reward is submitted.\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\n\n /// @dev Emitted when the block producer reward is distributed.\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\n /// @dev Emitted when the contract fails when distributing the block producer reward.\n event MiningRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the bridge operator reward is distributed.\n event BridgeOperatorRewardDistributed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipientAddr,\n uint256 amount\n );\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\n event BridgeOperatorRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\n event StakingRewardDistributionFailed(\n uint256 totalAmount,\n address[] consensusAddrs,\n uint256[] amounts,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the epoch is wrapped up.\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\n /// @dev Emitted when the bridge tracking contract's response is incorrect\n event BridgeTrackingIncorrectlyResponded();\n\n /// @dev Error of method caller must be coinbase\n error ErrCallerMustBeCoinbase();\n /// @dev Error of only allowed at the end of epoch\n error ErrAtEndOfEpochOnly();\n /// @dev Error of query for already wrapped up epoch\n error ErrAlreadyWrappedEpoch();\n\n /**\n * @dev Submits reward of the current block.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\n * Emits the event `BlockRewardSubmitted` for the valid call.\n *\n */\n function submitBlockReward() external payable;\n\n /**\n * @dev Wraps up the current epoch.\n *\n * Requirements:\n * - The method must be called when the current epoch is ending.\n * - The epoch is not wrapped yet.\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\n * Emits the event `WrappedUpEpoch`.\n *\n */\n function wrapUpEpoch() external payable;\n}\n" + }, + "contracts/interfaces/validator/ISlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ISlashingExecution {\n /// @dev Emitted when the validator is punished.\n event ValidatorPunished(\n address indexed consensusAddr,\n uint256 indexed period,\n uint256 jailedUntil,\n uint256 deductedStakingAmount,\n bool blockProducerRewardDeprecated,\n bool bridgeOperatorRewardDeprecated\n );\n /// @dev Emitted when the validator get out of jail by bailout.\n event ValidatorUnjailed(address indexed validator, uint256 period);\n\n /// @dev Error of cannot bailout due to high tier slash.\n error ErrCannotBailout(address validator);\n\n /**\n * @dev Finalize the slash request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorPunished`.\n *\n */\n function execSlash(\n address _validatorAddr,\n uint256 _newJailedUntil,\n uint256 _slashAmount,\n bool _cannotBailout\n ) external;\n\n /**\n * @dev Finalize the bailout request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorUnjailed`.\n *\n */\n function execBailOut(address _validatorAddr, uint256 _period) external;\n}\n" + }, + "contracts/interfaces/validator/IEmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IEmergencyExit {\n /// @dev Emitted when the fund is locked from an emergency exit request\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\n event EmergencyExitLockedFundReleased(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount\n );\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\n event EmergencyExitLockedFundReleasingFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the emergency exit locked amount is updated.\n event EmergencyExitLockedAmountUpdated(uint256 amount);\n /// @dev Emitted when the emergency expiry duration is updated.\n event EmergencyExpiryDurationUpdated(uint256 amount);\n\n /// @dev Error of already requested emergency exit before.\n error ErrAlreadyRequestedEmergencyExit();\n\n /**\n * @dev Returns the amount of RON to lock from a consensus address.\n */\n function emergencyExitLockedAmount() external returns (uint256);\n\n /**\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\n */\n function emergencyExpiryDuration() external returns (uint256);\n\n /**\n * @dev Sets the amount of RON to lock from a consensus address.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedAmountUpdated`.\n *\n */\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\n\n /**\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExpiryDurationUpdated`.\n *\n */\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\n\n /**\n * @dev Unlocks fund for emergency exit request.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\n *\n */\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\n\n /**\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n */\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IJailingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IJailingInfo {\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\n */\n function checkJailed(address) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeft(address _addr)\n external\n view\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n );\n\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\n */\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\n external\n view\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n );\n\n /**\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\n */\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\n */\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\n */\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\n\n /**\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\n */\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\n\n /**\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\n */\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\n external\n view\n returns (bool _result);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ITimingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ITimingInfo {\n /**\n * @dev Returns the block that validator set was updated.\n */\n function getLastUpdatedBlock() external view returns (uint256);\n\n /**\n * @dev Returns the number of blocks in a epoch.\n */\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\n\n /**\n * @dev Returns the epoch index from the block number.\n */\n function epochOf(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Returns whether the epoch ending is at the block number `_block`.\n */\n function epochEndingAt(uint256 _block) external view returns (bool);\n\n /**\n * @dev Tries to get the period index from the epoch number.\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\n\n /**\n * @dev Returns whether the period ending at the current block number.\n */\n function isPeriodEnding() external view returns (bool);\n\n /**\n * @dev Returns the period index from the current block.\n */\n function currentPeriod() external view returns (uint256);\n\n /**\n * @dev Returns the block number that the current period starts at.\n */\n function currentPeriodStartAtBlock() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IValidatorInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\n\ninterface IValidatorInfo {\n /// @dev Emitted when the number of max validator is updated.\n event MaxValidatorNumberUpdated(uint256);\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\n event MaxPrioritizedValidatorNumberUpdated(uint256);\n\n /// @dev Error of number of prioritized greater than number of max validators.\n error ErrInvalidMaxPrioritizedValidatorNumber();\n\n /**\n * @dev Returns the maximum number of validators in the epoch.\n */\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\n\n /**\n * @dev Returns the number of reserved slots for prioritized validators.\n */\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\n\n /**\n * @dev Returns the current validator list.\n */\n function getValidators()\n external\n view\n returns (\n address[] memory _validatorList,\n address[] memory _bridgeOperators,\n EnumFlags.ValidatorFlag[] memory _flags\n );\n\n /**\n * @dev Returns whether the address is either a bridge operator or a block producer.\n */\n function isValidator(address _addr) external view returns (bool);\n\n /**\n * @dev Returns the current block producer list.\n */\n function getBlockProducers() external view returns (address[] memory);\n\n /**\n * @dev Returns whether the address is block producer or not.\n */\n function isBlockProducer(address _addr) external view returns (bool);\n\n /**\n * @dev Returns total numbers of the block producers.\n */\n function totalBlockProducers() external view returns (uint256);\n\n /**\n * @dev Returns the current bridge operator list.\n */\n function getBridgeOperators() external view returns (address[] memory);\n\n /**\n * @dev Returns the bridge operator list corresponding to validator address list.\n */\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\n\n /**\n * @dev Returns whether the address is bridge operator.\n */\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\n\n /**\n * @dev Returns whether the consensus address is operating the bridge or not.\n */\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns total numbers of the bridge operators.\n */\n function totalBridgeOperators() external view returns (uint256);\n\n /**\n * @dev Updates the max validator number\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxValidatorNumberUpdated`\n *\n */\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\n\n /**\n * @dev Updates the number of reserved slots for prioritized validators\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\n *\n */\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\n}\n" + }, + "contracts/libraries/EnumFlags.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This library implements checking flag of an enumerated value.\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\n */\nlibrary EnumFlags {\n enum ValidatorFlag {\n None, // bit(00)\n BlockProducer, // bit(01)\n BridgeOperator, // bit(10)\n Both // bit(11)\n }\n\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\n return uint8(_value) == 0;\n }\n\n /**\n * @dev Checks if `_value` has `_flag`.\n */\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\n return (uint8(_value) & uint8(_flag)) != 0;\n }\n\n /**\n * @dev Calculate new value of `_value` after adding `_flag`.\n */\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) | uint8(_flag));\n }\n\n /**\n * @dev Calculate new value of `_value` after remove `_flag`.\n */\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\n }\n}\n" + }, + "contracts/extensions/collections/HasRoninTrustedOrganizationContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\n\ncontract HasRoninTrustedOrganizationContract is IHasRoninTrustedOrganizationContract, HasProxyAdmin {\n IRoninTrustedOrganization internal _roninTrustedOrganizationContract;\n\n modifier onlyRoninTrustedOrganizationContract() {\n if (roninTrustedOrganizationContract() != msg.sender) revert ErrCallerMustBeRoninTrustedOrgContract();\n _;\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function roninTrustedOrganizationContract() public view override returns (address) {\n return address(_roninTrustedOrganizationContract);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function setRoninTrustedOrganizationContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setRoninTrustedOrganizationContract(_addr);\n }\n\n /**\n * @dev Sets the ronin trusted organization contract.\n *\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\n *\n */\n function _setRoninTrustedOrganizationContract(address _addr) internal {\n _roninTrustedOrganizationContract = IRoninTrustedOrganization(_addr);\n emit RoninTrustedOrganizationContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/collections/HasBridgeContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasBridgeContract.sol\";\nimport \"../../interfaces/IBridge.sol\";\n\ncontract HasBridgeContract is IHasBridgeContract, HasProxyAdmin {\n IBridge internal _bridgeContract;\n\n modifier onlyBridgeContract() {\n if (bridgeContract() != msg.sender) revert ErrCallerMustBeBridgeContract();\n _;\n }\n\n /**\n * @inheritdoc IHasBridgeContract\n */\n function bridgeContract() public view override returns (address) {\n return address(_bridgeContract);\n }\n\n /**\n * @inheritdoc IHasBridgeContract\n */\n function setBridgeContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length <= 0) revert ErrZeroCodeContract();\n _setBridgeContract(_addr);\n }\n\n /**\n * @dev Sets the bridge contract.\n *\n * Emits the event `BridgeContractUpdated`.\n *\n */\n function _setBridgeContract(address _addr) internal {\n _bridgeContract = IBridge(_addr);\n emit BridgeContractUpdated(_addr);\n }\n}\n" + }, + "contracts/interfaces/IRoninTrustedOrganization.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IQuorum.sol\";\n\ninterface IRoninTrustedOrganization is IQuorum {\n struct TrustedOrganization {\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n address consensusAddr;\n // Address to voting proposal\n address governor;\n // Address to voting bridge operators\n address bridgeVoter;\n // Its Weight\n uint256 weight;\n // The block that the organization was added\n uint256 addedBlock;\n }\n\n /// @dev Emitted when the trusted organization is added.\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is updated.\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is removed.\n event TrustedOrganizationsRemoved(address[] orgs);\n\n /**\n * @dev Adds a list of addresses into the trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n * - The field `addedBlock` should be blank.\n *\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\n *\n */\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\n\n /**\n * @dev Updates weights for a list of existent trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n *\n * Emits the `TrustedOrganizationUpdated` event.\n *\n */\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\n\n /**\n * @dev Removes a list of addresses from the trusted organization.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\n *\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\n */\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\n\n /**\n * @dev Returns total weights.\n */\n function totalWeights() external view returns (uint256);\n\n /**\n * @dev Returns the weight of a consensus.\n */\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a governor.\n */\n function getGovernorWeight(address _governor) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a bridge voter.\n */\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\n\n /**\n * @dev Returns the weights of a list of consensus addresses.\n */\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of governor addresses.\n */\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of bridge voter addresses.\n */\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns total weights of the consensus list.\n */\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\n\n /**\n * @dev Returns total weights of the governor list.\n */\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\n\n /**\n * @dev Returns total weights of the bridge voter list.\n */\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\n\n /**\n * @dev Returns the trusted organization at `_index`.\n */\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\n\n /**\n * @dev Returns the number of trusted organizations.\n */\n function countTrustedOrganizations() external view returns (uint256);\n\n /**\n * @dev Returns all of the trusted organizations.\n */\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\n\n /**\n * @dev Returns the trusted organization by consensus address.\n *\n * Reverts once the consensus address is non-existent.\n */\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\n}\n" + }, + "contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\n /// @dev Emitted when the ronin trusted organization contract is updated.\n event RoninTrustedOrganizationContractUpdated(address);\n\n /// @dev Error of method caller must be Ronin trusted org contract.\n error ErrCallerMustBeRoninTrustedOrgContract();\n\n /**\n * @dev Returns the ronin trusted organization contract.\n */\n function roninTrustedOrganizationContract() external view returns (address);\n\n /**\n * @dev Sets the ronin trusted organization contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\n *\n */\n function setRoninTrustedOrganizationContract(address) external;\n}\n" + }, + "contracts/interfaces/IQuorum.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IQuorum {\n /// @dev Emitted when the threshold is updated\n event ThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n\n /**\n * @dev Returns the threshold.\n */\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\n\n /**\n * @dev Checks whether the `_voteWeight` passes the threshold.\n */\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\n\n /**\n * @dev Returns the minimum vote weight to pass the threshold.\n */\n function minimumVoteWeight() external view returns (uint256);\n\n /**\n * @dev Sets the threshold.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n returns (uint256 _previousNum, uint256 _previousDenom);\n}\n" + }, + "contracts/interfaces/collections/IHasBridgeContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasBridgeContract is IHasContract {\n /// @dev Emitted when the bridge contract is updated.\n event BridgeContractUpdated(address);\n\n /// @dev Error of method caller must be bridge contract.\n error ErrCallerMustBeBridgeContract();\n\n /**\n * @dev Returns the bridge contract.\n */\n function bridgeContract() external view returns (address);\n\n /**\n * @dev Sets the bridge contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `BridgeContractUpdated`.\n *\n */\n function setBridgeContract(address) external;\n}\n" + }, + "contracts/interfaces/IBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBridge {\n /**\n * @dev Replaces the old bridge operator list by the new one.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emitted the event `BridgeOperatorsReplaced`.\n *\n */\n function replaceBridgeOperators(address[] calldata) external;\n\n /**\n * @dev Returns the bridge operator list.\n */\n function getBridgeOperators() external view returns (address[] memory);\n}\n" + }, + "contracts/ronin/validator/EmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\nimport \"../../interfaces/validator/IEmergencyExit.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\nimport \"./CandidateManager.sol\";\n\nabstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateManager, CommonStorage {\n /**\n * @inheritdoc IEmergencyExit\n */\n function emergencyExitLockedAmount() external view returns (uint256) {\n return _emergencyExitLockedAmount;\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function emergencyExpiryDuration() external view returns (uint256) {\n return _emergencyExpiryDuration;\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external onlyStakingContract {\n EmergencyExitInfo storage _info = _exitInfo[_consensusAddr];\n if (_info.recyclingAt != 0) revert ErrAlreadyRequestedEmergencyExit();\n\n uint256 _revokingTimestamp = block.timestamp + _secLeftToRevoke;\n _setRevokingTimestamp(_candidateInfo[_consensusAddr], _revokingTimestamp);\n _emergencyExitJailedTimestamp[_consensusAddr] = _revokingTimestamp;\n _bridgeRewardDeprecatedAtPeriod[_consensusAddr][currentPeriod()] = true;\n\n uint256 _deductedAmount = _stakingContract.execDeductStakingAmount(_consensusAddr, _emergencyExitLockedAmount);\n if (_deductedAmount > 0) {\n uint256 _recyclingAt = block.timestamp + _emergencyExpiryDuration;\n _lockedConsensusList.push(_consensusAddr);\n _info.lockedAmount = _deductedAmount;\n _info.recyclingAt = _recyclingAt;\n IRoninGovernanceAdmin(_getAdmin()).createEmergencyExitPoll(\n _consensusAddr,\n _candidateInfo[_consensusAddr].treasuryAddr,\n block.timestamp,\n _recyclingAt\n );\n }\n emit EmergencyExitRequested(_consensusAddr, _deductedAmount);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external onlyAdmin {\n _setEmergencyExitLockedAmount(_emergencyExitLockedAmount);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external onlyAdmin {\n _setEmergencyExpiryDuration(_emergencyExpiryDuration);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient)\n external\n onlyAdmin\n {\n if (_exitInfo[_consensusAddr].recyclingAt == 0) {\n return;\n }\n\n uint256 _length = _lockedConsensusList.length;\n uint256 _index = _length;\n\n for (uint _i; _i < _length; _i++) {\n if (_lockedConsensusList[_i] == _consensusAddr) {\n _index = _i;\n break;\n }\n }\n\n // The locked amount might be recycled\n if (_index == _length) {\n return;\n }\n\n uint256 _amount = _exitInfo[_consensusAddr].lockedAmount;\n if (_amount > 0) {\n delete _exitInfo[_consensusAddr];\n if (_length > 1) {\n _lockedConsensusList[_index] = _lockedConsensusList[_length - 1];\n }\n _lockedConsensusList.pop();\n\n _lockedFundReleased[_consensusAddr] = true;\n if (_unsafeSendRON(_recipient, _amount, DEFAULT_ADDITION_GAS)) {\n emit EmergencyExitLockedFundReleased(_consensusAddr, _recipient, _amount);\n return;\n }\n\n emit EmergencyExitLockedFundReleasingFailed(_consensusAddr, _recipient, _amount, address(this).balance);\n }\n }\n\n /**\n * @dev Tries to recycle the locked funds from emergency exit requests.\n */\n function _tryRecycleLockedFundsFromEmergencyExits() internal {\n uint256 _length = _lockedConsensusList.length;\n\n uint256 _i;\n address _addr;\n EmergencyExitInfo storage _info;\n\n while (_i < _length) {\n _addr = _lockedConsensusList[_i];\n _info = _exitInfo[_addr];\n\n if (_info.recyclingAt <= block.timestamp) {\n _totalDeprecatedReward += _info.lockedAmount;\n\n delete _exitInfo[_addr];\n if (--_length > 0) {\n _lockedConsensusList[_i] = _lockedConsensusList[_length];\n }\n _lockedConsensusList.pop();\n continue;\n }\n\n _i++;\n }\n }\n\n /**\n * @dev Override `CandidateManager-_emergencyExitLockedFundReleased`.\n */\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {\n return _lockedFundReleased[_consensusAddr];\n }\n\n /**\n * @dev Override `CandidateManager-_removeCandidate`.\n */\n function _removeCandidate(address _consensusAddr) internal override {\n delete _lockedFundReleased[_consensusAddr];\n super._removeCandidate(_consensusAddr);\n }\n\n /**\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\n */\n function _bridgeOperatorOf(address _consensusAddr)\n internal\n view\n virtual\n override(CandidateManager, ValidatorInfoStorage)\n returns (address)\n {\n return CandidateManager._bridgeOperatorOf(_consensusAddr);\n }\n\n /**\n * @dev See `setEmergencyExitLockedAmount.\n */\n function _setEmergencyExitLockedAmount(uint256 _amount) internal {\n _emergencyExitLockedAmount = _amount;\n emit EmergencyExitLockedAmountUpdated(_amount);\n }\n\n /**\n * @dev See `setEmergencyExpiryDuration`.\n */\n function _setEmergencyExpiryDuration(uint256 _duration) internal {\n _emergencyExpiryDuration = _duration;\n emit EmergencyExpiryDurationUpdated(_duration);\n }\n}\n" + }, + "contracts/extensions/RONTransferHelper.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nabstract contract RONTransferHelper {\n /// @dev Error of recipient not accepting RON when transfer RON.\n error ErrRecipientRevert();\n /// @dev Error of sender has insufficient balance.\n error ErrInsufficientBalance();\n\n /**\n * @dev See `_sendRON`.\n * Reverts if the recipient does not receive RON.\n */\n function _transferRON(address payable _recipient, uint256 _amount) internal {\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\n }\n\n /**\n * @dev Send `_amount` RON to the address `_recipient`.\n * Returns whether the recipient receives RON or not.\n * Reverts once the contract balance is insufficient.\n *\n * Note: consider using `ReentrancyGuard` before calling this function.\n *\n */\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\n return _unsafeSendRON(_recipient, _amount);\n }\n\n /**\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\n * the call does not revert.\n *\n * Note:\n * - Does not assert whether the balance of sender is sufficient.\n * - Does not assert whether the recipient accepts RON.\n * - Consider using `ReentrancyGuard` before calling this function.\n *\n */\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\n (_success, ) = _recipient.call{ value: _amount }(\"\");\n }\n\n /**\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\n */\n function _unsafeSendRON(\n address payable _recipient,\n uint256 _amount,\n uint256 _gas\n ) internal returns (bool _success) {\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\"\");\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/CommonStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../interfaces/validator/info-fragments/ICommonInfo.sol\";\nimport \"./JailingStorage.sol\";\nimport \"./TimingStorage.sol\";\nimport \"./ValidatorInfoStorage.sol\";\n\nabstract contract CommonStorage is ICommonInfo, TimingStorage, JailingStorage, ValidatorInfoStorage {\n /// @dev Mapping from consensus address => pending reward from producing block\n mapping(address => uint256) internal _miningReward;\n /// @dev Mapping from consensus address => pending reward from delegating\n mapping(address => uint256) internal _delegatingReward;\n\n /// @dev The total reward for bridge operators\n uint256 internal _totalBridgeReward;\n /// @dev Mapping from consensus address => pending reward for being bridge operator\n mapping(address => uint256) internal _bridgeOperatingReward;\n\n /// @dev The deprecated reward that has not been withdrawn by admin\n uint256 internal _totalDeprecatedReward;\n\n /// @dev The amount of RON to lock from a consensus address.\n uint256 internal _emergencyExitLockedAmount;\n /// @dev The duration that an emergency request is expired and the fund will be recycled.\n uint256 internal _emergencyExpiryDuration;\n /// @dev The address list of consensus addresses that being locked fund.\n address[] internal _lockedConsensusList;\n /// @dev Mapping from consensus => request exist info\n mapping(address => EmergencyExitInfo) internal _exitInfo;\n /// @dev Mapping from consensus => flag indicating whether the locked fund is released\n mapping(address => bool) internal _lockedFundReleased;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[44] private ______gap;\n\n /**\n * @inheritdoc ICommonInfo\n */\n function getEmergencyExitInfo(address _consensusAddr)\n external\n view\n override\n returns (EmergencyExitInfo memory _info)\n {\n _info = _exitInfo[_consensusAddr];\n if (_info.recyclingAt == 0) revert NonExistentRecyclingInfo();\n }\n\n /**\n * @inheritdoc ICommonInfo\n */\n function totalDeprecatedReward() external view override returns (uint256) {\n return _totalDeprecatedReward;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochOf(uint256 _block)\n public\n view\n virtual\n override(ITimingInfo, JailingStorage, TimingStorage)\n returns (uint256)\n {\n return TimingStorage.epochOf(_block);\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriod() public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) {\n return TimingStorage.currentPeriod();\n }\n}\n" + }, + "contracts/ronin/validator/CandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasStakingContract.sol\";\nimport \"../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../interfaces/validator/ICandidateManager.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\n\nabstract contract CandidateManager is ICandidateManager, PercentageConsumer, GlobalConfigConsumer, HasStakingContract {\n /// @dev Maximum number of validator candidate\n uint256 private _maxValidatorCandidate;\n\n /// @dev The validator candidate array\n address[] internal _candidates;\n /// @dev Mapping from candidate consensus address => bitwise negation of validator index in `_candidates`\n mapping(address => uint256) internal _candidateIndex;\n /// @dev Mapping from candidate consensus address => their info\n mapping(address => ValidatorCandidate) internal _candidateInfo;\n\n /**\n * @dev The minimum offset in day from current date to the effective date of a new commission schedule.\n * Value of 1 means the change gets affected at the beginning of the following day.\n **/\n uint256 internal _minEffectiveDaysOnwards;\n /// @dev Mapping from candidate consensus address => schedule commission change.\n mapping(address => CommissionSchedule) internal _candidateCommissionChangeSchedule;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc ICandidateManager\n */\n function maxValidatorCandidate() public view override returns (uint256) {\n return _maxValidatorCandidate;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function minEffectiveDaysOnwards() external view override returns (uint256) {\n return _minEffectiveDaysOnwards;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function setMaxValidatorCandidate(uint256 _number) external override onlyAdmin {\n _setMaxValidatorCandidate(_number);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external override onlyAdmin {\n _setMinEffectiveDaysOnwards(_numOfDays);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function execApplyValidatorCandidate(\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external override onlyStakingContract {\n uint256 _length = _candidates.length;\n if (_length >= maxValidatorCandidate()) revert ErrExceedsMaxNumberOfCandidate();\n if (isValidatorCandidate(_consensusAddr)) revert ErrExistentCandidate();\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\n\n for (uint _i; _i < _candidates.length; _i++) {\n ValidatorCandidate storage existentInfo = _candidateInfo[_candidates[_i]];\n if (_candidateAdmin == existentInfo.admin) revert ErrExistentCandidateAdmin(_candidateAdmin);\n if (_treasuryAddr == existentInfo.treasuryAddr) revert ErrExistentTreasury(_treasuryAddr);\n if (_bridgeOperatorAddr == existentInfo.bridgeOperatorAddr) revert ErrExistentBridgeOperator(_bridgeOperatorAddr);\n }\n\n _candidateIndex[_consensusAddr] = ~_length;\n _candidates.push(_consensusAddr);\n\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\n _info.admin = _candidateAdmin;\n _info.consensusAddr = _consensusAddr;\n _info.treasuryAddr = _treasuryAddr;\n _info.bridgeOperatorAddr = _bridgeOperatorAddr;\n _info.commissionRate = _commissionRate;\n emit CandidateGranted(_consensusAddr, _treasuryAddr, _candidateAdmin, _bridgeOperatorAddr);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function execRequestRenounceCandidate(address _consensusAddr, uint256 _secsLeft)\n external\n override\n onlyStakingContract\n {\n if (_isTrustedOrg(_consensusAddr)) revert ErrTrustedOrgCannotRenounce();\n\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\n if (_info.revokingTimestamp != 0) revert ErrAlreadyRequestedRevokingCandidate();\n _setRevokingTimestamp(_info, block.timestamp + _secsLeft);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function execRequestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveDaysOnwards,\n uint256 _commissionRate\n ) external override onlyStakingContract {\n if (_candidateCommissionChangeSchedule[_consensusAddr].effectiveTimestamp != 0) {\n revert ErrAlreadyRequestedUpdatingCommissionRate();\n }\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\n if (_effectiveDaysOnwards < _minEffectiveDaysOnwards) revert ErrInvalidEffectiveDaysOnwards();\n\n CommissionSchedule storage _schedule = _candidateCommissionChangeSchedule[_consensusAddr];\n uint256 _effectiveTimestamp = ((block.timestamp / PERIOD_DURATION) + _effectiveDaysOnwards) * PERIOD_DURATION;\n _schedule.effectiveTimestamp = _effectiveTimestamp;\n _schedule.commissionRate = _commissionRate;\n\n emit CommissionRateUpdateScheduled(_consensusAddr, _effectiveTimestamp, _commissionRate);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function isValidatorCandidate(address _addr) public view override returns (bool) {\n return _candidateIndex[_addr] != 0;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCandidateInfos() external view override returns (ValidatorCandidate[] memory _list) {\n _list = new ValidatorCandidate[](_candidates.length);\n for (uint _i; _i < _list.length; _i++) {\n _list[_i] = _candidateInfo[_candidates[_i]];\n }\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCandidateInfo(address _candidate) external view override returns (ValidatorCandidate memory) {\n if (!isValidatorCandidate(_candidate)) revert ErrNonExistentCandidate();\n return _candidateInfo[_candidate];\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getValidatorCandidates() public view override returns (address[] memory) {\n return _candidates;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCommissionChangeSchedule(address _candidate) external view override returns (CommissionSchedule memory) {\n return _candidateCommissionChangeSchedule[_candidate];\n }\n\n /**\n * @dev Removes unsastisfied candidates, the ones who have insufficient minimum candidate staking amount,\n * or the ones who requested to renounce their candidate role.\n *\n * Emits the event `CandidatesRevoked` when a candidate is revoked.\n *\n */\n function _syncCandidateSet(uint256 _nextPeriod) internal returns (address[] memory _unsatisfiedCandidates) {\n IStaking _staking = _stakingContract;\n uint256 _waitingSecsToRevoke = _staking.waitingSecsToRevoke();\n uint256 _minStakingAmount = _staking.minValidatorStakingAmount();\n uint256[] memory _selfStakings = _staking.getManySelfStakings(_candidates);\n\n uint256 _length = _candidates.length;\n uint256 _unsatisfiedCount;\n _unsatisfiedCandidates = new address[](_length);\n\n {\n uint256 _i;\n address _addr;\n ValidatorCandidate storage _info;\n while (_i < _length) {\n _addr = _candidates[_i];\n _info = _candidateInfo[_addr];\n\n // Checks for under-balance status of candidates\n bool _hasTopupDeadline = _info.topupDeadline != 0;\n if (_selfStakings[_i] < _minStakingAmount) {\n // Updates deadline on the first time unsatisfied the staking amount condition\n if (!_hasTopupDeadline) {\n uint256 _topupDeadline = block.timestamp + _waitingSecsToRevoke;\n _info.topupDeadline = _topupDeadline;\n emit CandidateTopupDeadlineUpdated(_addr, _topupDeadline);\n }\n } else if (_hasTopupDeadline) {\n // Removes the deadline if the staking amount condition is satisfied\n delete _info.topupDeadline;\n emit CandidateTopupDeadlineUpdated(_addr, 0);\n }\n\n // Removes unsastisfied candidates\n bool _revokingActivated = (_info.revokingTimestamp != 0 && _info.revokingTimestamp <= block.timestamp) ||\n _emergencyExitLockedFundReleased(_addr);\n bool _topupDeadlineMissed = _info.topupDeadline != 0 && _info.topupDeadline <= block.timestamp;\n if (_revokingActivated || _topupDeadlineMissed) {\n _selfStakings[_i] = _selfStakings[--_length];\n _unsatisfiedCandidates[_unsatisfiedCount++] = _addr;\n _removeCandidate(_addr);\n continue;\n }\n\n // Checks for schedule of commission change and updates commission rate\n uint256 _scheduleTimestamp = _candidateCommissionChangeSchedule[_addr].effectiveTimestamp;\n if (_scheduleTimestamp != 0 && _scheduleTimestamp <= block.timestamp) {\n uint256 _commisionRate = _candidateCommissionChangeSchedule[_addr].commissionRate;\n delete _candidateCommissionChangeSchedule[_addr];\n _info.commissionRate = _commisionRate;\n emit CommissionRateUpdated(_addr, _commisionRate);\n }\n\n _i++;\n }\n }\n\n assembly {\n mstore(_unsatisfiedCandidates, _unsatisfiedCount)\n }\n\n if (_unsatisfiedCount > 0) {\n emit CandidatesRevoked(_unsatisfiedCandidates);\n _staking.execDeprecatePools(_unsatisfiedCandidates, _nextPeriod);\n }\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function isCandidateAdmin(address _candidate, address _admin) external view override returns (bool) {\n return _candidateInfo[_candidate].admin == _admin;\n }\n\n /**\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\n */\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address) {\n return _candidateInfo[_consensusAddr].bridgeOperatorAddr;\n }\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function _setMaxValidatorCandidate(uint256 _threshold) internal {\n _maxValidatorCandidate = _threshold;\n emit MaxValidatorCandidateUpdated(_threshold);\n }\n\n /**\n * @dev Sets the minimum number of days onwards to the effective date of commission rate change.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function _setMinEffectiveDaysOnwards(uint256 _numOfDays) internal {\n if (_numOfDays < 1) revert ErrInvalidMinEffectiveDaysOnwards();\n _minEffectiveDaysOnwards = _numOfDays;\n emit MinEffectiveDaysOnwardsUpdated(_numOfDays);\n }\n\n /**\n * @dev Removes the candidate.\n */\n function _removeCandidate(address _addr) internal virtual {\n uint256 _idx = _candidateIndex[_addr];\n if (_idx == 0) {\n return;\n }\n\n delete _candidateInfo[_addr];\n delete _candidateIndex[_addr];\n delete _candidateCommissionChangeSchedule[_addr];\n\n address _lastCandidate = _candidates[_candidates.length - 1];\n if (_lastCandidate != _addr) {\n _candidateIndex[_lastCandidate] = _idx;\n _candidates[~_idx] = _lastCandidate;\n }\n\n _candidates.pop();\n }\n\n /**\n * @dev Sets timestamp to revoke a candidate.\n */\n function _setRevokingTimestamp(ValidatorCandidate storage _candidate, uint256 _timestamp) internal {\n if (!isValidatorCandidate(_candidate.consensusAddr)) revert ErrNonExistentCandidate();\n _candidate.revokingTimestamp = _timestamp;\n emit CandidateRevokingTimestampUpdated(_candidate.consensusAddr, _timestamp);\n }\n\n /**\n * @dev Returns a flag indicating whether the fund is unlocked.\n */\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual returns (bool);\n\n /**\n * @dev Returns whether the consensus address is a trusted org or not.\n */\n function _isTrustedOrg(address _consensusAddr) internal virtual returns (bool);\n}\n" + }, + "contracts/ronin/validator/storage-fragments/JailingStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../interfaces/validator/info-fragments/IJailingInfo.sol\";\nimport \"./TimingStorage.sol\";\n\nabstract contract JailingStorage is IJailingInfo {\n /// @dev Mapping from consensus address => period number => block producer has no pending reward.\n mapping(address => mapping(uint256 => bool)) internal _miningRewardDeprecatedAtPeriod;\n /// @dev Mapping from consensus address => period number => whether the block producer get cut off reward, due to bailout.\n mapping(address => mapping(uint256 => bool)) internal _miningRewardBailoutCutOffAtPeriod;\n /// @dev Mapping from consensus address => period number => block operator has no pending reward.\n mapping(address => mapping(uint256 => bool)) internal _bridgeRewardDeprecatedAtPeriod;\n\n /// @dev Mapping from consensus address => the last block that the block producer is jailed.\n mapping(address => uint256) internal _blockProducerJailedBlock;\n /// @dev Mapping from consensus address => the last timestamp that the bridge operator is jailed.\n mapping(address => uint256) internal _emergencyExitJailedTimestamp;\n /// @dev Mapping from consensus address => the last block that the block producer cannot bailout.\n mapping(address => uint256) internal _cannotBailoutUntilBlock;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkJailed(address _addr) external view override returns (bool) {\n return checkJailedAtBlock(_addr, block.number);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function getJailedTimeLeft(address _addr)\n external\n view\n override\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n )\n {\n return getJailedTimeLeftAtBlock(_addr, block.number);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkJailedAtBlock(address _addr, uint256 _blockNum) public view override returns (bool) {\n return _jailedAtBlock(_addr, _blockNum);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\n public\n view\n override\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n )\n {\n uint256 _jailedBlock = _blockProducerJailedBlock[_addr];\n if (_jailedBlock < _blockNum) {\n return (false, 0, 0);\n }\n\n isJailed_ = true;\n blockLeft_ = _jailedBlock - _blockNum + 1;\n epochLeft_ = epochOf(_jailedBlock) - epochOf(_blockNum) + 1;\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkManyJailed(address[] calldata _addrList) external view override returns (bool[] memory _result) {\n _result = new bool[](_addrList.length);\n for (uint256 _i; _i < _addrList.length; _i++) {\n _result[_i] = _jailed(_addrList[_i]);\n }\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkMiningRewardDeprecated(address _blockProducer) external view override returns (bool _result) {\n uint256 _period = currentPeriod();\n return _miningRewardDeprecated(_blockProducer, _period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period)\n external\n view\n override\n returns (bool _result)\n {\n return _miningRewardDeprecated(_blockProducer, _period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n *\n * @dev Because the information of deprecating bridge reward of a period is only determined at the end of that period, this\n * method will return the deprecating info of the latest period. A method for querying that info of current period is no need.\n */\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr)\n external\n view\n override\n returns (bool _result)\n {\n uint256 _period = currentPeriod() - 1;\n return _bridgeRewardDeprecated(_consensusAddr, _period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\n external\n view\n override\n returns (bool _result)\n {\n return _bridgeRewardDeprecated(_consensusAddr, _period);\n }\n\n /**\n * @dev See `ITimingInfo-epochOf`\n */\n function epochOf(uint256 _block) public view virtual returns (uint256);\n\n /**\n * @dev See `ITimingInfo-currentPeriod`\n */\n function currentPeriod() public view virtual returns (uint256);\n\n /**\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) during the current period.\n */\n function _jailed(address _validatorAddr) internal view returns (bool) {\n return _jailedAtBlock(_validatorAddr, block.number);\n }\n\n /**\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) at a specific block.\n */\n function _jailedAtBlock(address _validatorAddr, uint256 _blockNum) internal view returns (bool) {\n return _blockNum <= _blockProducerJailedBlock[_validatorAddr];\n }\n\n /**\n * @dev Returns whether the block producer has no pending reward in that period.\n */\n function _miningRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\n return _miningRewardDeprecatedAtPeriod[_validatorAddr][_period];\n }\n\n /**\n * @dev Returns whether the bridge operator has no pending reward in the period.\n */\n function _bridgeRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\n return _bridgeRewardDeprecatedAtPeriod[_validatorAddr][_period];\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/TimingStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../../interfaces/validator/info-fragments/ITimingInfo.sol\";\n\nabstract contract TimingStorage is ITimingInfo, GlobalConfigConsumer {\n /// @dev The number of blocks in a epoch\n uint256 internal _numberOfBlocksInEpoch;\n /// @dev The last updated block\n uint256 internal _lastUpdatedBlock;\n /// @dev The last updated period\n uint256 internal _lastUpdatedPeriod;\n /// @dev The starting block of the last updated period\n uint256 internal _currentPeriodStartAtBlock;\n\n /// @dev Mapping from epoch index => period index\n mapping(uint256 => uint256) internal _periodOf;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n /**\n * @inheritdoc ITimingInfo\n */\n function getLastUpdatedBlock() external view override returns (uint256) {\n return _lastUpdatedBlock;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochOf(uint256 _block) public view virtual override returns (uint256) {\n return _block / _numberOfBlocksInEpoch + 1;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber) {\n return (_epoch <= epochOf(block.number) || _periodOf[_epoch] > 0, _periodOf[_epoch]);\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function isPeriodEnding() external view override returns (bool) {\n return _isPeriodEnding(_computePeriod(block.timestamp));\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochEndingAt(uint256 _block) public view virtual override returns (bool) {\n return _block % _numberOfBlocksInEpoch == _numberOfBlocksInEpoch - 1;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriod() public view virtual override returns (uint256) {\n return _lastUpdatedPeriod;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriodStartAtBlock() public view override returns (uint256) {\n return _currentPeriodStartAtBlock;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function numberOfBlocksInEpoch() public view virtual override returns (uint256 _numberOfBlocks) {\n return _numberOfBlocksInEpoch;\n }\n\n /**\n * @dev See `ITimingInfo-isPeriodEnding`\n */\n function _isPeriodEnding(uint256 _newPeriod) internal view virtual returns (bool) {\n return _newPeriod > _lastUpdatedPeriod;\n }\n\n /**\n * @dev Returns the calculated period.\n */\n function _computePeriod(uint256 _timestamp) internal pure returns (uint256) {\n return _timestamp / PERIOD_DURATION;\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/ValidatorInfoStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\nimport \"../../../extensions/collections/HasRoninTrustedOrganizationContract.sol\";\nimport \"../../../interfaces/validator/info-fragments/IValidatorInfo.sol\";\n\nabstract contract ValidatorInfoStorage is IValidatorInfo, HasRoninTrustedOrganizationContract {\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n /// @dev The maximum number of validator.\n uint256 internal _maxValidatorNumber;\n\n /// @dev The total of validators\n uint256 public validatorCount;\n /// @dev Mapping from validator index => validator address\n mapping(uint256 => address) internal _validators;\n /// @dev Mapping from address => flag indicating the validator ability: producing block, operating bridge\n mapping(address => EnumFlags.ValidatorFlag) internal _validatorMap;\n /// @dev The number of slot that is reserved for prioritized validators\n uint256 internal _maxPrioritizedValidatorNumber;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getValidators()\n public\n view\n override\n returns (\n address[] memory _validatorList,\n address[] memory _bridgeOperators,\n EnumFlags.ValidatorFlag[] memory _flags\n )\n {\n _validatorList = new address[](validatorCount);\n _bridgeOperators = new address[](validatorCount);\n _flags = new EnumFlags.ValidatorFlag[](validatorCount);\n for (uint _i; _i < _validatorList.length; _i++) {\n address _validator = _validators[_i];\n _validatorList[_i] = _validator;\n _bridgeOperators[_i] = _bridgeOperatorOf(_validator);\n _flags[_i] = _validatorMap[_validator];\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isValidator(address _addr) public view override returns (bool) {\n return !_validatorMap[_addr].isNone();\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getBlockProducers() public view override returns (address[] memory _result) {\n _result = new address[](validatorCount);\n uint256 _count = 0;\n for (uint _i; _i < _result.length; _i++) {\n if (isBlockProducer(_validators[_i])) {\n _result[_count++] = _validators[_i];\n }\n }\n\n assembly {\n mstore(_result, _count)\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isBlockProducer(address _addr) public view override returns (bool) {\n return _validatorMap[_addr].hasFlag(EnumFlags.ValidatorFlag.BlockProducer);\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function totalBlockProducers() external view returns (uint256 _total) {\n for (uint _i; _i < validatorCount; _i++) {\n if (isBlockProducer(_validators[_i])) {\n _total++;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getBridgeOperators() public view override returns (address[] memory _result) {\n _result = new address[](validatorCount);\n uint256 _count = 0;\n for (uint _i; _i < _result.length; _i++) {\n if (isOperatingBridge(_validators[_i])) {\n _result[_count++] = _bridgeOperatorOf(_validators[_i]);\n }\n }\n\n assembly {\n mstore(_result, _count)\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getBridgeOperatorsOf(address[] memory _validatorAddrs)\n public\n view\n override\n returns (address[] memory _result)\n {\n _result = new address[](_validatorAddrs.length);\n for (uint _i; _i < _result.length; _i++) {\n _result[_i] = _bridgeOperatorOf(_validatorAddrs[_i]);\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isBridgeOperator(address _bridgeOperatorAddr) external view override returns (bool _isOperator) {\n for (uint _i; _i < validatorCount; _i++) {\n if (_bridgeOperatorOf(_validators[_i]) == _bridgeOperatorAddr && isOperatingBridge(_validators[_i])) {\n _isOperator = true;\n break;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isOperatingBridge(address _consensusAddr) public view override returns (bool) {\n return _validatorMap[_consensusAddr].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator);\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {\n return _maxValidatorNumber;\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function maxPrioritizedValidatorNumber() external view override returns (uint256 _maximumPrioritizedValidatorNumber) {\n return _maxPrioritizedValidatorNumber;\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function totalBridgeOperators() public view returns (uint256 _total) {\n for (uint _i; _i < validatorCount; _i++) {\n if (isOperatingBridge(_validators[_i])) {\n _total++;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function setMaxValidatorNumber(uint256 _max) external override onlyAdmin {\n _setMaxValidatorNumber(_max);\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function setMaxPrioritizedValidatorNumber(uint256 _number) external override onlyAdmin {\n _setMaxPrioritizedValidatorNumber(_number);\n }\n\n /**\n * @dev Returns the bridge operator of a consensus address.\n */\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address);\n\n /**\n * @dev See `IValidatorInfo-setMaxValidatorNumber`\n */\n function _setMaxValidatorNumber(uint256 _number) internal {\n _maxValidatorNumber = _number;\n emit MaxValidatorNumberUpdated(_number);\n }\n\n /**\n * @dev See `IValidatorInfo-setMaxPrioritizedValidatorNumber`\n */\n function _setMaxPrioritizedValidatorNumber(uint256 _number) internal {\n if (_number > _maxValidatorNumber) revert ErrInvalidMaxPrioritizedValidatorNumber();\n _maxPrioritizedValidatorNumber = _number;\n emit MaxPrioritizedValidatorNumberUpdated(_number);\n }\n}\n" + }, + "contracts/extensions/consumers/GlobalConfigConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nabstract contract GlobalConfigConsumer {\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\n /// @dev The length of a period in second.\n uint256 public constant PERIOD_DURATION = 1 days;\n}\n" + }, + "contracts/extensions/collections/HasStakingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasStakingContract.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\n\ncontract HasStakingContract is IHasStakingContract, HasProxyAdmin {\n IStaking internal _stakingContract;\n\n modifier onlyStakingContract() {\n if (stakingContract() != msg.sender) revert ErrCallerMustBeStakingContract();\n _;\n }\n\n /**\n * @inheritdoc IHasStakingContract\n */\n function stakingContract() public view override returns (address) {\n return address(_stakingContract);\n }\n\n /**\n * @inheritdoc IHasStakingContract\n */\n function setStakingContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setStakingContract(_addr);\n }\n\n /**\n * @dev Sets the staking contract.\n *\n * Emits the event `StakingContractUpdated`.\n *\n */\n function _setStakingContract(address _addr) internal {\n _stakingContract = IStaking(_addr);\n emit StakingContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/consumers/PercentageConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract PercentageConsumer {\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\n}\n" + }, + "contracts/interfaces/staking/IStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseStaking.sol\";\nimport \"./ICandidateStaking.sol\";\nimport \"./IDelegatorStaking.sol\";\n\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\n /**\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\n *\n * Note: This method should be called once at the period ending.\n *\n */\n function execRecordRewards(\n address[] calldata _consensusAddrs,\n uint256[] calldata _rewards,\n uint256 _period\n ) external payable;\n\n /**\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `Unstaked`.\n *\n */\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\n external\n returns (uint256 _actualDeductingAmount);\n}\n" + }, + "contracts/interfaces/collections/IHasStakingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasStakingContract is IHasContract {\n /// @dev Emitted when the staking contract is updated.\n event StakingContractUpdated(address);\n\n /// @dev Error of method caller must be staking contract.\n error ErrCallerMustBeStakingContract();\n\n /**\n * @dev Returns the staking contract.\n */\n function stakingContract() external view returns (address);\n\n /**\n * @dev Sets the staking contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `StakingContractUpdated`.\n *\n */\n function setStakingContract(address) external;\n}\n" + }, + "contracts/interfaces/staking/IBaseStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IBaseStaking {\n struct PoolDetail {\n // Address of the pool i.e. consensus address of the validator\n address addr;\n // Pool admin address\n address admin;\n // Self-staking amount\n uint256 stakingAmount;\n // Total number of RON staking for the pool\n uint256 stakingTotal;\n // Mapping from delegator => delegating amount\n mapping(address => uint256) delegatingAmount;\n // Mapping from delegator => the last timestamp that delegator staked\n mapping(address => uint256) lastDelegatingTimestamp;\n }\n\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\n event WaitingSecsToRevokeUpdated(uint256 secs);\n\n /// @dev Error of cannot transfer RON.\n error ErrCannotTransferRON();\n /// @dev Error of receiving zero message value.\n error ErrZeroValue();\n /// @dev Error of pool admin is not allowed to call.\n error ErrPoolAdminForbidden();\n /// @dev Error of no one is allowed to call but the pool's admin.\n error ErrOnlyPoolAdminAllowed();\n /// @dev Error of admin of any active pool cannot delegate.\n error ErrAdminOfAnyActivePoolForbidden(address admin);\n /// @dev Error of querying inactive pool.\n error ErrInactivePool(address poolAddr);\n /// @dev Error of length of input arrays are not of the same.\n error ErrInvalidArrays();\n\n /**\n * @dev Returns whether the `_poolAdminAddr` is currently active.\n */\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\n\n /**\n * @dev Returns the consensus address corresponding to the pool admin.\n */\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\n\n /**\n * @dev Returns the staking pool detail.\n */\n function getPoolDetail(address)\n external\n view\n returns (\n address _admin,\n uint256 _stakingAmount,\n uint256 _stakingTotal\n );\n\n /**\n * @dev Returns the self-staking amounts of the pools.\n */\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\n\n /**\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n */\n function cooldownSecsToUndelegate() external view returns (uint256);\n\n /**\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\n */\n function waitingSecsToRevoke() external view returns (uint256);\n\n /**\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CooldownSecsToUndelegateUpdated`.\n *\n */\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\n\n /**\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `WaitingSecsToRevokeUpdated`.\n *\n */\n function setWaitingSecsToRevoke(uint256 _secs) external;\n}\n" + }, + "contracts/interfaces/staking/ICandidateStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface ICandidateStaking is IRewardPool {\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\n event MinValidatorStakingAmountUpdated(uint256 threshold);\n /// @dev Emitted when the commission rate range is updated.\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\n\n /// @dev Emitted when the pool admin staked for themself.\n event Staked(address indexed consensuAddr, uint256 amount);\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\n event Unstaked(address indexed consensuAddr, uint256 amount);\n\n /// @dev Emitted when the validator pool is approved.\n event PoolApproved(address indexed validator, address indexed admin);\n /// @dev Emitted when the validator pool is deprecated.\n event PoolsDeprecated(address[] validator);\n /// @dev Emitted when the staking amount transfer failed.\n event StakingAmountTransferFailed(\n address indexed validator,\n address indexed admin,\n uint256 amount,\n uint256 contractBalance\n );\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\n event StakingAmountDeductFailed(\n address indexed validator,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Error of cannot transfer RON to specified target.\n error ErrCannotInitTransferRON(address addr, string extraInfo);\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\n error ErrThreeInteractionAddrsNotEqual();\n /// @dev Error of three operation addresses must be distinct in applying for validator candidate.\n error ErrThreeOperationAddrsNotDistinct();\n /// @dev Error of unstaking zero amount.\n error ErrUnstakeZeroAmount();\n /// @dev Error of invalid staking amount left after deducted.\n error ErrStakingAmountLeft();\n /// @dev Error of insufficient staking amount for unstaking.\n error ErrInsufficientStakingAmount();\n /// @dev Error of unstaking too early.\n error ErrUnstakeTooEarly();\n /// @dev Error of setting commission rate exceeds max allowed.\n error ErrInvalidCommissionRate();\n\n /**\n * @dev Returns the minimum threshold for being a validator candidate.\n */\n function minValidatorStakingAmount() external view returns (uint256);\n\n /**\n * @dev Returns the commission rate range that the candidate can set.\n */\n function getCommissionRateRange() external view returns (uint256 _minRange, uint256 _maxRange);\n\n /**\n * @dev Sets the minimum threshold for being a validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinValidatorStakingAmountUpdated` event.\n *\n */\n function setMinValidatorStakingAmount(uint256) external;\n\n /**\n * @dev Sets the commission rate range that a candidate can set.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `CommissionRateRangeUpdated` event.\n *\n */\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external;\n\n /**\n * @dev Proposes a candidate to become a validator.\n *\n * Requirements:\n * - The method caller is able to receive RON.\n * - The treasury is able to receive RON.\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\n *\n * Emits the event `PoolApproved`.\n *\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\n * to its candidate, e.g. scheduling maintenance.\n *\n */\n function applyValidatorCandidate(\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external payable;\n\n /**\n * @dev Deprecates the pool.\n * - Deduct self-staking amount of the pool admin to zero.\n * - Transfer the deducted amount to the pool admin.\n * - Deactivate the pool admin address in the mapping of active pool admins\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\n *\n */\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\n\n /**\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `msg.value` is larger than 0.\n *\n * Emits the event `Staked`.\n *\n */\n function stake(address _consensusAddr) external payable;\n\n /**\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n * Emits the event `Unstaked`.\n *\n */\n function unstake(address _consensusAddr, uint256 _amount) external;\n\n /**\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\n * - The `_rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdated`.\n *\n */\n function requestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveDaysOnwards,\n uint256 _commissionRate\n ) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestRenounce(address _consensusAddr) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestEmergencyExit(address _consensusAddr) external;\n}\n" + }, + "contracts/interfaces/staking/IDelegatorStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface IDelegatorStaking is IRewardPool {\n /// @dev Emitted when the delegator staked for a validator candidate.\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\n /// @dev Emitted when the delegator unstaked from a validator candidate.\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\n\n /// @dev Error of undelegating zero amount.\n error ErrUndelegateZeroAmount();\n /// @dev Error of undelegating insufficient amount.\n error ErrInsufficientDelegatingAmount();\n /// @dev Error of undelegating too early.\n error ErrUndelegateTooEarly();\n\n /**\n * @dev Stakes for a validator candidate `_consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is not the pool admin.\n *\n * Emits the `Delegated` event.\n *\n */\n function delegate(address _consensusAddr) external payable;\n\n /**\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the `Undelegated` event.\n *\n */\n function undelegate(address _consensusAddr, uint256 _amount) external;\n\n /**\n * @dev Bulk unstakes from a list of candidates.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the events `Undelegated`.\n *\n */\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\n\n /**\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `Undelegated` event and the `Delegated` event.\n *\n */\n function redelegate(\n address _consensusAddrSrc,\n address _consensusAddrDst,\n uint256 _amount\n ) external;\n\n /**\n * @dev Returns the claimable reward of the user `_user`.\n */\n function getRewards(address _user, address[] calldata _poolAddrList)\n external\n view\n returns (uint256[] memory _rewards);\n\n /**\n * @dev Claims the reward of method caller.\n *\n * Emits the `RewardClaimed` event.\n *\n */\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\n\n /**\n * @dev Claims the rewards and delegates them to the consensus address.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `RewardClaimed` event and the `Delegated` event.\n *\n */\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\n external\n returns (uint256 _amount);\n}\n" + }, + "contracts/interfaces/staking/IRewardPool.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/consumers/PeriodWrapperConsumer.sol\";\n\ninterface IRewardPool is PeriodWrapperConsumer {\n struct UserRewardFields {\n // Recorded reward amount.\n uint256 debited;\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\n uint256 aRps;\n // Lowest staking amount in the period.\n uint256 lowestAmount;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n\n struct PoolFields {\n // Accumulated of the amount rewards per share (one unit staking).\n uint256 aRps;\n // The staking total to share reward of the current period.\n PeriodWrapper shares;\n }\n\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\n /// @dev Emitted when the user claimed their reward\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\n\n /// @dev Emitted when the pool shares are updated\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\n /// @dev Emitted when the pools are updated\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\n /// @dev Emitted when the contract fails when updating the pools\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\n /// @dev Emitted when the contract fails when updating the pools that already set\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\n\n /// @dev Error of invalid pool share.\n error ErrInvalidPoolShare();\n\n /**\n * @dev Returns the reward amount that user claimable.\n */\n function getReward(address _poolAddr, address _user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amount of an user.\n */\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amounts of the users.\n */\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Returns the total staking amount of all users for a pool.\n */\n function getStakingTotal(address _poolAddr) external view returns (uint256);\n\n /**\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\n */\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\n}\n" + }, + "contracts/interfaces/consumers/PeriodWrapperConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface PeriodWrapperConsumer {\n struct PeriodWrapper {\n // Inner value.\n uint256 inner;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n}\n" + }, + "contracts/mocks/validator/MockValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../ronin/validator/CandidateManager.sol\";\n\ncontract MockValidatorSet is IRoninValidatorSet, CandidateManager {\n address public stakingVestingContract;\n address public slashIndicatorContract;\n\n uint256 internal _lastUpdatedPeriod;\n uint256 internal _numberOfBlocksInEpoch;\n /// @dev Mapping from period number => slashed\n mapping(uint256 => bool) internal _periodSlashed;\n\n constructor(\n address __stakingContract,\n address _slashIndicatorContract,\n address _stakingVestingContract,\n uint256 __maxValidatorCandidate,\n uint256 __numberOfBlocksInEpoch,\n uint256 __minEffectiveDaysOnwards\n ) {\n _setStakingContract(__stakingContract);\n _setMaxValidatorCandidate(__maxValidatorCandidate);\n slashIndicatorContract = _slashIndicatorContract;\n stakingVestingContract = _stakingVestingContract;\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\n _minEffectiveDaysOnwards = __minEffectiveDaysOnwards;\n }\n\n function submitBlockReward() external payable override {}\n\n function wrapUpEpoch() external payable override {\n _syncCandidateSet(_lastUpdatedPeriod + 1);\n _lastUpdatedPeriod = currentPeriod();\n }\n\n function getLastUpdatedBlock() external view override returns (uint256) {}\n\n function checkManyJailed(address[] calldata) external view override returns (bool[] memory) {}\n\n function checkMiningRewardDeprecatedAtPeriod(address, uint256 _period) external view override returns (bool) {}\n\n function checkMiningRewardDeprecated(address) external view override returns (bool) {}\n\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr)\n external\n view\n override\n returns (bool _result)\n {}\n\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\n external\n view\n returns (bool _result)\n {}\n\n function epochOf(uint256 _block) external view override returns (uint256) {}\n\n function getValidators()\n external\n view\n override\n returns (\n address[] memory,\n address[] memory,\n EnumFlags.ValidatorFlag[] memory\n )\n {}\n\n function epochEndingAt(uint256 _block) external view override returns (bool) {}\n\n function execSlash(\n address _validatorAddr,\n uint256 _newJailedUntil,\n uint256 _slashAmount,\n bool _cannotBailout\n ) external override {}\n\n function execBailOut(address, uint256) external override {}\n\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external override {}\n\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external override {}\n\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {}\n\n function maxPrioritizedValidatorNumber()\n external\n view\n override\n returns (uint256 _maximumPrioritizedValidatorNumber)\n {}\n\n function isValidator(address) external pure override returns (bool) {\n return true;\n }\n\n function numberOfBlocksInEpoch() public view override returns (uint256) {\n return _numberOfBlocksInEpoch;\n }\n\n function getBridgeOperators() external view override returns (address[] memory) {}\n\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view override returns (address[] memory) {}\n\n function isBridgeOperator(address) external pure override returns (bool) {\n return true;\n }\n\n function totalBridgeOperators() external view override returns (uint256) {}\n\n function getBlockProducers() external view override returns (address[] memory) {}\n\n function isBlockProducer(address) external pure override returns (bool) {\n return true;\n }\n\n function totalBlockProducers() external view override returns (uint256) {}\n\n function tryGetPeriodOfEpoch(uint256) external view returns (bool, uint256) {}\n\n function isPeriodEnding() public view virtual returns (bool) {\n return currentPeriod() > _lastUpdatedPeriod;\n }\n\n function currentPeriod() public view override returns (uint256) {\n return block.timestamp / 86400;\n }\n\n function checkJailed(address) external view override returns (bool) {}\n\n function getJailedTimeLeft(address)\n external\n view\n override\n returns (\n bool,\n uint256,\n uint256\n )\n {}\n\n function currentPeriodStartAtBlock() external view override returns (uint256) {}\n\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view override returns (bool) {}\n\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\n external\n view\n override\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n )\n {}\n\n function totalDeprecatedReward() external view override returns (uint256) {}\n\n function _bridgeOperatorOf(address _consensusAddr) internal view override returns (address) {\n return super._bridgeOperatorOf(_consensusAddr);\n }\n\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient)\n external\n override\n {}\n\n function emergencyExitLockedAmount() external override returns (uint256) {}\n\n function emergencyExpiryDuration() external override returns (uint256) {}\n\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external override {}\n\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external override {}\n\n function getEmergencyExitInfo(address _consensusAddr) external view override returns (EmergencyExitInfo memory) {}\n\n function execEmergencyExit(address, uint256) external {}\n\n function isOperatingBridge(address) external view returns (bool) {}\n\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {}\n\n function _isTrustedOrg(address _consensusAddr) internal virtual override returns (bool) {}\n}\n" + }, + "contracts/ronin/staking/Staking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"./CandidateStaking.sol\";\nimport \"./DelegatorStaking.sol\";\n\ncontract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable {\n constructor() {\n _disableInitializers();\n }\n\n receive() external payable onlyValidatorContract {}\n\n fallback() external payable onlyValidatorContract {}\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 __minValidatorStakingAmount,\n uint256 __maxCommissionRate,\n uint256 __cooldownSecsToUndelegate,\n uint256 __waitingSecsToRevoke\n ) external initializer {\n _setValidatorContract(__validatorContract);\n _setMinValidatorStakingAmount(__minValidatorStakingAmount);\n _setCommissionRateRange(0, __maxCommissionRate);\n _setCooldownSecsToUndelegate(__cooldownSecsToUndelegate);\n _setWaitingSecsToRevoke(__waitingSecsToRevoke);\n }\n\n /**\n * @inheritdoc IStaking\n */\n function execRecordRewards(\n address[] calldata _consensusAddrs,\n uint256[] calldata _rewards,\n uint256 _period\n ) external payable override onlyValidatorContract {\n _recordRewards(_consensusAddrs, _rewards, _period);\n }\n\n /**\n * @inheritdoc IStaking\n */\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\n external\n override\n onlyValidatorContract\n returns (uint256 _actualDeductingAmount)\n {\n _actualDeductingAmount = _deductStakingAmount(_stakingPool[_consensusAddr], _amount);\n address payable _validatorContractAddr = payable(validatorContract());\n if (!_unsafeSendRON(_validatorContractAddr, _actualDeductingAmount)) {\n emit StakingAmountDeductFailed(\n _consensusAddr,\n _validatorContractAddr,\n _actualDeductingAmount,\n address(this).balance\n );\n }\n }\n\n /**\n * @inheritdoc RewardCalculation\n */\n function _currentPeriod() internal view virtual override returns (uint256) {\n return _validatorContract.currentPeriod();\n }\n\n /**\n * @inheritdoc CandidateStaking\n */\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount)\n internal\n override\n returns (uint256 _actualDeductingAmount)\n {\n _actualDeductingAmount = Math.min(_pool.stakingAmount, _amount);\n\n _pool.stakingAmount -= _actualDeductingAmount;\n _changeDelegatingAmount(\n _pool,\n _pool.admin,\n _pool.stakingAmount,\n Math.subNonNegative(_pool.stakingTotal, _actualDeductingAmount)\n );\n emit Unstaked(_pool.addr, _actualDeductingAmount);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "contracts/libraries/Math.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns whether the number `c` is in range of [a; b].\n */\n function inRange(\n uint256 c,\n uint256 a,\n uint256 b\n ) internal pure returns (bool) {\n return a <= c && c <= b;\n }\n\n /**\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\n */\n function twoRangeOverlap(\n uint256 x1,\n uint256 x2,\n uint256 y1,\n uint256 y2\n ) internal pure returns (bool) {\n return x1 <= y2 && y1 <= x2;\n }\n\n /**\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\n */\n function addWithUpperbound(\n uint256 a,\n uint256 b,\n uint256 upperbound\n ) internal pure returns (uint256) {\n return min(a + b, upperbound);\n }\n\n /**\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\n */\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a - b : 0;\n }\n\n /**\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\n */\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\n return zeroable != 0 ? a + zeroable : 0;\n }\n}\n" + }, + "contracts/ronin/staking/CandidateStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../libraries/AddressArrayUtils.sol\";\nimport \"../../interfaces/staking/ICandidateStaking.sol\";\nimport \"./BaseStaking.sol\";\n\nabstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConfigConsumer, PercentageConsumer {\n /// @dev The minimum threshold for being a validator candidate.\n uint256 internal _minValidatorStakingAmount;\n\n /// @dev The max commission rate that the validator can set (in range of [0;100_00] means [0-100%])\n uint256 internal _maxCommissionRate;\n /// @dev The min commission rate that the validator can set (in range of [0;100_00] means [0-100%])\n uint256 internal _minCommissionRate;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] ______gap;\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function minValidatorStakingAmount() public view override returns (uint256) {\n return _minValidatorStakingAmount;\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function getCommissionRateRange() external view override returns (uint256, uint256) {\n return (_minCommissionRate, _maxCommissionRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function setMinValidatorStakingAmount(uint256 _threshold) external override onlyAdmin {\n _setMinValidatorStakingAmount(_threshold);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external override onlyAdmin {\n _setCommissionRateRange(_minRate, _maxRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function applyValidatorCandidate(\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external payable override nonReentrant {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\n\n uint256 _amount = msg.value;\n address payable _poolAdmin = payable(msg.sender);\n _applyValidatorCandidate(\n _poolAdmin,\n _candidateAdmin,\n _consensusAddr,\n _treasuryAddr,\n _bridgeOperatorAddr,\n _commissionRate,\n _amount\n );\n\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\n _pool.admin = _poolAdmin;\n _pool.addr = _consensusAddr;\n _adminOfActivePoolMapping[_poolAdmin] = _consensusAddr;\n\n _stake(_stakingPool[_consensusAddr], _poolAdmin, _amount);\n emit PoolApproved(_consensusAddr, _poolAdmin);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveDaysOnwards,\n uint256 _commissionRate\n ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) {\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\n _validatorContract.execRequestUpdateCommissionRate(_consensusAddr, _effectiveDaysOnwards, _commissionRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function execDeprecatePools(address[] calldata _pools, uint256 _newPeriod) external override onlyValidatorContract {\n if (_pools.length == 0) {\n return;\n }\n\n for (uint _i = 0; _i < _pools.length; _i++) {\n PoolDetail storage _pool = _stakingPool[_pools[_i]];\n // Deactivate the pool admin in the active mapping.\n delete _adminOfActivePoolMapping[_pool.admin];\n\n // Deduct and transfer the self staking amount to the pool admin.\n uint256 _deductingAmount = _pool.stakingAmount;\n if (_deductingAmount > 0) {\n _deductStakingAmount(_pool, _deductingAmount);\n if (!_unsafeSendRON(payable(_pool.admin), _deductingAmount, DEFAULT_ADDITION_GAS)) {\n emit StakingAmountTransferFailed(_pool.addr, _pool.admin, _deductingAmount, address(this).balance);\n }\n }\n\n // Settle the unclaimed reward and transfer to the pool admin.\n uint256 _lastRewardAmount = _claimReward(_pools[_i], _pool.admin, _newPeriod);\n if (_lastRewardAmount > 0) {\n _unsafeSendRON(payable(_pool.admin), _lastRewardAmount, DEFAULT_ADDITION_GAS);\n }\n }\n\n emit PoolsDeprecated(_pools);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function stake(address _consensusAddr) external payable override noEmptyValue poolIsActive(_consensusAddr) {\n _stake(_stakingPool[_consensusAddr], msg.sender, msg.value);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function unstake(address _consensusAddr, uint256 _amount)\n external\n override\n nonReentrant\n poolIsActive(_consensusAddr)\n {\n if (_amount == 0) revert ErrUnstakeZeroAmount();\n address _requester = msg.sender;\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\n uint256 _remainAmount = _pool.stakingAmount - _amount;\n if (_remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft();\n\n _unstake(_pool, _requester, _amount);\n if (!_unsafeSendRON(payable(_requester), _amount, DEFAULT_ADDITION_GAS)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestRenounce(address _consensusAddr)\n external\n override\n poolIsActive(_consensusAddr)\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\n {\n _validatorContract.execRequestRenounceCandidate(_consensusAddr, _waitingSecsToRevoke);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestEmergencyExit(address _consensusAddr)\n external\n override\n poolIsActive(_consensusAddr)\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\n {\n _validatorContract.execEmergencyExit(_consensusAddr, _waitingSecsToRevoke);\n }\n\n /**\n * @dev See `ICandidateStaking-applyValidatorCandidate`\n */\n function _applyValidatorCandidate(\n address payable _poolAdmin,\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate,\n uint256 _amount\n ) internal {\n if (!_unsafeSendRON(_poolAdmin, 0)) revert ErrCannotInitTransferRON(_poolAdmin, \"pool admin\");\n if (!_unsafeSendRON(_treasuryAddr, 0)) revert ErrCannotInitTransferRON(_treasuryAddr, \"treasury\");\n if (_amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount();\n if (_poolAdmin != _candidateAdmin || _candidateAdmin != _treasuryAddr) revert ErrThreeInteractionAddrsNotEqual();\n\n address[] memory _diffAddrs = new address[](3);\n _diffAddrs[0] = _poolAdmin;\n _diffAddrs[1] = _consensusAddr;\n _diffAddrs[2] = _bridgeOperatorAddr;\n if (AddressArrayUtils.hasDuplicate(_diffAddrs)) revert ErrThreeOperationAddrsNotDistinct();\n\n _validatorContract.execApplyValidatorCandidate(\n _candidateAdmin,\n _consensusAddr,\n _treasuryAddr,\n _bridgeOperatorAddr,\n _commissionRate\n );\n }\n\n /**\n * @dev See `ICandidateStaking-stake`\n */\n function _stake(\n PoolDetail storage _pool,\n address _requester,\n uint256 _amount\n ) internal onlyPoolAdmin(_pool, _requester) {\n _pool.stakingAmount += _amount;\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal + _amount);\n _pool.lastDelegatingTimestamp[_requester] = block.timestamp;\n emit Staked(_pool.addr, _amount);\n }\n\n /**\n * @dev See `ICandidateStaking-unstake`\n */\n function _unstake(\n PoolDetail storage _pool,\n address _requester,\n uint256 _amount\n ) internal onlyPoolAdmin(_pool, _requester) {\n if (_amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount();\n if (_pool.lastDelegatingTimestamp[_requester] + _cooldownSecsToUndelegate > block.timestamp) {\n revert ErrUnstakeTooEarly();\n }\n\n _pool.stakingAmount -= _amount;\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal - _amount);\n emit Unstaked(_pool.addr, _amount);\n }\n\n /**\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\n *\n * Emits the event `Unstaked`.\n *\n * @return The actual deducted amount\n */\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount) internal virtual returns (uint256);\n\n /**\n * @dev Sets the minimum threshold for being a validator candidate.\n *\n * Emits the `MinValidatorStakingAmountUpdated` event.\n *\n */\n function _setMinValidatorStakingAmount(uint256 _threshold) internal {\n _minValidatorStakingAmount = _threshold;\n emit MinValidatorStakingAmountUpdated(_threshold);\n }\n\n /**\n * @dev Sets the max commission rate that a candidate can set.\n *\n * Emits the `MaxCommissionRateUpdated` event.\n *\n */\n function _setCommissionRateRange(uint256 _minRate, uint256 _maxRate) internal {\n if (_maxRate > _MAX_PERCENTAGE || _minRate > _maxRate) revert ErrInvalidCommissionRate();\n _maxCommissionRate = _maxRate;\n _minCommissionRate = _minRate;\n emit CommissionRateRangeUpdated(_minRate, _maxRate);\n }\n}\n" + }, + "contracts/ronin/staking/DelegatorStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/staking/IDelegatorStaking.sol\";\nimport \"./BaseStaking.sol\";\n\nabstract contract DelegatorStaking is BaseStaking, IDelegatorStaking {\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function delegate(address _consensusAddr) external payable noEmptyValue poolIsActive(_consensusAddr) {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n _delegate(_stakingPool[_consensusAddr], msg.sender, msg.value);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function undelegate(address _consensusAddr, uint256 _amount) external nonReentrant {\n address payable _delegator = payable(msg.sender);\n _undelegate(_stakingPool[_consensusAddr], _delegator, _amount);\n if (!_sendRON(_delegator, _amount)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external nonReentrant {\n if (_consensusAddrs.length == 0 || _consensusAddrs.length != _amounts.length) revert ErrInvalidArrays();\n\n address payable _delegator = payable(msg.sender);\n uint256 _total;\n\n for (uint _i = 0; _i < _consensusAddrs.length; _i++) {\n _total += _amounts[_i];\n _undelegate(_stakingPool[_consensusAddrs[_i]], _delegator, _amounts[_i]);\n }\n\n if (!_sendRON(_delegator, _total)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function redelegate(\n address _consensusAddrSrc,\n address _consensusAddrDst,\n uint256 _amount\n ) external nonReentrant poolIsActive(_consensusAddrDst) {\n address _delegator = msg.sender;\n _undelegate(_stakingPool[_consensusAddrSrc], _delegator, _amount);\n _delegate(_stakingPool[_consensusAddrDst], _delegator, _amount);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function claimRewards(address[] calldata _consensusAddrList)\n external\n override\n nonReentrant\n returns (uint256 _amount)\n {\n _amount = _claimRewards(msg.sender, _consensusAddrList);\n _transferRON(payable(msg.sender), _amount);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\n external\n override\n nonReentrant\n poolIsActive(_consensusAddrDst)\n returns (uint256 _amount)\n {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n return _delegateRewards(msg.sender, _consensusAddrList, _consensusAddrDst);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function getRewards(address _user, address[] calldata _poolAddrList)\n external\n view\n returns (uint256[] memory _rewards)\n {\n address _consensusAddr;\n uint256 _period = _validatorContract.currentPeriod();\n _rewards = new uint256[](_poolAddrList.length);\n\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\n _consensusAddr = _poolAddrList[_i];\n _rewards[_i] = _getReward(_consensusAddr, _user, _period, getStakingAmount(_consensusAddr, _user));\n }\n }\n\n /**\n * @dev Delegates from a validator address.\n *\n * Requirements:\n * - The delegator is not the pool admin.\n *\n * Emits the `Delegated` event.\n *\n * Note: This function does not verify the `msg.value` with the amount.\n *\n */\n function _delegate(\n PoolDetail storage _pool,\n address _delegator,\n uint256 _amount\n ) internal notPoolAdmin(_pool, _delegator) {\n _changeDelegatingAmount(\n _pool,\n _delegator,\n _pool.delegatingAmount[_delegator] + _amount,\n _pool.stakingTotal + _amount\n );\n _pool.lastDelegatingTimestamp[_delegator] = block.timestamp;\n emit Delegated(_delegator, _pool.addr, _amount);\n }\n\n /**\n * @dev Undelegates from a validator address.\n *\n * Requirements:\n * - The delegator is not the pool admin.\n * - The amount is larger than 0.\n * - The delegating amount is larger than or equal to the undelegating amount.\n *\n * Emits the `Undelegated` event.\n *\n * Note: Consider transferring back the amount of RON after calling this function.\n *\n */\n function _undelegate(\n PoolDetail storage _pool,\n address _delegator,\n uint256 _amount\n ) private notPoolAdmin(_pool, _delegator) {\n if (_amount == 0) revert ErrUndelegateZeroAmount();\n if (_pool.delegatingAmount[_delegator] < _amount) revert ErrInsufficientDelegatingAmount();\n\n if (\n _validatorContract.isValidatorCandidate(_pool.addr) &&\n _validatorContract.getCandidateInfo(_pool.addr).revokingTimestamp == 0 && // if candidate is not on renunciation\n _pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp // delegator is still in cooldown\n ) revert ErrUndelegateTooEarly();\n\n _changeDelegatingAmount(\n _pool,\n _delegator,\n _pool.delegatingAmount[_delegator] - _amount,\n _pool.stakingTotal - _amount\n );\n emit Undelegated(_delegator, _pool.addr, _amount);\n }\n\n /**\n * @dev Claims rewards from the pools `_poolAddrList`.\n * Note: This function does not transfer reward to user.\n */\n function _claimRewards(address _user, address[] memory _poolAddrList) internal returns (uint256 _amount) {\n uint256 _period = _currentPeriod();\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\n _amount += _claimReward(_poolAddrList[_i], _user, _period);\n }\n }\n\n /**\n * @dev Claims the rewards and delegates them to the consensus address.\n */\n function _delegateRewards(\n address _user,\n address[] calldata _poolAddrList,\n address _poolAddrDst\n ) internal returns (uint256 _amount) {\n _amount = _claimRewards(_user, _poolAddrList);\n _delegate(_stakingPool[_poolAddrDst], _user, _amount);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/libraries/AddressArrayUtils.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary AddressArrayUtils {\n /**\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\n * @param A Array to search\n * @return Returns true if duplicate, false otherwise\n */\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\n if (A.length == 0) {\n return false;\n }\n for (uint256 i = 0; i < A.length - 1; i++) {\n for (uint256 j = i + 1; j < A.length; j++) {\n if (A[i] == A[j]) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * @dev Returns whether two arrays of addresses are equal or not.\n */\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool) {\n bytes32 _thisHash;\n bytes32 _otherHash;\n\n assembly {\n _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\n _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\n }\n\n return _thisHash == _otherHash;\n }\n}\n" + }, + "contracts/ronin/staking/BaseStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\nimport \"../../interfaces/staking/IBaseStaking.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"./RewardCalculation.sol\";\n\nabstract contract BaseStaking is\n RONTransferHelper,\n ReentrancyGuard,\n RewardCalculation,\n HasValidatorContract,\n IBaseStaking\n{\n /// @dev Mapping from pool address => staking pool detail\n mapping(address => PoolDetail) internal _stakingPool;\n\n /// @dev The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n uint256 internal _cooldownSecsToUndelegate;\n /// @dev The number of seconds that a candidate must wait to be revoked and take the self-staking amount back.\n uint256 internal _waitingSecsToRevoke;\n\n /// @dev Mapping from admin address of an active pool => consensus address.\n mapping(address => address) internal _adminOfActivePoolMapping;\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n modifier noEmptyValue() {\n if (msg.value == 0) revert ErrZeroValue();\n _;\n }\n\n modifier notPoolAdmin(PoolDetail storage _pool, address _delegator) {\n if (_pool.admin == _delegator) revert ErrPoolAdminForbidden();\n _;\n }\n\n modifier onlyPoolAdmin(PoolDetail storage _pool, address _requester) {\n if (_pool.admin != _requester) revert ErrOnlyPoolAdminAllowed();\n _;\n }\n\n modifier poolIsActive(address _poolAddr) {\n if (!_validatorContract.isValidatorCandidate(_poolAddr)) revert ErrInactivePool(_poolAddr);\n _;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function isAdminOfActivePool(address _poolAdminAddr) public view override returns (bool) {\n return _adminOfActivePoolMapping[_poolAdminAddr] != address(0);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getPoolAddressOf(address _poolAdminAddr) external view override returns (address) {\n return _adminOfActivePoolMapping[_poolAdminAddr];\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getPoolDetail(address _poolAddr)\n external\n view\n returns (\n address _admin,\n uint256 _stakingAmount,\n uint256 _stakingTotal\n )\n {\n PoolDetail storage _pool = _stakingPool[_poolAddr];\n return (_pool.admin, _pool.stakingAmount, _pool.stakingTotal);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getManySelfStakings(address[] calldata _pools) external view returns (uint256[] memory _selfStakings) {\n _selfStakings = new uint256[](_pools.length);\n for (uint _i = 0; _i < _pools.length; _i++) {\n _selfStakings[_i] = _stakingPool[_pools[_i]].stakingAmount;\n }\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingTotal(address _poolAddr) public view override returns (uint256) {\n return _stakingPool[_poolAddr].stakingTotal;\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getManyStakingTotals(address[] calldata _poolList)\n public\n view\n override\n returns (uint256[] memory _stakingAmounts)\n {\n _stakingAmounts = new uint256[](_poolList.length);\n for (uint _i = 0; _i < _poolList.length; _i++) {\n _stakingAmounts[_i] = getStakingTotal(_poolList[_i]);\n }\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingAmount(address _poolAddr, address _user) public view override returns (uint256) {\n return _stakingPool[_poolAddr].delegatingAmount[_user];\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\n external\n view\n override\n returns (uint256[] memory _stakingAmounts)\n {\n if (_poolAddrs.length != _userList.length) revert ErrInvalidArrays();\n _stakingAmounts = new uint256[](_poolAddrs.length);\n for (uint _i = 0; _i < _stakingAmounts.length; _i++) {\n _stakingAmounts[_i] = _stakingPool[_poolAddrs[_i]].delegatingAmount[_userList[_i]];\n }\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function cooldownSecsToUndelegate() external view returns (uint256) {\n return _cooldownSecsToUndelegate;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function waitingSecsToRevoke() external view returns (uint256) {\n return _waitingSecsToRevoke;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external override onlyAdmin {\n _setCooldownSecsToUndelegate(_cooldownSecs);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function setWaitingSecsToRevoke(uint256 _secs) external override onlyAdmin {\n _setWaitingSecsToRevoke(_secs);\n }\n\n /**\n * @dev Sets the minium number of seconds to undelegate.\n *\n * Emits the event `CooldownSecsToUndelegateUpdated`.\n *\n */\n function _setCooldownSecsToUndelegate(uint256 _cooldownSecs) internal {\n _cooldownSecsToUndelegate = _cooldownSecs;\n emit CooldownSecsToUndelegateUpdated(_cooldownSecs);\n }\n\n /**\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\n *\n * Emits the event `WaitingSecsToRevokeUpdated`.\n *\n */\n function _setWaitingSecsToRevoke(uint256 _secs) internal {\n _waitingSecsToRevoke = _secs;\n emit WaitingSecsToRevokeUpdated(_secs);\n }\n\n /**\n * @dev Changes the delegate amount.\n */\n function _changeDelegatingAmount(\n PoolDetail storage _pool,\n address _delegator,\n uint256 _newDelegatingAmount,\n uint256 _newStakingTotal\n ) internal {\n _syncUserReward(_pool.addr, _delegator, _newDelegatingAmount);\n _pool.stakingTotal = _newStakingTotal;\n _pool.delegatingAmount[_delegator] = _newDelegatingAmount;\n }\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "contracts/ronin/staking/RewardCalculation.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/staking/IRewardPool.sol\";\nimport \"../../libraries/Math.sol\";\n\n/**\n * @title RewardCalculation contract\n * @dev This contract mainly contains the methods to calculate reward for staking contract.\n */\nabstract contract RewardCalculation is IRewardPool {\n /// @dev Mapping from pool address => period number => accumulated rewards per share (one unit staking)\n mapping(address => mapping(uint256 => PeriodWrapper)) private _accumulatedRps;\n /// @dev Mapping from the pool address => user address => the reward info of the user\n mapping(address => mapping(address => UserRewardFields)) private _userReward;\n /// @dev Mapping from the pool address => reward pool fields\n mapping(address => PoolFields) private _stakingPool;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IRewardPool\n */\n function getReward(address _poolAddr, address _user) external view returns (uint256) {\n return _getReward(_poolAddr, _user, _currentPeriod(), getStakingAmount(_poolAddr, _user));\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingAmount(address _poolAddr, address _user) public view virtual returns (uint256);\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingTotal(address _poolAddr) public view virtual returns (uint256);\n\n /**\n * @dev Returns the reward amount that user claimable.\n */\n function _getReward(\n address _poolAddr,\n address _user,\n uint256 _latestPeriod,\n uint256 _latestStakingAmount\n ) internal view returns (uint256) {\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\n\n if (_reward.lastPeriod == _latestPeriod) {\n return _reward.debited;\n }\n\n uint256 _aRps;\n uint256 _lastPeriodReward;\n PoolFields storage _pool = _stakingPool[_poolAddr];\n PeriodWrapper storage _wrappedArps = _accumulatedRps[_poolAddr][_reward.lastPeriod];\n\n if (_wrappedArps.lastPeriod > 0) {\n // Calculates the last period reward if the aRps at the period is set\n _aRps = _wrappedArps.inner;\n _lastPeriodReward = _reward.lowestAmount * (_aRps - _reward.aRps);\n } else {\n // Fallbacks to the previous aRps in case the aRps is not set\n _aRps = _reward.aRps;\n }\n\n uint256 _newPeriodsReward = _latestStakingAmount * (_pool.aRps - _aRps);\n return _reward.debited + (_lastPeriodReward + _newPeriodsReward) / 1e18;\n }\n\n /**\n * @dev Syncs the user reward.\n *\n * Emits the event `UserRewardUpdated` once the debit amount is updated.\n * Emits the event `PoolSharesUpdated` once the pool share is updated.\n *\n * Note: The method should be called whenever the user's staking amount changes.\n *\n */\n function _syncUserReward(\n address _poolAddr,\n address _user,\n uint256 _newStakingAmount\n ) internal {\n uint256 _period = _currentPeriod();\n PoolFields storage _pool = _stakingPool[_poolAddr];\n uint256 _lastShares = _pool.shares.inner;\n\n // Updates the pool shares if it is outdated\n if (_pool.shares.lastPeriod < _period) {\n _pool.shares = PeriodWrapper(getStakingTotal(_poolAddr), _period);\n }\n\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\n uint256 _debited = _getReward(_poolAddr, _user, _period, _currentStakingAmount);\n\n if (_reward.debited != _debited) {\n _reward.debited = _debited;\n emit UserRewardUpdated(_poolAddr, _user, _debited);\n }\n\n _syncMinStakingAmount(_pool, _reward, _period, _newStakingAmount, _currentStakingAmount);\n _reward.aRps = _pool.aRps;\n _reward.lastPeriod = _period;\n\n if (_pool.shares.inner != _lastShares) {\n emit PoolSharesUpdated(_period, _poolAddr, _pool.shares.inner);\n }\n }\n\n /**\n * @dev Syncs the minimum staking amount of an user in the current period.\n */\n function _syncMinStakingAmount(\n PoolFields storage _pool,\n UserRewardFields storage _reward,\n uint256 _latestPeriod,\n uint256 _newStakingAmount,\n uint256 _currentStakingAmount\n ) internal {\n if (_reward.lastPeriod < _latestPeriod) {\n _reward.lowestAmount = _currentStakingAmount;\n }\n\n uint256 _lowestAmount = Math.min(_reward.lowestAmount, _newStakingAmount);\n uint256 _diffAmount = _reward.lowestAmount - _lowestAmount;\n if (_diffAmount > 0) {\n _reward.lowestAmount = _lowestAmount;\n if (_pool.shares.inner < _diffAmount) revert ErrInvalidPoolShare();\n _pool.shares.inner -= _diffAmount;\n }\n }\n\n /**\n * @dev Claims the settled reward for a specific user.\n *\n * @param _lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or\n * `_currentPeriod + 1` in case of calculating the reward for revoked validators.\n *\n * Emits the `RewardClaimed` event and the `UserRewardUpdated` event.\n *\n * Note: This method should be called before transferring rewards for the user.\n *\n */\n function _claimReward(\n address _poolAddr,\n address _user,\n uint256 _lastPeriod\n ) internal returns (uint256 _amount) {\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\n _amount = _getReward(_poolAddr, _user, _lastPeriod, _currentStakingAmount);\n emit RewardClaimed(_poolAddr, _user, _amount);\n\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\n _reward.debited = 0;\n _syncMinStakingAmount(_stakingPool[_poolAddr], _reward, _lastPeriod, _currentStakingAmount, _currentStakingAmount);\n _reward.lastPeriod = _lastPeriod;\n _reward.aRps = _stakingPool[_poolAddr].aRps;\n emit UserRewardUpdated(_poolAddr, _user, 0);\n }\n\n /**\n * @dev Records the amount of rewards `_rewards` for the pools `_poolAddrs`.\n *\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\n * Emits the event `PoolUpdateConflicted` when the pool is already updated in the period.\n *\n * Note: This method should be called once at the period ending.\n *\n */\n function _recordRewards(\n address[] memory _poolAddrs,\n uint256[] calldata _rewards,\n uint256 _period\n ) internal {\n if (_poolAddrs.length != _rewards.length) {\n emit PoolsUpdateFailed(_period, _poolAddrs, _rewards);\n return;\n }\n\n uint256 _rps;\n uint256 _count;\n address _poolAddr;\n uint256 _stakingTotal;\n uint256[] memory _aRps = new uint256[](_poolAddrs.length);\n uint256[] memory _shares = new uint256[](_poolAddrs.length);\n address[] memory _conflicted = new address[](_poolAddrs.length);\n\n for (uint _i = 0; _i < _poolAddrs.length; _i++) {\n _poolAddr = _poolAddrs[_i];\n PoolFields storage _pool = _stakingPool[_poolAddr];\n _stakingTotal = getStakingTotal(_poolAddr);\n\n if (_accumulatedRps[_poolAddr][_period].lastPeriod == _period) {\n _conflicted[_count++] = _poolAddr;\n continue;\n }\n\n // Updates the pool shares if it is outdated\n if (_pool.shares.lastPeriod < _period) {\n _pool.shares = PeriodWrapper(_stakingTotal, _period);\n }\n\n // The rps is 0 if no one stakes for the pool\n _rps = _pool.shares.inner == 0 ? 0 : (_rewards[_i] * 1e18) / _pool.shares.inner;\n _aRps[_i - _count] = _pool.aRps += _rps;\n _accumulatedRps[_poolAddr][_period] = PeriodWrapper(_pool.aRps, _period);\n _pool.shares.inner = _stakingTotal;\n _shares[_i - _count] = _pool.shares.inner;\n _poolAddrs[_i - _count] = _poolAddr;\n }\n\n if (_count > 0) {\n assembly {\n mstore(_conflicted, _count)\n mstore(_poolAddrs, sub(mload(_poolAddrs), _count))\n }\n emit PoolsUpdateConflicted(_period, _conflicted);\n }\n\n if (_poolAddrs.length > 0) {\n emit PoolsUpdated(_period, _poolAddrs, _aRps, _shares);\n }\n }\n\n /**\n * @dev Returns the current period.\n */\n function _currentPeriod() internal view virtual returns (uint256);\n}\n" + }, + "contracts/ronin/Maintenance.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../interfaces/IMaintenance.sol\";\nimport \"../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../extensions/collections/HasValidatorContract.sol\";\nimport \"../libraries/Math.sol\";\n\ncontract Maintenance is IMaintenance, HasValidatorContract, Initializable {\n using Math for uint256;\n\n /// @dev Mapping from consensus address => maintenance schedule.\n mapping(address => Schedule) internal _schedule;\n\n /// @dev The min duration to maintenance in blocks.\n uint256 public minMaintenanceDurationInBlock;\n /// @dev The max duration to maintenance in blocks.\n uint256 public maxMaintenanceDurationInBlock;\n /// @dev The offset to the min block number that the schedule can start.\n uint256 public minOffsetToStartSchedule;\n /// @dev The offset to the max block number that the schedule can start.\n uint256 public maxOffsetToStartSchedule;\n /// @dev The max number of scheduled maintenances.\n uint256 public maxSchedules;\n /// @dev The cooldown time to request new schedule.\n uint256 public cooldownSecsToMaintain;\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) external initializer {\n _setValidatorContract(__validatorContract);\n _setMaintenanceConfig(\n _minMaintenanceDurationInBlock,\n _maxMaintenanceDurationInBlock,\n _minOffsetToStartSchedule,\n _maxOffsetToStartSchedule,\n _maxSchedules,\n _cooldownSecsToMaintain\n );\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function setMaintenanceConfig(\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) external onlyAdmin {\n _setMaintenanceConfig(\n _minMaintenanceDurationInBlock,\n _maxMaintenanceDurationInBlock,\n _minOffsetToStartSchedule,\n _maxOffsetToStartSchedule,\n _maxSchedules,\n _cooldownSecsToMaintain\n );\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function schedule(\n address _consensusAddr,\n uint256 _startedAtBlock,\n uint256 _endedAtBlock\n ) external override {\n IRoninValidatorSet _validator = _validatorContract;\n\n require(_validator.isBlockProducer(_consensusAddr), \"Maintenance: consensus address must be a block producer\");\n require(\n _validator.isCandidateAdmin(_consensusAddr, msg.sender),\n \"Maintenance: method caller must be a candidate admin\"\n );\n require(!checkScheduled(_consensusAddr), \"Maintenance: already scheduled\");\n require(checkCooldownEnds(_consensusAddr), \"Maintainance: cooldown time not end\");\n require(totalSchedules() < maxSchedules, \"Maintenance: exceeds total of schedules\");\n require(\n _startedAtBlock.inRange(block.number + minOffsetToStartSchedule, block.number + maxOffsetToStartSchedule),\n \"Maintenance: start block is out of offset\"\n );\n require(_startedAtBlock < _endedAtBlock, \"Maintenance: start block must be less than end block\");\n uint256 _maintenanceElapsed = _endedAtBlock - _startedAtBlock + 1;\n require(\n _maintenanceElapsed.inRange(minMaintenanceDurationInBlock, maxMaintenanceDurationInBlock),\n \"Maintenance: invalid maintenance duration\"\n );\n require(_validator.epochEndingAt(_startedAtBlock - 1), \"Maintenance: start block is not at the start of an epoch\");\n require(_validator.epochEndingAt(_endedAtBlock), \"Maintenance: end block is not at the end of an epoch\");\n\n Schedule storage _sSchedule = _schedule[_consensusAddr];\n _sSchedule.from = _startedAtBlock;\n _sSchedule.to = _endedAtBlock;\n _sSchedule.lastUpdatedBlock = block.number;\n _sSchedule.requestTimestamp = block.timestamp;\n emit MaintenanceScheduled(_consensusAddr, _sSchedule);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function cancelSchedule(address _consensusAddr) external override {\n require(\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\n \"Maintenance: method caller must be the candidate admin\"\n );\n require(checkScheduled(_consensusAddr), \"Maintenance: no schedule exists\");\n require(!checkMaintained(_consensusAddr, block.number), \"Maintenance: already on maintenance\");\n Schedule storage _sSchedule = _schedule[_consensusAddr];\n delete _sSchedule.from;\n delete _sSchedule.to;\n _sSchedule.lastUpdatedBlock = block.number;\n emit MaintenanceScheduleCancelled(_consensusAddr);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function getSchedule(address _consensusAddr) external view override returns (Schedule memory) {\n return _schedule[_consensusAddr];\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkManyMaintained(address[] calldata _addrList, uint256 _block)\n external\n view\n override\n returns (bool[] memory _resList)\n {\n _resList = new bool[](_addrList.length);\n for (uint _i = 0; _i < _addrList.length; _i++) {\n _resList[_i] = checkMaintained(_addrList[_i], _block);\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkManyMaintainedInBlockRange(\n address[] calldata _addrList,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view override returns (bool[] memory _resList) {\n _resList = new bool[](_addrList.length);\n for (uint _i = 0; _i < _addrList.length; _i++) {\n _resList[_i] = _maintainingInBlockRange(_addrList[_i], _fromBlock, _toBlock);\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function totalSchedules() public view override returns (uint256 _count) {\n (address[] memory _validators, , ) = _validatorContract.getValidators();\n for (uint _i = 0; _i < _validators.length; _i++) {\n if (checkScheduled(_validators[_i])) {\n _count++;\n }\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkMaintained(address _consensusAddr, uint256 _block) public view override returns (bool) {\n Schedule storage _s = _schedule[_consensusAddr];\n return _s.from <= _block && _block <= _s.to;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkMaintainedInBlockRange(\n address _consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) public view override returns (bool) {\n return _maintainingInBlockRange(_consensusAddr, _fromBlock, _toBlock);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkScheduled(address _consensusAddr) public view override returns (bool) {\n return block.number <= _schedule[_consensusAddr].to;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkCooldownEnds(address _consensusAddr) public view override returns (bool) {\n return block.timestamp > _schedule[_consensusAddr].requestTimestamp + cooldownSecsToMaintain;\n }\n\n /**\n * @dev Sets the min block period and max block period to maintenance.\n *\n * Requirements:\n * - The max period is larger than the min period.\n *\n * Emits the event `MaintenanceConfigUpdated`.\n *\n */\n function _setMaintenanceConfig(\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) internal {\n require(\n _minMaintenanceDurationInBlock < _maxMaintenanceDurationInBlock,\n \"Maintenance: invalid maintenance duration configs\"\n );\n require(\n _minOffsetToStartSchedule < _maxOffsetToStartSchedule,\n \"Maintenance: invalid offset to start schedule configs\"\n );\n minMaintenanceDurationInBlock = _minMaintenanceDurationInBlock;\n maxMaintenanceDurationInBlock = _maxMaintenanceDurationInBlock;\n minOffsetToStartSchedule = _minOffsetToStartSchedule;\n maxOffsetToStartSchedule = _maxOffsetToStartSchedule;\n maxSchedules = _maxSchedules;\n cooldownSecsToMaintain = _cooldownSecsToMaintain;\n emit MaintenanceConfigUpdated(\n _minMaintenanceDurationInBlock,\n _maxMaintenanceDurationInBlock,\n _minOffsetToStartSchedule,\n _maxOffsetToStartSchedule,\n _maxSchedules,\n _cooldownSecsToMaintain\n );\n }\n\n /**\n * @dev Check if the validator was maintaining in the current period.\n *\n * Note: This method should be called at the end of the period.\n */\n function _maintainingInBlockRange(\n address _consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) private view returns (bool) {\n Schedule storage _s = _schedule[_consensusAddr];\n return Math.twoRangeOverlap(_fromBlock, _toBlock, _s.from, _s.to);\n }\n}\n" + }, + "contracts/interfaces/IMaintenance.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IMaintenance {\n struct Schedule {\n uint256 from;\n uint256 to;\n uint256 lastUpdatedBlock;\n uint256 requestTimestamp;\n }\n\n /// @dev Emitted when a maintenance is scheduled.\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\n /// @dev Emitted when a schedule of maintenance is cancelled.\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\n /// @dev Emitted when the maintenance config is updated.\n event MaintenanceConfigUpdated(\n uint256 minMaintenanceDurationInBlock,\n uint256 maxMaintenanceDurationInBlock,\n uint256 minOffsetToStartSchedule,\n uint256 maxOffsetToStartSchedule,\n uint256 maxSchedules,\n uint256 cooldownSecsToMaintain\n );\n\n /**\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\n */\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\n */\n function checkMaintainedInBlockRange(\n address _consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool);\n\n /**\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\n */\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\n\n /**\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\n */\n function checkManyMaintainedInBlockRange(\n address[] calldata _addrList,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\n */\n function checkScheduled(address _consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `_consensusAddr`\n */\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\n */\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\n\n /**\n * @dev Returns the total of current schedules.\n */\n function totalSchedules() external view returns (uint256 _count);\n\n /**\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\n *\n * Requirements:\n * - The method caller is admin.\n * - The max duration is larger than the min duration.\n * - The max offset is larger than the min offset.\n *\n * Emits the event `MaintenanceConfigUpdated`.\n *\n */\n function setMaintenanceConfig(\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) external;\n\n /**\n * @dev Returns the min duration for maintenance in block.\n */\n function minMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev Returns the max duration for maintenance in block.\n */\n function maxMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev The offset to the min block number that the schedule can start\n */\n function minOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev The offset to the max block number that the schedule can start\n */\n function maxOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev Returns the max number of scheduled maintenances.\n */\n function maxSchedules() external view returns (uint256);\n\n /**\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\n *\n * Requirements:\n * - The candidate `_consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\n * - The total number of schedules is not larger than `maxSchedules()`.\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\n * - The end block is larger than the start block.\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\n * - The start block is at the start of an epoch.\n * - The end block is at the end of an epoch.\n *\n * Emits the event `MaintenanceScheduled`.\n *\n */\n function schedule(\n address _consensusAddr,\n uint256 _startedAtBlock,\n uint256 _endedAtBlock\n ) external;\n\n /**\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\n *\n * Requirements:\n * - The candidate `_consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\n *\n * Emits the event `MaintenanceScheduleCancelled`.\n */\n function cancelSchedule(address _consensusAddr) external;\n}\n" + }, + "contracts/ronin/StakingVesting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../interfaces/IStakingVesting.sol\";\nimport \"../extensions/collections/HasValidatorContract.sol\";\nimport \"../extensions/RONTransferHelper.sol\";\n\ncontract StakingVesting is IStakingVesting, HasValidatorContract, RONTransferHelper, Initializable {\n /// @dev The block bonus for the block producer whenever a new block is mined.\n uint256 internal _blockProducerBonusPerBlock;\n /// @dev The block bonus for the bridge operator whenever a new block is mined.\n uint256 internal _bridgeOperatorBonusPerBlock;\n /// @dev The last block number that the staking vesting sent.\n uint256 public lastBlockSendingBonus;\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 __blockProducerBonusPerBlock,\n uint256 __bridgeOperatorBonusPerBlock\n ) external payable initializer {\n _setValidatorContract(__validatorContract);\n _setBlockProducerBonusPerBlock(__blockProducerBonusPerBlock);\n _setBridgeOperatorBonusPerBlock(__bridgeOperatorBonusPerBlock);\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function receiveRON() external payable {}\n\n /**\n * @inheritdoc IStakingVesting\n */\n function blockProducerBlockBonus(\n uint256 /* _block */\n ) public view override returns (uint256) {\n return _blockProducerBonusPerBlock;\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function bridgeOperatorBlockBonus(\n uint256 /* _block */\n ) public view override returns (uint256) {\n return _bridgeOperatorBonusPerBlock;\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\n external\n override\n onlyValidatorContract\n returns (\n bool _success,\n uint256 _blockProducerBonus,\n uint256 _bridgeOperatorBonus\n )\n {\n require(block.number > lastBlockSendingBonus, \"StakingVesting: bonus for already sent\");\n lastBlockSendingBonus = block.number;\n\n _blockProducerBonus = _forBlockProducer ? blockProducerBlockBonus(block.number) : 0;\n _bridgeOperatorBonus = _forBridgeOperator ? bridgeOperatorBlockBonus(block.number) : 0;\n\n uint256 _totalAmount = _blockProducerBonus + _bridgeOperatorBonus;\n\n if (_totalAmount > 0) {\n address payable _validatorContractAddr = payable(validatorContract());\n\n _success = _unsafeSendRON(_validatorContractAddr, _totalAmount);\n\n if (!_success) {\n emit BonusTransferFailed(\n block.number,\n _validatorContractAddr,\n _blockProducerBonus,\n _bridgeOperatorBonus,\n address(this).balance\n );\n return (_success, 0, 0);\n }\n\n emit BonusTransferred(block.number, _validatorContractAddr, _blockProducerBonus, _bridgeOperatorBonus);\n }\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function setBlockProducerBonusPerBlock(uint256 _amount) external override onlyAdmin {\n _setBlockProducerBonusPerBlock(_amount);\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external override onlyAdmin {\n _setBridgeOperatorBonusPerBlock(_amount);\n }\n\n /**\n * @dev Sets the bonus amount per block for block producer.\n *\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\n *\n */\n function _setBlockProducerBonusPerBlock(uint256 _amount) internal {\n _blockProducerBonusPerBlock = _amount;\n emit BlockProducerBonusPerBlockUpdated(_amount);\n }\n\n /**\n * @dev Sets the bonus amount per block for bridge operator.\n *\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\n *\n */\n function _setBridgeOperatorBonusPerBlock(uint256 _amount) internal {\n _bridgeOperatorBonusPerBlock = _amount;\n emit BridgeOperatorBonusPerBlockUpdated(_amount);\n }\n}\n" + }, + "contracts/interfaces/IStakingVesting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IStakingVesting {\n /// @dev Emitted when the block bonus for block producer is transferred.\n event BonusTransferred(\n uint256 indexed blockNumber,\n address indexed recipient,\n uint256 blockProducerAmount,\n uint256 bridgeOperatorAmount\n );\n /// @dev Emitted when the transfer of block bonus for block producer is failed.\n event BonusTransferFailed(\n uint256 indexed blockNumber,\n address indexed recipient,\n uint256 blockProducerAmount,\n uint256 bridgeOperatorAmount,\n uint256 contractBalance\n );\n /// @dev Emitted when the block bonus for block producer is updated\n event BlockProducerBonusPerBlockUpdated(uint256);\n /// @dev Emitted when the block bonus for bridge operator is updated\n event BridgeOperatorBonusPerBlockUpdated(uint256);\n\n /**\n * @dev Returns the bonus amount for the block producer at `_block`.\n */\n function blockProducerBlockBonus(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Returns the bonus amount for the bridge validator at `_block`.\n */\n function bridgeOperatorBlockBonus(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Receives RON from any address.\n */\n function receiveRON() external payable;\n\n /**\n * @dev Returns the last block number that the staking vesting is sent.\n */\n function lastBlockSendingBonus() external view returns (uint256);\n\n /**\n * @dev Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined.\n *\n * Requirements:\n * - The method caller must be validator contract.\n * - The method must be called only once per block.\n *\n * Emits the event `BonusTransferred` or `BonusTransferFailed`.\n *\n * Notes:\n * - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method\n * will not be reverted, and the underlying nodes does not hang.\n *\n * @param _forBlockProducer Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\n * @param _forBridgeOperator Indicates whether requesting the bonus for the bridge operator.\n *\n * @return _success Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\n * @return _blockProducerBonus The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\n * @return _bridgeOperatorBonus The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\n *\n */\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\n external\n returns (\n bool _success,\n uint256 _blockProducerBonus,\n uint256 _bridgeOperatorBonus\n );\n\n /**\n * @dev Sets the bonus amount per block for block producer.\n *\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setBlockProducerBonusPerBlock(uint256 _amount) external;\n\n /**\n * @dev Sets the bonus amount per block for bridge operator.\n *\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external;\n}\n" + }, + "contracts/ronin/VaultForwarder.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../extensions/forwarder/Forwarder.sol\";\nimport \"../extensions/RONTransferHelper.sol\";\n\n/**\n * @title A vault contract that keeps RON, and behaves as an EOA account to interact with a target contract.\n * @dev There are three roles of interaction:\n * - Admin: top-up and withdraw RON to the vault, cannot forward call to the target.\n * - Moderator: forward all calls to the target, can top-up RON, cannot withdraw RON.\n * - Others: can top-up RON, cannot execute any other actions.\n */\ncontract VaultForwarder is Forwarder, RONTransferHelper {\n /// @dev Emitted when the admin withdraws all RON from the forwarder contract.\n event ForwarderRONWithdrawn(address indexed _recipient, uint256 _value);\n\n constructor(\n address[] memory _targets,\n address _admin,\n address _mod\n ) Forwarder(_targets, _admin, _mod) {}\n\n /**\n * @dev Withdraws all balance from the transfer to the admin.\n *\n * Requirements:\n * - Only the admin can call this method.\n */\n function withdrawAll() external onlyRole(DEFAULT_ADMIN_ROLE) {\n uint256 _value = address(this).balance;\n emit ForwarderRONWithdrawn(msg.sender, _value);\n _transferRON(payable(msg.sender), _value);\n }\n}\n" + }, + "contracts/extensions/forwarder/Forwarder.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\n\ncontract Forwarder is AccessControlEnumerable {\n /// @dev Only user with moderator role can invoke {functionCall} method to forward the call to the target.\n bytes32 public constant MODERATOR_ROLE = keccak256(\"MODERATOR_ROLE\");\n\n /**\n * @dev The target contracts must be registerred by the admin before called to. The admin can register the targets at\n * the contract construction or by assigning {TARGET_ROLE} to the target addresses.\n */\n bytes32 public constant TARGET_ROLE = keccak256(\"TARGET_ROLE\");\n\n /**\n * @dev Initializes the forwarder with an initial target address and a contract admin.\n */\n constructor(\n address[] memory _targets,\n address _admin,\n address _moderator\n ) payable {\n for (uint _i = 0; _i < _targets.length; _i++) {\n _setupRole(TARGET_ROLE, _targets[_i]);\n }\n _setupRole(DEFAULT_ADMIN_ROLE, _admin);\n _setupRole(MODERATOR_ROLE, _moderator);\n }\n\n modifier validTarget(address _target) {\n _checkRole(TARGET_ROLE, _target);\n _;\n }\n\n /**\n * @dev Receives RON transfer from all addresses.\n */\n fallback() external payable {}\n\n /**\n * @dev Receives RON transfer from all addresses.\n */\n receive() external payable {}\n\n /**\n * @dev Forwards the encoded call specified by `_data` to the target. The forwarder attachs `_val` value\n * from the forwarder contract and sends along with the call.\n *\n * Requirements:\n * - Only target with {TARGET_ROLE} can be called to.\n * - Only user with {MODERATOR_ROLE} can call this method.\n */\n function functionCall(\n address _target,\n bytes memory _data,\n uint256 _val\n ) external payable validTarget(_target) onlyRole(MODERATOR_ROLE) {\n require(_val <= address(this).balance, \"Forwarder: invalid forwarding value\");\n _call(_target, _data, _val);\n }\n\n /**\n * @dev Forwards the current call to `target`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _call(\n address _target,\n bytes memory _data,\n uint256 _value\n ) internal {\n (bool _success, bytes memory _res) = _target.call{ value: _value }(_data);\n if (!_success) {\n uint _size = _res.length;\n require(_size >= 4, \"Forwarder: target reverts silently\");\n assembly {\n _res := add(_res, 0x20)\n revert(_res, _size)\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/AccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerable.sol\";\nimport \"./AccessControl.sol\";\nimport \"../utils/structs/EnumerableSet.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override {\n super._grantRole(role, account);\n _roleMembers[role].add(account);\n }\n\n /**\n * @dev Overload {_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override {\n super._revokeRole(role, account);\n _roleMembers[role].remove(account);\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(uint160(account), 20),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/ronin/gateway/PauseEnforcer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"../../interfaces/IPauseTarget.sol\";\n\ncontract PauseEnforcer is AccessControlEnumerable {\n bytes32 public constant SENTRY_ROLE = keccak256(\"SENTRY_ROLE\");\n\n /// @dev The contract that can be paused or unpaused by the SENTRY_ROLE.\n IPauseTarget public target;\n /// @dev Indicating whether or not the target contract is paused in emergency mode.\n bool public emergency;\n\n /// @dev Emitted when the emergency ppause is triggered by `account`.\n event EmergencyPaused(address account);\n /// @dev Emitted when the emergency unpause is triggered by `account`.\n event EmergencyUnpaused(address account);\n /// @dev Emitted when the target is changed.\n event TargetChanged(IPauseTarget target);\n\n modifier onEmergency() {\n require(emergency, \"PauseEnforcer: not on emergency pause\");\n _;\n }\n\n modifier targetPaused() {\n require(target.paused(), \"PauseEnforcer: target is on pause\");\n _;\n }\n\n modifier targetNotPaused() {\n require(!target.paused(), \"PauseEnforcer: target is not on pause\");\n _;\n }\n\n constructor(\n IPauseTarget _target,\n address _admin,\n address[] memory _sentries\n ) {\n _changeTarget(_target);\n _setupRole(DEFAULT_ADMIN_ROLE, _admin);\n for (uint _i; _i < _sentries.length; _i++) {\n _grantRole(SENTRY_ROLE, _sentries[_i]);\n }\n }\n\n /**\n * @dev Grants the SENTRY_ROLE to the specified address.\n */\n function grantSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _grantRole(SENTRY_ROLE, _sentry);\n }\n\n /**\n * @dev Revokes the SENTRY_ROLE from the specified address.\n */\n function revokeSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _revokeRole(SENTRY_ROLE, _sentry);\n }\n\n /**\n * @dev Triggers a pause on the target contract.\n *\n * Requirements:\n * - Only be called by accounts with the SENTRY_ROLE,\n * - The target contract is not already paused.\n */\n function triggerPause() external onlyRole(SENTRY_ROLE) targetNotPaused {\n emergency = true;\n target.pause();\n emit EmergencyPaused(msg.sender);\n }\n\n /**\n * @dev Triggers an unpause on the target contract.\n *\n * Requirements:\n * - Only be called by accounts with the SENTRY_ROLE,\n * - The target contract is already paused.\n * - The target contract is paused in emergency mode.\n */\n function triggerUnpause() external onlyRole(SENTRY_ROLE) onEmergency targetPaused {\n emergency = false;\n target.unpause();\n emit EmergencyUnpaused(msg.sender);\n }\n\n /**\n * @dev Setter for `target`.\n *\n * Requirements:\n * - Only admin can call this method.\n */\n function changeTarget(IPauseTarget _target) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _changeTarget(_target);\n }\n\n /**\n * @dev Internal helper for setting value to `target`.\n */\n function _changeTarget(IPauseTarget _target) internal {\n target = _target;\n emit TargetChanged(_target);\n }\n}\n" + }, + "contracts/interfaces/IPauseTarget.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IPauseTarget {\n function pause() external;\n\n function unpause() external;\n\n function paused() external returns (bool);\n}\n" + }, + "contracts/ronin/gateway/RoninGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../extensions/GatewayV2.sol\";\nimport \"../../extensions/MinimumWithdrawal.sol\";\nimport \"../../interfaces/IERC20Mintable.sol\";\nimport \"../../interfaces/IERC721Mintable.sol\";\nimport \"../../interfaces/IBridgeTracking.sol\";\nimport \"../../interfaces/IRoninGatewayV2.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/collections/IHasValidatorContract.sol\";\nimport \"../../interfaces/collections/IHasBridgeTrackingContract.sol\";\nimport \"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\n\ncontract RoninGatewayV2 is\n GatewayV2,\n Initializable,\n MinimumWithdrawal,\n AccessControlEnumerable,\n VoteStatusConsumer,\n IRoninGatewayV2,\n IHasValidatorContract,\n IHasBridgeTrackingContract,\n IHasRoninTrustedOrganizationContract\n{\n using Token for Token.Info;\n using Transfer for Transfer.Request;\n using Transfer for Transfer.Receipt;\n using IsolatedGovernance for IsolatedGovernance.Vote;\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n /// @dev Withdrawal unlocker role hash\n bytes32 public constant WITHDRAWAL_MIGRATOR = keccak256(\"WITHDRAWAL_MIGRATOR\");\n\n /// @dev Flag indicating whether the withdrawal migrate progress is done\n bool public withdrawalMigrated;\n /// @dev Total withdrawal\n uint256 public withdrawalCount;\n /// @dev Mapping from chain id => deposit id => deposit vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) public depositVote;\n /// @dev Mapping from withdrawal id => mainchain withdrew vote\n mapping(uint256 => IsolatedGovernance.Vote) public mainchainWithdrewVote;\n /// @dev Mapping from withdrawal id => withdrawal receipt\n mapping(uint256 => Transfer.Receipt) public withdrawal;\n /// @dev Mapping from withdrawal id => validator address => signatures\n mapping(uint256 => mapping(address => bytes)) internal _withdrawalSig;\n /// @dev Mapping from token address => chain id => mainchain token address\n mapping(address => mapping(uint256 => MappedToken)) internal _mainchainToken;\n\n /// @dev The ronin validator contract\n IRoninValidatorSet internal _validatorContract;\n /// @dev The bridge tracking contract\n IBridgeTracking internal _bridgeTrackingContract;\n\n /// @dev Mapping from withdrawal id => vote for recording withdrawal stats\n mapping(uint256 => IsolatedGovernance.Vote) public withdrawalStatVote;\n\n /// @dev The trusted organization contract\n IRoninTrustedOrganization internal _trustedOrgContract;\n\n uint256 internal _trustedNum;\n uint256 internal _trustedDenom;\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n modifier onlyBridgeOperator() {\n require(_validatorContract.isBridgeOperator(msg.sender), \"RoninGatewayV2: unauthorized sender\");\n _;\n }\n\n /**\n * @dev Initializes contract storage.\n */\n function initialize(\n address _roleSetter,\n uint256 _numerator,\n uint256 _denominator,\n uint256 _trustedNumerator,\n uint256 _trustedDenominator,\n address[] calldata _withdrawalMigrators,\n // _packedAddresses[0]: roninTokens\n // _packedAddresses[1]: mainchainTokens\n address[][2] calldata _packedAddresses,\n // _packedNumbers[0]: chainIds\n // _packedNumbers[1]: minimumThresholds\n uint256[][2] calldata _packedNumbers,\n Token.Standard[] calldata _standards\n ) external virtual initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n _setThreshold(_numerator, _denominator);\n _setTrustedThreshold(_trustedNumerator, _trustedDenominator);\n if (_packedAddresses[0].length > 0) {\n _mapTokens(_packedAddresses[0], _packedAddresses[1], _packedNumbers[0], _standards);\n _setMinimumThresholds(_packedAddresses[0], _packedNumbers[1]);\n }\n\n for (uint256 _i; _i < _withdrawalMigrators.length; _i++) {\n _grantRole(WITHDRAWAL_MIGRATOR, _withdrawalMigrators[_i]);\n }\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function validatorContract() external view returns (address) {\n return address(_validatorContract);\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function setValidatorContract(address _addr) external override onlyAdmin {\n require(_addr.code.length > 0, \"RoninGatewayV2: set to non-contract\");\n _setValidatorContract(_addr);\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function bridgeTrackingContract() external view override returns (address) {\n return address(_bridgeTrackingContract);\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function setBridgeTrackingContract(address _addr) external override onlyAdmin {\n require(_addr.code.length > 0, \"RoninGatewayV2: set to non-contract\");\n _setBridgeTrackingContract(_addr);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function roninTrustedOrganizationContract() external view override returns (address) {\n return address(_trustedOrgContract);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function setRoninTrustedOrganizationContract(address _addr) external override onlyAdmin {\n require(_addr.code.length > 0, \"RoninGatewayV2: set to non-contract\");\n _setRoninTrustedOrganizationContract(_addr);\n }\n\n /**\n * @dev Migrates withdrawals.\n *\n * Requirements:\n * - The method caller is the migrator.\n * - The arrays have the same length and its length larger than 0.\n *\n */\n function migrateWithdrawals(Transfer.Request[] calldata _requests, address[] calldata _requesters)\n external\n onlyRole(WITHDRAWAL_MIGRATOR)\n {\n require(!withdrawalMigrated, \"RoninGatewayV2: withdrawals migrated\");\n require(_requesters.length == _requests.length && _requests.length > 0, \"RoninGatewayV2: invalid array lengths\");\n for (uint256 _i; _i < _requests.length; _i++) {\n MappedToken memory _token = getMainchainToken(_requests[_i].tokenAddr, 1);\n require(_requests[_i].info.erc == _token.erc, \"RoninGatewayV2: invalid token standard\");\n _storeAsReceipt(_requests[_i], 1, _requesters[_i], _token.tokenAddr);\n }\n }\n\n /**\n * @dev Mark the migration as done.\n */\n function markWithdrawalMigrated() external {\n require(\n hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(WITHDRAWAL_MIGRATOR, msg.sender),\n \"RoninGatewayV2: unauthorized sender\"\n );\n require(!withdrawalMigrated, \"RoninGatewayV2: withdrawals migrated\");\n withdrawalMigrated = true;\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function getWithdrawalSignatures(uint256 _withdrawalId, address[] calldata _validators)\n external\n view\n returns (bytes[] memory _signatures)\n {\n _signatures = new bytes[](_validators.length);\n for (uint256 _i = 0; _i < _validators.length; _i++) {\n _signatures[_i] = _withdrawalSig[_withdrawalId][_validators[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function depositFor(Transfer.Receipt calldata _receipt) external whenNotPaused onlyBridgeOperator {\n address _sender = msg.sender;\n _depositFor(_receipt, _sender, minimumVoteWeight(), minimumTrustedVoteWeight());\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds)\n external\n onlyBridgeOperator\n returns (bool[] memory _executedReceipts)\n {\n address _governor = msg.sender;\n uint256 _minVoteWeight = minimumVoteWeight();\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\n\n uint256 _withdrawalId;\n _executedReceipts = new bool[](_withdrawalIds.length);\n for (uint256 _i; _i < _withdrawalIds.length; _i++) {\n _withdrawalId = _withdrawalIds[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId, _governor);\n if (mainchainWithdrew(_withdrawalId)) {\n _executedReceipts[_i] = true;\n } else {\n IsolatedGovernance.Vote storage _vote = mainchainWithdrewVote[_withdrawalId];\n Transfer.Receipt memory _withdrawal = withdrawal[_withdrawalId];\n bytes32 _hash = _withdrawal.hash();\n VoteStatus _status = _castIsolatedVote(_vote, _governor, _minVoteWeight, _minTrustedVoteWeight, _hash);\n if (_status == VoteStatus.Approved) {\n _vote.status = VoteStatus.Executed;\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId);\n emit MainchainWithdrew(_hash, _withdrawal);\n }\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts)\n external\n whenNotPaused\n onlyBridgeOperator\n returns (bool[] memory _executedReceipts)\n {\n address _sender = msg.sender;\n\n Transfer.Receipt memory _receipt;\n _executedReceipts = new bool[](_receipts.length);\n uint256 _minVoteWeight = minimumVoteWeight();\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\n for (uint256 _i; _i < _receipts.length; _i++) {\n _receipt = _receipts[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\n if (depositVote[_receipt.mainchain.chainId][_receipt.id].status == VoteStatus.Executed) {\n _executedReceipts[_i] = true;\n } else {\n _depositFor(_receipt, _sender, _minVoteWeight, _minTrustedVoteWeight);\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external whenNotPaused {\n _requestWithdrawalFor(_request, msg.sender, _chainId);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external whenNotPaused {\n require(_requests.length > 0, \"RoninGatewayV2: empty array\");\n for (uint256 _i; _i < _requests.length; _i++) {\n _requestWithdrawalFor(_requests[_i], msg.sender, _chainId);\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function requestWithdrawalSignatures(uint256 _withdrawalId) external whenNotPaused {\n require(!mainchainWithdrew(_withdrawalId), \"RoninGatewayV2: withdrew on mainchain already\");\n Transfer.Receipt memory _receipt = withdrawal[_withdrawalId];\n require(_receipt.ronin.chainId == block.chainid, \"RoninGatewayV2: query for invalid withdrawal\");\n emit WithdrawalSignaturesRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures)\n external\n whenNotPaused\n onlyBridgeOperator\n {\n address _validator = msg.sender;\n\n require(\n _withdrawals.length > 0 && _withdrawals.length == _signatures.length,\n \"RoninGatewayV2: invalid array length\"\n );\n\n uint256 _minVoteWeight = minimumVoteWeight();\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\n\n uint256 _id;\n for (uint256 _i; _i < _withdrawals.length; _i++) {\n _id = _withdrawals[_i];\n _withdrawalSig[_id][_validator] = _signatures[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Withdrawal, _id, _validator);\n\n IsolatedGovernance.Vote storage _proposal = withdrawalStatVote[_id];\n VoteStatus _status = _castIsolatedVote(\n _proposal,\n _validator,\n _minVoteWeight,\n _minTrustedVoteWeight,\n bytes32(_id)\n );\n if (_status == VoteStatus.Approved) {\n _proposal.status = VoteStatus.Executed;\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Withdrawal, _id);\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata _chainIds,\n Token.Standard[] calldata _standards\n ) external onlyAdmin {\n require(_roninTokens.length > 0, \"RoninGatewayV2: invalid array length\");\n _mapTokens(_roninTokens, _mainchainTokens, _chainIds, _standards);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function depositVoted(\n uint256 _chainId,\n uint256 _depositId,\n address _voter\n ) external view returns (bool) {\n return depositVote[_chainId][_depositId].voted(_voter);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool) {\n return mainchainWithdrewVote[_withdrawalId].voted(_voter);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function mainchainWithdrew(uint256 _withdrawalId) public view returns (bool) {\n return mainchainWithdrewVote[_withdrawalId].status == VoteStatus.Executed;\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function getMainchainToken(address _roninToken, uint256 _chainId) public view returns (MappedToken memory _token) {\n _token = _mainchainToken[_roninToken][_chainId];\n require(_token.tokenAddr != address(0), \"RoninGatewayV2: unsupported token\");\n }\n\n /**\n * @dev Maps Ronin tokens to mainchain networks.\n *\n * Requirement:\n * - The arrays have the same length.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function _mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata _chainIds,\n Token.Standard[] calldata _standards\n ) internal {\n require(\n _roninTokens.length == _mainchainTokens.length && _roninTokens.length == _chainIds.length,\n \"RoninGatewayV2: invalid array length\"\n );\n\n for (uint256 _i; _i < _roninTokens.length; _i++) {\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].tokenAddr = _mainchainTokens[_i];\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].erc = _standards[_i];\n }\n\n emit TokenMapped(_roninTokens, _mainchainTokens, _chainIds, _standards);\n }\n\n /**\n * @dev Deposits based on the receipt.\n *\n * Emits the `Deposited` once the assets are released.\n *\n */\n function _depositFor(\n Transfer.Receipt memory _receipt,\n address _validator,\n uint256 _minVoteWeight,\n uint256 _minTrustedVoteWeight\n ) internal {\n uint256 _id = _receipt.id;\n _receipt.info.validate();\n require(_receipt.kind == Transfer.Kind.Deposit, \"RoninGatewayV2: invalid receipt kind\");\n require(_receipt.ronin.chainId == block.chainid, \"RoninGatewayV2: invalid chain id\");\n MappedToken memory _token = getMainchainToken(_receipt.ronin.tokenAddr, _receipt.mainchain.chainId);\n require(\n _token.erc == _receipt.info.erc && _token.tokenAddr == _receipt.mainchain.tokenAddr,\n \"RoninGatewayV2: invalid receipt\"\n );\n\n IsolatedGovernance.Vote storage _proposal = depositVote[_receipt.mainchain.chainId][_id];\n bytes32 _receiptHash = _receipt.hash();\n VoteStatus _status = _castIsolatedVote(_proposal, _validator, _minVoteWeight, _minTrustedVoteWeight, _receiptHash);\n emit DepositVoted(_validator, _id, _receipt.mainchain.chainId, _receiptHash);\n if (_status == VoteStatus.Approved) {\n _proposal.status = VoteStatus.Executed;\n _receipt.info.handleAssetTransfer(payable(_receipt.ronin.addr), _receipt.ronin.tokenAddr, IWETH(address(0)));\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Deposit, _receipt.id);\n emit Deposited(_receiptHash, _receipt);\n }\n }\n\n /**\n * @dev Locks the assets and request withdrawal.\n *\n * Requirements:\n * - The token info is valid.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function _requestWithdrawalFor(\n Transfer.Request calldata _request,\n address _requester,\n uint256 _chainId\n ) internal {\n _request.info.validate();\n _checkWithdrawal(_request);\n MappedToken memory _token = getMainchainToken(_request.tokenAddr, _chainId);\n require(_request.info.erc == _token.erc, \"RoninGatewayV2: invalid token standard\");\n _request.info.transferFrom(_requester, address(this), _request.tokenAddr);\n _storeAsReceipt(_request, _chainId, _requester, _token.tokenAddr);\n }\n\n /**\n * @dev Stores the withdrawal request as a receipt.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function _storeAsReceipt(\n Transfer.Request calldata _request,\n uint256 _chainId,\n address _requester,\n address _mainchainTokenAddr\n ) internal returns (uint256 _withdrawalId) {\n _withdrawalId = withdrawalCount++;\n Transfer.Receipt memory _receipt = _request.into_withdrawal_receipt(\n _requester,\n _withdrawalId,\n _mainchainTokenAddr,\n _chainId\n );\n withdrawal[_withdrawalId] = _receipt;\n emit WithdrawalRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @dev Don't send me RON.\n */\n function _fallback() internal virtual {\n revert(\"RoninGatewayV2: invalid request\");\n }\n\n /**\n * @inheritdoc GatewayV2\n */\n function _getTotalWeight() internal view virtual override returns (uint256) {\n return _validatorContract.totalBridgeOperators();\n }\n\n /**\n * @dev Returns the total trusted weight.\n */\n function _getTotalTrustedWeight() internal view virtual returns (uint256) {\n return _trustedOrgContract.countTrustedOrganizations();\n }\n\n /**\n * @dev Sets the validator contract.\n *\n * Emits the event `ValidatorContractUpdated`.\n *\n */\n function _setValidatorContract(address _addr) internal {\n _validatorContract = IRoninValidatorSet(_addr);\n emit ValidatorContractUpdated(_addr);\n }\n\n /**\n * @dev Sets the bridge tracking contract.\n *\n * Emits the event `BridgeTrackingContractUpdated`.\n *\n */\n function _setBridgeTrackingContract(address _addr) internal {\n _bridgeTrackingContract = IBridgeTracking(_addr);\n emit BridgeTrackingContractUpdated(_addr);\n }\n\n /**\n * @dev Sets the ronin trusted organization contract.\n *\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\n *\n */\n function _setRoninTrustedOrganizationContract(address _addr) internal {\n _trustedOrgContract = IRoninTrustedOrganization(_addr);\n emit RoninTrustedOrganizationContractUpdated(_addr);\n }\n\n /**\n * @dev Casts and updates the vote result.\n *\n * Requirements:\n * - The vote is not finalized.\n * - The voter has not voted for the round.\n *\n */\n function _castIsolatedVote(\n IsolatedGovernance.Vote storage _v,\n address _voter,\n uint256 _minVoteWeight,\n uint256 _minTrustedVoteWeight,\n bytes32 _hash\n ) internal virtual returns (VoteStatus _status) {\n _v.castVote(_voter, _hash);\n (uint256 _totalWeight, uint256 _trustedWeight) = _getVoteWeight(_v, _hash);\n return _v.syncVoteStatus(_minVoteWeight, _totalWeight, _minTrustedVoteWeight, _trustedWeight, _hash);\n }\n\n /**\n * @dev Returns the vote weight for a specified hash.\n */\n function _getVoteWeight(IsolatedGovernance.Vote storage _v, bytes32 _hash)\n internal\n view\n returns (uint256 _totalWeight, uint256 _trustedWeight)\n {\n (\n address[] memory _consensusList,\n address[] memory _bridgeOperators,\n EnumFlags.ValidatorFlag[] memory _flags\n ) = _validatorContract.getValidators();\n uint256[] memory _trustedWeights = _trustedOrgContract.getConsensusWeights(_consensusList);\n\n for (uint _i; _i < _bridgeOperators.length; _i++) {\n if (_flags[_i].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator) && _v.voteHashOf[_bridgeOperators[_i]] == _hash) {\n _totalWeight++;\n if (_trustedWeights[_i] > 0) {\n _trustedWeight++;\n }\n }\n }\n }\n\n function setTrustedThreshold(uint256 _trustedNumerator, uint256 _trustedDenominator)\n external\n virtual\n onlyAdmin\n returns (uint256, uint256)\n {\n return _setTrustedThreshold(_trustedNumerator, _trustedDenominator);\n }\n\n /**\n * @dev Returns the minimum trusted vote weight to pass the threshold.\n */\n function minimumTrustedVoteWeight() public view virtual returns (uint256) {\n return _minimumTrustedVoteWeight(_getTotalTrustedWeight());\n }\n\n /**\n * @dev Returns the threshold about trusted org.\n */\n function getTrustedThreshold() external view virtual returns (uint256 trustedNum_, uint256 trustedDenom_) {\n return (_trustedNum, _trustedDenom);\n }\n\n /**\n * @dev Sets trusted threshold and returns the old one.\n *\n * Emits the `TrustedThresholdUpdated` event.\n *\n */\n function _setTrustedThreshold(uint256 _trustedNumerator, uint256 _trustedDenominator)\n internal\n virtual\n returns (uint256 _previousTrustedNum, uint256 _previousTrustedDenom)\n {\n require(_trustedNumerator <= _trustedDenominator, \"GatewayV2: invalid trusted threshold\");\n _previousTrustedNum = _num;\n _previousTrustedDenom = _denom;\n _trustedNum = _trustedNumerator;\n _trustedDenom = _trustedDenominator;\n emit TrustedThresholdUpdated(\n nonce++,\n _trustedNumerator,\n _trustedDenominator,\n _previousTrustedNum,\n _previousTrustedDenom\n );\n }\n\n /**\n * @dev Returns minimum trusted vote weight.\n */\n function _minimumTrustedVoteWeight(uint256 _totalTrustedWeight) internal view virtual returns (uint256) {\n return (_trustedNum * _totalTrustedWeight + _trustedDenom - 1) / _trustedDenom;\n }\n}\n" + }, + "contracts/extensions/GatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/security/Pausable.sol\";\nimport \"../interfaces/IQuorum.sol\";\nimport \"./collections/HasProxyAdmin.sol\";\n\nabstract contract GatewayV2 is HasProxyAdmin, Pausable, IQuorum {\n uint256 internal _num;\n uint256 internal _denom;\n\n address private ______deprecated;\n uint256 public nonce;\n\n address public emergencyPauser;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n /**\n * @dev Grant emergency pauser role for `_addr`.\n */\n function setEmergencyPauser(address _addr) external onlyAdmin {\n emergencyPauser = _addr;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\n return (_num, _denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _denom >= _num * _getTotalWeight();\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n virtual\n onlyAdmin\n returns (uint256, uint256)\n {\n return _setThreshold(_numerator, _denominator);\n }\n\n /**\n * @dev Triggers paused state.\n */\n function pause() external {\n require(msg.sender == _getAdmin() || msg.sender == emergencyPauser, \"GatewayV2: not authorized pauser\");\n _pause();\n }\n\n /**\n * @dev Triggers unpaused state.\n */\n function unpause() external {\n require(msg.sender == _getAdmin() || msg.sender == emergencyPauser, \"GatewayV2: not authorized pauser\");\n _unpause();\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function minimumVoteWeight() public view virtual returns (uint256) {\n return _minimumVoteWeight(_getTotalWeight());\n }\n\n /**\n * @dev Sets threshold and returns the old one.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function _setThreshold(uint256 _numerator, uint256 _denominator)\n internal\n virtual\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n require(_numerator <= _denominator, \"GatewayV2: invalid threshold\");\n _previousNum = _num;\n _previousDenom = _denom;\n _num = _numerator;\n _denom = _denominator;\n emit ThresholdUpdated(nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n\n /**\n * @dev Returns minimum vote weight.\n */\n function _minimumVoteWeight(uint256 _totalWeight) internal view virtual returns (uint256) {\n return (_num * _totalWeight + _denom - 1) / _denom;\n }\n\n /**\n * @dev Returns the total weight.\n */\n function _getTotalWeight() internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/MinimumWithdrawal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./collections/HasProxyAdmin.sol\";\nimport \"../libraries/Transfer.sol\";\n\nabstract contract MinimumWithdrawal is HasProxyAdmin {\n /// @dev Emitted when the minimum thresholds are updated\n event MinimumThresholdsUpdated(address[] tokens, uint256[] threshold);\n\n /// @dev Mapping from token address => minimum thresholds\n mapping(address => uint256) public minimumThreshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @dev Sets the minimum thresholds to withdraw.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `MinimumThresholdsUpdated` event.\n *\n */\n function setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) external virtual onlyAdmin {\n require(_tokens.length > 0, \"MinimumWithdrawal: invalid array length\");\n _setMinimumThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets minimum thresholds.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `MinimumThresholdsUpdated` event.\n *\n */\n function _setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n require(_tokens.length == _thresholds.length, \"MinimumWithdrawal: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n minimumThreshold[_tokens[_i]] = _thresholds[_i];\n }\n emit MinimumThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Checks whether the request is larger than or equal to the minimum threshold.\n */\n function _checkWithdrawal(Transfer.Request calldata _request) internal view {\n require(\n _request.info.erc != Token.Standard.ERC20 || _request.info.quantity >= minimumThreshold[_request.tokenAddr],\n \"MinimumWithdrawal: query for too small quantity\"\n );\n }\n}\n" + }, + "contracts/interfaces/IERC20Mintable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\ninterface IERC20Mintable {\n function mint(address _to, uint256 _value) external returns (bool _success);\n}\n" + }, + "contracts/interfaces/IERC721Mintable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC721Mintable {\n function mint(address _to, uint256 _tokenId) external returns (bool);\n}\n" + }, + "contracts/interfaces/IBridgeTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBridgeTracking {\n struct Request {\n VoteKind kind;\n uint256 id;\n }\n\n enum VoteKind {\n Deposit,\n Withdrawal,\n MainchainWithdrawal\n }\n\n /**\n * @dev Returns the total number of votes at the specific period `_period`.\n */\n function totalVotes(uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the total number of ballots at the specific period `_period`.\n */\n function totalBallots(uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\n */\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\n */\n function totalBallotsOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\n\n /**\n * @dev Handles the request once it is approved.\n *\n * Requirements:\n * - The method caller is the bridge contract.\n *\n */\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\n\n /**\n * @dev Records vote for a receipt and a operator.\n *\n * Requirements:\n * - The method caller is the bridge contract.\n *\n */\n function recordVote(\n VoteKind _kind,\n uint256 _requestId,\n address _operator\n ) external;\n}\n" + }, + "contracts/interfaces/IRoninGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/Transfer.sol\";\nimport \"./consumers/MappedTokenConsumer.sol\";\n\ninterface IRoninGatewayV2 is MappedTokenConsumer {\n /// @dev Emitted when the assets are depositted\n event Deposited(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal is requested\n event WithdrawalRequested(bytes32 receiptHash, Transfer.Receipt);\n /// @dev Emitted when the assets are withdrawn on mainchain\n event MainchainWithdrew(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal signatures is requested\n event WithdrawalSignaturesRequested(bytes32 receiptHash, Transfer.Receipt);\n /// @dev Emitted when the tokens are mapped\n event TokenMapped(address[] roninTokens, address[] mainchainTokens, uint256[] chainIds, Token.Standard[] standards);\n /// @dev Emitted when the threshold is updated\n event TrustedThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n /// @dev Emitted when a deposit is voted\n event DepositVoted(address indexed bridgeOperator, uint256 indexed id, uint256 indexed chainId, bytes32 receiptHash);\n\n /**\n * @dev Returns withdrawal count.\n */\n function withdrawalCount() external view returns (uint256);\n\n /**\n * @dev Returns withdrawal signatures.\n */\n function getWithdrawalSignatures(uint256 _withdrawalId, address[] calldata _validators)\n external\n view\n returns (bytes[] memory);\n\n /**\n * @dev Deposits based on the receipt.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Deposited` once the assets are released.\n *\n * @notice The assets will be transferred whenever the valid call passes the quorum threshold.\n *\n */\n function depositFor(Transfer.Receipt calldata _receipt) external;\n\n /**\n * @dev Marks the withdrawals are done on mainchain and returns the boolean array indicating whether the withdrawal\n * vote is already done before.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `MainchainWithdrew` once the valid call passes the quorum threshold.\n *\n * @notice Not reverting to avoid unnecessary failed transactions because the validators can send transactions at the\n * same time.\n *\n */\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds) external returns (bool[] memory);\n\n /**\n * @dev Tries bulk deposits based on the receipts and returns the boolean array indicating whether the deposit vote\n * is already done before. Reverts if the deposit is invalid or is voted by the validator again.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Deposited` once the assets are released.\n *\n * @notice The assets will be transferred whenever the valid call for the receipt passes the quorum threshold. Not\n * reverting to avoid unnecessary failed transactions because the validators can send transactions at the same time.\n *\n */\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts) external returns (bool[] memory);\n\n /**\n * @dev Locks the assets and request withdrawal.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external;\n\n /**\n * @dev Bulk requests withdrawals.\n *\n * Emits the `WithdrawalRequested` events.\n *\n */\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external;\n\n /**\n * @dev Requests withdrawal signatures for a specific withdrawal.\n *\n * Emits the `WithdrawalSignaturesRequested` event.\n *\n */\n function requestWithdrawalSignatures(uint256 _withdrawalId) external;\n\n /**\n * @dev Submits withdrawal signatures.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n */\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures) external;\n\n /**\n * @dev Maps Ronin tokens to mainchain networks.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata chainIds,\n Token.Standard[] calldata _standards\n ) external;\n\n /**\n * @dev Returns whether the deposit is casted by the voter.\n */\n function depositVoted(\n uint256 _chainId,\n uint256 _depositId,\n address _voter\n ) external view returns (bool);\n\n /**\n * @dev Returns whether the mainchain withdrew is casted by the voter.\n */\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool);\n\n /**\n * @dev Returns whether the withdrawal is done on mainchain.\n */\n function mainchainWithdrew(uint256 _withdrawalId) external view returns (bool);\n\n /**\n * @dev Returns mainchain token address.\n * Reverts for unsupported token.\n */\n function getMainchainToken(address _roninToken, uint256 _chainId) external view returns (MappedToken memory _token);\n}\n" + }, + "contracts/interfaces/collections/IHasBridgeTrackingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasBridgeTrackingContract is IHasContract {\n /// @dev Emitted when the bridge tracking contract is updated.\n event BridgeTrackingContractUpdated(address);\n\n /// @dev Error of method caller must be bridge tracking contract.\n error ErrCallerMustBeBridgeTrackingContract();\n\n /**\n * @dev Returns the bridge tracking contract.\n */\n function bridgeTrackingContract() external view returns (address);\n\n /**\n * @dev Sets the bridge tracking contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `BridgeTrackingContractUpdated`.\n *\n */\n function setBridgeTrackingContract(address) external;\n}\n" + }, + "@openzeppelin/contracts/security/Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" + }, + "contracts/libraries/Transfer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"./Token.sol\";\n\nlibrary Transfer {\n using ECDSA for bytes32;\n\n enum Kind {\n Deposit,\n Withdrawal\n }\n\n struct Request {\n // For deposit request: Recipient address on Ronin network\n // For withdrawal request: Recipient address on mainchain network\n address recipientAddr;\n // Token address to deposit/withdraw\n // Value 0: native token\n address tokenAddr;\n Token.Info info;\n }\n\n /**\n * @dev Converts the transfer request into the deposit receipt.\n */\n function into_deposit_receipt(\n Request memory _request,\n address _requester,\n uint256 _id,\n address _roninTokenAddr,\n uint256 _roninChainId\n ) internal view returns (Receipt memory _receipt) {\n _receipt.id = _id;\n _receipt.kind = Kind.Deposit;\n _receipt.mainchain.addr = _requester;\n _receipt.mainchain.tokenAddr = _request.tokenAddr;\n _receipt.mainchain.chainId = block.chainid;\n _receipt.ronin.addr = _request.recipientAddr;\n _receipt.ronin.tokenAddr = _roninTokenAddr;\n _receipt.ronin.chainId = _roninChainId;\n _receipt.info = _request.info;\n }\n\n /**\n * @dev Converts the transfer request into the withdrawal receipt.\n */\n function into_withdrawal_receipt(\n Request memory _request,\n address _requester,\n uint256 _id,\n address _mainchainTokenAddr,\n uint256 _mainchainId\n ) internal view returns (Receipt memory _receipt) {\n _receipt.id = _id;\n _receipt.kind = Kind.Withdrawal;\n _receipt.ronin.addr = _requester;\n _receipt.ronin.tokenAddr = _request.tokenAddr;\n _receipt.ronin.chainId = block.chainid;\n _receipt.mainchain.addr = _request.recipientAddr;\n _receipt.mainchain.tokenAddr = _mainchainTokenAddr;\n _receipt.mainchain.chainId = _mainchainId;\n _receipt.info = _request.info;\n }\n\n struct Receipt {\n uint256 id;\n Kind kind;\n Token.Owner mainchain;\n Token.Owner ronin;\n Token.Info info;\n }\n\n // keccak256(\"Receipt(uint256 id,uint8 kind,TokenOwner mainchain,TokenOwner ronin,TokenInfo info)TokenInfo(uint8 erc,uint256 id,uint256 quantity)TokenOwner(address addr,address tokenAddr,uint256 chainId)\");\n bytes32 public constant TYPE_HASH = 0xb9d1fe7c9deeec5dc90a2f47ff1684239519f2545b2228d3d91fb27df3189eea;\n\n /**\n * @dev Returns token info struct hash.\n */\n function hash(Receipt memory _receipt) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _receipt.id,\n _receipt.kind,\n Token.hash(_receipt.mainchain),\n Token.hash(_receipt.ronin),\n Token.hash(_receipt.info)\n )\n );\n }\n\n /**\n * @dev Returns the receipt digest.\n */\n function receiptDigest(bytes32 _domainSeparator, bytes32 _receiptHash) internal pure returns (bytes32) {\n return _domainSeparator.toTypedDataHash(_receiptHash);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "contracts/libraries/Token.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../interfaces/IWETH.sol\";\n\nlibrary Token {\n enum Standard {\n ERC20,\n ERC721\n }\n struct Info {\n Standard erc;\n // For ERC20: the id must be 0 and the quantity is larger than 0.\n // For ERC721: the quantity must be 0.\n uint256 id;\n uint256 quantity;\n }\n\n // keccak256(\"TokenInfo(uint8 erc,uint256 id,uint256 quantity)\");\n bytes32 public constant INFO_TYPE_HASH = 0x1e2b74b2a792d5c0f0b6e59b037fa9d43d84fbb759337f0112fcc15ca414fc8d;\n\n /**\n * @dev Returns token info struct hash.\n */\n function hash(Info memory _info) internal pure returns (bytes32) {\n return keccak256(abi.encode(INFO_TYPE_HASH, _info.erc, _info.id, _info.quantity));\n }\n\n /**\n * @dev Validates the token info.\n */\n function validate(Info memory _info) internal pure {\n require(\n (_info.erc == Standard.ERC20 && _info.quantity > 0 && _info.id == 0) ||\n (_info.erc == Standard.ERC721 && _info.quantity == 0),\n \"Token: invalid info\"\n );\n }\n\n /**\n * @dev Transfer asset from.\n *\n * Requirements:\n * - The `_from` address must approve for the contract using this library.\n *\n */\n function transferFrom(\n Info memory _info,\n address _from,\n address _to,\n address _token\n ) internal {\n bool _success;\n bytes memory _data;\n if (_info.erc == Standard.ERC20) {\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, _from, _to, _info.quantity));\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\n } else if (_info.erc == Standard.ERC721) {\n // bytes4(keccak256(\"transferFrom(address,address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x23b872dd, _from, _to, _info.id));\n } else {\n revert(\"Token: unsupported token standard\");\n }\n\n if (!_success) {\n revert(\n string(\n abi.encodePacked(\n \"Token: could not transfer \",\n toString(_info),\n \" from \",\n Strings.toHexString(uint160(_from), 20),\n \" to \",\n Strings.toHexString(uint160(_to), 20),\n \" token \",\n Strings.toHexString(uint160(_token), 20)\n )\n )\n );\n }\n }\n\n /**\n * @dev Transfers ERC721 token and returns the result.\n */\n function tryTransferERC721(\n address _token,\n address _to,\n uint256 _id\n ) internal returns (bool _success) {\n (_success, ) = _token.call(abi.encodeWithSelector(IERC721.transferFrom.selector, address(this), _to, _id));\n }\n\n /**\n * @dev Transfers ERC20 token and returns the result.\n */\n function tryTransferERC20(\n address _token,\n address _to,\n uint256 _quantity\n ) internal returns (bool _success) {\n bytes memory _data;\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transfer.selector, _to, _quantity));\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\n }\n\n /**\n * @dev Transfer assets from current address to `_to` address.\n */\n function transfer(\n Info memory _info,\n address _to,\n address _token\n ) internal {\n bool _success;\n if (_info.erc == Standard.ERC20) {\n _success = tryTransferERC20(_token, _to, _info.quantity);\n } else if (_info.erc == Standard.ERC721) {\n _success = tryTransferERC721(_token, _to, _info.id);\n } else {\n revert(\"Token: unsupported token standard\");\n }\n\n if (!_success) {\n revert(\n string(\n abi.encodePacked(\n \"Token: could not transfer \",\n toString(_info),\n \" to \",\n Strings.toHexString(uint160(_to), 20),\n \" token \",\n Strings.toHexString(uint160(_token), 20)\n )\n )\n );\n }\n }\n\n /**\n * @dev Tries minting and transfering assets.\n *\n * @notice Prioritizes transfer native token if the token is wrapped.\n *\n */\n function handleAssetTransfer(\n Info memory _info,\n address payable _to,\n address _token,\n IWETH _wrappedNativeToken\n ) internal {\n bool _success;\n if (_token == address(_wrappedNativeToken)) {\n // Try sending the native token before transferring the wrapped token\n if (!_to.send(_info.quantity)) {\n _wrappedNativeToken.deposit{ value: _info.quantity }();\n transfer(_info, _to, _token);\n }\n } else if (_info.erc == Token.Standard.ERC20) {\n uint256 _balance = IERC20(_token).balanceOf(address(this));\n\n if (_balance < _info.quantity) {\n // bytes4(keccak256(\"mint(address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, address(this), _info.quantity - _balance));\n require(_success, \"Token: ERC20 minting failed\");\n }\n\n transfer(_info, _to, _token);\n } else if (_info.erc == Token.Standard.ERC721) {\n if (!tryTransferERC721(_token, _to, _info.id)) {\n // bytes4(keccak256(\"mint(address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, _to, _info.id));\n require(_success, \"Token: ERC721 minting failed\");\n }\n } else {\n revert(\"Token: unsupported token standard\");\n }\n }\n\n /**\n * @dev Returns readable string.\n */\n function toString(Info memory _info) internal pure returns (string memory) {\n return\n string(\n abi.encodePacked(\n \"TokenInfo(\",\n Strings.toHexString(uint160(_info.erc), 1),\n \",\",\n Strings.toHexString(_info.id),\n \",\",\n Strings.toHexString(_info.quantity),\n \")\"\n )\n );\n }\n\n struct Owner {\n address addr;\n address tokenAddr;\n uint256 chainId;\n }\n\n // keccak256(\"TokenOwner(address addr,address tokenAddr,uint256 chainId)\");\n bytes32 public constant OWNER_TYPE_HASH = 0x353bdd8d69b9e3185b3972e08b03845c0c14a21a390215302776a7a34b0e8764;\n\n /**\n * @dev Returns ownership struct hash.\n */\n function hash(Owner memory _owner) internal pure returns (bytes32) {\n return keccak256(abi.encode(OWNER_TYPE_HASH, _owner.addr, _owner.tokenAddr, _owner.chainId));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IWETH.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IWETH {\n function deposit() external payable;\n\n function withdraw(uint256 _wad) external;\n\n function balanceOf(address) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/consumers/MappedTokenConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../libraries/Token.sol\";\n\ninterface MappedTokenConsumer {\n struct MappedToken {\n Token.Standard erc;\n address tokenAddr;\n }\n}\n" + }, + "contracts/extensions/bridge-operator-governance/BOsGovernanceRelay.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\nimport \"../../libraries/BridgeOperatorsBallot.sol\";\nimport \"../../libraries/AddressArrayUtils.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\n\nabstract contract BOsGovernanceRelay is SignatureConsumer, VoteStatusConsumer {\n /// @dev The last the brige operator set info.\n BridgeOperatorsBallot.BridgeOperatorSet internal _lastSyncedBridgeOperatorSetInfo;\n /// @dev Mapping from period index => epoch index => bridge operators vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) internal _vote;\n\n /**\n * @dev Returns the synced bridge operator set info.\n */\n function lastSyncedBridgeOperatorSetInfo() external view returns (BridgeOperatorsBallot.BridgeOperatorSet memory) {\n return _lastSyncedBridgeOperatorSetInfo;\n }\n\n /**\n * @dev Relays votes by signatures.\n *\n * Requirements:\n * - The period of voting is larger than the last synced period.\n * - The arrays are not empty.\n * - The signature signers are in order.\n *\n * @notice Does not store the voter signature into storage.\n *\n */\n function _relayVotesBySignatures(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures,\n uint256 _minimumVoteWeight,\n bytes32 _domainSeperator\n ) internal {\n require(\n (_ballot.period >= _lastSyncedBridgeOperatorSetInfo.period &&\n _ballot.epoch > _lastSyncedBridgeOperatorSetInfo.epoch),\n \"BOsGovernanceRelay: query for outdated bridge operator set\"\n );\n BridgeOperatorsBallot.verifyBallot(_ballot);\n require(\n !AddressArrayUtils.isEqual(_ballot.operators, _lastSyncedBridgeOperatorSetInfo.operators),\n \"BOsGovernanceRelay: bridge operator set is already voted\"\n );\n require(_signatures.length > 0, \"BOsGovernanceRelay: invalid array length\");\n\n Signature calldata _sig;\n address[] memory _signers = new address[](_signatures.length);\n address _lastSigner;\n bytes32 _hash = BridgeOperatorsBallot.hash(_ballot);\n bytes32 _digest = ECDSA.toTypedDataHash(_domainSeperator, _hash);\n\n for (uint256 _i = 0; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n _signers[_i] = ECDSA.recover(_digest, _sig.v, _sig.r, _sig.s);\n require(_lastSigner < _signers[_i], \"BOsGovernanceRelay: invalid order\");\n _lastSigner = _signers[_i];\n }\n\n IsolatedGovernance.Vote storage _v = _vote[_ballot.period][_ballot.epoch];\n uint256 _totalVoteWeight = _sumBridgeVoterWeights(_signers);\n if (_totalVoteWeight >= _minimumVoteWeight) {\n require(_totalVoteWeight > 0, \"BOsGovernanceRelay: invalid vote weight\");\n _v.status = VoteStatus.Approved;\n _lastSyncedBridgeOperatorSetInfo = _ballot;\n return;\n }\n\n revert(\"BOsGovernanceRelay: relay failed\");\n }\n\n /**\n * @dev Returns the weight of the governor list.\n */\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual returns (uint256);\n}\n" + }, + "contracts/mainchain/MainchainGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"../extensions/bridge-operator-governance/BOsGovernanceRelay.sol\";\nimport \"../extensions/sequential-governance/GovernanceRelay.sol\";\nimport \"../extensions/TransparentUpgradeableProxyV2.sol\";\nimport \"../extensions/GovernanceAdmin.sol\";\nimport \"../interfaces/IBridge.sol\";\n\ncontract MainchainGovernanceAdmin is AccessControlEnumerable, GovernanceRelay, GovernanceAdmin, BOsGovernanceRelay {\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n uint256 private constant DEFAULT_EXPIRY_DURATION = 1 << 255;\n\n constructor(\n uint256 _roninChainId,\n address _roleSetter,\n address _roninTrustedOrganizationContract,\n address _bridgeContract,\n address[] memory _relayers\n ) GovernanceAdmin(_roninChainId, _roninTrustedOrganizationContract, _bridgeContract, DEFAULT_EXPIRY_DURATION) {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n for (uint256 _i; _i < _relayers.length; _i++) {\n _grantRole(RELAYER_ROLE, _relayers[_i]);\n }\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for the proposal.\n */\n function proposalRelayed(uint256 _chainId, uint256 _round) external view returns (bool) {\n return vote[_chainId][_round].status != VoteStatus.Pending;\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for bridge operators at a specific period.\n */\n function bridgeOperatorsRelayed(uint256 _period, uint256 _epoch) external view returns (bool) {\n return _vote[_period][_epoch].status != VoteStatus.Pending;\n }\n\n /**\n * @dev See `GovernanceRelay-_relayProposal`.\n *\n * Requirements:\n * - The method caller is relayer.\n *\n */\n function relayProposal(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyRole(RELAYER_ROLE) {\n _relayProposal(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender);\n }\n\n /**\n * @dev See `GovernanceRelay-_relayGlobalProposal`.\n *\n * Requirements:\n * - The method caller is relayer.\n *\n */\n function relayGlobalProposal(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyRole(RELAYER_ROLE) {\n _relayGlobalProposal(\n _globalProposal,\n _supports,\n _signatures,\n DOMAIN_SEPARATOR,\n roninTrustedOrganizationContract(),\n bridgeContract(),\n msg.sender\n );\n }\n\n /**\n * @dev See `BOsGovernanceRelay-_relayVotesBySignatures`.\n *\n * Requirements:\n * - The method caller is relayer.\n *\n */\n function relayBridgeOperators(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures\n ) external onlyRole(RELAYER_ROLE) {\n _relayVotesBySignatures(_ballot, _signatures, _getMinimumVoteWeight(), DOMAIN_SEPARATOR);\n TransparentUpgradeableProxyV2(payable(bridgeContract())).functionDelegateCall(\n abi.encodeWithSelector(_bridgeContract.replaceBridgeOperators.selector, _ballot.operators)\n );\n }\n\n /**\n * @inheritdoc GovernanceRelay\n */\n function _sumWeights(address[] memory _governors) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumGovernorWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governors)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @inheritdoc BOsGovernanceRelay\n */\n function _sumBridgeVoterWeights(address[] memory _governors) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumBridgeVoterWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governors)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev See {CoreGovernance-_getChainType}\n */\n function _getChainType() internal pure override returns (ChainType) {\n return ChainType.Mainchain;\n }\n}\n" + }, + "contracts/extensions/sequential-governance/GovernanceRelay.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./CoreGovernance.sol\";\n\nabstract contract GovernanceRelay is CoreGovernance {\n using Proposal for Proposal.ProposalDetail;\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\n\n /**\n * @dev Relays votes by signatures.\n *\n * @notice Does not store the voter signature into storage.\n *\n */\n function _relayVotesBySignatures(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _forDigest,\n bytes32 _againstDigest\n ) internal {\n require(_supports.length > 0 && _supports.length == _signatures.length, \"GovernanceRelay: invalid array length\");\n uint256 _forVoteCount;\n uint256 _againstVoteCount;\n address[] memory _forVoteSigners = new address[](_signatures.length);\n address[] memory _againstVoteSigners = new address[](_signatures.length);\n\n {\n address _signer;\n address _lastSigner;\n Ballot.VoteType _support;\n Signature calldata _sig;\n\n for (uint256 _i; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n _support = _supports[_i];\n\n if (_support == Ballot.VoteType.For) {\n _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s);\n _forVoteSigners[_forVoteCount++] = _signer;\n } else if (_support == Ballot.VoteType.Against) {\n _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s);\n _againstVoteSigners[_againstVoteCount++] = _signer;\n } else {\n revert(\"GovernanceRelay: query for unsupported vote type\");\n }\n\n require(_lastSigner < _signer, \"GovernanceRelay: invalid order\");\n _lastSigner = _signer;\n }\n }\n\n assembly {\n mstore(_forVoteSigners, _forVoteCount)\n mstore(_againstVoteSigners, _againstVoteCount)\n }\n\n ProposalVote storage _vote = vote[_proposal.chainId][_proposal.nonce];\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _totalForVoteWeight = _sumWeights(_forVoteSigners);\n if (_totalForVoteWeight >= _minimumForVoteWeight) {\n require(_totalForVoteWeight > 0, \"GovernanceRelay: invalid vote weight\");\n _vote.status = VoteStatus.Approved;\n emit ProposalApproved(_vote.hash);\n _tryExecute(_vote, _proposal);\n return;\n }\n\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\n uint256 _totalAgainstVoteWeight = _sumWeights(_againstVoteSigners);\n if (_totalAgainstVoteWeight >= _minimumAgainstVoteWeight) {\n require(_totalAgainstVoteWeight > 0, \"GovernanceRelay: invalid vote weight\");\n _vote.status = VoteStatus.Rejected;\n emit ProposalRejected(_vote.hash);\n return;\n }\n\n revert(\"GovernanceRelay: relay failed\");\n }\n\n /**\n * @dev Relays voted proposal.\n *\n * Requirements:\n * - The relay proposal is finalized.\n *\n */\n function _relayProposal(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _creator\n ) internal {\n _proposeProposalStruct(_proposal, _creator);\n bytes32 _proposalHash = _proposal.hash();\n _relayVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Relays voted global proposal.\n *\n * Requirements:\n * - The relay proposal is finalized.\n *\n */\n function _relayGlobalProposal(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal {\n Proposal.ProposalDetail memory _proposal = _proposeGlobalStruct(\n _globalProposal,\n _roninTrustedOrganizationContract,\n _gatewayContract,\n _creator\n );\n bytes32 _globalProposalHash = _globalProposal.hash();\n _relayVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Returns the weight of the governor list.\n */\n function _sumWeights(address[] memory _governors) internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/TransparentUpgradeableProxyV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\n\n /**\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\n *\n * Requirements:\n * - Only the admin can call this function.\n *\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\n * reviewing the encoded data `_data` and the method which is called before using this.\n *\n */\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\n address _addr = _implementation();\n assembly {\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\n returndatacopy(0, 0, returndatasize())\n switch _result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "contracts/mocks/MockBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol\";\nimport \"../interfaces/IBridge.sol\";\n\ncontract MockBridge is IBridge {\n /// @dev Mapping from validator address => last block that the bridge operator is added\n mapping(address => uint256) public bridgeOperatorAddedBlock;\n /// @dev Bridge operators array\n address[] public bridgeOperators;\n\n function replaceBridgeOperators(address[] calldata _list) external {\n address _addr;\n for (uint256 _i = 0; _i < _list.length; _i++) {\n _addr = _list[_i];\n if (bridgeOperatorAddedBlock[_addr] == 0) {\n bridgeOperators.push(_addr);\n }\n bridgeOperatorAddedBlock[_addr] = block.number;\n }\n\n {\n uint256 _i;\n while (_i < bridgeOperators.length) {\n _addr = bridgeOperators[_i];\n if (bridgeOperatorAddedBlock[_addr] < block.number) {\n delete bridgeOperatorAddedBlock[_addr];\n bridgeOperators[_i] = bridgeOperators[bridgeOperators.length - 1];\n bridgeOperators.pop();\n continue;\n }\n _i++;\n }\n }\n }\n\n function getBridgeOperators() external view override returns (address[] memory) {\n return bridgeOperators;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetMinterPauser.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../extensions/ERC20Burnable.sol\";\nimport \"../extensions/ERC20Pausable.sol\";\nimport \"../../../access/AccessControlEnumerable.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev {ERC20} token, including:\n *\n * - ability for holders to burn (destroy) their tokens\n * - a minter role that allows for token minting (creation)\n * - a pauser role that allows to stop all token transfers\n *\n * This contract uses {AccessControl} to lock permissioned functions using the\n * different roles - head to its documentation for details.\n *\n * The account that deploys the contract will be granted the minter and pauser\n * roles, as well as the default admin role, which will let it grant both minter\n * and pauser roles to other accounts.\n *\n * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._\n */\ncontract ERC20PresetMinterPauser is Context, AccessControlEnumerable, ERC20Burnable, ERC20Pausable {\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant PAUSER_ROLE = keccak256(\"PAUSER_ROLE\");\n\n /**\n * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the\n * account that deploys the contract.\n *\n * See {ERC20-constructor}.\n */\n constructor(string memory name, string memory symbol) ERC20(name, symbol) {\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n\n _setupRole(MINTER_ROLE, _msgSender());\n _setupRole(PAUSER_ROLE, _msgSender());\n }\n\n /**\n * @dev Creates `amount` new tokens for `to`.\n *\n * See {ERC20-_mint}.\n *\n * Requirements:\n *\n * - the caller must have the `MINTER_ROLE`.\n */\n function mint(address to, uint256 amount) public virtual {\n require(hasRole(MINTER_ROLE, _msgSender()), \"ERC20PresetMinterPauser: must have minter role to mint\");\n _mint(to, amount);\n }\n\n /**\n * @dev Pauses all token transfers.\n *\n * See {ERC20Pausable} and {Pausable-_pause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function pause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC20PresetMinterPauser: must have pauser role to pause\");\n _pause();\n }\n\n /**\n * @dev Unpauses all token transfers.\n *\n * See {ERC20Pausable} and {Pausable-_unpause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function unpause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC20PresetMinterPauser: must have pauser role to unpause\");\n _unpause();\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override(ERC20, ERC20Pausable) {\n super._beforeTokenTransfer(from, to, amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\n * tokens and those that they have an allowance for, in a way that can be\n * recognized off-chain (via event analysis).\n */\nabstract contract ERC20Burnable is Context, ERC20 {\n /**\n * @dev Destroys `amount` tokens from the caller.\n *\n * See {ERC20-_burn}.\n */\n function burn(uint256 amount) public virtual {\n _burn(_msgSender(), amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\n * allowance.\n *\n * See {ERC20-_burn} and {ERC20-allowance}.\n *\n * Requirements:\n *\n * - the caller must have allowance for ``accounts``'s tokens of at least\n * `amount`.\n */\n function burnFrom(address account, uint256 amount) public virtual {\n _spendAllowance(account, _msgSender(), amount);\n _burn(account, amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../security/Pausable.sol\";\n\n/**\n * @dev ERC20 token with pausable token transfers, minting and burning.\n *\n * Useful for scenarios such as preventing trades until the end of an evaluation\n * period, or having an emergency switch for freezing all token transfers in the\n * event of a large bug.\n */\nabstract contract ERC20Pausable is ERC20, Pausable {\n /**\n * @dev See {ERC20-_beforeTokenTransfer}.\n *\n * Requirements:\n *\n * - the contract must not be paused.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, amount);\n\n require(!paused(), \"ERC20Pausable: token transfer while paused\");\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"../../access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" + }, + "contracts/multi-chains/RoninTrustedOrganization.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../libraries/AddressArrayUtils.sol\";\nimport \"../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../extensions/collections/HasProxyAdmin.sol\";\n\ncontract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, Initializable {\n uint256 internal _num;\n uint256 internal _denom;\n uint256 internal _totalWeight;\n uint256 internal _nonce;\n\n /// @dev Mapping from consensus address => weight\n mapping(address => uint256) internal _consensusWeight;\n /// @dev Mapping from governor address => weight\n mapping(address => uint256) internal _governorWeight;\n /// @dev Mapping from bridge voter address => weight\n mapping(address => uint256) internal _bridgeVoterWeight;\n\n /// @dev Mapping from consensus address => added block\n mapping(address => uint256) internal _addedBlock;\n\n /// @dev Consensus array\n address[] internal _consensusList;\n /// @dev Governors array\n address[] internal _governorList;\n /// @dev Bridge voters array\n address[] internal _bridgeVoterList;\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n TrustedOrganization[] calldata _trustedOrgs,\n uint256 __num,\n uint256 __denom\n ) external initializer {\n if (_trustedOrgs.length > 0) {\n _addTrustedOrganizations(_trustedOrgs);\n }\n _setThreshold(__num, __denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\n return (_num, _denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _denom >= _num * _totalWeight;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function minimumVoteWeight() external view virtual returns (uint256) {\n return (_num * _totalWeight + _denom - 1) / _denom;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n override\n onlyAdmin\n returns (uint256, uint256)\n {\n return _setThreshold(_numerator, _denominator);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function addTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\n _addTrustedOrganizations(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\n require(_list.length > 0, \"RoninTrustedOrganization: invalid array length\");\n for (uint256 _i; _i < _list.length; _i++) {\n _updateTrustedOrganization(_list[_i]);\n }\n emit TrustedOrganizationsUpdated(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function removeTrustedOrganizations(address[] calldata _list) external override onlyAdmin {\n require(_list.length > 0, \"RoninTrustedOrganization: invalid array length\");\n for (uint _i = 0; _i < _list.length; _i++) {\n _removeTrustedOrganization(_list[_i]);\n }\n emit TrustedOrganizationsRemoved(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function totalWeights() external view virtual returns (uint256) {\n return _totalWeight;\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getConsensusWeight(address _consensusAddr) external view returns (uint256) {\n return _consensusWeight[_consensusAddr];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getGovernorWeight(address _governor) external view returns (uint256) {\n return _governorWeight[_governor];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getBridgeVoterWeight(address _addr) external view returns (uint256) {\n return _bridgeVoterWeight[_addr];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; _i++) {\n _res[_i] = _consensusWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; _i++) {\n _res[_i] = _governorWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; _i++) {\n _res[_i] = _bridgeVoterWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; _i++) {\n _res += _consensusWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; _i++) {\n _res += _governorWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; _i++) {\n _res += _bridgeVoterWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function countTrustedOrganizations() external view override returns (uint256) {\n return _consensusList.length;\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getAllTrustedOrganizations() external view override returns (TrustedOrganization[] memory _list) {\n _list = new TrustedOrganization[](_consensusList.length);\n address _addr;\n for (uint256 _i; _i < _list.length; _i++) {\n _addr = _consensusList[_i];\n _list[_i].consensusAddr = _addr;\n _list[_i].governor = _governorList[_i];\n _list[_i].bridgeVoter = _bridgeVoterList[_i];\n _list[_i].weight = _consensusWeight[_addr];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory) {\n for (uint _i = 0; _i < _consensusList.length; _i++) {\n if (_consensusList[_i] == _consensusAddr) {\n return getTrustedOrganizationAt(_i);\n }\n }\n revert(\"RoninTrustedOrganization: query for non-existent consensus address\");\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getTrustedOrganizationAt(uint256 _idx) public view override returns (TrustedOrganization memory) {\n address _addr = _consensusList[_idx];\n return\n TrustedOrganization(\n _addr,\n _governorList[_idx],\n _bridgeVoterList[_idx],\n _consensusWeight[_addr],\n _addedBlock[_addr]\n );\n }\n\n /**\n * @dev Adds a list of trusted organizations.\n */\n function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {\n for (uint256 _i; _i < _list.length; _i++) {\n _addTrustedOrganization(_list[_i]);\n }\n emit TrustedOrganizationsAdded(_list);\n }\n\n /**\n * @dev Adds a trusted organization.\n *\n * Requirements:\n * - The weight is larger than 0.\n * - The consensus address is not added.\n * - The govenor address is not added.\n * - The bridge voter address is not added.\n *\n */\n function _addTrustedOrganization(TrustedOrganization memory _v) internal virtual {\n require(_v.addedBlock == 0, \"RoninTrustedOrganization: invalid request\");\n _sanityCheckTrustedOrganizationData(_v);\n\n if (_consensusWeight[_v.consensusAddr] > 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: consensus address \",\n Strings.toHexString(uint160(_v.consensusAddr), 20),\n \" is added already\"\n )\n )\n );\n }\n\n if (_governorWeight[_v.governor] > 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: govenor address \",\n Strings.toHexString(uint160(_v.governor), 20),\n \" is added already\"\n )\n )\n );\n }\n\n if (_bridgeVoterWeight[_v.bridgeVoter] > 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: bridge voter address \",\n Strings.toHexString(uint160(_v.bridgeVoter), 20),\n \" is added already\"\n )\n )\n );\n }\n\n _consensusList.push(_v.consensusAddr);\n _consensusWeight[_v.consensusAddr] = _v.weight;\n\n _governorList.push(_v.governor);\n _governorWeight[_v.governor] = _v.weight;\n\n _bridgeVoterList.push(_v.bridgeVoter);\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\n\n _addedBlock[_v.consensusAddr] = block.number;\n\n _totalWeight += _v.weight;\n }\n\n /**\n * @dev Updates a trusted organization.\n *\n * Requirements:\n * - The weight is larger than 0.\n * - The consensus address is already added.\n *\n */\n function _updateTrustedOrganization(TrustedOrganization memory _v) internal virtual {\n _sanityCheckTrustedOrganizationData(_v);\n\n uint256 _weight = _consensusWeight[_v.consensusAddr];\n if (_weight == 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: consensus address \",\n Strings.toHexString(uint160(_v.consensusAddr), 20),\n \" is not added\"\n )\n )\n );\n }\n\n uint256 _count = _consensusList.length;\n for (uint256 _i = 0; _i < _count; _i++) {\n if (_consensusList[_i] == _v.consensusAddr) {\n _totalWeight -= _weight;\n _totalWeight += _v.weight;\n\n if (_governorList[_i] != _v.governor) {\n require(_governorWeight[_v.governor] == 0, \"RoninTrustedOrganization: query for duplicated governor\");\n delete _governorWeight[_governorList[_i]];\n _governorList[_i] = _v.governor;\n }\n\n if (_bridgeVoterList[_i] != _v.bridgeVoter) {\n require(\n _bridgeVoterWeight[_v.bridgeVoter] == 0,\n \"RoninTrustedOrganization: query for duplicated bridge voter\"\n );\n delete _bridgeVoterWeight[_bridgeVoterList[_i]];\n _bridgeVoterList[_i] = _v.bridgeVoter;\n }\n\n _consensusWeight[_v.consensusAddr] = _v.weight;\n _governorWeight[_v.governor] = _v.weight;\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\n return;\n }\n }\n }\n\n /**\n * @dev Removes a trusted organization.\n *\n * Requirements:\n * - The consensus address is added.\n *\n */\n function _removeTrustedOrganization(address _addr) internal virtual {\n uint256 _weight = _consensusWeight[_addr];\n if (_weight == 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: consensus address \",\n Strings.toHexString(uint160(_addr), 20),\n \" is not added\"\n )\n )\n );\n }\n\n uint256 _index;\n uint256 _count = _consensusList.length;\n for (uint256 _i = 0; _i < _count; _i++) {\n if (_consensusList[_i] == _addr) {\n _index = _i;\n break;\n }\n }\n\n _totalWeight -= _weight;\n\n delete _addedBlock[_addr];\n delete _consensusWeight[_addr];\n _consensusList[_index] = _consensusList[_count - 1];\n _consensusList.pop();\n\n delete _governorWeight[_governorList[_index]];\n _governorList[_index] = _governorList[_count - 1];\n _governorList.pop();\n\n delete _bridgeVoterWeight[_bridgeVoterList[_index]];\n _bridgeVoterList[_index] = _bridgeVoterList[_count - 1];\n _bridgeVoterList.pop();\n }\n\n /**\n * @dev Sets threshold and returns the old one.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function _setThreshold(uint256 _numerator, uint256 _denominator)\n internal\n virtual\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n require(_numerator <= _denominator, \"RoninTrustedOrganization: invalid threshold\");\n _previousNum = _num;\n _previousDenom = _denom;\n _num = _numerator;\n _denom = _denominator;\n emit ThresholdUpdated(_nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n\n /**\n * @dev Hook that checks trusted organization's data. Reverts if the requirements are not met.\n *\n * Requirements:\n * - The weight must be larger than 0.\n * - The consensus address, governor address, and bridge voter address are different.\n */\n function _sanityCheckTrustedOrganizationData(TrustedOrganization memory _v) private pure {\n require(_v.weight > 0, \"RoninTrustedOrganization: invalid weight\");\n\n address[] memory _addresses = new address[](3);\n _addresses[0] = _v.consensusAddr;\n _addresses[1] = _v.governor;\n _addresses[2] = _v.bridgeVoter;\n require(!AddressArrayUtils.hasDuplicate(_addresses), \"RoninTrustedOrganization: three addresses must be distinct\");\n }\n}\n" + }, + "contracts/ronin/gateway/BridgeTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../extensions/collections/HasBridgeContract.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\nimport \"../../interfaces/IBridgeTracking.sol\";\n\ncontract BridgeTracking is HasBridgeContract, HasValidatorContract, Initializable, IBridgeTracking {\n struct PeriodVotingMetric {\n /// @dev Total requests that are tracked in the period. This value is 0 until the {_bufferMetric.requests[]} gets added into a period metric.\n uint256 totalRequests;\n uint256 totalBallots;\n mapping(address => uint256) totalBallotsOf;\n address[] voters;\n }\n\n struct PeriodVotingMetricTimeWrapper {\n uint256 lastEpoch;\n Request[] requests;\n PeriodVotingMetric data;\n }\n\n struct ReceiptTrackingInfo {\n /// @dev The period that the receipt is approved. Value 0 means the receipt is not approved yet.\n uint256 approvedPeriod;\n /// @dev The address list of voters\n address[] voters;\n /// @dev Mapping from voter => flag indicating the voter casts vote for this receipt\n mapping(address => bool) voted;\n /// @dev The period that the receipt is tracked, i.e. the metric is transferred from buffer to the period. Value 0 means the receipt is currently in buffer or not tracked yet.\n uint256 trackedPeriod;\n }\n\n /// @dev The block that the contract allows incoming mutable calls.\n uint256 public startedAtBlock;\n\n /// @dev The temporary info of votes and ballots\n PeriodVotingMetricTimeWrapper internal _bufferMetric;\n /// @dev Mapping from period number => vote stats based on period\n mapping(uint256 => PeriodVotingMetric) internal _periodMetric;\n /// @dev Mapping from vote kind => receipt id => receipt stats\n mapping(VoteKind => mapping(uint256 => ReceiptTrackingInfo)) internal _receiptTrackingInfo;\n\n modifier skipOnUnstarted() {\n if (block.number < startedAtBlock) {\n return;\n }\n _;\n }\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address _bridgeContract,\n address _validatorContract,\n uint256 _startedAtBlock\n ) external initializer {\n _setBridgeContract(_bridgeContract);\n _setValidatorContract(_validatorContract);\n startedAtBlock = _startedAtBlock;\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalVotes(uint256 _period) external view override returns (uint256 _totalVotes) {\n _totalVotes = _periodMetric[_period].totalRequests;\n if (_isBufferCountedForPeriod(_period)) {\n _totalVotes += _bufferMetric.requests.length;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalBallots(uint256 _period) external view override returns (uint256 _totalBallots) {\n _totalBallots = _periodMetric[_period].totalBallots;\n if (_isBufferCountedForPeriod(_period)) {\n _totalBallots += _bufferMetric.data.totalBallots;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\n external\n view\n override\n returns (uint256[] memory _res)\n {\n _res = new uint256[](_bridgeOperators.length);\n bool _isBufferCounted = _isBufferCountedForPeriod(_period);\n for (uint _i = 0; _i < _bridgeOperators.length; _i++) {\n _res[_i] = _totalBallotsOf(_period, _bridgeOperators[_i], _isBufferCounted);\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalBallotsOf(uint256 _period, address _bridgeOperator) public view override returns (uint256) {\n return _totalBallotsOf(_period, _bridgeOperator, _isBufferCountedForPeriod(_period));\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external override onlyBridgeContract skipOnUnstarted {\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\n\n // Only records for the receipt which not approved\n if (_receiptInfo.approvedPeriod == 0) {\n _trySyncBuffer();\n uint256 _currentPeriod = _validatorContract.currentPeriod();\n _receiptInfo.approvedPeriod = _currentPeriod;\n\n Request storage _bufferRequest = _bufferMetric.requests.push();\n _bufferRequest.kind = _kind;\n _bufferRequest.id = _requestId;\n\n address[] storage _voters = _receiptInfo.voters;\n for (uint _i = 0; _i < _voters.length; _i++) {\n _increaseBallot(_kind, _requestId, _voters[_i], _currentPeriod);\n }\n\n delete _receiptInfo.voters;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function recordVote(\n VoteKind _kind,\n uint256 _requestId,\n address _operator\n ) external override onlyBridgeContract skipOnUnstarted {\n uint256 _period = _validatorContract.currentPeriod();\n _trySyncBuffer();\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\n\n // When the vote is not approved yet, the voters are saved in the receipt info, and not increase ballot metric.\n // The ballot metric will be increased later in the {handleVoteApproved} method.\n if (_receiptInfo.approvedPeriod == 0) {\n _receiptInfo.voters.push(_operator);\n return;\n }\n\n _increaseBallot(_kind, _requestId, _operator, _period);\n }\n\n /**\n * @dev Increases the ballot for the operator at a period.\n */\n function _increaseBallot(\n VoteKind _kind,\n uint256 _requestId,\n address _operator,\n uint256 _currentPeriod\n ) internal {\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\n if (_receiptInfo.voted[_operator]) {\n return;\n }\n\n _receiptInfo.voted[_operator] = true;\n\n uint256 _trackedPeriod = _receiptInfo.trackedPeriod;\n\n // Do not increase ballot for receipt that is neither in the buffer, nor in the most current tracked period.\n // If the receipt is not tracked in a period, increase metric in buffer.\n if (_trackedPeriod == 0) {\n if (_bufferMetric.data.totalBallotsOf[_operator] == 0) {\n _bufferMetric.data.voters.push(_operator);\n }\n _bufferMetric.data.totalBallots++;\n _bufferMetric.data.totalBallotsOf[_operator]++;\n }\n // If the receipt is tracked in the most current tracked period, increase metric in the period.\n else if (_trackedPeriod == _currentPeriod) {\n PeriodVotingMetric storage _metric = _periodMetric[_trackedPeriod];\n _metric.totalBallots++;\n _metric.totalBallotsOf[_operator]++;\n }\n }\n\n /**\n * @dev See `totalBallotsOf`.\n */\n function _totalBallotsOf(\n uint256 _period,\n address _bridgeOperator,\n bool _mustCountLastStats\n ) internal view returns (uint256 _totalBallots) {\n _totalBallots = _periodMetric[_period].totalBallotsOf[_bridgeOperator];\n if (_mustCountLastStats) {\n _totalBallots += _bufferMetric.data.totalBallotsOf[_bridgeOperator];\n }\n }\n\n /**\n * @dev Syncs period stats. Move all data from the buffer metric to the period metric.\n *\n * Requirements:\n * - The epoch after the buffer epoch is wrapped up.\n */\n function _trySyncBuffer() internal {\n uint256 _currentEpoch = _validatorContract.epochOf(block.number);\n if (_bufferMetric.lastEpoch < _currentEpoch) {\n (, uint256 _trackedPeriod) = _validatorContract.tryGetPeriodOfEpoch(_bufferMetric.lastEpoch + 1);\n _bufferMetric.lastEpoch = _currentEpoch;\n\n // Copy numbers of totals\n PeriodVotingMetric storage _metric = _periodMetric[_trackedPeriod];\n _metric.totalRequests += _bufferMetric.requests.length;\n _metric.totalBallots += _bufferMetric.data.totalBallots;\n\n // Copy voters info and voters' ballot\n for (uint _i = 0; _i < _bufferMetric.data.voters.length; _i++) {\n address _voter = _bufferMetric.data.voters[_i];\n _metric.totalBallotsOf[_voter] += _bufferMetric.data.totalBallotsOf[_voter];\n delete _bufferMetric.data.totalBallotsOf[_voter]; // need to manually delete each element, due to mapping\n }\n\n // Mark all receipts in the buffer as tracked. Keep total number of receipts and delete receipt details.\n for (uint _i = 0; _i < _bufferMetric.requests.length; _i++) {\n Request storage _bufferRequest = _bufferMetric.requests[_i];\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_bufferRequest.kind][_bufferRequest.id];\n _receiptInfo.trackedPeriod = _trackedPeriod;\n }\n\n delete _bufferMetric.requests;\n delete _bufferMetric.data;\n }\n }\n\n /**\n * @dev Returns whether the buffer stats must be counted or not.\n */\n function _isBufferCountedForPeriod(uint256 _queriedPeriod) internal view returns (bool) {\n uint256 _currentEpoch = _validatorContract.epochOf(block.number);\n (bool _filled, uint256 _periodOfNextTemporaryEpoch) = _validatorContract.tryGetPeriodOfEpoch(\n _bufferMetric.lastEpoch + 1\n );\n return _filled && _queriedPeriod == _periodOfNextTemporaryEpoch && _bufferMetric.lastEpoch < _currentEpoch;\n }\n}\n" + }, + "contracts/mocks/MockGatewayForTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../interfaces/IBridgeTracking.sol\";\nimport \"../extensions/collections/HasBridgeTrackingContract.sol\";\n\ncontract MockGatewayForTracking is HasBridgeTrackingContract {\n constructor(address _bridgeTrackingContract) {\n _setBridgeTrackingContract(_bridgeTrackingContract);\n }\n\n function sendBallot(\n IBridgeTracking.VoteKind _kind,\n uint256 _id,\n address[] memory _voters\n ) external {\n for (uint256 _i; _i < _voters.length; _i++) {\n _bridgeTrackingContract.recordVote(_kind, _id, _voters[_i]);\n }\n }\n\n function sendApprovedVote(IBridgeTracking.VoteKind _kind, uint256 _id) external {\n _bridgeTrackingContract.handleVoteApproved(_kind, _id);\n }\n}\n" + }, + "contracts/extensions/collections/HasBridgeTrackingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasBridgeTrackingContract.sol\";\nimport \"../../interfaces/IBridgeTracking.sol\";\n\ncontract HasBridgeTrackingContract is IHasBridgeTrackingContract, HasProxyAdmin {\n IBridgeTracking internal _bridgeTrackingContract;\n\n modifier onlyBridgeTrackingContract() {\n if (bridgeTrackingContract() != msg.sender) revert ErrCallerMustBeBridgeTrackingContract();\n _;\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function bridgeTrackingContract() public view override returns (address) {\n return address(_bridgeTrackingContract);\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function setBridgeTrackingContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setBridgeTrackingContract(_addr);\n }\n\n /**\n * @dev Sets the bridge tracking contract.\n *\n * Emits the event `BridgeTrackingContractUpdated`.\n *\n */\n function _setBridgeTrackingContract(address _addr) internal {\n _bridgeTrackingContract = IBridgeTracking(_addr);\n emit BridgeTrackingContractUpdated(_addr);\n }\n}\n" + }, + "contracts/ronin/validator/CoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasBridgeTrackingContract.sol\";\nimport \"../../extensions/collections/HasMaintenanceContract.sol\";\nimport \"../../extensions/collections/HasSlashIndicatorContract.sol\";\nimport \"../../extensions/collections/HasStakingVestingContract.sol\";\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../interfaces/validator/ICoinbaseExecution.sol\";\nimport \"../../libraries/EnumFlags.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"../../precompile-usages/PCUSortValidators.sol\";\nimport \"../../precompile-usages/PCUPickValidatorSet.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\nimport \"./CandidateManager.sol\";\nimport \"./EmergencyExit.sol\";\n\nabstract contract CoinbaseExecution is\n ICoinbaseExecution,\n RONTransferHelper,\n PCUSortValidators,\n PCUPickValidatorSet,\n HasStakingVestingContract,\n HasBridgeTrackingContract,\n HasMaintenanceContract,\n HasSlashIndicatorContract,\n EmergencyExit\n{\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n modifier onlyCoinbase() {\n if (msg.sender != block.coinbase) revert ErrCallerMustBeCoinbase();\n _;\n }\n\n modifier whenEpochEnding() {\n if (!epochEndingAt(block.number)) revert ErrAtEndOfEpochOnly();\n _;\n }\n\n modifier oncePerEpoch() {\n if (epochOf(_lastUpdatedBlock) >= epochOf(block.number)) revert ErrAlreadyWrappedEpoch();\n _lastUpdatedBlock = block.number;\n _;\n }\n\n /**\n * @inheritdoc ICoinbaseExecution\n */\n function submitBlockReward() external payable override onlyCoinbase {\n bool _requestForBlockProducer = isBlockProducer(msg.sender) &&\n !_jailed(msg.sender) &&\n !_miningRewardDeprecated(msg.sender, currentPeriod());\n\n (, uint256 _blockProducerBonus, uint256 _bridgeOperatorBonus) = _stakingVestingContract.requestBonus(\n _requestForBlockProducer,\n true // _requestForBridgeOperator\n );\n\n _totalBridgeReward += _bridgeOperatorBonus;\n\n // Deprecates reward for non-validator or slashed validator\n if (!_requestForBlockProducer) {\n _totalDeprecatedReward += msg.value;\n emit BlockRewardDeprecated(msg.sender, msg.value, BlockRewardDeprecatedType.UNAVAILABILITY);\n return;\n }\n\n emit BlockRewardSubmitted(msg.sender, msg.value, _blockProducerBonus);\n\n uint256 _period = currentPeriod();\n uint256 _reward = msg.value + _blockProducerBonus;\n uint256 _cutOffReward;\n if (_miningRewardBailoutCutOffAtPeriod[msg.sender][_period]) {\n (, , , uint256 _cutOffPercentage) = _slashIndicatorContract.getCreditScoreConfigs();\n _cutOffReward = (_reward * _cutOffPercentage) / _MAX_PERCENTAGE;\n _totalDeprecatedReward += _cutOffReward;\n emit BlockRewardDeprecated(msg.sender, _cutOffReward, BlockRewardDeprecatedType.AFTER_BAILOUT);\n }\n\n _reward -= _cutOffReward;\n (uint256 _minRate, uint256 _maxRate) = _stakingContract.getCommissionRateRange();\n uint256 _rate = Math.max(Math.min(_candidateInfo[msg.sender].commissionRate, _maxRate), _minRate);\n uint256 _miningAmount = (_rate * _reward) / _MAX_PERCENTAGE;\n _miningReward[msg.sender] += _miningAmount;\n\n uint256 _delegatingAmount = _reward - _miningAmount;\n _delegatingReward[msg.sender] += _delegatingAmount;\n }\n\n /**\n * @inheritdoc ICoinbaseExecution\n */\n function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {\n uint256 _newPeriod = _computePeriod(block.timestamp);\n bool _periodEnding = _isPeriodEnding(_newPeriod);\n\n (address[] memory _currentValidators, , ) = getValidators();\n address[] memory _revokedCandidates;\n uint256 _epoch = epochOf(block.number);\n uint256 _nextEpoch = _epoch + 1;\n uint256 _lastPeriod = currentPeriod();\n\n if (_periodEnding) {\n _syncBridgeOperatingReward(_lastPeriod, _currentValidators);\n (\n uint256 _totalDelegatingReward,\n uint256[] memory _delegatingRewards\n ) = _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(_lastPeriod, _currentValidators);\n _settleAndTransferDelegatingRewards(_lastPeriod, _currentValidators, _totalDelegatingReward, _delegatingRewards);\n _tryRecycleLockedFundsFromEmergencyExits();\n _recycleDeprecatedRewards();\n _slashIndicatorContract.updateCreditScores(_currentValidators, _lastPeriod);\n (_currentValidators, _revokedCandidates) = _syncValidatorSet(_newPeriod);\n if (_revokedCandidates.length > 0) {\n _slashIndicatorContract.execResetCreditScores(_revokedCandidates);\n }\n _currentPeriodStartAtBlock = block.number + 1;\n }\n _revampRoles(_newPeriod, _nextEpoch, _currentValidators);\n emit WrappedUpEpoch(_lastPeriod, _epoch, _periodEnding);\n _periodOf[_nextEpoch] = _newPeriod;\n _lastUpdatedPeriod = _newPeriod;\n }\n\n /**\n * @dev This loop over the all current validators to sync the bridge operating reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _syncBridgeOperatingReward(uint256 _lastPeriod, address[] memory _currentValidators) internal {\n uint256 _totalBridgeBallots = _bridgeTrackingContract.totalBallots(_lastPeriod);\n uint256 _totalBridgeVotes = _bridgeTrackingContract.totalVotes(_lastPeriod);\n uint256[] memory _bridgeBallots = _bridgeTrackingContract.getManyTotalBallots(\n _lastPeriod,\n getBridgeOperatorsOf(_currentValidators)\n );\n\n if (\n !_validateBridgeTrackingResponse(_totalBridgeBallots, _totalBridgeVotes, _bridgeBallots) || _totalBridgeVotes == 0\n ) {\n // Shares equally in case the bridge has nothing to vote or bridge tracking response is incorrect\n for (uint256 _i; _i < _currentValidators.length; _i++) {\n _bridgeOperatingReward[_currentValidators[_i]] = _totalBridgeReward / _currentValidators.length;\n }\n return;\n }\n\n (\n uint256 _missingVotesRatioTier1,\n uint256 _missingVotesRatioTier2,\n uint256 _jailDurationForMissingVotesRatioTier2,\n uint256 _skipBridgeOperatorSlashingThreshold\n ) = _slashIndicatorContract.getBridgeOperatorSlashingConfigs();\n\n // Slashes the bridge reward if the total of votes exceeds the slashing threshold.\n bool _shouldSlash = _totalBridgeVotes > _skipBridgeOperatorSlashingThreshold;\n for (uint256 _i; _i < _currentValidators.length; _i++) {\n // Shares the bridge operators reward proportionally.\n _bridgeOperatingReward[_currentValidators[_i]] = (_totalBridgeReward * _bridgeBallots[_i]) / _totalBridgeBallots;\n if (_shouldSlash) {\n _slashBridgeOperatorBasedOnPerformance(\n _lastPeriod,\n _currentValidators[_i],\n _MAX_PERCENTAGE - (_bridgeBallots[_i] * _MAX_PERCENTAGE) / _totalBridgeVotes,\n _jailDurationForMissingVotesRatioTier2,\n _missingVotesRatioTier1,\n _missingVotesRatioTier2\n );\n }\n }\n }\n\n /**\n * @dev Returns whether the responses from bridge tracking are correct.\n */\n function _validateBridgeTrackingResponse(\n uint256 _totalBridgeBallots,\n uint256 _totalBridgeVotes,\n uint256[] memory _bridgeBallots\n ) private returns (bool _valid) {\n _valid = true;\n uint256 _sumBallots;\n for (uint _i; _i < _bridgeBallots.length; _i++) {\n if (_bridgeBallots[_i] > _totalBridgeVotes) {\n _valid = false;\n break;\n }\n _sumBallots += _bridgeBallots[_i];\n }\n _valid = _valid && (_sumBallots <= _totalBridgeBallots);\n if (!_valid) {\n emit BridgeTrackingIncorrectlyResponded();\n }\n }\n\n /**\n * @dev Slashes the validator on the corresponding bridge operator performance. Updates the status of the deprecated reward. Not update the reward amount.\n *\n * Consider validating the bridge tracking response by using the method `_validateBridgeTrackingResponse` before calling this function.\n */\n function _slashBridgeOperatorBasedOnPerformance(\n uint256 _period,\n address _validator,\n uint256 _missedRatio,\n uint256 _jailDurationTier2,\n uint256 _ratioTier1,\n uint256 _ratioTier2\n ) internal {\n if (_missedRatio >= _ratioTier2) {\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\n _miningRewardDeprecatedAtPeriod[_validator][_period] = true;\n\n uint256 _newJailUntilBlock = Math.addIfNonZero(block.number, _jailDurationTier2);\n _blockProducerJailedBlock[_validator] = Math.max(_newJailUntilBlock, _blockProducerJailedBlock[_validator]);\n _cannotBailoutUntilBlock[_validator] = Math.max(_newJailUntilBlock, _cannotBailoutUntilBlock[_validator]);\n\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 2, _period);\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, true, true);\n } else if (_missedRatio >= _ratioTier1) {\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 1, _period);\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, false, true);\n }\n }\n\n /**\n * @dev This loops over all current validators to:\n * - Update delegating reward for and calculate total delegating rewards to be sent to the staking contract,\n * - Distribute the reward of block producers and bridge operators to their treasury addresses,\n * - Update the total deprecated reward if the two previous conditions do not sastify.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(\n uint256 _lastPeriod,\n address[] memory _currentValidators\n ) private returns (uint256 _totalDelegatingReward, uint256[] memory _delegatingRewards) {\n address _consensusAddr;\n address payable _treasury;\n _delegatingRewards = new uint256[](_currentValidators.length);\n for (uint _i; _i < _currentValidators.length; _i++) {\n _consensusAddr = _currentValidators[_i];\n _treasury = _candidateInfo[_consensusAddr].treasuryAddr;\n\n if (!_bridgeRewardDeprecated(_consensusAddr, _lastPeriod)) {\n _distributeBridgeOperatingReward(_consensusAddr, _candidateInfo[_consensusAddr].bridgeOperatorAddr, _treasury);\n } else {\n _totalDeprecatedReward += _bridgeOperatingReward[_consensusAddr];\n }\n\n if (!_jailed(_consensusAddr) && !_miningRewardDeprecated(_consensusAddr, _lastPeriod)) {\n _totalDelegatingReward += _delegatingReward[_consensusAddr];\n _delegatingRewards[_i] = _delegatingReward[_consensusAddr];\n _distributeMiningReward(_consensusAddr, _treasury);\n } else {\n _totalDeprecatedReward += _miningReward[_consensusAddr] + _delegatingReward[_consensusAddr];\n }\n\n delete _delegatingReward[_consensusAddr];\n delete _miningReward[_consensusAddr];\n delete _bridgeOperatingReward[_consensusAddr];\n }\n delete _totalBridgeReward;\n }\n\n /**\n * @dev Distributes bonus of staking vesting and mining fee for the block producer.\n *\n * Emits the `MiningRewardDistributed` once the reward is distributed successfully.\n * Emits the `MiningRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeMiningReward(address _consensusAddr, address payable _treasury) private {\n uint256 _amount = _miningReward[_consensusAddr];\n if (_amount > 0) {\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\n emit MiningRewardDistributed(_consensusAddr, _treasury, _amount);\n return;\n }\n\n emit MiningRewardDistributionFailed(_consensusAddr, _treasury, _amount, address(this).balance);\n }\n }\n\n /**\n * @dev Distribute bonus of staking vesting for the bridge operator.\n *\n * Emits the `BridgeOperatorRewardDistributed` once the reward is distributed successfully.\n * Emits the `BridgeOperatorRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeBridgeOperatingReward(\n address _consensusAddr,\n address _bridgeOperator,\n address payable _treasury\n ) private {\n uint256 _amount = _bridgeOperatingReward[_consensusAddr];\n if (_amount > 0) {\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\n emit BridgeOperatorRewardDistributed(_consensusAddr, _bridgeOperator, _treasury, _amount);\n return;\n }\n\n emit BridgeOperatorRewardDistributionFailed(\n _consensusAddr,\n _bridgeOperator,\n _treasury,\n _amount,\n address(this).balance\n );\n }\n }\n\n /**\n * @dev Helper function to settle rewards for delegators of `_currentValidators` at the end of each period,\n * then transfer the rewards from this contract to the staking contract, in order to finalize a period.\n *\n * Emits the `StakingRewardDistributed` once the reward is distributed successfully.\n * Emits the `StakingRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _settleAndTransferDelegatingRewards(\n uint256 _period,\n address[] memory _currentValidators,\n uint256 _totalDelegatingReward,\n uint256[] memory _delegatingRewards\n ) private {\n IStaking _staking = _stakingContract;\n if (_totalDelegatingReward > 0) {\n if (_unsafeSendRON(payable(address(_staking)), _totalDelegatingReward)) {\n _staking.execRecordRewards(_currentValidators, _delegatingRewards, _period);\n emit StakingRewardDistributed(_totalDelegatingReward, _currentValidators, _delegatingRewards);\n return;\n }\n\n emit StakingRewardDistributionFailed(\n _totalDelegatingReward,\n _currentValidators,\n _delegatingRewards,\n address(this).balance\n );\n }\n }\n\n /**\n * @dev Transfer the deprecated rewards e.g. the rewards that get deprecated when validator is slashed/maintained,\n * to the staking vesting contract\n *\n * Note: This method should be called once in the end of each period.\n */\n function _recycleDeprecatedRewards() private {\n uint256 _withdrawAmount = _totalDeprecatedReward;\n\n if (_withdrawAmount != 0) {\n address _withdrawTarget = stakingVestingContract();\n\n delete _totalDeprecatedReward;\n\n (bool _success, ) = _withdrawTarget.call{ value: _withdrawAmount }(\n abi.encodeWithSelector(IStakingVesting.receiveRON.selector)\n );\n\n if (_success) {\n emit DeprecatedRewardRecycled(_withdrawTarget, _withdrawAmount);\n } else {\n emit DeprecatedRewardRecycleFailed(_withdrawTarget, _withdrawAmount, address(this).balance);\n }\n }\n }\n\n /**\n * @dev Updates the validator set based on the validator candidates from the Staking contract.\n *\n * Emits the `ValidatorSetUpdated` event.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _syncValidatorSet(uint256 _newPeriod)\n private\n returns (address[] memory _newValidators, address[] memory _unsastifiedCandidates)\n {\n _unsastifiedCandidates = _syncCandidateSet(_newPeriod);\n uint256[] memory _weights = _stakingContract.getManyStakingTotals(_candidates);\n uint256[] memory _trustedWeights = _roninTrustedOrganizationContract.getConsensusWeights(_candidates);\n uint256 _newValidatorCount;\n (_newValidators, _newValidatorCount) = _pcPickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n _setNewValidatorSet(_newValidators, _newValidatorCount, _newPeriod);\n }\n\n /**\n * @dev Private helper function helps writing the new validator set into the contract storage.\n *\n * Emits the `ValidatorSetUpdated` event.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _setNewValidatorSet(\n address[] memory _newValidators,\n uint256 _newValidatorCount,\n uint256 _newPeriod\n ) private {\n // Remove exceeding validators in the current set\n for (uint256 _i = _newValidatorCount; _i < validatorCount; _i++) {\n delete _validatorMap[_validators[_i]];\n delete _validators[_i];\n }\n\n // Remove flag for all validator in the current set\n for (uint _i; _i < _newValidatorCount; _i++) {\n delete _validatorMap[_validators[_i]];\n }\n\n // Update new validator set and set flag correspondingly.\n for (uint256 _i; _i < _newValidatorCount; _i++) {\n address _newValidator = _newValidators[_i];\n _validatorMap[_newValidator] = EnumFlags.ValidatorFlag.Both;\n _validators[_i] = _newValidator;\n }\n\n validatorCount = _newValidatorCount;\n emit ValidatorSetUpdated(_newPeriod, _newValidators);\n }\n\n /**\n * @dev Activate/Deactivate the validators from producing blocks, based on their in jail status and maintenance status.\n *\n * Requirements:\n * - This method is called at the end of each epoch\n *\n * Emits the `BlockProducerSetUpdated` event.\n * Emits the `BridgeOperatorSetUpdated` event.\n *\n */\n function _revampRoles(\n uint256 _newPeriod,\n uint256 _nextEpoch,\n address[] memory _currentValidators\n ) private {\n bool[] memory _maintainedList = _maintenanceContract.checkManyMaintained(_currentValidators, block.number + 1);\n\n for (uint _i; _i < _currentValidators.length; _i++) {\n address _validator = _currentValidators[_i];\n bool _emergencyExitRequested = block.timestamp <= _emergencyExitJailedTimestamp[_validator];\n bool _isProducerBefore = isBlockProducer(_validator);\n bool _isProducerAfter = !(_jailedAtBlock(_validator, block.number + 1) ||\n _maintainedList[_i] ||\n _emergencyExitRequested);\n\n if (!_isProducerBefore && _isProducerAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BlockProducer);\n } else if (_isProducerBefore && !_isProducerAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BlockProducer);\n }\n\n bool _isBridgeOperatorBefore = isOperatingBridge(_validator);\n bool _isBridgeOperatorAfter = !_emergencyExitRequested;\n if (!_isBridgeOperatorBefore && _isBridgeOperatorAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BridgeOperator);\n } else if (_isBridgeOperatorBefore && !_isBridgeOperatorAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BridgeOperator);\n }\n }\n\n emit BlockProducerSetUpdated(_newPeriod, _nextEpoch, getBlockProducers());\n emit BridgeOperatorSetUpdated(_newPeriod, _nextEpoch, getBridgeOperators());\n }\n\n /**\n * @dev Override `CandidateManager-_isTrustedOrg`.\n */\n function _isTrustedOrg(address _consensusAddr) internal view override returns (bool) {\n return _roninTrustedOrganizationContract.getConsensusWeight(_consensusAddr) > 0;\n }\n}\n" + }, + "contracts/extensions/collections/HasMaintenanceContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasMaintenanceContract.sol\";\nimport \"../../interfaces/IMaintenance.sol\";\n\ncontract HasMaintenanceContract is IHasMaintenanceContract, HasProxyAdmin {\n IMaintenance internal _maintenanceContract;\n\n modifier onlyMaintenanceContract() {\n if (maintenanceContract() != msg.sender) revert ErrCallerMustBeMaintenanceContract();\n _;\n }\n\n /**\n * @inheritdoc IHasMaintenanceContract\n */\n function maintenanceContract() public view override returns (address) {\n return address(_maintenanceContract);\n }\n\n /**\n * @inheritdoc IHasMaintenanceContract\n */\n function setMaintenanceContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setMaintenanceContract(_addr);\n }\n\n /**\n * @dev Sets the scheduled maintenance contract.\n *\n * Emits the event `MaintenanceContractUpdated`.\n *\n */\n function _setMaintenanceContract(address _addr) internal {\n _maintenanceContract = IMaintenance(_addr);\n emit MaintenanceContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/collections/HasSlashIndicatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasSlashIndicatorContract.sol\";\nimport \"../../interfaces/slash-indicator/ISlashIndicator.sol\";\n\ncontract HasSlashIndicatorContract is IHasSlashIndicatorContract, HasProxyAdmin {\n ISlashIndicator internal _slashIndicatorContract;\n\n modifier onlySlashIndicatorContract() {\n if (slashIndicatorContract() != msg.sender) revert ErrCallerMustBeSlashIndicatorContract();\n _;\n }\n\n /**\n * @inheritdoc IHasSlashIndicatorContract\n */\n function slashIndicatorContract() public view override returns (address) {\n return address(_slashIndicatorContract);\n }\n\n /**\n * @inheritdoc IHasSlashIndicatorContract\n */\n function setSlashIndicatorContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setSlashIndicatorContract(_addr);\n }\n\n /**\n * @dev Sets the slash indicator contract.\n *\n * Emits the event `SlashIndicatorContractUpdated`.\n *\n */\n function _setSlashIndicatorContract(address _addr) internal {\n _slashIndicatorContract = ISlashIndicator(_addr);\n emit SlashIndicatorContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/collections/HasStakingVestingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasStakingVestingContract.sol\";\nimport \"../../interfaces/IStakingVesting.sol\";\n\ncontract HasStakingVestingContract is IHasStakingVestingContract, HasProxyAdmin {\n IStakingVesting internal _stakingVestingContract;\n\n modifier onlyStakingVestingContract() {\n if (stakingVestingContract() != msg.sender) revert ErrCallerMustBeStakingVestingContract();\n _;\n }\n\n /**\n * @inheritdoc IHasStakingVestingContract\n */\n function stakingVestingContract() public view override returns (address) {\n return address(_stakingVestingContract);\n }\n\n /**\n * @inheritdoc IHasStakingVestingContract\n */\n function setStakingVestingContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setStakingVestingContract(_addr);\n }\n\n /**\n * @dev Sets the staking vesting contract.\n *\n * Emits the event `StakingVestingContractUpdated`.\n *\n */\n function _setStakingVestingContract(address _addr) internal {\n _stakingVestingContract = IStakingVesting(_addr);\n emit StakingVestingContractUpdated(_addr);\n }\n}\n" + }, + "contracts/precompile-usages/PCUSortValidators.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUSortValidators is PrecompiledUsage {\n /// @dev Gets the address of the precompile of sorting validators\n function precompileSortValidatorsAddress() public view virtual returns (address) {\n return address(0x66);\n }\n\n /**\n * @dev Sorts candidates descending by their weights by calling precompile contract.\n *\n * Note: This function is marked as virtual for being wrapping in mock contract for testing purpose.\n */\n function _pcSortCandidates(address[] memory _candidates, uint256[] memory _weights)\n internal\n view\n virtual\n returns (address[] memory _result)\n {\n address _smc = precompileSortValidatorsAddress();\n bool _success = true;\n\n bytes memory _payload = abi.encodeWithSignature(\"sortValidators(address[],uint256[])\", _candidates, _weights);\n uint256 _payloadLength = _payload.length;\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n\n _result := add(_result, 0x20)\n }\n\n if (!_success) revert ErrCallPrecompiled();\n }\n}\n" + }, + "contracts/precompile-usages/PCUPickValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUPickValidatorSet is PrecompiledUsage {\n /// @dev Gets the address of the precompile of picking validator set\n function precompilePickValidatorSetAddress() public view virtual returns (address) {\n return address(0x68);\n }\n\n /**\n * @dev Sorts and arranges to return a new validator set.\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcPickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) internal view virtual returns (address[] memory _result, uint256 _newValidatorCount) {\n address _smc = precompilePickValidatorSetAddress();\n bytes memory _payload = abi.encodeWithSignature(\n \"pickValidatorSet(address[],uint256[],uint256[],uint256,uint256)\",\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n bool _success = true;\n\n uint256 _payloadLength = _payload.length;\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n\n _result := add(_result, 0x20)\n }\n\n if (!_success) revert ErrCallPrecompiled();\n\n _newValidatorCount = _result.length;\n }\n}\n" + }, + "contracts/interfaces/collections/IHasMaintenanceContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasMaintenanceContract is IHasContract {\n /// @dev Emitted when the maintenance contract is updated.\n event MaintenanceContractUpdated(address);\n\n /// @dev Error of method caller must be maintenance contract.\n error ErrCallerMustBeMaintenanceContract();\n\n /**\n * @dev Returns the maintenance contract.\n */\n function maintenanceContract() external view returns (address);\n\n /**\n * @dev Sets the maintenance contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `MaintenanceContractUpdated`.\n *\n */\n function setMaintenanceContract(address) external;\n}\n" + }, + "contracts/interfaces/collections/IHasSlashIndicatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasSlashIndicatorContract is IHasContract {\n /// @dev Emitted when the slash indicator contract is updated.\n event SlashIndicatorContractUpdated(address);\n\n /// @dev Error of method caller must be slash indicator contract.\n error ErrCallerMustBeSlashIndicatorContract();\n\n /**\n * @dev Returns the slash indicator contract.\n */\n function slashIndicatorContract() external view returns (address);\n\n /**\n * @dev Sets the slash indicator contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `SlashIndicatorContractUpdated`.\n *\n */\n function setSlashIndicatorContract(address) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashDoubleSign.sol\";\nimport \"./ISlashBridgeVoting.sol\";\nimport \"./ISlashBridgeOperator.sol\";\nimport \"./ISlashUnavailability.sol\";\nimport \"./ICreditScore.sol\";\n\ninterface ISlashIndicator is\n ISlashDoubleSign,\n ISlashBridgeVoting,\n ISlashBridgeOperator,\n ISlashUnavailability,\n ICreditScore\n{}\n" + }, + "contracts/interfaces/slash-indicator/ISlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashDoubleSign is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\n * for param details.\n */\n event DoubleSignSlashingConfigsUpdated(\n uint256 slashDoubleSignAmount,\n uint256 doubleSigningJailUntilBlock,\n uint256 doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Slashes for double signing.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\n */\n function slashDoubleSign(\n address _validatorAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) external;\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\n * double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n returns (\n uint256 _slashDoubleSignAmount,\n uint256 _doubleSigningJailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\n *\n * @param _slashAmount The amount of RON to slash double sign.\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashBridgeVoting is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash bridge voting is updated. See the method `getBridgeVotingSlashingConfigs` for param\n * details.\n */\n event BridgeVotingSlashingConfigsUpdated(uint256 bridgeVotingThreshold, uint256 bridgeVotingSlashAmount);\n\n /**\n * @dev Slashes for bridge voter governance.\n *\n * Emits the event `Slashed`.\n */\n function slashBridgeVoting(address _consensusAddr) external;\n\n /**\n * @dev Returns the configs related to bridge voting slashing.\n *\n * @return _bridgeVotingThreshold The threshold to slash when a trusted organization does not vote for bridge\n * operators.\n * @return _bridgeVotingSlashAmount The amount of RON to slash bridge voting.\n *\n */\n function getBridgeVotingSlashingConfigs()\n external\n view\n returns (uint256 _bridgeVotingThreshold, uint256 _bridgeVotingSlashAmount);\n\n /**\n * @dev Sets the configs to slash bridge voting.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeVotingSlashingConfigsUpdated`.\n *\n * @param _threshold The threshold to slash when a trusted organization does not vote for bridge operators.\n * @param _slashAmount The amount of RON to slash bridge voting.\n *\n */\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashBridgeOperator is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash bridge operator is updated. See the method\n * `getBridgeOperatorSlashingConfigs` for param details.\n */\n event BridgeOperatorSlashingConfigsUpdated(\n uint256 missingVotesRatioTier1,\n uint256 missingVotesRatioTier2,\n uint256 jailDurationForMissingVotesRatioTier2,\n uint256 skipBridgeOperatorSlashingThreshold\n );\n\n /**\n * @dev Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\n * @param _tier The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1`\n * and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2`\n *\n * Requirements:\n * - Only validator contract can invoke this method.\n * - Should be called only at the end of period.\n * - Should be called only when there is slash of bridge operator.\n *\n * Emits the event `Slashed`.\n */\n function execSlashBridgeOperator(\n address _consensusAddr,\n uint256 _tier,\n uint256 _period\n ) external;\n\n /**\n * @dev Returns the configs related to bridge operator slashing.\n *\n * @return _missingVotesRatioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio.\n * @return _missingVotesRatioTier2 The bridge reward and mining reward will be deprecated and the corresponding\n * block producer will be put in jail if (s)he misses more than this ratio.\n * @return _jailDurationForMissingVotesRatioTier2 The number of blocks to jail the corresponding block producer when\n * its bridge operator is slashed tier-2.\n * @return _skipBridgeOperatorSlashingThreshold The threshold to skip slashing the bridge operator in case the total\n * number of votes in the bridge is too small.\n *\n */\n function getBridgeOperatorSlashingConfigs()\n external\n view\n returns (\n uint256 _missingVotesRatioTier1,\n uint256 _missingVotesRatioTier2,\n uint256 _jailDurationForMissingVotesRatioTier2,\n uint256 _skipBridgeOperatorSlashingThreshold\n );\n\n /**\n * @dev Sets the configs to slash bridge operators.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\n *\n * @param _ratioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map\n * to 0%-100%.\n * @param _ratioTier2 The bridge reward and mining reward will be deprecated and the corresponding block producer will\n * be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\n * @param _jailDurationTier2 The number of blocks to jail the corresponding block producer when its bridge operator is\n * slashed tier-2.\n * @param _skipSlashingThreshold The threshold to skip slashing the bridge operator in case the total number of votes\n * in the bridge is too small.\n *\n */\n function setBridgeOperatorSlashingConfigs(\n uint256 _ratioTier1,\n uint256 _ratioTier2,\n uint256 _jailDurationTier2,\n uint256 _skipSlashingThreshold\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashUnavailability is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\n * for param details.\n */\n event UnavailabilitySlashingConfigsUpdated(\n uint256 unavailabilityTier1Threshold,\n uint256 unavailabilityTier2Threshold,\n uint256 slashAmountForUnavailabilityTier2Threshold,\n uint256 jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Returns the last block that a block producer is slashed for unavailability.\n */\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\n\n /**\n * @dev Slashes for unavailability by increasing the counter of block producer `_consensusAddr`.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` when the threshold is reached.\n *\n */\n function slashUnavailability(address _consensusAddr) external;\n\n /**\n * @dev Returns the current unavailability indicator of a block producer.\n */\n function currentUnavailabilityIndicator(address _validator) external view returns (uint256);\n\n /**\n * @dev Returns the unavailability indicator in the period `_period` of a block producer.\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return _unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\n * @return _unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n * @return _slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\n * producer when (s)he is slashed with tier-2 or tier-3.\n * @return _jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\n * slashed with tier-2 or tier-3.\n *\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n returns (\n uint256 _unavailabilityTier1Threshold,\n uint256 _unavailabilityTier2Threshold,\n uint256 _slashAmountForUnavailabilityTier2Threshold,\n uint256 _jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\n *\n * @param _tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\n * @param _tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold.\n * @param _slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\n * is slashed tier-2.\n * @param _jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\n *\n */\n function setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ICreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ICreditScore {\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\n event CreditScoreConfigsUpdated(\n uint256 gainCreditScore,\n uint256 maxCreditScore,\n uint256 bailOutCostMultiplier,\n uint256 cutOffPercentageAfterBailout\n );\n /// @dev Emitted the credit score of validators is updated.\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\n /// @dev Emitted when a validator bailed out of jail.\n event BailedOut(address indexed validator, uint256 period, uint256 usedCreditScore);\n\n /**\n * @dev Updates the credit score for the validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function updateCreditScores(address[] calldata _validators, uint256 _period) external;\n\n /**\n * @dev Resets the credit score for the revoked validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function execResetCreditScores(address[] calldata _validators) external;\n\n /**\n * @dev A slashed validator use this method to get out of jail.\n *\n * Requirements:\n * - The `_consensusAddr` must be a validator.\n * - Only validator's admin can call this method.\n *\n * Emits the event `BailedOut`.\n *\n */\n function bailOut(address _consensusAddr) external;\n\n /**\n * @dev Sets the configs to credit score.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CreditScoreConfigsUpdated`.\n *\n * @param _gainScore The score to gain per period.\n * @param _maxScore The max number of credit score that a validator can hold.\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external;\n\n /**\n * @dev Returns the configs related to credit score.\n *\n * @return _gainCreditScore The score to gain per period.\n * @return _maxCreditScore The max number of credit score that a validator can hold.\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function getCreditScoreConfigs()\n external\n view\n returns (\n uint256 _gainCreditScore,\n uint256 _maxCreditScore,\n uint256 _bailOutCostMultiplier,\n uint256 _cutOffPercentageAfterBailout\n );\n\n /**\n * @dev Returns the current credit score of the validator.\n */\n function getCreditScore(address _validator) external view returns (uint256);\n\n /**\n * @dev Returns the current credit score of a list of validators.\n */\n function getManyCreditScores(address[] calldata _validators) external view returns (uint256[] memory _resultList);\n\n /**\n * @dev Returns the whether the `_validator` has been bailed out at the `_period`.\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period) external view returns (bool);\n}\n" + }, + "contracts/interfaces/slash-indicator/IBaseSlash.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IBaseSlash {\n enum SlashType {\n UNKNOWN,\n UNAVAILABILITY_TIER_1,\n UNAVAILABILITY_TIER_2,\n DOUBLE_SIGNING,\n BRIDGE_VOTING,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\n UNAVAILABILITY_TIER_3\n }\n\n /// @dev Emitted when the validator is slashed.\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\n}\n" + }, + "contracts/interfaces/collections/IHasStakingVestingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasStakingVestingContract is IHasContract {\n /// @dev Emitted when the staking vesting contract is updated.\n event StakingVestingContractUpdated(address);\n\n /// @dev Error of method caller must be staking vesting contract.\n error ErrCallerMustBeStakingVestingContract();\n\n /**\n * @dev Returns the staking vesting contract.\n */\n function stakingVestingContract() external view returns (address);\n\n /**\n * @dev Sets the staking vesting contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `StakingVestingContractUpdated`.\n *\n */\n function setStakingVestingContract(address) external;\n}\n" + }, + "contracts/precompile-usages/PrecompiledUsage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PrecompiledUsage {\n /// @dev Error of call to precompile fails.\n error ErrCallPrecompiled();\n}\n" + }, + "contracts/ronin/validator/SlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasSlashIndicatorContract.sol\";\nimport \"../../extensions/collections/HasStakingContract.sol\";\nimport \"../../interfaces/validator/ISlashingExecution.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\n\nabstract contract SlashingExecution is\n ISlashingExecution,\n HasSlashIndicatorContract,\n HasStakingContract,\n CommonStorage\n{\n /**\n * @inheritdoc ISlashingExecution\n */\n function execSlash(\n address _validatorAddr,\n uint256 _newJailedUntil,\n uint256 _slashAmount,\n bool _cannotBailout\n ) external override onlySlashIndicatorContract {\n uint256 _period = currentPeriod();\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = true;\n\n _totalDeprecatedReward += _miningReward[_validatorAddr] + _delegatingReward[_validatorAddr];\n\n delete _miningReward[_validatorAddr];\n delete _delegatingReward[_validatorAddr];\n\n _blockProducerJailedBlock[_validatorAddr] = Math.max(_newJailedUntil, _blockProducerJailedBlock[_validatorAddr]);\n\n if (_slashAmount > 0) {\n uint256 _actualAmount = _stakingContract.execDeductStakingAmount(_validatorAddr, _slashAmount);\n _totalDeprecatedReward += _actualAmount;\n }\n\n if (_cannotBailout) {\n _cannotBailoutUntilBlock[_validatorAddr] = Math.max(_newJailedUntil, _cannotBailoutUntilBlock[_validatorAddr]);\n }\n\n emit ValidatorPunished(\n _validatorAddr,\n _period,\n _blockProducerJailedBlock[_validatorAddr],\n _slashAmount,\n true,\n false\n );\n }\n\n /**\n * @inheritdoc ISlashingExecution\n */\n function execBailOut(address _validatorAddr, uint256 _period) external override onlySlashIndicatorContract {\n if (block.number <= _cannotBailoutUntilBlock[_validatorAddr]) revert ErrCannotBailout(_validatorAddr);\n\n // Note: Removing rewards of validator in `bailOut` function is not needed, since the rewards have been\n // removed previously in the `slash` function.\n _miningRewardBailoutCutOffAtPeriod[_validatorAddr][_period] = true;\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = false;\n _blockProducerJailedBlock[_validatorAddr] = block.number - 1;\n\n emit ValidatorUnjailed(_validatorAddr, _period);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/slash-indicator/ISlashIndicator.sol\";\nimport \"./SlashDoubleSign.sol\";\nimport \"./SlashBridgeVoting.sol\";\nimport \"./SlashBridgeOperator.sol\";\nimport \"./SlashUnavailability.sol\";\nimport \"./CreditScore.sol\";\n\ncontract SlashIndicator is\n ISlashIndicator,\n SlashDoubleSign,\n SlashBridgeVoting,\n SlashBridgeOperator,\n SlashUnavailability,\n CreditScore,\n Initializable\n{\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n address __maintenanceContract,\n address __roninTrustedOrganizationContract,\n address __roninGovernanceAdminContract,\n // _bridgeOperatorSlashingConfigs[0]: _missingVotesRatioTier1\n // _bridgeOperatorSlashingConfigs[1]: _missingVotesRatioTier2\n // _bridgeOperatorSlashingConfigs[2]: _jailDurationForMissingVotesRatioTier2\n // _bridgeOperatorSlashingConfigs[3]: _skipBridgeOperatorSlashingThreshold\n uint256[4] calldata _bridgeOperatorSlashingConfigs,\n // _bridgeVotingSlashingConfigs[0]: _bridgeVotingThreshold\n // _bridgeVotingSlashingConfigs[1]: _bridgeVotingSlashAmount\n uint256[2] calldata _bridgeVotingSlashingConfigs,\n // _doubleSignSlashingConfigs[0]: _slashDoubleSignAmount\n // _doubleSignSlashingConfigs[1]: _doubleSigningJailUntilBlock\n // _doubleSignSlashingConfigs[2]: _doubleSigningOffsetLimitBlock\n uint256[3] calldata _doubleSignSlashingConfigs,\n // _unavailabilitySlashingConfigs[0]: _unavailabilityTier1Threshold\n // _unavailabilitySlashingConfigs[1]: _unavailabilityTier2Threshold\n // _unavailabilitySlashingConfigs[2]: _slashAmountForUnavailabilityTier2Threshold\n // _unavailabilitySlashingConfigs[3]: _jailDurationForUnavailabilityTier2Threshold\n uint256[4] calldata _unavailabilitySlashingConfigs,\n // _creditScoreConfigs[0]: _gainCreditScore\n // _creditScoreConfigs[1]: _maxCreditScore\n // _creditScoreConfigs[2]: _bailOutCostMultiplier\n // _creditScoreConfigs[3]: _cutOffPercentageAfterBailout\n uint256[4] calldata _creditScoreConfigs\n ) external initializer {\n _setValidatorContract(__validatorContract);\n _setMaintenanceContract(__maintenanceContract);\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\n _setRoninGovernanceAdminContract(__roninGovernanceAdminContract);\n _setBridgeOperatorSlashingConfigs(\n _bridgeOperatorSlashingConfigs[0],\n _bridgeOperatorSlashingConfigs[1],\n _bridgeOperatorSlashingConfigs[2],\n _bridgeOperatorSlashingConfigs[3]\n );\n _setBridgeVotingSlashingConfigs(_bridgeVotingSlashingConfigs[0], _bridgeVotingSlashingConfigs[1]);\n _setDoubleSignSlashingConfigs(\n _doubleSignSlashingConfigs[0],\n _doubleSignSlashingConfigs[1],\n _doubleSignSlashingConfigs[2]\n );\n _setUnavailabilitySlashingConfigs(\n _unavailabilitySlashingConfigs[0],\n _unavailabilitySlashingConfigs[1],\n _unavailabilitySlashingConfigs[2],\n _unavailabilitySlashingConfigs[3]\n );\n _setCreditScoreConfigs(\n _creditScoreConfigs[0],\n _creditScoreConfigs[1],\n _creditScoreConfigs[2],\n _creditScoreConfigs[3]\n );\n }\n\n /**\n * @dev Helper for CreditScore contract to reset the indicator of the validator after bailing out.\n */\n function _setUnavailabilityIndicator(\n address _validator,\n uint256 _period,\n uint256 _indicator\n ) internal override(CreditScore, SlashUnavailability) {\n SlashUnavailability._setUnavailabilityIndicator(_validator, _period, _indicator);\n }\n\n /**\n * @dev Helper for CreditScore contract to query indicator of the validator.\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period)\n public\n view\n override(CreditScore, ISlashUnavailability, SlashUnavailability)\n returns (uint256)\n {\n return SlashUnavailability.getUnavailabilityIndicator(_validator, _period);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period)\n public\n view\n override(CreditScore, ICreditScore, SlashUnavailability)\n returns (bool)\n {\n return CreditScore.checkBailedOutAtPeriod(_validator, _period);\n }\n\n /**\n * @dev Sanity check the address to be slashed\n */\n function _shouldSlash(address _addr) internal view override(SlashDoubleSign, SlashUnavailability) returns (bool) {\n return\n (msg.sender != _addr) &&\n _validatorContract.isBlockProducer(_addr) &&\n !_maintenanceContract.checkMaintained(_addr, block.number);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/slash-indicator/ISlashDoubleSign.sol\";\nimport \"../../precompile-usages/PCUValidateDoubleSign.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashDoubleSign is ISlashDoubleSign, HasValidatorContract, PCUValidateDoubleSign {\n /// @dev The amount of RON to slash double sign.\n uint256 internal _slashDoubleSignAmount;\n /// @dev The block number that the punished validator will be jailed until, due to double signing.\n uint256 internal _doubleSigningJailUntilBlock;\n /** @dev The offset from the submitted block to the current block, from which double signing will be invalidated.\n * This parameter is exposed for system transaction.\n **/\n uint256 internal _doubleSigningOffsetLimitBlock;\n /// @dev Recording of submitted proof to prevent relay attack.\n mapping(bytes32 => bool) _submittedEvidence;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function slashDoubleSign(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) external override onlyAdmin {\n bytes32 _header1Checksum = keccak256(_header1);\n bytes32 _header2Checksum = keccak256(_header2);\n\n require(\n !_submittedEvidence[_header1Checksum] && !_submittedEvidence[_header2Checksum],\n \"SlashDoubleSign: evidence already submitted\"\n );\n\n if (_pcValidateEvidence(_consensusAddr, _header1, _header2)) {\n uint256 _period = _validatorContract.currentPeriod();\n _submittedEvidence[_header1Checksum] = true;\n _submittedEvidence[_header2Checksum] = true;\n emit Slashed(_consensusAddr, SlashType.DOUBLE_SIGNING, _period);\n _validatorContract.execSlash(_consensusAddr, _doubleSigningJailUntilBlock, _slashDoubleSignAmount, true);\n }\n }\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n override\n returns (\n uint256 slashDoubleSignAmount_,\n uint256 doubleSigningJailUntilBlock_,\n uint256 doubleSigningOffsetLimitBlock_\n )\n {\n return (_slashDoubleSignAmount, _doubleSigningJailUntilBlock, _doubleSigningOffsetLimitBlock);\n }\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _offsetLimitBlock\n ) external override onlyAdmin {\n _setDoubleSignSlashingConfigs(_slashAmount, _jailUntilBlock, _offsetLimitBlock);\n }\n\n /**\n * @dev See `ISlashDoubleSign-setDoubleSignSlashingConfigs`.\n */\n function _setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _offsetLimitBlock\n ) internal {\n _slashDoubleSignAmount = _slashAmount;\n _doubleSigningJailUntilBlock = _jailUntilBlock;\n _doubleSigningOffsetLimitBlock = _offsetLimitBlock;\n emit DoubleSignSlashingConfigsUpdated(_slashAmount, _jailUntilBlock, _doubleSigningOffsetLimitBlock);\n }\n\n /**\n * @dev Returns whether the account `_addr` should be slashed or not.\n */\n function _shouldSlash(address _addr) internal view virtual returns (bool);\n}\n" + }, + "contracts/ronin/slash-indicator/SlashBridgeVoting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../libraries/Math.sol\";\nimport \"../../interfaces/slash-indicator/ISlashBridgeVoting.sol\";\nimport \"../../extensions/collections/HasRoninTrustedOrganizationContract.sol\";\nimport \"../../extensions/collections/HasRoninGovernanceAdminContract.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashBridgeVoting is\n ISlashBridgeVoting,\n HasValidatorContract,\n HasRoninTrustedOrganizationContract,\n HasRoninGovernanceAdminContract\n{\n /// @dev Mapping from validator address => period index => bridge voting slashed\n mapping(address => mapping(uint256 => bool)) internal _bridgeVotingSlashed;\n /// @dev The threshold to slash when a trusted organization does not vote for bridge operators.\n uint256 internal _bridgeVotingThreshold;\n /// @dev The amount of RON to slash bridge voting.\n uint256 internal _bridgeVotingSlashAmount;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ISlashBridgeVoting\n */\n function slashBridgeVoting(address _consensusAddr) external onlyAdmin {\n IRoninTrustedOrganization.TrustedOrganization memory _org = _roninTrustedOrganizationContract\n .getTrustedOrganization(_consensusAddr);\n uint256 _lastVotedBlock = Math.max(_roninGovernanceAdminContract.lastVotedBlock(_org.bridgeVoter), _org.addedBlock);\n uint256 _period = _validatorContract.currentPeriod();\n\n require(\n block.number - _lastVotedBlock > _bridgeVotingThreshold && !_bridgeVotingSlashed[_consensusAddr][_period],\n \"SlashBridgeVoting: invalid slash\"\n );\n\n _bridgeVotingSlashed[_consensusAddr][_period] = true;\n emit Slashed(_consensusAddr, SlashType.BRIDGE_VOTING, _period);\n _validatorContract.execSlash(_consensusAddr, 0, _bridgeVotingSlashAmount, false);\n }\n\n /**\n * @inheritdoc ISlashBridgeVoting\n */\n function getBridgeVotingSlashingConfigs()\n external\n view\n override\n returns (uint256 bridgeVotingThreshold_, uint256 bridgeVotingSlashAmount_)\n {\n return (_bridgeVotingThreshold, _bridgeVotingSlashAmount);\n }\n\n /**\n * @inheritdoc ISlashBridgeVoting\n */\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external override onlyAdmin {\n _setBridgeVotingSlashingConfigs(_threshold, _slashAmount);\n }\n\n /**\n * @dev See `ISlashBridgeVoting-setBridgeVotingSlashingConfigs`.\n */\n function _setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) internal {\n _bridgeVotingThreshold = _threshold;\n _bridgeVotingSlashAmount = _slashAmount;\n emit BridgeVotingSlashingConfigsUpdated(_threshold, _slashAmount);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashBridgeOperator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../extensions/collections/HasProxyAdmin.sol\";\nimport \"../../interfaces/slash-indicator/ISlashBridgeOperator.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashBridgeOperator is ISlashBridgeOperator, HasProxyAdmin, HasValidatorContract, PercentageConsumer {\n /**\n * @dev The bridge operators will be deprecated reward if (s)he missed more than the ratio.\n * Values 0-10,000 map to 0%-100%.\n */\n uint256 internal _missingVotesRatioTier1;\n /**\n * @dev The bridge operators will be deprecated all rewards including bridge reward and mining reward if (s)he missed\n * more than the ratio. Values 0-10,000 map to 0%-100%.\n */\n uint256 internal _missingVotesRatioTier2;\n /// @dev The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\n uint256 internal _jailDurationForMissingVotesRatioTier2;\n /// @dev The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\n uint256 internal _skipBridgeOperatorSlashingThreshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ISlashBridgeOperator\n */\n function getBridgeOperatorSlashingConfigs()\n external\n view\n override\n returns (\n uint256 missingVotesRatioTier1_,\n uint256 missingVotesRatioTier2_,\n uint256 jailDurationForMissingVotesRatioTier2_,\n uint256 skipBridgeOperatorSlashingThreshold_\n )\n {\n return (\n _missingVotesRatioTier1,\n _missingVotesRatioTier2,\n _jailDurationForMissingVotesRatioTier2,\n _skipBridgeOperatorSlashingThreshold\n );\n }\n\n /**\n * @inheritdoc ISlashBridgeOperator\n */\n function setBridgeOperatorSlashingConfigs(\n uint256 _ratioTier1,\n uint256 _ratioTier2,\n uint256 _jailDurationTier2,\n uint256 _skipSlashingThreshold\n ) external override onlyAdmin {\n _setBridgeOperatorSlashingConfigs(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\n }\n\n /**\n * @inheritdoc ISlashBridgeOperator\n */\n function execSlashBridgeOperator(\n address _consensusAddr,\n uint256 _tier,\n uint256 _period\n ) external onlyValidatorContract {\n if (_tier == 1) {\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1, _period);\n } else if (_tier == 2) {\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2, _period);\n }\n }\n\n /**\n * @dev See `ISlashBridgeOperator-setBridgeOperatorSlashingConfigs`.\n */\n function _setBridgeOperatorSlashingConfigs(\n uint256 _ratioTier1,\n uint256 _ratioTier2,\n uint256 _jailDurationTier2,\n uint256 _skipSlashingThreshold\n ) internal {\n require(\n _ratioTier1 <= _ratioTier2 && _ratioTier1 <= _MAX_PERCENTAGE && _ratioTier2 <= _MAX_PERCENTAGE,\n \"SlashIndicator: invalid ratios\"\n );\n _missingVotesRatioTier1 = _ratioTier1;\n _missingVotesRatioTier2 = _ratioTier2;\n _jailDurationForMissingVotesRatioTier2 = _jailDurationTier2;\n _skipBridgeOperatorSlashingThreshold = _skipSlashingThreshold;\n emit BridgeOperatorSlashingConfigsUpdated(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./CreditScore.sol\";\nimport \"../../interfaces/slash-indicator/ISlashUnavailability.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashUnavailability is ISlashUnavailability, HasValidatorContract {\n /// @dev The last block that a validator is slashed for unavailability.\n uint256 public lastUnavailabilitySlashedBlock;\n /// @dev Mapping from validator address => period index => unavailability indicator.\n mapping(address => mapping(uint256 => uint256)) internal _unavailabilityIndicator;\n\n /**\n * @dev The mining reward will be deprecated, if (s)he missed more than this threshold.\n * This threshold is applied for tier-1 and tier-3 of unavailability slash.\n */\n uint256 internal _unavailabilityTier1Threshold;\n /**\n * @dev The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n */\n uint256 internal _unavailabilityTier2Threshold;\n /**\n * @dev The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with\n * tier-2 or tier-3.\n **/\n uint256 internal _slashAmountForUnavailabilityTier2Threshold;\n /// @dev The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\n uint256 internal _jailDurationForUnavailabilityTier2Threshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n modifier oncePerBlock() {\n require(\n block.number > lastUnavailabilitySlashedBlock,\n \"SlashIndicator: cannot slash a validator twice or slash more than one validator in one block\"\n );\n lastUnavailabilitySlashedBlock = block.number;\n _;\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function slashUnavailability(address _validatorAddr) external override oncePerBlock {\n require(msg.sender == block.coinbase, \"SlashUnavailability: method caller must be coinbase\");\n if (!_shouldSlash(_validatorAddr)) {\n // Should return instead of throwing error since this is a part of system transaction.\n return;\n }\n\n uint256 _period = _validatorContract.currentPeriod();\n uint256 _count = ++_unavailabilityIndicator[_validatorAddr][_period];\n uint256 _newJailedUntilBlock = Math.addIfNonZero(block.number, _jailDurationForUnavailabilityTier2Threshold);\n\n if (_count == _unavailabilityTier2Threshold) {\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_2, _period);\n _validatorContract.execSlash(\n _validatorAddr,\n _newJailedUntilBlock,\n _slashAmountForUnavailabilityTier2Threshold,\n false\n );\n } else if (_count == _unavailabilityTier1Threshold) {\n bool _tier1SecondTime = checkBailedOutAtPeriod(_validatorAddr, _period);\n if (!_tier1SecondTime) {\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_1, _period);\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\n } else {\n /// Handles tier-3\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_3, _period);\n _validatorContract.execSlash(\n _validatorAddr,\n _newJailedUntilBlock,\n _slashAmountForUnavailabilityTier2Threshold,\n true\n );\n }\n }\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) external override onlyAdmin {\n _setUnavailabilitySlashingConfigs(\n _tier1Threshold,\n _tier2Threshold,\n _slashAmountForTier2Threshold,\n _jailDurationForTier2Threshold\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n override\n returns (\n uint256 unavailabilityTier1Threshold_,\n uint256 unavailabilityTier2Threshold_,\n uint256 slashAmountForUnavailabilityTier2Threshold_,\n uint256 jailDurationForUnavailabilityTier2Threshold_\n )\n {\n return (\n _unavailabilityTier1Threshold,\n _unavailabilityTier2Threshold,\n _slashAmountForUnavailabilityTier2Threshold,\n _jailDurationForUnavailabilityTier2Threshold\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function currentUnavailabilityIndicator(address _validator) external view override returns (uint256) {\n return getUnavailabilityIndicator(_validator, _validatorContract.currentPeriod());\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period)\n public\n view\n virtual\n override\n returns (uint256)\n {\n return _unavailabilityIndicator[_validator][_period];\n }\n\n /**\n * @dev Sets the unavailability indicator of the `_validator` at `_period`.\n */\n function _setUnavailabilityIndicator(\n address _validator,\n uint256 _period,\n uint256 _indicator\n ) internal virtual {\n _unavailabilityIndicator[_validator][_period] = _indicator;\n }\n\n /**\n * @dev See `ISlashUnavailability-setUnavailabilitySlashingConfigs`.\n */\n function _setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) internal {\n require(_unavailabilityTier1Threshold <= _unavailabilityTier2Threshold, \"SlashUnavailability: invalid threshold\");\n _unavailabilityTier1Threshold = _tier1Threshold;\n _unavailabilityTier2Threshold = _tier2Threshold;\n _slashAmountForUnavailabilityTier2Threshold = _slashAmountForTier2Threshold;\n _jailDurationForUnavailabilityTier2Threshold = _jailDurationForTier2Threshold;\n emit UnavailabilitySlashingConfigsUpdated(\n _tier1Threshold,\n _tier2Threshold,\n _slashAmountForTier2Threshold,\n _jailDurationForTier2Threshold\n );\n }\n\n /**\n * @dev Returns whether the account `_addr` should be slashed or not.\n */\n function _shouldSlash(address _addr) internal view virtual returns (bool);\n\n /**\n * @dev See `ICreditScore-checkBailedOutAtPeriod`\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual returns (bool);\n}\n" + }, + "contracts/ronin/slash-indicator/CreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/slash-indicator/ICreditScore.sol\";\nimport \"../../extensions/collections/HasMaintenanceContract.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../libraries/Math.sol\";\n\nabstract contract CreditScore is ICreditScore, HasValidatorContract, HasMaintenanceContract, PercentageConsumer {\n /// @dev Mapping from validator address => period index => whether bailed out before\n mapping(address => mapping(uint256 => bool)) internal _checkBailedOutAtPeriod;\n /// @dev Mapping from validator address => credit score\n mapping(address => uint256) internal _creditScore;\n\n /// @dev The max gained number of credit score per period.\n uint256 internal _gainCreditScore;\n /// @dev The max number of credit score that a validator can hold.\n uint256 internal _maxCreditScore;\n /// @dev The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n uint256 internal _bailOutCostMultiplier;\n /// @dev The percentage of reward to be cut off from the validator in the rest of the period after bailed out.\n uint256 internal _cutOffPercentageAfterBailout;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ICreditScore\n */\n function updateCreditScores(address[] calldata _validators, uint256 _period) external override onlyValidatorContract {\n uint256 _periodStartAtBlock = _validatorContract.currentPeriodStartAtBlock();\n\n bool[] memory _jaileds = _validatorContract.checkManyJailed(_validators);\n bool[] memory _maintaineds = _maintenanceContract.checkManyMaintainedInBlockRange(\n _validators,\n _periodStartAtBlock,\n block.number\n );\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\n\n for (uint _i = 0; _i < _validators.length; _i++) {\n address _validator = _validators[_i];\n\n uint256 _indicator = getUnavailabilityIndicator(_validator, _period);\n bool _isJailedInPeriod = _jaileds[_i];\n bool _isMaintainingInPeriod = _maintaineds[_i];\n\n uint256 _actualGain = (_isJailedInPeriod || _isMaintainingInPeriod)\n ? 0\n : Math.subNonNegative(_gainCreditScore, _indicator);\n\n _creditScore[_validator] = Math.addWithUpperbound(_creditScore[_validator], _actualGain, _maxCreditScore);\n _updatedCreditScores[_i] = _creditScore[_validator];\n }\n\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\n }\n\n function execResetCreditScores(address[] calldata _validators) external override onlyValidatorContract {\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\n for (uint _i = 0; _i < _validators.length; _i++) {\n address _validator = _validators[_i];\n delete _creditScore[_validator];\n delete _updatedCreditScores[_i];\n }\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function bailOut(address _consensusAddr) external override {\n require(\n _validatorContract.isValidatorCandidate(_consensusAddr),\n \"SlashIndicator: consensus address must be a validator candidate\"\n );\n require(\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\n \"SlashIndicator: method caller must be a candidate admin\"\n );\n\n (bool _isJailed, , uint256 _jailedEpochLeft) = _validatorContract.getJailedTimeLeft(_consensusAddr);\n require(_isJailed, \"SlashIndicator: caller must be jailed in the current period\");\n\n uint256 _period = _validatorContract.currentPeriod();\n require(!_checkBailedOutAtPeriod[_consensusAddr][_period], \"SlashIndicator: validator has bailed out previously\");\n\n uint256 _score = _creditScore[_consensusAddr];\n uint256 _cost = _jailedEpochLeft * _bailOutCostMultiplier;\n require(_score >= _cost, \"SlashIndicator: insufficient credit score to bail out\");\n\n _validatorContract.execBailOut(_consensusAddr, _period);\n\n _creditScore[_consensusAddr] -= _cost;\n _setUnavailabilityIndicator(_consensusAddr, _period, 0);\n _checkBailedOutAtPeriod[_consensusAddr][_period] = true;\n emit BailedOut(_consensusAddr, _period, _cost);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external override onlyAdmin {\n _setCreditScoreConfigs(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\n }\n\n /**\n * @dev See `ISlashUnavailability`\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period) public view virtual returns (uint256);\n\n /**\n * @inheritdoc ICreditScore\n */\n function getCreditScoreConfigs()\n external\n view\n override\n returns (\n uint256 gainCreditScore_,\n uint256 maxCreditScore_,\n uint256 bailOutCostMultiplier_,\n uint256 cutOffPercentageAfterBailout_\n )\n {\n return (_gainCreditScore, _maxCreditScore, _bailOutCostMultiplier, _cutOffPercentageAfterBailout);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function getCreditScore(address _validator) external view override returns (uint256) {\n return _creditScore[_validator];\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function getManyCreditScores(address[] calldata _validators)\n public\n view\n override\n returns (uint256[] memory _resultList)\n {\n _resultList = new uint256[](_validators.length);\n\n for (uint _i = 0; _i < _resultList.length; _i++) {\n _resultList[_i] = _creditScore[_validators[_i]];\n }\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual override returns (bool) {\n return _checkBailedOutAtPeriod[_validator][_period];\n }\n\n /**\n * @dev See `SlashUnavailability`.\n */\n function _setUnavailabilityIndicator(\n address _validator,\n uint256 _period,\n uint256 _indicator\n ) internal virtual;\n\n /**\n * @dev See `ICreditScore-setCreditScoreConfigs`.\n */\n function _setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) internal {\n require(_gainScore <= _maxScore, \"CreditScore: invalid credit score config\");\n require(_cutOffPercentage <= _MAX_PERCENTAGE, \"CreditScore: invalid cut off percentage config\");\n\n _gainCreditScore = _gainScore;\n _maxCreditScore = _maxScore;\n _bailOutCostMultiplier = _bailOutMultiplier;\n _cutOffPercentageAfterBailout = _cutOffPercentage;\n emit CreditScoreConfigsUpdated(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\n }\n}\n" + }, + "contracts/precompile-usages/PCUValidateDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUValidateDoubleSign is PrecompiledUsage {\n /// @dev Gets the address of the precompile of validating double sign evidence\n function precompileValidateDoubleSignAddress() public view virtual returns (address) {\n return address(0x67);\n }\n\n /**\n * @dev Validates the two submitted block header if they are produced by the same address\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcValidateEvidence(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) internal view virtual returns (bool _validEvidence) {\n address _smc = precompileValidateDoubleSignAddress();\n bool _success = true;\n\n bytes memory _payload = abi.encodeWithSignature(\n \"validatingDoubleSignProof(address,bytes,bytes)\",\n _consensusAddr,\n _header1,\n _header2\n );\n uint _payloadLength = _payload.length;\n uint[1] memory _output;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _output, 0x20)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n }\n\n if (!_success) revert ErrCallPrecompiled();\n return (_output[0] != 0);\n }\n}\n" + }, + "contracts/extensions/collections/HasRoninGovernanceAdminContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasRoninGovernanceAdminContract.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\n\ncontract HasRoninGovernanceAdminContract is IHasRoninGovernanceAdminContract, HasProxyAdmin {\n IRoninGovernanceAdmin internal _roninGovernanceAdminContract;\n\n modifier onlyRoninGovernanceAdminContract() {\n if (roninGovernanceAdminContract() != msg.sender) revert ErrCallerMustBeGovernanceAdminContract();\n _;\n }\n\n /**\n * @inheritdoc IHasRoninGovernanceAdminContract\n */\n function roninGovernanceAdminContract() public view override returns (address) {\n return address(_roninGovernanceAdminContract);\n }\n\n /**\n * @inheritdoc IHasRoninGovernanceAdminContract\n */\n function setRoninGovernanceAdminContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setRoninGovernanceAdminContract(_addr);\n }\n\n /**\n * @dev Sets the ronin governance admin contract.\n *\n * Emits the event `RoninGovernanceAdminContractUpdated`.\n *\n */\n function _setRoninGovernanceAdminContract(address _addr) internal {\n _roninGovernanceAdminContract = IRoninGovernanceAdmin(_addr);\n emit RoninGovernanceAdminContractUpdated(_addr);\n }\n}\n" + }, + "contracts/interfaces/collections/IHasRoninGovernanceAdminContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasRoninGovernanceAdminContract is IHasContract {\n /// @dev Emitted when the ronin governance admin contract is updated.\n event RoninGovernanceAdminContractUpdated(address);\n\n /// @dev Error of method caller must be goverance admin contract.\n error ErrCallerMustBeGovernanceAdminContract();\n\n /**\n * @dev Returns the ronin governance admin contract.\n */\n function roninGovernanceAdminContract() external view returns (address);\n\n /**\n * @dev Sets the ronin governance admin contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `RoninGovernanceAdminContractUpdated`.\n *\n */\n function setRoninGovernanceAdminContract(address) external;\n}\n" + }, + "contracts/mocks/validator/MockRoninValidatorSetExtended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./MockRoninValidatorSetOverridePrecompile.sol\";\nimport \"../../libraries/EnumFlags.sol\";\n\ncontract MockRoninValidatorSetExtended is MockRoninValidatorSetOverridePrecompile {\n bool private _initialized;\n uint256[] internal _epochs;\n\n constructor() {}\n\n function initEpoch() public {\n if (!_initialized) {\n _epochs.push(0);\n _initialized = true;\n }\n }\n\n function endEpoch() external {\n _epochs.push(block.number);\n }\n\n function epochOf(uint256 _block) public view override returns (uint256 _epoch) {\n for (uint256 _i = _epochs.length; _i > 0; _i--) {\n if (_block > _epochs[_i - 1]) {\n return _i;\n }\n }\n }\n\n function epochEndingAt(uint256 _block) public view override(ITimingInfo, TimingStorage) returns (bool) {\n for (uint _i = 0; _i < _epochs.length; _i++) {\n if (_block == _epochs[_i]) {\n return true;\n }\n }\n return false;\n }\n\n function getJailUntils(address[] calldata _addrs) public view returns (uint256[] memory jailUntils_) {\n jailUntils_ = new uint256[](_addrs.length);\n for (uint _i = 0; _i < _addrs.length; _i++) {\n jailUntils_[_i] = _blockProducerJailedBlock[_addrs[_i]];\n }\n }\n\n function addValidators(address[] calldata _addrs) public {\n for (uint _i = 0; _i < _addrs.length; _i++) {\n _validators[_i] = _addrs[_i];\n _validatorMap[_addrs[_i]] = EnumFlags.ValidatorFlag.Both;\n }\n }\n}\n" + }, + "contracts/mocks/validator/MockRoninValidatorSetOverridePrecompile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../MockPrecompile.sol\";\nimport \"../../ronin/validator/RoninValidatorSet.sol\";\n\ncontract MockRoninValidatorSetOverridePrecompile is RoninValidatorSet, MockPrecompile {\n constructor() {}\n\n function arrangeValidatorCandidates(\n address[] memory _candidates,\n uint256[] memory _trustedWeights,\n uint _newValidatorCount,\n uint _maxPrioritizedValidatorNumber\n ) external pure returns (address[] memory) {\n _arrangeValidatorCandidates(_candidates, _trustedWeights, _newValidatorCount, _maxPrioritizedValidatorNumber);\n return _candidates;\n }\n\n function _pcSortCandidates(address[] memory _candidates, uint256[] memory _weights)\n internal\n pure\n override\n returns (address[] memory _result)\n {\n return sortValidators(_candidates, _weights);\n }\n\n function _pcPickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) internal pure override returns (address[] memory _result, uint256 _newValidatorCount) {\n _result = pickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n\n _newValidatorCount = _result.length;\n }\n}\n" + }, + "contracts/mocks/MockPrecompile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./libraries/Sorting.sol\";\nimport \"../libraries/Math.sol\";\n\ncontract MockPrecompile {\n function sortValidators(address[] memory _validators, uint256[] memory _weights)\n public\n pure\n returns (address[] memory)\n {\n return Sorting.sort(_validators, _weights);\n }\n\n function validatingDoubleSignProof(\n address, /*consensusAddr*/\n bytes calldata, /*_header1*/\n bytes calldata /*_header2*/\n ) public pure returns (bool _validEvidence) {\n return true;\n }\n\n function pickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) public pure returns (address[] memory _result) {\n (_result, _trustedWeights) = Sorting.sortWithExternalKeys(_candidates, _weights, _trustedWeights);\n uint256 _newValidatorCount = Math.min(_maxValidatorNumber, _result.length);\n _arrangeValidatorCandidates(_result, _trustedWeights, _newValidatorCount, _maxPrioritizedValidatorNumber);\n }\n\n /**\n * @dev Arranges the sorted candidates to list of validators, by asserting prioritized and non-prioritized candidates\n *\n * @param _candidates A sorted list of candidates\n */\n function _arrangeValidatorCandidates(\n address[] memory _candidates,\n uint256[] memory _trustedWeights,\n uint _newValidatorCount,\n uint _maxPrioritizedValidatorNumber\n ) internal pure {\n address[] memory _waitingCandidates = new address[](_candidates.length);\n uint _waitingCounter;\n uint _prioritySlotCounter;\n\n for (uint _i = 0; _i < _candidates.length; _i++) {\n if (_trustedWeights[_i] > 0 && _prioritySlotCounter < _maxPrioritizedValidatorNumber) {\n _candidates[_prioritySlotCounter++] = _candidates[_i];\n continue;\n }\n _waitingCandidates[_waitingCounter++] = _candidates[_i];\n }\n\n _waitingCounter = 0;\n for (uint _i = _prioritySlotCounter; _i < _newValidatorCount; _i++) {\n _candidates[_i] = _waitingCandidates[_waitingCounter++];\n }\n\n assembly {\n mstore(_candidates, _newValidatorCount)\n }\n }\n}\n" + }, + "contracts/ronin/validator/RoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"./CoinbaseExecution.sol\";\nimport \"./SlashingExecution.sol\";\n\ncontract RoninValidatorSet is Initializable, CoinbaseExecution, SlashingExecution {\n constructor() {\n _disableInitializers();\n }\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __slashIndicatorContract,\n address __stakingContract,\n address __stakingVestingContract,\n address __maintenanceContract,\n address __roninTrustedOrganizationContract,\n address __bridgeTrackingContract,\n uint256 __maxValidatorNumber,\n uint256 __maxValidatorCandidate,\n uint256 __maxPrioritizedValidatorNumber,\n uint256 __minEffectiveDaysOnwards,\n uint256 __numberOfBlocksInEpoch,\n // __emergencyExitConfigs[0]: emergencyExitLockedAmount\n // __emergencyExitConfigs[1]: emergencyExpiryDuration\n uint256[2] calldata __emergencyExitConfigs\n ) external initializer {\n _setSlashIndicatorContract(__slashIndicatorContract);\n _setStakingContract(__stakingContract);\n _setStakingVestingContract(__stakingVestingContract);\n _setMaintenanceContract(__maintenanceContract);\n _setBridgeTrackingContract(__bridgeTrackingContract);\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\n _setMaxValidatorNumber(__maxValidatorNumber);\n _setMaxValidatorCandidate(__maxValidatorCandidate);\n _setMaxPrioritizedValidatorNumber(__maxPrioritizedValidatorNumber);\n _setMinEffectiveDaysOnwards(__minEffectiveDaysOnwards);\n _setEmergencyExitLockedAmount(__emergencyExitConfigs[0]);\n _setEmergencyExpiryDuration(__emergencyExitConfigs[1]);\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\n }\n\n /**\n * @dev Only receives RON from staking vesting contract (for topping up bonus), and from staking contract (for transferring\n * deducting amount on slashing).\n */\n function _fallback() internal view {\n if (msg.sender != stakingVestingContract() && msg.sender != stakingContract()) revert ErrUnauthorizedReceiveRON();\n }\n\n /**\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\n */\n function _bridgeOperatorOf(address _consensusAddr)\n internal\n view\n override(EmergencyExit, ValidatorInfoStorage)\n returns (address)\n {\n return super._bridgeOperatorOf(_consensusAddr);\n }\n}\n" + }, + "contracts/mocks/libraries/Sorting.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Sorting {\n struct Node {\n uint key;\n uint value;\n }\n\n struct Node3 {\n uint key;\n uint value;\n uint otherKey;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // VALUE SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sort(uint[] memory data) internal pure returns (uint[] memory) {\n return _quickSort(data, int(0), int(data.length - 1));\n }\n\n function _quickSort(\n uint[] memory arr,\n int left,\n int right\n ) private pure returns (uint[] memory) {\n int i = left;\n int j = right;\n if (i == j) return arr;\n uint pivot = arr[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (arr[uint(i)] > pivot) i++;\n while (pivot > arr[uint(j)]) j--;\n if (i <= j) {\n (arr[uint(i)], arr[uint(j)]) = (arr[uint(j)], arr[uint(i)]);\n i++;\n j--;\n }\n }\n if (left < j) arr = _quickSort(arr, left, j);\n if (i < right) arr = _quickSort(arr, i, right);\n\n return arr;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // NODE SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sort(address[] memory _keys, uint256[] memory _values) internal pure returns (address[] memory) {\n require(_values.length == _keys.length, \"Sorting: invalid array length\");\n if (_keys.length == 0) {\n return _keys;\n }\n\n Node[] memory _nodes = new Node[](_keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node(uint256(uint160(_keys[_i])), _values[_i]);\n }\n _quickSortNodes(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n _keys[_i] = address(uint160(_nodes[_i].key)); // Casting?\n }\n\n return _keys;\n }\n\n function sortNodes(Node[] memory nodes) internal pure returns (Node[] memory) {\n return _quickSortNodes(nodes, int(0), int(nodes.length - 1));\n }\n\n function _quickSortNodes(\n Node[] memory nodes,\n int left,\n int right\n ) private pure returns (Node[] memory) {\n int i = left;\n int j = right;\n if (i == j) return nodes;\n Node memory pivot = nodes[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (nodes[uint(i)].value > pivot.value) i++;\n while (pivot.value > nodes[uint(j)].value) j--;\n if (i <= j) {\n (nodes[uint(i)], nodes[uint(j)]) = __swapNodes(nodes[uint(i)], nodes[uint(j)]);\n i++;\n j--;\n }\n }\n if (left < j) nodes = _quickSortNodes(nodes, left, j);\n if (i < right) nodes = _quickSortNodes(nodes, i, right);\n\n return nodes;\n }\n\n function _bubbleSortNodes(Node[] memory nodes) private pure returns (Node[] memory) {\n uint length = nodes.length;\n for (uint i = 0; i < length - 1; i++) {\n for (uint j = i + 1; j < length; j++) {\n if (nodes[j].value > nodes[i].value) {\n (nodes[i], nodes[j]) = __swapNodes(nodes[i], nodes[j]);\n }\n }\n }\n return nodes;\n }\n\n function __swapNodes(Node memory x, Node memory y) private pure returns (Node memory, Node memory) {\n Node memory tmp = x;\n (x, y) = (y, tmp);\n return (x, y);\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // NODE3 SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sortWithExternalKeys(\n address[] memory _keys,\n uint256[] memory _values,\n uint256[] memory _otherKeys\n ) internal pure returns (address[] memory keys_, uint256[] memory otherKeys_) {\n require((_values.length == _keys.length) && (_otherKeys.length == _keys.length), \"Sorting: invalid array length\");\n if (_keys.length == 0) {\n return (_keys, _otherKeys);\n }\n\n Node3[] memory _nodes = new Node3[](_keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node3(uint256(uint160(_keys[_i])), _values[_i], _otherKeys[_i]);\n }\n _quickSortNode3s(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n _keys[_i] = address(uint160(_nodes[_i].key)); // Casting?\n }\n\n return (_keys, _otherKeys);\n }\n\n function sortNode3s(Node3[] memory nodes) internal pure returns (Node3[] memory) {\n return _quickSortNode3s(nodes, int(0), int(nodes.length - 1));\n }\n\n function _quickSortNode3s(\n Node3[] memory nodes,\n int left,\n int right\n ) private pure returns (Node3[] memory) {\n int i = left;\n int j = right;\n if (i == j) return nodes;\n Node3 memory pivot = nodes[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (nodes[uint(i)].value > pivot.value) i++;\n while (pivot.value > nodes[uint(j)].value) j--;\n if (i <= j) {\n (nodes[uint(i)], nodes[uint(j)]) = __swapNode3s(nodes[uint(i)], nodes[uint(j)]);\n i++;\n j--;\n }\n }\n if (left < j) nodes = _quickSortNode3s(nodes, left, j);\n if (i < right) nodes = _quickSortNode3s(nodes, i, right);\n\n return nodes;\n }\n\n function _bubbleSortNode3s(Node3[] memory nodes) private pure returns (Node3[] memory) {\n uint length = nodes.length;\n for (uint i = 0; i < length - 1; i++) {\n for (uint j = i + 1; j < length; j++) {\n if (nodes[j].value > nodes[i].value) {\n (nodes[i], nodes[j]) = __swapNode3s(nodes[i], nodes[j]);\n }\n }\n }\n return nodes;\n }\n\n function __swapNode3s(Node3 memory x, Node3 memory y) private pure returns (Node3 memory, Node3 memory) {\n Node3 memory tmp = x;\n (x, y) = (y, tmp);\n return (x, y);\n }\n}\n" + }, + "contracts/mainchain/MainchainGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../extensions/GatewayV2.sol\";\nimport \"../extensions/WithdrawalLimitation.sol\";\nimport \"../libraries/Transfer.sol\";\nimport \"../interfaces/IMainchainGatewayV2.sol\";\n\ncontract MainchainGatewayV2 is WithdrawalLimitation, Initializable, AccessControlEnumerable, IMainchainGatewayV2 {\n using Token for Token.Info;\n using Transfer for Transfer.Request;\n using Transfer for Transfer.Receipt;\n\n /// @dev Emitted when the bridge operators are replaced\n event BridgeOperatorsReplaced(address[] operators);\n\n /// @dev Withdrawal unlocker role hash\n bytes32 public constant WITHDRAWAL_UNLOCKER_ROLE = keccak256(\"WITHDRAWAL_UNLOCKER_ROLE\");\n\n /// @dev Wrapped native token address\n IWETH public wrappedNativeToken;\n /// @dev Ronin network id\n uint256 public roninChainId;\n /// @dev Total deposit\n uint256 public depositCount;\n /// @dev Domain seperator\n bytes32 internal _domainSeparator;\n /// @dev Mapping from mainchain token => token address on Ronin network\n mapping(address => MappedToken) internal _roninToken;\n /// @dev Mapping from withdrawal id => withdrawal hash\n mapping(uint256 => bytes32) public withdrawalHash;\n /// @dev Mapping from withdrawal id => locked\n mapping(uint256 => bool) public withdrawalLocked;\n\n /// @dev Mapping from validator address => last block that the bridge operator is added\n mapping(address => uint256) internal _bridgeOperatorAddedBlock;\n /// @dev Bridge operators array\n address[] internal _bridgeOperators;\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n /**\n * @dev Initializes contract storage.\n */\n function initialize(\n address _roleSetter,\n IWETH _wrappedToken,\n uint256 _roninChainId,\n uint256 _numerator,\n uint256 _highTierVWNumerator,\n uint256 _denominator,\n // _addresses[0]: mainchainTokens\n // _addresses[1]: roninTokens\n // _addresses[2]: withdrawalUnlockers\n address[][3] calldata _addresses,\n // _thresholds[0]: highTierThreshold\n // _thresholds[1]: lockedThreshold\n // _thresholds[2]: unlockFeePercentages\n // _thresholds[3]: dailyWithdrawalLimit\n uint256[][4] calldata _thresholds,\n Token.Standard[] calldata _standards\n ) external payable virtual initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n roninChainId = _roninChainId;\n\n _setWrappedNativeTokenContract(_wrappedToken);\n _updateDomainSeparator();\n _setThreshold(_numerator, _denominator);\n _setHighTierVoteWeightThreshold(_highTierVWNumerator, _denominator);\n _verifyThresholds();\n\n if (_addresses[0].length > 0) {\n // Map mainchain tokens to ronin tokens\n _mapTokens(_addresses[0], _addresses[1], _standards);\n // Sets thresholds based on the mainchain tokens\n _setHighTierThresholds(_addresses[0], _thresholds[0]);\n _setLockedThresholds(_addresses[0], _thresholds[1]);\n _setUnlockFeePercentages(_addresses[0], _thresholds[2]);\n _setDailyWithdrawalLimits(_addresses[0], _thresholds[3]);\n }\n\n // Grant role for withdrawal unlocker\n for (uint256 _i; _i < _addresses[2].length; _i++) {\n _grantRole(WITHDRAWAL_UNLOCKER_ROLE, _addresses[2][_i]);\n }\n }\n\n /**\n * @inheritdoc IBridge\n */\n function replaceBridgeOperators(address[] calldata _list) external onlyAdmin {\n address _addr;\n for (uint256 _i = 0; _i < _list.length; _i++) {\n _addr = _list[_i];\n if (_bridgeOperatorAddedBlock[_addr] == 0) {\n _bridgeOperators.push(_addr);\n }\n _bridgeOperatorAddedBlock[_addr] = block.number;\n }\n\n {\n uint256 _i;\n while (_i < _bridgeOperators.length) {\n _addr = _bridgeOperators[_i];\n if (_bridgeOperatorAddedBlock[_addr] < block.number) {\n delete _bridgeOperatorAddedBlock[_addr];\n _bridgeOperators[_i] = _bridgeOperators[_bridgeOperators.length - 1];\n _bridgeOperators.pop();\n continue;\n }\n _i++;\n }\n }\n\n emit BridgeOperatorsReplaced(_list);\n }\n\n /**\n * @inheritdoc IBridge\n */\n function getBridgeOperators() external view returns (address[] memory) {\n return _bridgeOperators;\n }\n\n /**\n * @dev Receives ether without doing anything. Use this function to topup native token.\n */\n function receiveEther() external payable {}\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {\n return _domainSeparator;\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function setWrappedNativeTokenContract(IWETH _wrappedToken) external virtual onlyAdmin {\n _setWrappedNativeTokenContract(_wrappedToken);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function requestDepositFor(Transfer.Request calldata _request) external payable virtual whenNotPaused {\n _requestDepositFor(_request, msg.sender);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function submitWithdrawal(Transfer.Receipt calldata _receipt, Signature[] calldata _signatures)\n external\n virtual\n whenNotPaused\n returns (bool _locked)\n {\n return _submitWithdrawal(_receipt, _signatures);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function unlockWithdrawal(Transfer.Receipt calldata _receipt) external onlyRole(WITHDRAWAL_UNLOCKER_ROLE) {\n bytes32 _receiptHash = _receipt.hash();\n require(withdrawalHash[_receipt.id] == _receipt.hash(), \"MainchainGatewayV2: invalid receipt\");\n require(withdrawalLocked[_receipt.id], \"MainchainGatewayV2: query for approved withdrawal\");\n delete withdrawalLocked[_receipt.id];\n emit WithdrawalUnlocked(_receiptHash, _receipt);\n\n address _token = _receipt.mainchain.tokenAddr;\n if (_receipt.info.erc == Token.Standard.ERC20) {\n Token.Info memory _feeInfo = _receipt.info;\n _feeInfo.quantity = _computeFeePercentage(_receipt.info.quantity, unlockFeePercentages[_token]);\n Token.Info memory _withdrawInfo = _receipt.info;\n _withdrawInfo.quantity = _receipt.info.quantity - _feeInfo.quantity;\n\n _feeInfo.handleAssetTransfer(payable(msg.sender), _token, wrappedNativeToken);\n _withdrawInfo.handleAssetTransfer(payable(_receipt.mainchain.addr), _token, wrappedNativeToken);\n } else {\n _receipt.info.handleAssetTransfer(payable(_receipt.mainchain.addr), _token, wrappedNativeToken);\n }\n\n emit Withdrew(_receiptHash, _receipt);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function mapTokens(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards\n ) external virtual onlyAdmin {\n require(_mainchainTokens.length > 0, \"MainchainGatewayV2: query for empty array\");\n _mapTokens(_mainchainTokens, _roninTokens, _standards);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function mapTokensAndThresholds(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards,\n // _thresholds[0]: highTierThreshold\n // _thresholds[1]: lockedThreshold\n // _thresholds[2]: unlockFeePercentages\n // _thresholds[3]: dailyWithdrawalLimit\n uint256[][4] calldata _thresholds\n ) external virtual onlyAdmin {\n require(_mainchainTokens.length > 0, \"MainchainGatewayV2: query for empty array\");\n _mapTokens(_mainchainTokens, _roninTokens, _standards);\n _setHighTierThresholds(_mainchainTokens, _thresholds[0]);\n _setLockedThresholds(_mainchainTokens, _thresholds[1]);\n _setUnlockFeePercentages(_mainchainTokens, _thresholds[2]);\n _setDailyWithdrawalLimits(_mainchainTokens, _thresholds[3]);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function getRoninToken(address _mainchainToken) public view returns (MappedToken memory _token) {\n _token = _roninToken[_mainchainToken];\n require(_token.tokenAddr != address(0), \"MainchainGatewayV2: unsupported token\");\n }\n\n /**\n * @dev Maps mainchain tokens to Ronin network.\n *\n * Requirement:\n * - The arrays have the same length.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function _mapTokens(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards\n ) internal virtual {\n require(\n _mainchainTokens.length == _roninTokens.length && _mainchainTokens.length == _standards.length,\n \"MainchainGatewayV2: invalid array length\"\n );\n\n for (uint256 _i; _i < _mainchainTokens.length; _i++) {\n _roninToken[_mainchainTokens[_i]].tokenAddr = _roninTokens[_i];\n _roninToken[_mainchainTokens[_i]].erc = _standards[_i];\n }\n\n emit TokenMapped(_mainchainTokens, _roninTokens, _standards);\n }\n\n /**\n * @dev Submits withdrawal receipt.\n *\n * Requirements:\n * - The receipt kind is withdrawal.\n * - The receipt is to withdraw on this chain.\n * - The receipt is not used to withdraw before.\n * - The withdrawal is not reached the limit threshold.\n * - The signer weight total is larger than or equal to the minimum threshold.\n * - The signature signers are in order.\n *\n * Emits the `Withdrew` once the assets are released.\n *\n */\n function _submitWithdrawal(Transfer.Receipt calldata _receipt, Signature[] memory _signatures)\n internal\n virtual\n returns (bool _locked)\n {\n uint256 _id = _receipt.id;\n uint256 _quantity = _receipt.info.quantity;\n address _tokenAddr = _receipt.mainchain.tokenAddr;\n\n _receipt.info.validate();\n require(_receipt.kind == Transfer.Kind.Withdrawal, \"MainchainGatewayV2: invalid receipt kind\");\n require(_receipt.mainchain.chainId == block.chainid, \"MainchainGatewayV2: invalid chain id\");\n MappedToken memory _token = getRoninToken(_receipt.mainchain.tokenAddr);\n require(\n _token.erc == _receipt.info.erc && _token.tokenAddr == _receipt.ronin.tokenAddr,\n \"MainchainGatewayV2: invalid receipt\"\n );\n require(withdrawalHash[_id] == bytes32(0), \"MainchainGatewayV2: query for processed withdrawal\");\n require(\n _receipt.info.erc == Token.Standard.ERC721 || !_reachedWithdrawalLimit(_tokenAddr, _quantity),\n \"MainchainGatewayV2: reached daily withdrawal limit\"\n );\n\n bytes32 _receiptHash = _receipt.hash();\n bytes32 _receiptDigest = Transfer.receiptDigest(_domainSeparator, _receiptHash);\n\n uint256 _minimumVoteWeight;\n (_minimumVoteWeight, _locked) = _computeMinVoteWeight(_receipt.info.erc, _tokenAddr, _quantity);\n\n {\n bool _passed;\n address _signer;\n address _lastSigner;\n Signature memory _sig;\n uint256 _weight;\n for (uint256 _i; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n _signer = ecrecover(_receiptDigest, _sig.v, _sig.r, _sig.s);\n require(_lastSigner < _signer, \"MainchainGatewayV2: invalid order\");\n _lastSigner = _signer;\n\n _weight += _getWeight(_signer);\n if (_weight >= _minimumVoteWeight) {\n _passed = true;\n break;\n }\n }\n require(_passed, \"MainchainGatewayV2: query for insufficient vote weight\");\n withdrawalHash[_id] = _receiptHash;\n }\n\n if (_locked) {\n withdrawalLocked[_id] = true;\n emit WithdrawalLocked(_receiptHash, _receipt);\n return _locked;\n }\n\n _recordWithdrawal(_tokenAddr, _quantity);\n _receipt.info.handleAssetTransfer(payable(_receipt.mainchain.addr), _tokenAddr, wrappedNativeToken);\n emit Withdrew(_receiptHash, _receipt);\n }\n\n /**\n * @dev Requests deposit made by `_requester` address.\n *\n * Requirements:\n * - The token info is valid.\n * - The `msg.value` is 0 while depositing ERC20 token.\n * - The `msg.value` is equal to deposit quantity while depositing native token.\n *\n * Emits the `DepositRequested` event.\n *\n */\n function _requestDepositFor(Transfer.Request memory _request, address _requester) internal virtual {\n MappedToken memory _token;\n address _weth = address(wrappedNativeToken);\n\n _request.info.validate();\n if (_request.tokenAddr == address(0)) {\n require(_request.info.quantity == msg.value, \"MainchainGatewayV2: invalid request\");\n _token = getRoninToken(_weth);\n require(_token.erc == _request.info.erc, \"MainchainGatewayV2: invalid token standard\");\n _request.tokenAddr = _weth;\n } else {\n require(msg.value == 0, \"MainchainGatewayV2: invalid request\");\n _token = getRoninToken(_request.tokenAddr);\n require(_token.erc == _request.info.erc, \"MainchainGatewayV2: invalid token standard\");\n _request.info.transferFrom(_requester, address(this), _request.tokenAddr);\n // Withdraw if token is WETH\n if (_weth == _request.tokenAddr) {\n IWETH(_weth).withdraw(_request.info.quantity);\n }\n }\n\n uint256 _depositId = depositCount++;\n Transfer.Receipt memory _receipt = _request.into_deposit_receipt(\n _requester,\n _depositId,\n _token.tokenAddr,\n roninChainId\n );\n\n emit DepositRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @dev Returns the minimum vote weight for the token.\n */\n function _computeMinVoteWeight(\n Token.Standard _erc,\n address _token,\n uint256 _quantity\n ) internal virtual returns (uint256 _weight, bool _locked) {\n uint256 _totalWeight = _getTotalWeight();\n _weight = _minimumVoteWeight(_totalWeight);\n if (_erc == Token.Standard.ERC20) {\n if (highTierThreshold[_token] <= _quantity) {\n _weight = _highTierVoteWeight(_totalWeight);\n }\n _locked = _lockedWithdrawalRequest(_token, _quantity);\n }\n }\n\n /**\n * @dev Update domain seperator.\n */\n function _updateDomainSeparator() internal {\n _domainSeparator = keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(\"MainchainGatewayV2\"),\n keccak256(\"2\"),\n block.chainid,\n address(this)\n )\n );\n }\n\n /**\n * @dev Sets the WETH contract.\n *\n * Emits the `WrappedNativeTokenContractUpdated` event.\n *\n */\n function _setWrappedNativeTokenContract(IWETH _wrapedToken) internal {\n wrappedNativeToken = _wrapedToken;\n emit WrappedNativeTokenContractUpdated(_wrapedToken);\n }\n\n /**\n * @dev Receives ETH from WETH or creates deposit request.\n */\n function _fallback() internal virtual whenNotPaused {\n if (msg.sender != address(wrappedNativeToken)) {\n Transfer.Request memory _request;\n _request.recipientAddr = msg.sender;\n _request.info.quantity = msg.value;\n _requestDepositFor(_request, _request.recipientAddr);\n }\n }\n\n /**\n * @inheritdoc GatewayV2\n */\n function _getTotalWeight() internal view override returns (uint256) {\n return _bridgeOperators.length;\n }\n\n /**\n * @dev Returns the weight of an address.\n */\n function _getWeight(address _addr) internal view returns (uint256) {\n return _bridgeOperatorAddedBlock[_addr] > 0 ? 1 : 0;\n }\n}\n" + }, + "contracts/extensions/WithdrawalLimitation.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./GatewayV2.sol\";\n\nabstract contract WithdrawalLimitation is GatewayV2 {\n /// @dev Emitted when the high-tier vote weight threshold is updated\n event HighTierVoteWeightThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n /// @dev Emitted when the thresholds for high-tier withdrawals that requires high-tier vote weights are updated\n event HighTierThresholdsUpdated(address[] tokens, uint256[] thresholds);\n /// @dev Emitted when the thresholds for locked withdrawals are updated\n event LockedThresholdsUpdated(address[] tokens, uint256[] thresholds);\n /// @dev Emitted when the fee percentages to unlock withdraw are updated\n event UnlockFeePercentagesUpdated(address[] tokens, uint256[] percentages);\n /// @dev Emitted when the daily limit thresholds are updated\n event DailyWithdrawalLimitsUpdated(address[] tokens, uint256[] limits);\n\n uint256 public constant _MAX_PERCENTAGE = 1_000_000;\n\n uint256 internal _highTierVWNum;\n uint256 internal _highTierVWDenom;\n\n /// @dev Mapping from mainchain token => the amount thresholds for high-tier withdrawals that requires high-tier vote weights\n mapping(address => uint256) public highTierThreshold;\n /// @dev Mapping from mainchain token => the amount thresholds to lock withdrawal\n mapping(address => uint256) public lockedThreshold;\n /// @dev Mapping from mainchain token => unlock fee percentages for unlocker\n /// @notice Values 0-1,000,000 map to 0%-100%\n mapping(address => uint256) public unlockFeePercentages;\n /// @dev Mapping from mainchain token => daily limit amount for withdrawal\n mapping(address => uint256) public dailyWithdrawalLimit;\n /// @dev Mapping from token address => today withdrawal amount\n mapping(address => uint256) public lastSyncedWithdrawal;\n /// @dev Mapping from token address => last date synced to record the `lastSyncedWithdrawal`\n mapping(address => uint256) public lastDateSynced;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @dev Override `GatewayV2-setThreshold`.\n *\n * Requirements:\n * - The high-tier vote weight threshold must equal to or larger than the normal threshold.\n *\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n virtual\n override\n onlyAdmin\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n (_previousNum, _previousDenom) = _setThreshold(_numerator, _denominator);\n _verifyThresholds();\n }\n\n /**\n * @dev Returns the high-tier vote weight threshold.\n */\n function getHighTierVoteWeightThreshold() external view virtual returns (uint256, uint256) {\n return (_highTierVWNum, _highTierVWDenom);\n }\n\n /**\n * @dev Checks whether the `_voteWeight` passes the high-tier vote weight threshold.\n */\n function checkHighTierVoteWeightThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _highTierVWDenom >= _highTierVWNum * _getTotalWeight();\n }\n\n /**\n * @dev Sets high-tier vote weight threshold and returns the old one.\n *\n * Requirements:\n * - The method caller is admin.\n * - The high-tier vote weight threshold must equal to or larger than the normal threshold.\n *\n * Emits the `HighTierVoteWeightThresholdUpdated` event.\n *\n */\n function setHighTierVoteWeightThreshold(uint256 _numerator, uint256 _denominator)\n external\n virtual\n onlyAdmin\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n (_previousNum, _previousDenom) = _setHighTierVoteWeightThreshold(_numerator, _denominator);\n _verifyThresholds();\n }\n\n /**\n * @dev Sets the thresholds for high-tier withdrawals that requires high-tier vote weights.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `HighTierThresholdsUpdated` event.\n *\n */\n function setHighTierThresholds(address[] calldata _tokens, uint256[] calldata _thresholds)\n external\n virtual\n onlyAdmin\n {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setHighTierThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets the amount thresholds to lock withdrawal.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `LockedThresholdsUpdated` event.\n *\n */\n function setLockedThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) external virtual onlyAdmin {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setLockedThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets fee percentages to unlock withdrawal.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `UnlockFeePercentagesUpdated` event.\n *\n */\n function setUnlockFeePercentages(address[] calldata _tokens, uint256[] calldata _percentages)\n external\n virtual\n onlyAdmin\n {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setUnlockFeePercentages(_tokens, _percentages);\n }\n\n /**\n * @dev Sets daily limit amounts for the withdrawals.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `DailyWithdrawalLimitsUpdated` event.\n *\n */\n function setDailyWithdrawalLimits(address[] calldata _tokens, uint256[] calldata _limits) external virtual onlyAdmin {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setDailyWithdrawalLimits(_tokens, _limits);\n }\n\n /**\n * @dev Checks whether the withdrawal reaches the limitation.\n */\n function reachedWithdrawalLimit(address _token, uint256 _quantity) external view virtual returns (bool) {\n return _reachedWithdrawalLimit(_token, _quantity);\n }\n\n /**\n * @dev Sets high-tier vote weight threshold and returns the old one.\n *\n * Emits the `HighTierVoteWeightThresholdUpdated` event.\n *\n */\n function _setHighTierVoteWeightThreshold(uint256 _numerator, uint256 _denominator)\n internal\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n require(_numerator <= _denominator, \"WithdrawalLimitation: invalid threshold\");\n _previousNum = _highTierVWNum;\n _previousDenom = _highTierVWDenom;\n _highTierVWNum = _numerator;\n _highTierVWDenom = _denominator;\n emit HighTierVoteWeightThresholdUpdated(nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n\n /**\n * @dev Sets the thresholds for high-tier withdrawals that requires high-tier vote weights.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `HighTierThresholdsUpdated` event.\n *\n */\n function _setHighTierThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n require(_tokens.length == _thresholds.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n highTierThreshold[_tokens[_i]] = _thresholds[_i];\n }\n emit HighTierThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets the amount thresholds to lock withdrawal.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `LockedThresholdsUpdated` event.\n *\n */\n function _setLockedThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n require(_tokens.length == _thresholds.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n lockedThreshold[_tokens[_i]] = _thresholds[_i];\n }\n emit LockedThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets fee percentages to unlock withdrawal.\n *\n * Requirements:\n * - The array lengths are equal.\n * - The percentage is equal to or less than 100_000.\n *\n * Emits the `UnlockFeePercentagesUpdated` event.\n *\n */\n function _setUnlockFeePercentages(address[] calldata _tokens, uint256[] calldata _percentages) internal virtual {\n require(_tokens.length == _percentages.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n require(_percentages[_i] <= _MAX_PERCENTAGE, \"WithdrawalLimitation: invalid percentage\");\n unlockFeePercentages[_tokens[_i]] = _percentages[_i];\n }\n emit UnlockFeePercentagesUpdated(_tokens, _percentages);\n }\n\n /**\n * @dev Sets daily limit amounts for the withdrawals.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `DailyWithdrawalLimitsUpdated` event.\n *\n */\n function _setDailyWithdrawalLimits(address[] calldata _tokens, uint256[] calldata _limits) internal virtual {\n require(_tokens.length == _limits.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n dailyWithdrawalLimit[_tokens[_i]] = _limits[_i];\n }\n emit DailyWithdrawalLimitsUpdated(_tokens, _limits);\n }\n\n /**\n * @dev Checks whether the withdrawal reaches the daily limitation.\n *\n * Requirements:\n * - The daily withdrawal threshold should not apply for locked withdrawals.\n *\n */\n function _reachedWithdrawalLimit(address _token, uint256 _quantity) internal view virtual returns (bool) {\n if (_lockedWithdrawalRequest(_token, _quantity)) {\n return false;\n }\n\n uint256 _currentDate = block.timestamp / 1 days;\n if (_currentDate > lastDateSynced[_token]) {\n return dailyWithdrawalLimit[_token] <= _quantity;\n } else {\n return dailyWithdrawalLimit[_token] <= lastSyncedWithdrawal[_token] + _quantity;\n }\n }\n\n /**\n * @dev Record withdrawal token.\n */\n function _recordWithdrawal(address _token, uint256 _quantity) internal virtual {\n uint256 _currentDate = block.timestamp / 1 days;\n if (_currentDate > lastDateSynced[_token]) {\n lastDateSynced[_token] = _currentDate;\n lastSyncedWithdrawal[_token] = _quantity;\n } else {\n lastSyncedWithdrawal[_token] += _quantity;\n }\n }\n\n /**\n * @dev Returns whether the withdrawal request is locked or not.\n */\n function _lockedWithdrawalRequest(address _token, uint256 _quantity) internal view virtual returns (bool) {\n return lockedThreshold[_token] <= _quantity;\n }\n\n /**\n * @dev Computes fee percentage.\n */\n function _computeFeePercentage(uint256 _amount, uint256 _percentage) internal view virtual returns (uint256) {\n return (_amount * _percentage) / _MAX_PERCENTAGE;\n }\n\n /**\n * @dev Returns high-tier vote weight.\n */\n function _highTierVoteWeight(uint256 _totalWeight) internal view virtual returns (uint256) {\n return (_highTierVWNum * _totalWeight + _highTierVWDenom - 1) / _highTierVWDenom;\n }\n\n /**\n * @dev Validates whether the high-tier vote weight threshold is larger than the normal threshold.\n */\n function _verifyThresholds() internal view {\n require(_num * _highTierVWDenom <= _highTierVWNum * _denom, \"WithdrawalLimitation: invalid thresholds\");\n }\n}\n" + }, + "contracts/interfaces/IMainchainGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./IBridge.sol\";\nimport \"./IWETH.sol\";\nimport \"./consumers/SignatureConsumer.sol\";\nimport \"./consumers/MappedTokenConsumer.sol\";\nimport \"../libraries/Transfer.sol\";\n\ninterface IMainchainGatewayV2 is SignatureConsumer, MappedTokenConsumer, IBridge {\n /// @dev Emitted when the deposit is requested\n event DepositRequested(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the assets are withdrawn\n event Withdrew(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the tokens are mapped\n event TokenMapped(address[] mainchainTokens, address[] roninTokens, Token.Standard[] standards);\n /// @dev Emitted when the wrapped native token contract is updated\n event WrappedNativeTokenContractUpdated(IWETH weth);\n /// @dev Emitted when the withdrawal is locked\n event WithdrawalLocked(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal is unlocked\n event WithdrawalUnlocked(bytes32 receiptHash, Transfer.Receipt receipt);\n\n /**\n * @dev Returns the domain seperator.\n */\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n /**\n * @dev Returns deposit count.\n */\n function depositCount() external view returns (uint256);\n\n /**\n * @dev Sets the wrapped native token contract.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `WrappedNativeTokenContractUpdated` event.\n *\n */\n function setWrappedNativeTokenContract(IWETH _wrappedToken) external;\n\n /**\n * @dev Returns whether the withdrawal is locked.\n */\n function withdrawalLocked(uint256 withdrawalId) external view returns (bool);\n\n /**\n * @dev Returns the withdrawal hash.\n */\n function withdrawalHash(uint256 withdrawalId) external view returns (bytes32);\n\n /**\n * @dev Locks the assets and request deposit.\n */\n function requestDepositFor(Transfer.Request calldata _request) external payable;\n\n /**\n * @dev Withdraws based on the receipt and the validator signatures.\n * Returns whether the withdrawal is locked.\n *\n * Emits the `Withdrew` once the assets are released.\n *\n */\n function submitWithdrawal(Transfer.Receipt memory _receipt, Signature[] memory _signatures)\n external\n returns (bool _locked);\n\n /**\n * @dev Approves a specific withdrawal.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Withdrew` once the assets are released.\n *\n */\n function unlockWithdrawal(Transfer.Receipt calldata _receipt) external;\n\n /**\n * @dev Maps mainchain tokens to Ronin network.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokens(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards\n ) external;\n\n /**\n * @dev Maps mainchain tokens to Ronin network and sets thresholds.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokensAndThresholds(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards,\n uint256[][4] calldata _thresholds\n ) external;\n\n /**\n * @dev Returns token address on Ronin network.\n * Note: Reverts for unsupported token.\n */\n function getRoninToken(address _mainchainToken) external view returns (MappedToken memory _token);\n}\n" + }, + "contracts/mocks/MockSlashIndicatorExtended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./MockPrecompile.sol\";\nimport \"../ronin/slash-indicator/SlashIndicator.sol\";\n\ncontract MockSlashIndicatorExtended is SlashIndicator, MockPrecompile {\n function slashFelony(address _validatorAddr) external {\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\n }\n\n function slashMisdemeanor(address _validatorAddr) external {\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\n }\n\n function _pcValidateEvidence(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) internal pure override returns (bool _validEvidence) {\n return validatingDoubleSignProof(_consensusAddr, _header1, _header2);\n }\n}\n" + }, + "contracts/mocks/sorting/MockSorting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\nimport \"../libraries/Sorting.sol\";\n\ncontract MockSorting {\n uint256[] public data;\n\n function addData(uint256[] memory _data) public {\n for (uint256 i; i < _data.length; i++) {\n data.push(_data[i]);\n }\n }\n\n function sort(uint256[] memory _data) public pure returns (uint256[] memory) {\n return Sorting.sort(_data);\n }\n\n function sortOnStorage() public returns (uint256[] memory, uint256) {\n uint256[] memory _tmpData = data;\n data = Sorting.sort(_tmpData);\n\n return (data, data.length);\n }\n\n function sortAddressesAndValues(address[] calldata _addrs, uint256[] calldata _values)\n public\n pure\n returns (address[] memory)\n {\n return Sorting.sort(_addrs, _values);\n }\n}\n" + }, + "contracts/mocks/MockStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../ronin/staking/RewardCalculation.sol\";\n\ncontract MockStaking is RewardCalculation, GlobalConfigConsumer {\n /// @dev Mapping from user => staking balance\n mapping(address => uint256) internal _stakingAmount;\n /// @dev Mapping from period number => slashed\n mapping(uint256 => bool) internal _periodSlashed;\n\n uint256 internal _stakingTotal;\n\n uint256 public lastUpdatedPeriod;\n uint256 public pendingReward;\n address public poolAddr;\n\n constructor(address _poolAddr) {\n poolAddr = _poolAddr;\n }\n\n function firstEverWrapup() external {\n delete pendingReward;\n lastUpdatedPeriod = block.timestamp / PERIOD_DURATION + 1;\n }\n\n function endPeriod() external {\n address[] memory _addrs = new address[](1);\n uint256[] memory _rewards = new uint256[](1);\n _addrs[0] = poolAddr;\n _rewards[0] = pendingReward;\n this.execRecordRewards(_addrs, _rewards);\n\n pendingReward = 0;\n lastUpdatedPeriod++;\n }\n\n function increasePeriod() external {\n lastUpdatedPeriod++;\n }\n\n function stake(address _user, uint256 _amount) external {\n uint256 _lastStakingAmount = _stakingAmount[_user];\n uint256 _newStakingAmount = _lastStakingAmount + _amount;\n _syncUserReward(poolAddr, _user, _newStakingAmount);\n _stakingAmount[_user] = _newStakingAmount;\n _stakingTotal += _amount;\n }\n\n function unstake(address _user, uint256 _amount) external {\n uint256 _lastStakingAmount = _stakingAmount[_user];\n uint256 _newStakingAmount = _lastStakingAmount - _amount;\n _syncUserReward(poolAddr, _user, _newStakingAmount);\n _stakingAmount[_user] = _newStakingAmount;\n _stakingTotal -= _amount;\n }\n\n function increaseReward(uint256 _amount) external {\n pendingReward += _amount;\n }\n\n function decreaseReward(uint256 _amount) external {\n pendingReward -= _amount;\n }\n\n function execRecordRewards(address[] calldata _addrList, uint256[] calldata _rewards) external {\n _recordRewards(_addrList, _rewards, _currentPeriod());\n }\n\n function getPeriod() public view returns (uint256) {\n return _currentPeriod();\n }\n\n function claimReward(address _user) external returns (uint256 _amount) {\n _amount = _claimReward(poolAddr, _user, getPeriod());\n }\n\n function getStakingAmount(address, address _user) public view override returns (uint256) {\n return _stakingAmount[_user];\n }\n\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\n external\n view\n override\n returns (uint256[] memory)\n {}\n\n function getStakingTotal(address _addr) public view virtual override returns (uint256) {\n return _addr == poolAddr ? _stakingTotal : 0;\n }\n\n function _currentPeriod() internal view override returns (uint256 _period) {\n return lastUpdatedPeriod;\n }\n\n function getManyStakingTotals(address[] calldata _poolAddr) external view override returns (uint256[] memory) {}\n}\n" + }, + "contracts/mocks/precompile-usages/MockPCUValidateDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../precompile-usages/PCUValidateDoubleSign.sol\";\n\ncontract MockPCUValidateDoubleSign is PCUValidateDoubleSign {\n address internal _precompileValidateDoubleSignAddress;\n\n constructor(address _precompile) {\n setPrecompileValidateDoubleSignAddress(_precompile);\n }\n\n function setPrecompileValidateDoubleSignAddress(address _addr) public {\n _precompileValidateDoubleSignAddress = _addr;\n }\n\n function precompileValidateDoubleSignAddress() public view override returns (address) {\n return _precompileValidateDoubleSignAddress;\n }\n\n function callPrecompile(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) public view returns (bool) {\n return _pcValidateEvidence(_consensusAddr, _header1, _header2);\n }\n}\n" + }, + "contracts/mocks/precompile-usages/MockPCUSortValidators.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../precompile-usages/PCUSortValidators.sol\";\n\ncontract MockPCUSortValidators is PCUSortValidators {\n address internal _precompileSortValidatorAddress;\n\n constructor(address _precompile) {\n setPrecompileSortValidatorAddress(_precompile);\n }\n\n function setPrecompileSortValidatorAddress(address _addr) public {\n _precompileSortValidatorAddress = _addr;\n }\n\n function precompileSortValidatorsAddress() public view override returns (address) {\n return _precompileSortValidatorAddress;\n }\n\n function callPrecompile(address[] calldata _validators, uint256[] calldata _weights)\n public\n view\n returns (address[] memory _result)\n {\n return _pcSortCandidates(_validators, _weights);\n }\n}\n" + }, + "contracts/mocks/precompile-usages/MockPCUPickValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../precompile-usages/PCUPickValidatorSet.sol\";\n\ncontract MockPCUPickValidatorSet is PCUPickValidatorSet {\n address internal _precompileSortValidatorAddress;\n\n constructor(address _precompile) {\n setPrecompileSortValidatorAddress(_precompile);\n }\n\n function setPrecompileSortValidatorAddress(address _addr) public {\n _precompileSortValidatorAddress = _addr;\n }\n\n function precompilePickValidatorSetAddress() public view override returns (address) {\n return _precompileSortValidatorAddress;\n }\n\n function callPrecompile(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) public view returns (address[] memory _result) {\n (_result, ) = _pcPickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n }\n}\n" + }, + "contracts/mocks/ronin/MockRoninGatewayV2Extended.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../ronin/gateway/RoninGatewayV2.sol\";\n\ncontract MockRoninGatewayV2Extended is RoninGatewayV2 {\n /*\n * @dev Returns the vote weight for a deposit based on its corressponding hash.\n */\n function getDepositVoteWeight(\n uint256 _chainId,\n uint256 _depositId,\n bytes32 _hash\n ) external view returns (uint256, uint256) {\n return _getVoteWeight(depositVote[_chainId][_depositId], _hash);\n }\n\n /**\n * @dev Returns the vote weight for a mainchain withdrew acknowledgement based on its corressponding hash.\n */\n function getMainchainWithdrewVoteWeight(uint256 _withdrawalId, bytes32 _hash)\n external\n view\n returns (uint256, uint256)\n {\n return _getVoteWeight(mainchainWithdrewVote[_withdrawalId], _hash);\n }\n\n /**\n * @dev Returns the vote weight for a withdraw stats based on its corressponding hash.\n */\n function getWithdrawalStatVoteWeight(uint256 _withdrawalId, bytes32 _hash) external view returns (uint256, uint256) {\n return _getVoteWeight(withdrawalStatVote[_withdrawalId], _hash);\n }\n}\n" + }, + "contracts/mocks/MockTransferFallback.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"../extensions/RONTransferHelper.sol\";\n\ncontract MockPaymentFallback {\n event SafeReceived(address indexed sender, uint256 value);\n\n /// @dev Fallback function accepts ether transactions.\n receive() external payable {\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n\ncontract MockPaymentFallbackExpensive {\n uint[] public array;\n event SafeReceived(address indexed sender, uint256 value);\n\n constructor() {\n array.push(0);\n }\n\n /// @dev Fallback function accepts ether transactions and set non-zero value to a zero value slot.\n receive() external payable {\n array.push(block.number);\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n\ncontract MockTransfer is RONTransferHelper {\n uint256 public track;\n\n constructor() payable {}\n\n function fooTransfer(\n address payable _recipient,\n uint256 _amount,\n uint256 _gas\n ) external {\n if (_unsafeSendRON(_recipient, _amount, _gas)) {\n track++;\n }\n }\n}\n" + }, + "contracts/mocks/forwarder/MockForwarderTarget.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/RONTransferHelper.sol\";\n\ncontract MockForwarderTarget is RONTransferHelper {\n address public owner;\n uint256 public data;\n\n event TargetWithdrawn(address indexed _origin, address indexed _caller, address indexed _recipient);\n\n error ErrIntentionally();\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"MockForwarderContract: only owner can call method\");\n _;\n }\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n constructor(address _owner, uint256 _data) payable {\n owner = _owner;\n data = _data;\n }\n\n function foo(uint256 _data) external onlyOwner {\n data = _data;\n }\n\n function fooPayable(uint256 _data) external payable onlyOwner {\n data = _data;\n }\n\n function fooSilentRevert() external view onlyOwner {\n revert();\n }\n\n function fooCustomErrorRevert() external view onlyOwner {\n revert ErrIntentionally();\n }\n\n function fooRevert() external view onlyOwner {\n revert(\"MockForwarderContract: revert intentionally\");\n }\n\n function getBalance() external view returns (uint256) {\n return address(this).balance;\n }\n\n function withdrawAll() external onlyOwner {\n emit TargetWithdrawn(tx.origin, msg.sender, msg.sender);\n _transferRON(payable(msg.sender), address(this).balance);\n }\n\n function _fallback() private pure {\n revert(\"MockForwardTarget: hello from fallback\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 0 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "storageLayout" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/ronin-mainnet/solcInputs/85b953b22882c536a643bf4b61b3153b.json b/deployments/ronin-mainnet/solcInputs/85b953b22882c536a643bf4b61b3153b.json new file mode 100644 index 000000000..923fd155d --- /dev/null +++ b/deployments/ronin-mainnet/solcInputs/85b953b22882c536a643bf4b61b3153b.json @@ -0,0 +1,525 @@ +{ + "language": "Solidity", + "sources": { + "contracts/extensions/bridge-operator-governance/BOsGovernanceProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../libraries/BridgeOperatorsBallot.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\n\nabstract contract BOsGovernanceProposal is SignatureConsumer, IRoninGovernanceAdmin {\n using IsolatedGovernance for IsolatedGovernance.Vote;\n\n /// @dev The last the brige operator set info.\n BridgeOperatorsBallot.BridgeOperatorSet internal _lastSyncedBridgeOperatorSetInfo;\n /// @dev Mapping from period index => epoch index => bridge operators vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) internal _bridgeOperatorVote;\n /// @dev Mapping from bridge voter address => last block that the address voted\n mapping(address => uint256) internal _lastVotedBlock;\n /// @dev Mapping from period index => epoch index => voter => bridge voter signatures\n mapping(uint256 => mapping(uint256 => mapping(address => Signature))) internal _bridgeVoterSig;\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256) {\n return _lastVotedBlock[_bridgeVoter];\n }\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function lastSyncedBridgeOperatorSetInfo() external view returns (BridgeOperatorsBallot.BridgeOperatorSet memory) {\n return _lastSyncedBridgeOperatorSetInfo;\n }\n\n /**\n * @dev Votes for a set of bridge operators by signatures.\n *\n * Requirements:\n * - The period of voting is larger than the last synced period.\n * - The arrays are not empty.\n * - The signature signers are in order.\n *\n */\n function _castBOVotesBySignatures(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures,\n uint256 _minimumVoteWeight,\n bytes32 _domainSeperator\n ) internal {\n require(\n _ballot.period >= _lastSyncedBridgeOperatorSetInfo.period &&\n _ballot.epoch >= _lastSyncedBridgeOperatorSetInfo.epoch,\n \"BOsGovernanceProposal: query for outdated bridge operator set\"\n );\n BridgeOperatorsBallot.verifyBallot(_ballot);\n require(_signatures.length > 0, \"BOsGovernanceProposal: invalid array length\");\n\n address _signer;\n address _lastSigner;\n bytes32 _hash = BridgeOperatorsBallot.hash(_ballot);\n bytes32 _digest = ECDSA.toTypedDataHash(_domainSeperator, _hash);\n IsolatedGovernance.Vote storage _v = _bridgeOperatorVote[_ballot.period][_ballot.epoch];\n mapping(address => Signature) storage _sigMap = _bridgeVoterSig[_ballot.period][_ballot.epoch];\n bool _hasValidVotes;\n\n for (uint256 _i; _i < _signatures.length; _i++) {\n // Avoids stack too deeps\n {\n Signature calldata _sig = _signatures[_i];\n _signer = ECDSA.recover(_digest, _sig.v, _sig.r, _sig.s);\n require(_lastSigner < _signer, \"BOsGovernanceProposal: invalid signer order\");\n _lastSigner = _signer;\n }\n\n if (_isBridgeVoter(_signer)) {\n _hasValidVotes = true;\n _lastVotedBlock[_signer] = block.number;\n _sigMap[_signer] = _signatures[_i];\n _v.castVote(_signer, _hash);\n }\n }\n\n require(_hasValidVotes, \"BOsGovernanceProposal: invalid signatures\");\n address[] memory _filteredVoters = _v.filterByHash(_hash);\n _v.syncVoteStatus(_minimumVoteWeight, _sumBridgeVoterWeights(_filteredVoters), 0, 0, _hash);\n }\n\n /**\n * @dev Returns whether the address is the bridge voter.\n */\n function _isBridgeVoter(address) internal view virtual returns (bool);\n\n /**\n * @dev Returns the weight of many bridge voters.\n */\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual returns (uint256);\n}\n" + }, + "contracts/interfaces/consumers/SignatureConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface SignatureConsumer {\n struct Signature {\n uint8 v;\n bytes32 r;\n bytes32 s;\n }\n}\n" + }, + "contracts/libraries/BridgeOperatorsBallot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary BridgeOperatorsBallot {\n struct BridgeOperatorSet {\n uint256 period;\n uint256 epoch;\n address[] operators;\n }\n\n // keccak256(\"BridgeOperatorsBallot(uint256 period,uint256 epoch,address[] operators)\");\n bytes32 public constant BRIDGE_OPERATORS_BALLOT_TYPEHASH =\n 0xd679a49e9e099fa9ed83a5446aaec83e746b03ec6723d6f5efb29d37d7f0b78a;\n\n /**\n * @dev Verifies whether the ballot is valid or not.\n *\n * Requirements:\n * - The ballot is not for an empty operator set.\n * - The operator address list is in order.\n *\n */\n function verifyBallot(BridgeOperatorSet calldata _ballot) internal pure {\n require(_ballot.operators.length > 0, \"BridgeOperatorsBallot: invalid array length\");\n address _addr = _ballot.operators[0];\n for (uint _i = 1; _i < _ballot.operators.length; _i++) {\n require(_addr < _ballot.operators[_i], \"BridgeOperatorsBallot: invalid order of bridge operators\");\n _addr = _ballot.operators[_i];\n }\n }\n\n /**\n * @dev Returns hash of the ballot.\n */\n function hash(BridgeOperatorSet calldata _ballot) internal pure returns (bytes32) {\n bytes32 _operatorsHash;\n address[] memory _operators = _ballot.operators;\n\n assembly {\n _operatorsHash := keccak256(add(_operators, 32), mul(mload(_operators), 32))\n }\n\n return keccak256(abi.encode(BRIDGE_OPERATORS_BALLOT_TYPEHASH, _ballot.period, _ballot.epoch, _operatorsHash));\n }\n}\n" + }, + "contracts/interfaces/IRoninGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/BridgeOperatorsBallot.sol\";\n\ninterface IRoninGovernanceAdmin {\n /// @dev Emitted when the bridge operators are approved.\n event BridgeOperatorsApproved(uint256 _period, uint256 _epoch, address[] _operators);\n /// @dev Emitted when an emergency exit poll is created.\n event EmergencyExitPollCreated(\n bytes32 _voteHash,\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n );\n /// @dev Emitted when an emergency exit poll is approved.\n event EmergencyExitPollApproved(bytes32 _voteHash);\n /// @dev Emitted when an emergency exit poll is expired.\n event EmergencyExitPollExpired(bytes32 _voteHash);\n\n /**\n * @dev Returns the last voted block of the bridge voter.\n */\n function lastVotedBlock(address _bridgeVoter) external view returns (uint256);\n\n /**\n * @dev Returns the synced bridge operator set info.\n */\n function lastSyncedBridgeOperatorSetInfo()\n external\n view\n returns (BridgeOperatorsBallot.BridgeOperatorSet memory _bridgeOperatorSetInfo);\n\n /**\n * @dev Create a vote to agree that an emergency exit is valid and should return the locked funds back.a\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n */\n function createEmergencyExitPoll(\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) external;\n}\n" + }, + "contracts/libraries/IsolatedGovernance.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../interfaces/consumers/VoteStatusConsumer.sol\";\n\nlibrary IsolatedGovernance {\n struct Vote {\n VoteStatusConsumer.VoteStatus status;\n bytes32 finalHash;\n /// @dev Mapping from voter => receipt hash\n mapping(address => bytes32) voteHashOf;\n /// @dev The timestamp that voting is expired (no expiration=0)\n uint256 expiredAt;\n /// @dev The timestamp that voting is created\n uint256 createdAt;\n /// @dev The list of voters\n address[] voters;\n }\n\n /**\n * @dev Casts vote for the receipt with the receipt hash `_hash`.\n *\n * Requirements:\n * - The voter has not voted for the round.\n *\n */\n function castVote(\n Vote storage _v,\n address _voter,\n bytes32 _hash\n ) internal {\n if (_v.expiredAt > 0 && _v.expiredAt <= block.timestamp) {\n _v.status = VoteStatusConsumer.VoteStatus.Expired;\n }\n\n if (voted(_v, _voter)) {\n revert(\n string(abi.encodePacked(\"IsolatedGovernance: \", Strings.toHexString(uint160(_voter), 20), \" already voted\"))\n );\n }\n\n _v.voteHashOf[_voter] = _hash;\n _v.voters.push(_voter);\n }\n\n /**\n * @dev Updates vote with the requirement of minimum vote weight.\n */\n function syncVoteStatus(\n Vote storage _v,\n uint256 _minimumVoteWeight,\n uint256 _votedWeightForHash,\n uint256 _minimumTrustedVoteWeight,\n uint256 _trustedVotedWeightForHash,\n bytes32 _hash\n ) internal returns (VoteStatusConsumer.VoteStatus _status) {\n if (\n _votedWeightForHash >= _minimumVoteWeight &&\n _trustedVotedWeightForHash >= _minimumTrustedVoteWeight &&\n _v.status == VoteStatusConsumer.VoteStatus.Pending\n ) {\n _v.status = VoteStatusConsumer.VoteStatus.Approved;\n _v.finalHash = _hash;\n }\n\n return _v.status;\n }\n\n /**\n * @dev Returns the list of vote's addresses that voted for the hash `_hash`.\n */\n function filterByHash(Vote storage _v, bytes32 _hash) internal view returns (address[] memory _voters) {\n uint256 _count;\n _voters = new address[](_v.voters.length);\n\n for (uint _i; _i < _voters.length; _i++) {\n address _voter = _v.voters[_i];\n if (_v.voteHashOf[_voter] == _hash) {\n _voters[_count++] = _voter;\n }\n }\n\n assembly {\n mstore(_voters, _count)\n }\n }\n\n /**\n * @dev Returns whether the voter casted for the proposal.\n */\n function voted(Vote storage _v, address _voter) internal view returns (bool) {\n return _v.voteHashOf[_voter] != bytes32(0);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.3) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/interfaces/consumers/VoteStatusConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface VoteStatusConsumer {\n enum VoteStatus {\n Pending,\n Approved,\n Executed,\n Rejected,\n Expired\n }\n}\n" + }, + "contracts/ronin/RoninGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../extensions/bridge-operator-governance/BOsGovernanceProposal.sol\";\nimport \"../extensions/sequential-governance/GovernanceProposal.sol\";\nimport \"../extensions/collections/HasValidatorContract.sol\";\nimport \"../extensions/GovernanceAdmin.sol\";\nimport \"../libraries/EmergencyExitBallot.sol\";\nimport \"../interfaces/IRoninGovernanceAdmin.sol\";\n\ncontract RoninGovernanceAdmin is\n IRoninGovernanceAdmin,\n GovernanceAdmin,\n GovernanceProposal,\n BOsGovernanceProposal,\n HasValidatorContract\n{\n using Proposal for Proposal.ProposalDetail;\n using IsolatedGovernance for IsolatedGovernance.Vote;\n\n /// @dev Mapping from request hash => emergency poll\n mapping(bytes32 => IsolatedGovernance.Vote) internal _emergencyExitPoll;\n\n modifier onlyGovernor() {\n require(_getWeight(msg.sender) > 0, \"RoninGovernanceAdmin: sender is not governor\");\n _;\n }\n\n constructor(\n uint256 _roninChainId,\n address _roninTrustedOrganizationContract,\n address _bridgeContract,\n address _validatorContract,\n uint256 _proposalExpiryDuration\n ) GovernanceAdmin(_roninChainId, _roninTrustedOrganizationContract, _bridgeContract, _proposalExpiryDuration) {\n _setValidatorContract(_validatorContract);\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function setValidatorContract(address _addr) external override onlySelfCall {\n require(_addr.code.length > 0, \"RoninGovernanceAdmin: set to non-contract\");\n _setValidatorContract(_addr);\n }\n\n /**\n * @dev Returns the voted signatures for the proposals.\n *\n * Note: The signatures can be empty in case the proposal is voted on the current network.\n *\n */\n function getProposalSignatures(uint256 _chainId, uint256 _round)\n external\n view\n returns (\n address[] memory _voters,\n Ballot.VoteType[] memory _supports,\n Signature[] memory _signatures\n )\n {\n ProposalVote storage _vote = vote[_chainId][_round];\n\n uint256 _forLength = _vote.forVoteds.length;\n uint256 _againstLength = _vote.againstVoteds.length;\n uint256 _voterLength = _forLength + _againstLength;\n\n _supports = new Ballot.VoteType[](_voterLength);\n _signatures = new Signature[](_voterLength);\n _voters = new address[](_voterLength);\n for (uint256 _i; _i < _forLength; _i++) {\n _supports[_i] = Ballot.VoteType.For;\n _signatures[_i] = vote[_chainId][_round].sig[_vote.forVoteds[_i]];\n _voters[_i] = _vote.forVoteds[_i];\n }\n for (uint256 _i; _i < _againstLength; _i++) {\n _supports[_i + _forLength] = Ballot.VoteType.Against;\n _signatures[_i + _forLength] = vote[_chainId][_round].sig[_vote.againstVoteds[_i]];\n _voters[_i + _forLength] = _vote.againstVoteds[_i];\n }\n }\n\n /**\n * @dev Returns the voted signatures for bridge operators at a specific period.\n */\n function getBridgeOperatorVotingSignatures(uint256 _period, uint256 _epoch)\n external\n view\n returns (address[] memory _voters, Signature[] memory _signatures)\n {\n mapping(address => Signature) storage _sigMap = _bridgeVoterSig[_period][_epoch];\n _voters = _bridgeOperatorVote[_period][_epoch].voters;\n _signatures = new Signature[](_voters.length);\n for (uint _i; _i < _voters.length; _i++) {\n _signatures[_i] = _sigMap[_voters[_i]];\n }\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for the proposal.\n */\n function proposalVoted(\n uint256 _chainId,\n uint256 _round,\n address _voter\n ) external view returns (bool) {\n return _voted(vote[_chainId][_round], _voter);\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for bridge operators at a specific period.\n */\n function bridgeOperatorsVoted(\n uint256 _period,\n uint256 _epoch,\n address _voter\n ) external view returns (bool) {\n return _bridgeOperatorVote[_period][_epoch].voted(_voter);\n }\n\n /**\n * @dev Returns whether the voter casted vote for emergency exit poll.\n */\n function emergencyPollVoted(bytes32 _voteHash, address _voter) external view returns (bool) {\n return _emergencyExitPoll[_voteHash].voted(_voter);\n }\n\n /**\n * @dev See `CoreGovernance-_proposeProposal`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function propose(\n uint256 _chainId,\n uint256 _expiryTimestamp,\n address[] calldata _targets,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts\n ) external onlyGovernor {\n _proposeProposal(_chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts, msg.sender);\n }\n\n /**\n * @dev See `GovernanceProposal-_proposeProposalStructAndCastVotes`.\n *\n * Requirements:\n * - The method caller is governor.\n * - The proposal is for the current network.\n *\n */\n function proposeProposalStructAndCastVotes(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyGovernor {\n _proposeProposalStructAndCastVotes(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender);\n }\n\n /**\n * @dev Proposes and casts vote for a proposal on the current network.\n *\n * Requirements:\n * - The method caller is governor.\n * - The proposal is for the current network.\n *\n */\n function proposeProposalForCurrentNetwork(\n uint256 _expiryTimestamp,\n address[] calldata _targets,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts,\n Ballot.VoteType _support\n ) external onlyGovernor {\n address _voter = msg.sender;\n Proposal.ProposalDetail memory _proposal = _proposeProposal(\n block.chainid,\n _expiryTimestamp,\n _targets,\n _values,\n _calldatas,\n _gasAmounts,\n _voter\n );\n _castProposalVoteForCurrentNetwork(_voter, _proposal, _support);\n }\n\n /**\n * @dev Casts vote for a proposal on the current network.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function castProposalVoteForCurrentNetwork(Proposal.ProposalDetail calldata _proposal, Ballot.VoteType _support)\n external\n onlyGovernor\n {\n _castProposalVoteForCurrentNetwork(msg.sender, _proposal, _support);\n }\n\n /**\n * @dev See `GovernanceProposal-_castProposalBySignatures`.\n */\n function castProposalBySignatures(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external {\n _castProposalBySignatures(_proposal, _supports, _signatures, DOMAIN_SEPARATOR);\n }\n\n /**\n * @dev See `CoreGovernance-_proposeGlobal`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function proposeGlobal(\n uint256 _expiryTimestamp,\n GlobalProposal.TargetOption[] calldata _targetOptions,\n uint256[] calldata _values,\n bytes[] calldata _calldatas,\n uint256[] calldata _gasAmounts\n ) external onlyGovernor {\n _proposeGlobal(\n _expiryTimestamp,\n _targetOptions,\n _values,\n _calldatas,\n _gasAmounts,\n roninTrustedOrganizationContract(),\n bridgeContract(),\n msg.sender\n );\n }\n\n /**\n * @dev See `GovernanceProposal-_proposeGlobalProposalStructAndCastVotes`.\n *\n * Requirements:\n * - The method caller is governor.\n *\n */\n function proposeGlobalProposalStructAndCastVotes(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyGovernor {\n _proposeGlobalProposalStructAndCastVotes(\n _globalProposal,\n _supports,\n _signatures,\n DOMAIN_SEPARATOR,\n roninTrustedOrganizationContract(),\n bridgeContract(),\n msg.sender\n );\n }\n\n /**\n * @dev See `GovernanceProposal-_castGlobalProposalBySignatures`.\n */\n function castGlobalProposalBySignatures(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external {\n _castGlobalProposalBySignatures(\n _globalProposal,\n _supports,\n _signatures,\n DOMAIN_SEPARATOR,\n roninTrustedOrganizationContract(),\n bridgeContract()\n );\n }\n\n /**\n * @dev Deletes the expired proposal by its chainId and nonce, without creating a new proposal.\n *\n * Requirements:\n * - The proposal is already created.\n *\n */\n function deleteExpired(uint256 _chainId, uint256 _round) external {\n ProposalVote storage _vote = vote[_chainId][_round];\n require(_vote.hash != bytes32(0), \"RoninGovernanceAdmin: query for empty voting\");\n _tryDeleteExpiredVotingRound(_vote);\n }\n\n /**\n * @dev See `BOsGovernanceProposal-_castVotesBySignatures`.\n */\n function voteBridgeOperatorsBySignatures(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures\n ) external {\n _castBOVotesBySignatures(_ballot, _signatures, _getMinimumVoteWeight(), DOMAIN_SEPARATOR);\n IsolatedGovernance.Vote storage _v = _bridgeOperatorVote[_ballot.period][_ballot.epoch];\n if (_v.status == VoteStatus.Approved) {\n _lastSyncedBridgeOperatorSetInfo = _ballot;\n emit BridgeOperatorsApproved(_ballot.period, _ballot.epoch, _ballot.operators);\n _v.status = VoteStatus.Executed;\n }\n }\n\n /**\n * @inheritdoc IRoninGovernanceAdmin\n */\n function createEmergencyExitPoll(\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) external onlyValidatorContract {\n bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\n IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash];\n _v.createdAt = block.timestamp;\n _v.expiredAt = _expiredAt;\n emit EmergencyExitPollCreated(_hash, _consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\n }\n\n /**\n * @dev Votes for an emergency exit. Executes to unlock fund for the emergency exit's requester.\n *\n * Requirements:\n * - The voter is governor.\n * - The voting is existent.\n * - The voting is not expired yet.\n *\n */\n function voteEmergencyExit(\n bytes32 _voteHash,\n address _consensusAddr,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) external onlyGovernor {\n address _voter = msg.sender;\n bytes32 _hash = EmergencyExitBallot.hash(_consensusAddr, _recipientAfterUnlockedFund, _requestedAt, _expiredAt);\n require(_voteHash == _hash, \"RoninGovernanceAdmin: invalid vote hash\");\n\n IsolatedGovernance.Vote storage _v = _emergencyExitPoll[_hash];\n require(_v.createdAt > 0, \"RoninGovernanceAdmin: query for non-existent vote\");\n require(_v.status != VoteStatus.Expired, \"RoninGovernanceAdmin: query for expired vote\");\n\n _v.castVote(_voter, _hash);\n address[] memory _voters = _v.filterByHash(_hash);\n VoteStatus _stt = _v.syncVoteStatus(_getMinimumVoteWeight(), _sumGovernorWeights(_voters), 0, 0, _hash);\n if (_stt == VoteStatus.Approved) {\n _execReleaseLockedFundForEmergencyExitRequest(_consensusAddr, _recipientAfterUnlockedFund);\n emit EmergencyExitPollApproved(_hash);\n _v.status = VoteStatus.Executed;\n } else if (_stt == VoteStatus.Expired) {\n emit EmergencyExitPollExpired(_hash);\n }\n }\n\n /**\n * @inheritdoc GovernanceProposal\n */\n function _getWeight(address _governor) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.getGovernorWeight.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governor)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Returns the total weight of a list address of governors.\n */\n function _sumGovernorWeights(address[] memory _governors) internal view virtual returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumGovernorWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governors)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Returns the bridge voter weight.\n */\n function _getBridgeVoterWeight(address _governor) internal view virtual returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.getBridgeVoterWeight.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governor)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @inheritdoc BOsGovernanceProposal\n */\n function _isBridgeVoter(address _addr) internal view virtual override returns (bool) {\n return _getBridgeVoterWeight(_addr) > 0;\n }\n\n /**\n * @inheritdoc BOsGovernanceProposal\n */\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumBridgeVoterWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _bridgeVoters)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Trigger function from validator contract to unlock fund for emeregency exit request.\n */\n function _execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address _recipientAfterUnlockedFund)\n internal\n virtual\n {\n bytes4 _selector = _validatorContract.execReleaseLockedFundForEmergencyExitRequest.selector;\n (bool _success, ) = validatorContract().call(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _consensusAddr, _recipientAfterUnlockedFund)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n }\n\n /**\n * @dev See `CoreGovernance-_getChainType`.\n */\n function _getChainType() internal pure override returns (ChainType) {\n return ChainType.RoninChain;\n }\n\n /**\n * @dev See `castProposalVoteForCurrentNetwork`.\n */\n function _castProposalVoteForCurrentNetwork(\n address _voter,\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType _support\n ) internal {\n require(_proposal.chainId == block.chainid, \"RoninGovernanceAdmin: invalid chain id\");\n require(\n vote[_proposal.chainId][_proposal.nonce].hash == _proposal.hash(),\n \"RoninGovernanceAdmin: cast vote for invalid proposal\"\n );\n\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\n Signature memory _emptySignature;\n _castVote(\n _proposal,\n _support,\n _minimumForVoteWeight,\n _minimumAgainstVoteWeight,\n _voter,\n _emptySignature,\n _getWeight(_voter)\n );\n }\n}\n" + }, + "contracts/extensions/sequential-governance/GovernanceProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./CoreGovernance.sol\";\n\nabstract contract GovernanceProposal is CoreGovernance {\n using Proposal for Proposal.ProposalDetail;\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\n\n /**\n * @dev Casts votes by signatures.\n *\n * Note: This method does not verify the proposal hash with the vote hash. Please consider checking it before.\n *\n */\n function _castVotesBySignatures(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _forDigest,\n bytes32 _againstDigest\n ) internal {\n require(_supports.length > 0 && _supports.length == _signatures.length, \"GovernanceProposal: invalid array length\");\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\n\n address _lastSigner;\n address _signer;\n Signature calldata _sig;\n bool _hasValidVotes;\n for (uint256 _i; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n\n if (_supports[_i] == Ballot.VoteType.For) {\n _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s);\n } else if (_supports[_i] == Ballot.VoteType.Against) {\n _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s);\n } else {\n revert(\"GovernanceProposal: query for unsupported vote type\");\n }\n\n require(_lastSigner < _signer, \"GovernanceProposal: invalid order\");\n _lastSigner = _signer;\n\n uint256 _weight = _getWeight(_signer);\n if (_weight > 0) {\n _hasValidVotes = true;\n if (\n _castVote(_proposal, _supports[_i], _minimumForVoteWeight, _minimumAgainstVoteWeight, _signer, _sig, _weight)\n ) {\n return;\n }\n }\n }\n\n require(_hasValidVotes, \"GovernanceProposal: invalid signatures\");\n }\n\n /**\n * @dev Proposes a proposal struct and casts votes by signature.\n */\n function _proposeProposalStructAndCastVotes(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _creator\n ) internal {\n _proposeProposalStruct(_proposal, _creator);\n bytes32 _proposalHash = _proposal.hash();\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes a proposal struct and casts votes by signature.\n */\n function _castProposalBySignatures(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator\n ) internal {\n bytes32 _proposalHash = _proposal.hash();\n require(\n vote[_proposal.chainId][_proposal.nonce].hash == _proposalHash,\n \"GovernanceAdmin: cast vote for invalid proposal\"\n );\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes and votes by signature.\n */\n function _proposeGlobalProposalStructAndCastVotes(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal returns (Proposal.ProposalDetail memory _proposal) {\n _proposal = _proposeGlobalStruct(_globalProposal, _roninTrustedOrganizationContract, _gatewayContract, _creator);\n bytes32 _globalProposalHash = _globalProposal.hash();\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Proposes a global proposal struct and casts votes by signature.\n */\n function _castGlobalProposalBySignatures(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _roninTrustedOrganizationContract,\n address _gatewayContract\n ) internal {\n Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail(\n _roninTrustedOrganizationContract,\n _gatewayContract\n );\n bytes32 _globalProposalHash = _globalProposal.hash();\n require(vote[0][_proposal.nonce].hash == _proposal.hash(), \"GovernanceAdmin: cast vote for invalid proposal\");\n _castVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Returns the weight of a governor.\n */\n function _getWeight(address _governor) internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/collections/HasValidatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasValidatorContract.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\n\ncontract HasValidatorContract is IHasValidatorContract, HasProxyAdmin {\n IRoninValidatorSet internal _validatorContract;\n\n modifier onlyValidatorContract() {\n if (validatorContract() != msg.sender) revert ErrCallerMustBeValidatorContract();\n _;\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function validatorContract() public view override returns (address) {\n return address(_validatorContract);\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function setValidatorContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setValidatorContract(_addr);\n }\n\n /**\n * @dev Sets the validator contract.\n *\n * Emits the event `ValidatorContractUpdated`.\n *\n */\n function _setValidatorContract(address _addr) internal {\n _validatorContract = IRoninValidatorSet(_addr);\n emit ValidatorContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/GovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../extensions/sequential-governance/CoreGovernance.sol\";\nimport \"../extensions/collections/HasRoninTrustedOrganizationContract.sol\";\nimport \"../extensions/collections/HasBridgeContract.sol\";\nimport \"../interfaces/IRoninTrustedOrganization.sol\";\n\nabstract contract GovernanceAdmin is CoreGovernance, HasRoninTrustedOrganizationContract, HasBridgeContract {\n uint256 public roninChainId;\n /// @dev Domain separator\n bytes32 public DOMAIN_SEPARATOR;\n\n error ErrProxyCallFailed(bytes4 methodSignature);\n\n modifier onlySelfCall() {\n require(msg.sender == address(this), \"GovernanceAdmin: only allowed self-call\");\n _;\n }\n\n constructor(\n uint256 _roninChainId,\n address _roninTrustedOrganizationContract,\n address _bridgeContract,\n uint256 _proposalExpiryDuration\n ) CoreGovernance(_proposalExpiryDuration) {\n roninChainId = _roninChainId;\n DOMAIN_SEPARATOR = keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,bytes32 salt)\"),\n keccak256(\"GovernanceAdmin\"), // name hash\n keccak256(\"2\"), // version hash\n keccak256(abi.encode(\"RONIN_GOVERNANCE_ADMIN\", _roninChainId)) // salt\n )\n );\n _setRoninTrustedOrganizationContract(_roninTrustedOrganizationContract);\n _setBridgeContract(_bridgeContract);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function setRoninTrustedOrganizationContract(address _addr) external override onlySelfCall {\n require(_addr.code.length > 0, \"GovernanceAdmin: set to non-contract\");\n _setRoninTrustedOrganizationContract(_addr);\n }\n\n /**\n * @inheritdoc IHasBridgeContract\n */\n function setBridgeContract(address _addr) external override onlySelfCall {\n require(_addr.code.length > 0, \"GovernanceAdmin: set to non-contract\");\n _setBridgeContract(_addr);\n }\n\n /**\n * @dev Sets the expiry duration for a new proposal.\n *\n * Requirements:\n * - Only allowing self-call to this method, since this contract does not have admin.\n *\n */\n function setProposalExpiryDuration(uint256 _expiryDuration) external onlySelfCall {\n _setProposalExpiryDuration(_expiryDuration);\n }\n\n /**\n * @dev Returns the current implementation of `_proxy`.\n *\n * Requirements:\n * - This contract must be the admin of `_proxy`.\n *\n */\n function getProxyImplementation(address _proxy) external view returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n bytes4 _selector = 0x5c60da1b;\n (bool _success, bytes memory _returndata) = _proxy.staticcall(abi.encodeWithSelector(_selector));\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (address));\n }\n\n /**\n * @dev Returns the proposal expiry duration.\n */\n function getProposalExpiryDuration() external view returns (uint256) {\n return super._getProposalExpiryDuration();\n }\n\n /**\n * @dev Returns the current admin of `_proxy`.\n *\n * Requirements:\n * - This contract must be the admin of `_proxy`.\n *\n */\n function getProxyAdmin(address _proxy) external view returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n bytes4 _selector = 0xf851a440;\n (bool _success, bytes memory _returndata) = _proxy.staticcall(abi.encodeWithSelector(_selector));\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `_proxy` to `newAdmin`.\n *\n * Requirements:\n * - This contract must be the current admin of `_proxy`.\n *\n */\n function changeProxyAdmin(address _proxy, address _newAdmin) external onlySelfCall {\n // bytes4(keccak256(\"changeAdmin(address)\"))\n bytes4 _selector = 0x8f283970;\n (bool _success, ) = _proxy.call(abi.encodeWithSelector(_selector, _newAdmin));\n if (!_success) revert ErrProxyCallFailed(_selector);\n }\n\n /**\n * @dev Override `CoreGovernance-_getMinimumVoteWeight`.\n */\n function _getMinimumVoteWeight() internal view virtual override returns (uint256) {\n bytes4 _selector = IQuorum.minimumVoteWeight.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev Override `CoreGovernance-_getTotalWeights`.\n */\n function _getTotalWeights() internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.totalWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n}\n" + }, + "contracts/libraries/EmergencyExitBallot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary EmergencyExitBallot {\n // keccak256(\"EmergencyExitBallot(address consensusAddress,address recipientAfterUnlockedFund,uint256 requestedAt,uint256 expiredAt)\");\n bytes32 public constant EMERGENCY_EXIT_BALLOT_TYPEHASH =\n 0x697acba4deaf1a718d8c2d93e42860488cb7812696f28ca10eed17bac41e7027;\n\n /**\n * @dev Returns hash of the ballot.\n */\n function hash(\n address _consensusAddress,\n address _recipientAfterUnlockedFund,\n uint256 _requestedAt,\n uint256 _expiredAt\n ) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n EMERGENCY_EXIT_BALLOT_TYPEHASH,\n _consensusAddress,\n _recipientAfterUnlockedFund,\n _requestedAt,\n _expiredAt\n )\n );\n }\n}\n" + }, + "contracts/extensions/sequential-governance/CoreGovernance.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../../libraries/Proposal.sol\";\nimport \"../../libraries/GlobalProposal.sol\";\nimport \"../../libraries/Ballot.sol\";\nimport \"../../interfaces/consumers/ChainTypeConsumer.sol\";\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\n\nabstract contract CoreGovernance is SignatureConsumer, VoteStatusConsumer, ChainTypeConsumer {\n using Proposal for Proposal.ProposalDetail;\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\n\n struct ProposalVote {\n VoteStatus status;\n bytes32 hash;\n uint256 againstVoteWeight; // Total weight of against votes\n uint256 forVoteWeight; // Total weight of for votes\n address[] forVoteds; // Array of addresses voting for\n address[] againstVoteds; // Array of addresses voting against\n uint256 expiryTimestamp;\n mapping(address => Signature) sig;\n mapping(address => bool) voted;\n }\n\n /// @dev Emitted when a proposal is created\n event ProposalCreated(\n uint256 indexed chainId,\n uint256 indexed round,\n bytes32 indexed proposalHash,\n Proposal.ProposalDetail proposal,\n address creator\n );\n /// @dev Emitted when a proposal is created\n event GlobalProposalCreated(\n uint256 indexed round,\n bytes32 indexed proposalHash,\n Proposal.ProposalDetail proposal,\n bytes32 globalProposalHash,\n GlobalProposal.GlobalProposalDetail globalProposal,\n address creator\n );\n /// @dev Emitted when the proposal is voted\n event ProposalVoted(bytes32 indexed proposalHash, address indexed voter, Ballot.VoteType support, uint256 weight);\n /// @dev Emitted when the proposal is approved\n event ProposalApproved(bytes32 indexed proposalHash);\n /// @dev Emitted when the vote is reject\n event ProposalRejected(bytes32 indexed proposalHash);\n /// @dev Emitted when the vote is expired\n event ProposalExpired(bytes32 indexed proposalHash);\n /// @dev Emitted when the proposal is executed\n event ProposalExecuted(bytes32 indexed proposalHash, bool[] successCalls, bytes[] returnDatas);\n\n /// @dev Mapping from chain id => vote round\n /// @notice chain id = 0 for global proposal\n mapping(uint256 => uint256) public round;\n /// @dev Mapping from chain id => vote round => proposal vote\n mapping(uint256 => mapping(uint256 => ProposalVote)) public vote;\n\n uint256 private _proposalExpiryDuration;\n\n constructor(uint256 _expiryDuration) {\n _setProposalExpiryDuration(_expiryDuration);\n }\n\n /**\n * @dev Creates new voting round by calculating the `_round` number of chain `_chainId`.\n * Increases the `_round` number if the previous one is not expired. Delete the previous proposal\n * if it is expired and not increase the `_round`.\n */\n function _createVotingRound(uint256 _chainId) internal returns (uint256 _round) {\n _round = round[_chainId];\n // Skip checking for the first ever round\n if (_round == 0) {\n _round = round[_chainId] = 1;\n } else {\n ProposalVote storage _latestProposalVote = vote[_chainId][_round];\n bool _isExpired = _tryDeleteExpiredVotingRound(_latestProposalVote);\n // Skip increasing round number if the latest round is expired, allow the vote to be overridden\n if (!_isExpired) {\n require(_latestProposalVote.status != VoteStatus.Pending, \"CoreGovernance: current proposal is not completed\");\n _round = ++round[_chainId];\n }\n }\n }\n\n /**\n * @dev Saves new round voting for the proposal `_proposalHash` of chain `_chainId`.\n */\n function _saveVotingRound(\n ProposalVote storage _vote,\n bytes32 _proposalHash,\n uint256 _expiryTimestamp\n ) internal {\n _vote.hash = _proposalHash;\n _vote.expiryTimestamp = _expiryTimestamp;\n }\n\n /**\n * @dev Proposes for a new proposal.\n *\n * Requirements:\n * - The chain id is not equal to 0.\n *\n * Emits the `ProposalCreated` event.\n *\n */\n function _proposeProposal(\n uint256 _chainId,\n uint256 _expiryTimestamp,\n address[] memory _targets,\n uint256[] memory _values,\n bytes[] memory _calldatas,\n uint256[] memory _gasAmounts,\n address _creator\n ) internal virtual returns (Proposal.ProposalDetail memory _proposal) {\n require(_chainId != 0, \"CoreGovernance: invalid chain id\");\n uint256 _round = _createVotingRound(_chainId);\n\n _proposal = Proposal.ProposalDetail(_round, _chainId, _expiryTimestamp, _targets, _values, _calldatas, _gasAmounts);\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n _saveVotingRound(vote[_chainId][_round], _proposalHash, _expiryTimestamp);\n emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator);\n }\n\n /**\n * @dev Proposes proposal struct.\n *\n * Requirements:\n * - The chain id is not equal to 0.\n * - The proposal nonce is equal to the new round.\n *\n * Emits the `ProposalCreated` event.\n *\n */\n function _proposeProposalStruct(Proposal.ProposalDetail memory _proposal, address _creator)\n internal\n virtual\n returns (uint256 _round)\n {\n uint256 _chainId = _proposal.chainId;\n require(_chainId != 0, \"CoreGovernance: invalid chain id\");\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n _round = _createVotingRound(_chainId);\n _saveVotingRound(vote[_chainId][_round], _proposalHash, _proposal.expiryTimestamp);\n require(_round == _proposal.nonce, \"CoreGovernance: invalid proposal nonce\");\n emit ProposalCreated(_chainId, _round, _proposalHash, _proposal, _creator);\n }\n\n /**\n * @dev Proposes for a global proposal.\n *\n * Emits the `GlobalProposalCreated` event.\n *\n */\n function _proposeGlobal(\n uint256 _expiryTimestamp,\n GlobalProposal.TargetOption[] calldata _targetOptions,\n uint256[] memory _values,\n bytes[] memory _calldatas,\n uint256[] memory _gasAmounts,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal virtual {\n uint256 _round = _createVotingRound(0);\n GlobalProposal.GlobalProposalDetail memory _globalProposal = GlobalProposal.GlobalProposalDetail(\n _round,\n _expiryTimestamp,\n _targetOptions,\n _values,\n _calldatas,\n _gasAmounts\n );\n Proposal.ProposalDetail memory _proposal = _globalProposal.into_proposal_detail(\n _roninTrustedOrganizationContract,\n _gatewayContract\n );\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n _saveVotingRound(vote[0][_round], _proposalHash, _expiryTimestamp);\n emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator);\n }\n\n /**\n * @dev Proposes global proposal struct.\n *\n * Requirements:\n * - The proposal nonce is equal to the new round.\n *\n * Emits the `GlobalProposalCreated` event.\n *\n */\n function _proposeGlobalStruct(\n GlobalProposal.GlobalProposalDetail memory _globalProposal,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal virtual returns (Proposal.ProposalDetail memory _proposal) {\n _proposal = _globalProposal.into_proposal_detail(_roninTrustedOrganizationContract, _gatewayContract);\n _proposal.validate(_proposalExpiryDuration);\n\n bytes32 _proposalHash = _proposal.hash();\n uint256 _round = _createVotingRound(0);\n _saveVotingRound(vote[0][_round], _proposalHash, _globalProposal.expiryTimestamp);\n require(_round == _proposal.nonce, \"CoreGovernance: invalid proposal nonce\");\n emit GlobalProposalCreated(_round, _proposalHash, _proposal, _globalProposal.hash(), _globalProposal, _creator);\n }\n\n /**\n * @dev Casts vote for the proposal with data and returns whether the voting is done.\n *\n * Requirements:\n * - The proposal nonce is equal to the round.\n * - The vote is not finalized.\n * - The voter has not voted for the round.\n *\n * Emits the `ProposalVoted` event. Emits the `ProposalApproved`, `ProposalExecuted` or `ProposalRejected` once the\n * proposal is approved, executed or rejected.\n *\n */\n function _castVote(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType _support,\n uint256 _minimumForVoteWeight,\n uint256 _minimumAgainstVoteWeight,\n address _voter,\n Signature memory _signature,\n uint256 _voterWeight\n ) internal virtual returns (bool _done) {\n uint256 _chainId = _proposal.chainId;\n uint256 _round = _proposal.nonce;\n ProposalVote storage _vote = vote[_chainId][_round];\n\n if (_tryDeleteExpiredVotingRound(_vote)) {\n return true;\n }\n\n require(round[_proposal.chainId] == _round, \"CoreGovernance: query for invalid proposal nonce\");\n require(_vote.status == VoteStatus.Pending, \"CoreGovernance: the vote is finalized\");\n if (_voted(_vote, _voter)) {\n revert(string(abi.encodePacked(\"CoreGovernance: \", Strings.toHexString(uint160(_voter), 20), \" already voted\")));\n }\n\n _vote.voted[_voter] = true;\n // Stores the signature if it is not empty\n if (_signature.r > 0 || _signature.s > 0 || _signature.v > 0) {\n _vote.sig[_voter] = _signature;\n }\n emit ProposalVoted(_vote.hash, _voter, _support, _voterWeight);\n\n uint256 _forVoteWeight;\n uint256 _againstVoteWeight;\n if (_support == Ballot.VoteType.For) {\n _vote.forVoteds.push(_voter);\n _forVoteWeight = _vote.forVoteWeight += _voterWeight;\n } else if (_support == Ballot.VoteType.Against) {\n _vote.againstVoteds.push(_voter);\n _againstVoteWeight = _vote.againstVoteWeight += _voterWeight;\n } else {\n revert(\"CoreGovernance: unsupported vote type\");\n }\n\n if (_forVoteWeight >= _minimumForVoteWeight) {\n _done = true;\n _vote.status = VoteStatus.Approved;\n emit ProposalApproved(_vote.hash);\n _tryExecute(_vote, _proposal);\n } else if (_againstVoteWeight >= _minimumAgainstVoteWeight) {\n _done = true;\n _vote.status = VoteStatus.Rejected;\n emit ProposalRejected(_vote.hash);\n }\n }\n\n /**\n * @dev When the contract is on Ronin chain, checks whether the proposal is expired and delete it if is expired.\n *\n * Emits the event `ProposalExpired` if the vote is expired.\n *\n * Note: This function assumes the vote `_proposalVote` is already created, consider verifying the vote's existence\n * before or it will emit an unexpected event of `ProposalExpired`.\n */\n function _tryDeleteExpiredVotingRound(ProposalVote storage _proposalVote) internal returns (bool _isExpired) {\n _isExpired =\n _getChainType() == ChainType.RoninChain &&\n _proposalVote.status == VoteStatus.Pending &&\n _proposalVote.expiryTimestamp <= block.timestamp;\n\n if (_isExpired) {\n emit ProposalExpired(_proposalVote.hash);\n\n for (uint256 _i; _i < _proposalVote.forVoteds.length; _i++) {\n delete _proposalVote.voted[_proposalVote.forVoteds[_i]];\n delete _proposalVote.sig[_proposalVote.forVoteds[_i]];\n }\n for (uint256 _i; _i < _proposalVote.againstVoteds.length; _i++) {\n delete _proposalVote.voted[_proposalVote.againstVoteds[_i]];\n delete _proposalVote.sig[_proposalVote.againstVoteds[_i]];\n }\n delete _proposalVote.status;\n delete _proposalVote.hash;\n delete _proposalVote.againstVoteWeight;\n delete _proposalVote.forVoteWeight;\n delete _proposalVote.forVoteds;\n delete _proposalVote.againstVoteds;\n delete _proposalVote.expiryTimestamp;\n }\n }\n\n /**\n * @dev Executes the proposal and update the vote status once the proposal is executable.\n */\n function _tryExecute(ProposalVote storage _vote, Proposal.ProposalDetail memory _proposal) internal {\n if (_proposal.executable()) {\n _vote.status = VoteStatus.Executed;\n (bool[] memory _successCalls, bytes[] memory _returnDatas) = _proposal.execute();\n emit ProposalExecuted(_vote.hash, _successCalls, _returnDatas);\n }\n }\n\n /**\n * @dev Sets the expiry duration for a new proposal.\n */\n function _setProposalExpiryDuration(uint256 _expiryDuration) internal {\n _proposalExpiryDuration = _expiryDuration;\n }\n\n /**\n * @dev Returns whether the voter casted for the proposal.\n */\n function _voted(ProposalVote storage _vote, address _voter) internal view returns (bool) {\n return _vote.voted[_voter];\n }\n\n /**\n * @dev Returns the expiry duration for a new proposal.\n */\n function _getProposalExpiryDuration() internal view returns (uint256) {\n return _proposalExpiryDuration;\n }\n\n /**\n * @dev Returns total weight from validators.\n */\n function _getTotalWeights() internal view virtual returns (uint256);\n\n /**\n * @dev Returns minimum vote to pass a proposal.\n */\n function _getMinimumVoteWeight() internal view virtual returns (uint256);\n\n /**\n * @dev Returns current context is running on whether Ronin chain or on mainchain.\n */\n function _getChainType() internal view virtual returns (ChainType);\n}\n" + }, + "contracts/libraries/Proposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nlibrary Proposal {\n struct ProposalDetail {\n // Nonce to make sure proposals are executed in order\n uint256 nonce;\n // Value 0: all chain should run this proposal\n // Other values: only specifc chain has to execute\n uint256 chainId;\n uint256 expiryTimestamp;\n address[] targets;\n uint256[] values;\n bytes[] calldatas;\n uint256[] gasAmounts;\n }\n\n // keccak256(\"ProposalDetail(uint256 nonce,uint256 chainId,uint256 expiryTimestamp,address[] targets,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\");\n bytes32 public constant TYPE_HASH = 0xd051578048e6ff0bbc9fca3b65a42088dbde10f36ca841de566711087ad9b08a;\n\n /**\n * @dev Validates the proposal.\n */\n function validate(ProposalDetail memory _proposal, uint256 _maxExpiryDuration) internal view {\n require(\n _proposal.targets.length > 0 &&\n _proposal.targets.length == _proposal.values.length &&\n _proposal.targets.length == _proposal.calldatas.length &&\n _proposal.targets.length == _proposal.gasAmounts.length,\n \"Proposal: invalid array length\"\n );\n require(_proposal.expiryTimestamp <= block.timestamp + _maxExpiryDuration, \"Proposal: invalid expiry timestamp\");\n }\n\n /**\n * @dev Returns struct hash of the proposal.\n */\n function hash(ProposalDetail memory _proposal) internal pure returns (bytes32) {\n bytes32 _targetsHash;\n bytes32 _valuesHash;\n bytes32 _calldatasHash;\n bytes32 _gasAmountsHash;\n\n uint256[] memory _values = _proposal.values;\n address[] memory _targets = _proposal.targets;\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _calldataHashList.length; _i++) {\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\n }\n\n assembly {\n _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32))\n _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32))\n _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32))\n _gasAmountsHash := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32))\n }\n\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _proposal.nonce,\n _proposal.chainId,\n _proposal.expiryTimestamp,\n _targetsHash,\n _valuesHash,\n _calldatasHash,\n _gasAmountsHash\n )\n );\n }\n\n /**\n * @dev Returns whether the proposal is executable for the current chain.\n *\n * @notice Does not check whether the call result is successful or not. Please use `execute` instead.\n *\n */\n function executable(ProposalDetail memory _proposal) internal view returns (bool _result) {\n return _proposal.chainId == 0 || _proposal.chainId == block.chainid;\n }\n\n /**\n * @dev Executes the proposal.\n */\n function execute(ProposalDetail memory _proposal)\n internal\n returns (bool[] memory _successCalls, bytes[] memory _returnDatas)\n {\n require(executable(_proposal), \"Proposal: query for invalid chainId\");\n _successCalls = new bool[](_proposal.targets.length);\n _returnDatas = new bytes[](_proposal.targets.length);\n for (uint256 _i = 0; _i < _proposal.targets.length; ++_i) {\n require(gasleft() > _proposal.gasAmounts[_i], \"Proposal: insufficient gas\");\n\n (_successCalls[_i], _returnDatas[_i]) = _proposal.targets[_i].call{\n value: _proposal.values[_i],\n gas: _proposal.gasAmounts[_i]\n }(_proposal.calldatas[_i]);\n }\n }\n}\n" + }, + "contracts/libraries/GlobalProposal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./Proposal.sol\";\n\nlibrary GlobalProposal {\n enum TargetOption {\n RoninTrustedOrganizationContract,\n GatewayContract\n }\n\n struct GlobalProposalDetail {\n // Nonce to make sure proposals are executed in order\n uint256 nonce;\n uint256 expiryTimestamp;\n TargetOption[] targetOptions;\n uint256[] values;\n bytes[] calldatas;\n uint256[] gasAmounts;\n }\n\n // keccak256(\"GlobalProposalDetail(uint256 nonce,uint256 expiryTimestamp,uint8[] targetOptions,uint256[] values,bytes[] calldatas,uint256[] gasAmounts)\");\n bytes32 public constant TYPE_HASH = 0x1463f426c05aff2c1a7a0957a71c9898bc8b47142540538e79ee25ee91141350;\n\n /**\n * @dev Returns struct hash of the proposal.\n */\n function hash(GlobalProposalDetail memory _proposal) internal pure returns (bytes32) {\n bytes32 _targetsHash;\n bytes32 _valuesHash;\n bytes32 _calldatasHash;\n bytes32 _gasAmountsHash;\n\n uint256[] memory _values = _proposal.values;\n TargetOption[] memory _targets = _proposal.targetOptions;\n bytes32[] memory _calldataHashList = new bytes32[](_proposal.calldatas.length);\n uint256[] memory _gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _calldataHashList.length; _i++) {\n _calldataHashList[_i] = keccak256(_proposal.calldatas[_i]);\n }\n\n assembly {\n _targetsHash := keccak256(add(_targets, 32), mul(mload(_targets), 32))\n _valuesHash := keccak256(add(_values, 32), mul(mload(_values), 32))\n _calldatasHash := keccak256(add(_calldataHashList, 32), mul(mload(_calldataHashList), 32))\n _gasAmountsHash := keccak256(add(_gasAmounts, 32), mul(mload(_gasAmounts), 32))\n }\n\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _proposal.nonce,\n _proposal.expiryTimestamp,\n _targetsHash,\n _valuesHash,\n _calldatasHash,\n _gasAmountsHash\n )\n );\n }\n\n /**\n * @dev Converts into the normal proposal.\n */\n function into_proposal_detail(\n GlobalProposalDetail memory _proposal,\n address _roninTrustedOrganizationContract,\n address _gatewayContract\n ) internal pure returns (Proposal.ProposalDetail memory _detail) {\n _detail.nonce = _proposal.nonce;\n _detail.expiryTimestamp = _proposal.expiryTimestamp;\n _detail.chainId = 0;\n _detail.targets = new address[](_proposal.targetOptions.length);\n _detail.values = _proposal.values;\n _detail.calldatas = _proposal.calldatas;\n _detail.gasAmounts = _proposal.gasAmounts;\n\n for (uint256 _i; _i < _proposal.targetOptions.length; _i++) {\n if (_proposal.targetOptions[_i] == TargetOption.GatewayContract) {\n _detail.targets[_i] = _gatewayContract;\n } else if (_proposal.targetOptions[_i] == TargetOption.RoninTrustedOrganizationContract) {\n _detail.targets[_i] = _roninTrustedOrganizationContract;\n } else {\n revert(\"GlobalProposal: unsupported target\");\n }\n }\n }\n}\n" + }, + "contracts/libraries/Ballot.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\n\nlibrary Ballot {\n using ECDSA for bytes32;\n\n enum VoteType {\n For,\n Against\n }\n\n // keccak256(\"Ballot(bytes32 proposalHash,uint8 support)\");\n bytes32 public constant BALLOT_TYPEHASH = 0xd900570327c4c0df8dd6bdd522b7da7e39145dd049d2fd4602276adcd511e3c2;\n\n function hash(bytes32 _proposalHash, VoteType _support) internal pure returns (bytes32) {\n return keccak256(abi.encode(BALLOT_TYPEHASH, _proposalHash, _support));\n }\n}\n" + }, + "contracts/interfaces/consumers/ChainTypeConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface ChainTypeConsumer {\n enum ChainType {\n RoninChain,\n Mainchain\n }\n}\n" + }, + "contracts/extensions/collections/HasProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/StorageSlot.sol\";\n\nabstract contract HasProxyAdmin {\n // bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n modifier onlyAdmin() {\n require(msg.sender == _getAdmin(), \"HasProxyAdmin: unauthorized sender\");\n _;\n }\n\n /**\n * @dev Returns proxy admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n}\n" + }, + "contracts/interfaces/collections/IHasValidatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasValidatorContract is IHasContract {\n /// @dev Emitted when the validator contract is updated.\n event ValidatorContractUpdated(address);\n\n /// @dev Error of method caller must be validator contract.\n error ErrCallerMustBeValidatorContract();\n\n /**\n * @dev Returns the validator contract.\n */\n function validatorContract() external view returns (address);\n\n /**\n * @dev Sets the validator contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `ValidatorContractUpdated`.\n *\n */\n function setValidatorContract(address) external;\n}\n" + }, + "contracts/interfaces/validator/IRoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ICandidateManager.sol\";\nimport \"./info-fragments/ICommonInfo.sol\";\nimport \"./ICoinbaseExecution.sol\";\nimport \"./ISlashingExecution.sol\";\nimport \"./IEmergencyExit.sol\";\n\ninterface IRoninValidatorSet is\n ICandidateManager,\n ICommonInfo,\n ISlashingExecution,\n ICoinbaseExecution,\n IEmergencyExit\n{}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "contracts/interfaces/collections/IHasContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IHasContract {\n /// @dev Error of set to non-contract.\n error ErrZeroCodeContract();\n}\n" + }, + "contracts/interfaces/validator/ICandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ICandidateManager {\n struct ValidatorCandidate {\n // Admin of the candidate\n address admin;\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n address consensusAddr;\n // Address that receives mining reward of the validator\n address payable treasuryAddr;\n // Address of the bridge operator corresponding to the candidate\n address bridgeOperatorAddr;\n // The percentage of reward that validators can be received, the rest goes to the delegators.\n // Values in range [0; 100_00] stands for 0-100%\n uint256 commissionRate;\n // The timestamp that scheduled to revoke the candidate (no schedule=0)\n uint256 revokingTimestamp;\n // The deadline that the candidate must top up staking amount to keep it larger than or equal to the threshold (no deadline=0)\n uint256 topupDeadline;\n }\n\n struct CommissionSchedule {\n // The timestamp that the commission schedule gets affected (no schedule=0).\n uint256 effectiveTimestamp;\n // The new commission rate. Value is in range [0; 100_00], stands for 0-100%\n uint256 commissionRate;\n }\n\n /// @dev Emitted when the maximum number of validator candidates is updated.\n event MaxValidatorCandidateUpdated(uint256 threshold);\n /// @dev Emitted when the min offset to the effective date of commission rate change is updated.\n event MinEffectiveDaysOnwardsUpdated(uint256 numOfDays);\n /// @dev Emitted when the validator candidate is granted.\n event CandidateGranted(\n address indexed consensusAddr,\n address indexed treasuryAddr,\n address indexed admin,\n address bridgeOperator\n );\n /// @dev Emitted when the revoking timestamp of a candidate is updated.\n event CandidateRevokingTimestampUpdated(address indexed consensusAddr, uint256 revokingTimestamp);\n /// @dev Emitted when the topup deadline of a candidate is updated.\n event CandidateTopupDeadlineUpdated(address indexed consensusAddr, uint256 topupDeadline);\n /// @dev Emitted when the validator candidate is revoked.\n event CandidatesRevoked(address[] consensusAddrs);\n\n /// @dev Emitted when a schedule for updating commission rate is set.\n event CommissionRateUpdateScheduled(address indexed consensusAddr, uint256 effectiveTimestamp, uint256 rate);\n /// @dev Emitted when the commission rate of a validator is updated.\n event CommissionRateUpdated(address indexed consensusAddr, uint256 rate);\n\n /// @dev Error of exceeding maximum number of candidates.\n error ErrExceedsMaxNumberOfCandidate();\n /// @dev Error of querying for already existent candidate.\n error ErrExistentCandidate();\n /// @dev Error of querying for non-existent candidate.\n error ErrNonExistentCandidate();\n /// @dev Error of candidate admin already exists.\n error ErrExistentCandidateAdmin(address _candidateAdminAddr);\n /// @dev Error of treasury already exists.\n error ErrExistentTreasury(address _treasuryAddr);\n /// @dev Error of bridge operator already exists.\n error ErrExistentBridgeOperator(address _bridgeOperatorAddr);\n /// @dev Error of invalid commission rate.\n error ErrInvalidCommissionRate();\n /// @dev Error of invalid effective days onwards.\n error ErrInvalidEffectiveDaysOnwards();\n /// @dev Error of invalid min effective days onwards.\n error ErrInvalidMinEffectiveDaysOnwards();\n /// @dev Error of already requested revoking candidate before.\n error ErrAlreadyRequestedRevokingCandidate();\n /// @dev Error of commission change schedule exists.\n error ErrAlreadyRequestedUpdatingCommissionRate();\n /// @dev Error of trusted org cannot renounce.\n error ErrTrustedOrgCannotRenounce();\n\n /**\n * @dev Returns the maximum number of validator candidate.\n */\n function maxValidatorCandidate() external view returns (uint256);\n\n /**\n * @dev Returns the minimum number of days to the effective date of commission rate change.\n */\n function minEffectiveDaysOnwards() external view returns (uint256);\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function setMaxValidatorCandidate(uint256) external;\n\n /**\n * @dev Sets the minimum number of days to the effective date of commision rate change.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external;\n\n /**\n * @dev Grants a validator candidate.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateGranted`.\n *\n */\n function execApplyValidatorCandidate(\n address _admin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external;\n\n /**\n * @dev Requests to revoke a validator candidate in next `_secsLeft` seconds.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n * Emits the event `CandidateRevokingTimestampUpdated`.\n *\n */\n function execRequestRenounceCandidate(address, uint256 _secsLeft) external;\n\n /**\n * @dev Fallback function of `CandidateStaking-requestUpdateCommissionRate`.\n *\n * Requirements:\n * - The method caller is the staking contract.\n * - The `_effectiveTimestamp` must be the beginning of a UTC day, and at least from 7 days onwards\n * - The `_rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdateScheduled`.\n *\n */\n function execRequestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveTimestamp,\n uint256 _rate\n ) external;\n\n /**\n * @dev Returns whether the address is a validator (candidate).\n */\n function isValidatorCandidate(address _addr) external view returns (bool);\n\n /**\n * @dev Returns the validator candidate.\n */\n function getValidatorCandidates() external view returns (address[] memory);\n\n /**\n * @dev Returns all candidate info.\n */\n function getCandidateInfos() external view returns (ValidatorCandidate[] memory);\n\n /**\n * @dev Returns the info of a candidate.\n */\n function getCandidateInfo(address _candidate) external view returns (ValidatorCandidate memory);\n\n /**\n * @dev Returns whether the address is the candidate admin.\n */\n function isCandidateAdmin(address _candidate, address _admin) external view returns (bool);\n\n /**\n * @dev Returns the schedule of changing commission rate of a candidate address.\n */\n function getCommissionChangeSchedule(address _candidate) external view returns (CommissionSchedule memory);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ICommonInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IJailingInfo.sol\";\nimport \"./ITimingInfo.sol\";\nimport \"./IValidatorInfo.sol\";\n\ninterface ICommonInfo is ITimingInfo, IJailingInfo, IValidatorInfo {\n struct EmergencyExitInfo {\n uint256 lockedAmount;\n // The timestamp that this locked amount will be recycled to staking vesting contract\n uint256 recyclingAt;\n }\n\n /// @dev Emitted when the deprecated reward is withdrawn.\n event DeprecatedRewardRecycled(address indexed recipientAddr, uint256 amount);\n /// @dev Emitted when the deprecated reward withdrawal is failed\n event DeprecatedRewardRecycleFailed(address indexed recipientAddr, uint256 amount, uint256 balance);\n\n /// @dev Error thrown when receives RON from neither staking vesting contract nor staking contract\n error ErrUnauthorizedReceiveRON();\n /// @dev Error thrown when queries for a non existent info.\n error NonExistentRecyclingInfo();\n\n /**\n * @dev Returns the total deprecated reward, which includes reward that is not sent for slashed validators and unsastified bridge operators\n */\n function totalDeprecatedReward() external view returns (uint256);\n\n /**\n * @dev Returns the emergency exit request.\n */\n function getEmergencyExitInfo(address _consensusAddr) external view returns (EmergencyExitInfo memory);\n}\n" + }, + "contracts/interfaces/validator/ICoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashingExecution.sol\";\n\ninterface ICoinbaseExecution is ISlashingExecution {\n enum BlockRewardDeprecatedType {\n UNKNOWN,\n UNAVAILABILITY,\n AFTER_BAILOUT\n }\n\n /// @dev Emitted when the validator set is updated\n event ValidatorSetUpdated(uint256 indexed period, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated, to mirror the in-jail and maintaining status of the validator.\n event BlockProducerSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] consensusAddrs);\n /// @dev Emitted when the bridge operator set is updated.\n event BridgeOperatorSetUpdated(uint256 indexed period, uint256 indexed epoch, address[] bridgeOperators);\n\n /// @dev Emitted when the reward of the block producer is deprecated.\n event BlockRewardDeprecated(\n address indexed coinbaseAddr,\n uint256 rewardAmount,\n BlockRewardDeprecatedType deprecatedType\n );\n /// @dev Emitted when the block reward is submitted.\n event BlockRewardSubmitted(address indexed coinbaseAddr, uint256 submittedAmount, uint256 bonusAmount);\n\n /// @dev Emitted when the block producer reward is distributed.\n event MiningRewardDistributed(address indexed consensusAddr, address indexed recipient, uint256 amount);\n /// @dev Emitted when the contract fails when distributing the block producer reward.\n event MiningRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the bridge operator reward is distributed.\n event BridgeOperatorRewardDistributed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipientAddr,\n uint256 amount\n );\n /// @dev Emitted when the contract fails when distributing the bridge operator reward.\n event BridgeOperatorRewardDistributionFailed(\n address indexed consensusAddr,\n address indexed bridgeOperator,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the amount of RON reward is distributed to staking contract.\n event StakingRewardDistributed(uint256 totalAmount, address[] consensusAddrs, uint256[] amounts);\n /// @dev Emitted when the contracts fails when distributing the amount of RON to the staking contract.\n event StakingRewardDistributionFailed(\n uint256 totalAmount,\n address[] consensusAddrs,\n uint256[] amounts,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the epoch is wrapped up.\n event WrappedUpEpoch(uint256 indexed periodNumber, uint256 indexed epochNumber, bool periodEnding);\n /// @dev Emitted when the bridge tracking contract's response is incorrect\n event BridgeTrackingIncorrectlyResponded();\n\n /// @dev Error of method caller must be coinbase\n error ErrCallerMustBeCoinbase();\n /// @dev Error of only allowed at the end of epoch\n error ErrAtEndOfEpochOnly();\n /// @dev Error of query for already wrapped up epoch\n error ErrAlreadyWrappedEpoch();\n\n /**\n * @dev Submits reward of the current block.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDeprecated` if the coinbase is slashed or no longer be a block producer.\n * Emits the event `BlockRewardSubmitted` for the valid call.\n *\n */\n function submitBlockReward() external payable;\n\n /**\n * @dev Wraps up the current epoch.\n *\n * Requirements:\n * - The method must be called when the current epoch is ending.\n * - The epoch is not wrapped yet.\n * - The method caller is coinbase.\n *\n * Emits the event `MiningRewardDistributed` when some validator has reward distributed.\n * Emits the event `StakingRewardDistributed` when some staking pool has reward distributed.\n * Emits the event `BlockProducerSetUpdated` when the epoch is wrapped up.\n * Emits the event `BridgeOperatorSetUpdated` when the epoch is wrapped up at period ending.\n * Emits the event `ValidatorSetUpdated` when the epoch is wrapped up at period ending, and the validator set gets updated.\n * Emits the event `WrappedUpEpoch`.\n *\n */\n function wrapUpEpoch() external payable;\n}\n" + }, + "contracts/interfaces/validator/ISlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ISlashingExecution {\n /// @dev Emitted when the validator is punished.\n event ValidatorPunished(\n address indexed consensusAddr,\n uint256 indexed period,\n uint256 jailedUntil,\n uint256 deductedStakingAmount,\n bool blockProducerRewardDeprecated,\n bool bridgeOperatorRewardDeprecated\n );\n /// @dev Emitted when the validator get out of jail by bailout.\n event ValidatorUnjailed(address indexed validator, uint256 period);\n\n /// @dev Error of cannot bailout due to high tier slash.\n error ErrCannotBailout(address validator);\n\n /**\n * @dev Finalize the slash request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorPunished`.\n *\n */\n function execSlash(\n address _validatorAddr,\n uint256 _newJailedUntil,\n uint256 _slashAmount,\n bool _cannotBailout\n ) external;\n\n /**\n * @dev Finalize the bailout request from slash indicator contract.\n *\n * Requirements:\n * - The method caller is slash indicator contract.\n *\n * Emits the event `ValidatorUnjailed`.\n *\n */\n function execBailOut(address _validatorAddr, uint256 _period) external;\n}\n" + }, + "contracts/interfaces/validator/IEmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IEmergencyExit {\n /// @dev Emitted when the fund is locked from an emergency exit request\n event EmergencyExitRequested(address indexed consensusAddr, uint256 lockedAmount);\n /// @dev Emitted when the fund that locked from an emergency exit request is transferred to the recipient.\n event EmergencyExitLockedFundReleased(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount\n );\n /// @dev Emitted when the fund that locked from an emergency exit request is failed to transferred back.\n event EmergencyExitLockedFundReleasingFailed(\n address indexed consensusAddr,\n address indexed recipient,\n uint256 unlockedAmount,\n uint256 contractBalance\n );\n\n /// @dev Emitted when the emergency exit locked amount is updated.\n event EmergencyExitLockedAmountUpdated(uint256 amount);\n /// @dev Emitted when the emergency expiry duration is updated.\n event EmergencyExpiryDurationUpdated(uint256 amount);\n\n /// @dev Error of already requested emergency exit before.\n error ErrAlreadyRequestedEmergencyExit();\n\n /**\n * @dev Returns the amount of RON to lock from a consensus address.\n */\n function emergencyExitLockedAmount() external returns (uint256);\n\n /**\n * @dev Returns the duration that an emergency request is expired and the fund will be recycled.\n */\n function emergencyExpiryDuration() external returns (uint256);\n\n /**\n * @dev Sets the amount of RON to lock from a consensus address.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedAmountUpdated`.\n *\n */\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external;\n\n /**\n * @dev Sets the duration that an emergency request is expired and the fund will be recycled.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExpiryDurationUpdated`.\n *\n */\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external;\n\n /**\n * @dev Unlocks fund for emergency exit request.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `EmergencyExitLockedFundReleased` if the fund is successfully unlocked.\n * Emits the event `EmergencyExitLockedFundReleasingFailed` if the fund is failed to unlock.\n *\n */\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient) external;\n\n /**\n * @dev Fallback function of `IStaking-requestEmergencyExit`.\n *\n * Requirements:\n * - The method caller is staking contract.\n *\n */\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external;\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IJailingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IJailingInfo {\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) during the current period.\n */\n function checkJailed(address) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeft(address _addr)\n external\n view\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n );\n\n /**\n * @dev Returns whether the validator are put in jail (cannot join the set of validators) at a specific block.\n */\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view returns (bool);\n\n /**\n * @dev Returns whether the validator are put in jail at a specific block and the number of block and epoch that he still is in the jail.\n */\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\n external\n view\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n );\n\n /**\n * @dev Returns whether the validators are put in jail (cannot join the set of validators) during the current period.\n */\n function checkManyJailed(address[] calldata) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during the current period.\n */\n function checkMiningRewardDeprecated(address _blockProducer) external view returns (bool);\n\n /**\n * @dev Returns whether the incoming reward of the block producer is deprecated during a specific period.\n */\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period) external view returns (bool);\n\n /**\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the latest wrapped up period.\n */\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr) external view returns (bool _result);\n\n /**\n * @dev Returns whether the incoming reward of the validator with `_consensusAddr` is deprecated in the `_period`.\n */\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\n external\n view\n returns (bool _result);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/ITimingInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ITimingInfo {\n /**\n * @dev Returns the block that validator set was updated.\n */\n function getLastUpdatedBlock() external view returns (uint256);\n\n /**\n * @dev Returns the number of blocks in a epoch.\n */\n function numberOfBlocksInEpoch() external view returns (uint256 _numberOfBlocks);\n\n /**\n * @dev Returns the epoch index from the block number.\n */\n function epochOf(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Returns whether the epoch ending is at the block number `_block`.\n */\n function epochEndingAt(uint256 _block) external view returns (bool);\n\n /**\n * @dev Tries to get the period index from the epoch number.\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber);\n\n /**\n * @dev Returns whether the period ending at the current block number.\n */\n function isPeriodEnding() external view returns (bool);\n\n /**\n * @dev Returns the period index from the current block.\n */\n function currentPeriod() external view returns (uint256);\n\n /**\n * @dev Returns the block number that the current period starts at.\n */\n function currentPeriodStartAtBlock() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/validator/info-fragments/IValidatorInfo.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\n\ninterface IValidatorInfo {\n /// @dev Emitted when the number of max validator is updated.\n event MaxValidatorNumberUpdated(uint256);\n /// @dev Emitted when the number of reserved slots for prioritized validators is updated.\n event MaxPrioritizedValidatorNumberUpdated(uint256);\n\n /// @dev Error of number of prioritized greater than number of max validators.\n error ErrInvalidMaxPrioritizedValidatorNumber();\n\n /**\n * @dev Returns the maximum number of validators in the epoch.\n */\n function maxValidatorNumber() external view returns (uint256 _maximumValidatorNumber);\n\n /**\n * @dev Returns the number of reserved slots for prioritized validators.\n */\n function maxPrioritizedValidatorNumber() external view returns (uint256 _maximumPrioritizedValidatorNumber);\n\n /**\n * @dev Returns the current validator list.\n */\n function getValidators()\n external\n view\n returns (\n address[] memory _validatorList,\n address[] memory _bridgeOperators,\n EnumFlags.ValidatorFlag[] memory _flags\n );\n\n /**\n * @dev Returns whether the address is either a bridge operator or a block producer.\n */\n function isValidator(address _addr) external view returns (bool);\n\n /**\n * @dev Returns the current block producer list.\n */\n function getBlockProducers() external view returns (address[] memory);\n\n /**\n * @dev Returns whether the address is block producer or not.\n */\n function isBlockProducer(address _addr) external view returns (bool);\n\n /**\n * @dev Returns total numbers of the block producers.\n */\n function totalBlockProducers() external view returns (uint256);\n\n /**\n * @dev Returns the current bridge operator list.\n */\n function getBridgeOperators() external view returns (address[] memory);\n\n /**\n * @dev Returns the bridge operator list corresponding to validator address list.\n */\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view returns (address[] memory);\n\n /**\n * @dev Returns whether the address is bridge operator.\n */\n function isBridgeOperator(address _addr) external view returns (bool isOperator);\n\n /**\n * @dev Returns whether the consensus address is operating the bridge or not.\n */\n function isOperatingBridge(address _consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns total numbers of the bridge operators.\n */\n function totalBridgeOperators() external view returns (uint256);\n\n /**\n * @dev Updates the max validator number\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxValidatorNumberUpdated`\n *\n */\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external;\n\n /**\n * @dev Updates the number of reserved slots for prioritized validators\n *\n * Requirements:\n * - The method caller is admin\n *\n * Emits the event `MaxPrioritizedValidatorNumberUpdated`\n *\n */\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external;\n}\n" + }, + "contracts/libraries/EnumFlags.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This library implements checking flag of an enumerated value.\n * The originated idea is inherited from [Enum.HashFlag(Enum)](https://learn.microsoft.com/en-us/dotnet/api/system.enum.hasflag?view=net-6.0) method of C#.\n */\nlibrary EnumFlags {\n enum ValidatorFlag {\n None, // bit(00)\n BlockProducer, // bit(01)\n BridgeOperator, // bit(10)\n Both // bit(11)\n }\n\n function isNone(ValidatorFlag _value) internal pure returns (bool) {\n return uint8(_value) == 0;\n }\n\n /**\n * @dev Checks if `_value` has `_flag`.\n */\n function hasFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (bool) {\n return (uint8(_value) & uint8(_flag)) != 0;\n }\n\n /**\n * @dev Calculate new value of `_value` after adding `_flag`.\n */\n function addFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) | uint8(_flag));\n }\n\n /**\n * @dev Calculate new value of `_value` after remove `_flag`.\n */\n function removeFlag(ValidatorFlag _value, ValidatorFlag _flag) internal pure returns (ValidatorFlag) {\n return ValidatorFlag(uint8(_value) & ~uint8(_flag));\n }\n}\n" + }, + "contracts/extensions/collections/HasRoninTrustedOrganizationContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\n\ncontract HasRoninTrustedOrganizationContract is IHasRoninTrustedOrganizationContract, HasProxyAdmin {\n IRoninTrustedOrganization internal _roninTrustedOrganizationContract;\n\n modifier onlyRoninTrustedOrganizationContract() {\n if (roninTrustedOrganizationContract() != msg.sender) revert ErrCallerMustBeRoninTrustedOrgContract();\n _;\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function roninTrustedOrganizationContract() public view override returns (address) {\n return address(_roninTrustedOrganizationContract);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function setRoninTrustedOrganizationContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setRoninTrustedOrganizationContract(_addr);\n }\n\n /**\n * @dev Sets the ronin trusted organization contract.\n *\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\n *\n */\n function _setRoninTrustedOrganizationContract(address _addr) internal {\n _roninTrustedOrganizationContract = IRoninTrustedOrganization(_addr);\n emit RoninTrustedOrganizationContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/collections/HasBridgeContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasBridgeContract.sol\";\nimport \"../../interfaces/IBridge.sol\";\n\ncontract HasBridgeContract is IHasBridgeContract, HasProxyAdmin {\n IBridge internal _bridgeContract;\n\n modifier onlyBridgeContract() {\n if (bridgeContract() != msg.sender) revert ErrCallerMustBeBridgeContract();\n _;\n }\n\n /**\n * @inheritdoc IHasBridgeContract\n */\n function bridgeContract() public view override returns (address) {\n return address(_bridgeContract);\n }\n\n /**\n * @inheritdoc IHasBridgeContract\n */\n function setBridgeContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length <= 0) revert ErrZeroCodeContract();\n _setBridgeContract(_addr);\n }\n\n /**\n * @dev Sets the bridge contract.\n *\n * Emits the event `BridgeContractUpdated`.\n *\n */\n function _setBridgeContract(address _addr) internal {\n _bridgeContract = IBridge(_addr);\n emit BridgeContractUpdated(_addr);\n }\n}\n" + }, + "contracts/interfaces/IRoninTrustedOrganization.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IQuorum.sol\";\n\ninterface IRoninTrustedOrganization is IQuorum {\n struct TrustedOrganization {\n // Address of the validator that produces block, e.g. block.coinbase. This is so-called validator address.\n address consensusAddr;\n // Address to voting proposal\n address governor;\n // Address to voting bridge operators\n address bridgeVoter;\n // Its Weight\n uint256 weight;\n // The block that the organization was added\n uint256 addedBlock;\n }\n\n /// @dev Emitted when the trusted organization is added.\n event TrustedOrganizationsAdded(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is updated.\n event TrustedOrganizationsUpdated(TrustedOrganization[] orgs);\n /// @dev Emitted when the trusted organization is removed.\n event TrustedOrganizationsRemoved(address[] orgs);\n\n /**\n * @dev Adds a list of addresses into the trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n * - The field `addedBlock` should be blank.\n *\n * Emits the event `TrustedOrganizationAdded` once an organization is added.\n *\n */\n function addTrustedOrganizations(TrustedOrganization[] calldata) external;\n\n /**\n * @dev Updates weights for a list of existent trusted organization.\n *\n * Requirements:\n * - The weights should larger than 0.\n * - The method caller is admin.\n *\n * Emits the `TrustedOrganizationUpdated` event.\n *\n */\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external;\n\n /**\n * @dev Removes a list of addresses from the trusted organization.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `TrustedOrganizationRemoved` once an organization is removed.\n *\n * @param _consensusAddrs The list of consensus addresses linked to corresponding trusted organization that to be removed.\n */\n function removeTrustedOrganizations(address[] calldata _consensusAddrs) external;\n\n /**\n * @dev Returns total weights.\n */\n function totalWeights() external view returns (uint256);\n\n /**\n * @dev Returns the weight of a consensus.\n */\n function getConsensusWeight(address _consensusAddr) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a governor.\n */\n function getGovernorWeight(address _governor) external view returns (uint256);\n\n /**\n * @dev Returns the weight of a bridge voter.\n */\n function getBridgeVoterWeight(address _addr) external view returns (uint256);\n\n /**\n * @dev Returns the weights of a list of consensus addresses.\n */\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of governor addresses.\n */\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns the weights of a list of bridge voter addresses.\n */\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory);\n\n /**\n * @dev Returns total weights of the consensus list.\n */\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res);\n\n /**\n * @dev Returns total weights of the governor list.\n */\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res);\n\n /**\n * @dev Returns total weights of the bridge voter list.\n */\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res);\n\n /**\n * @dev Returns the trusted organization at `_index`.\n */\n function getTrustedOrganizationAt(uint256 _index) external view returns (TrustedOrganization memory);\n\n /**\n * @dev Returns the number of trusted organizations.\n */\n function countTrustedOrganizations() external view returns (uint256);\n\n /**\n * @dev Returns all of the trusted organizations.\n */\n function getAllTrustedOrganizations() external view returns (TrustedOrganization[] memory);\n\n /**\n * @dev Returns the trusted organization by consensus address.\n *\n * Reverts once the consensus address is non-existent.\n */\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory);\n}\n" + }, + "contracts/interfaces/collections/IHasRoninTrustedOrganizationContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasRoninTrustedOrganizationContract is IHasContract {\n /// @dev Emitted when the ronin trusted organization contract is updated.\n event RoninTrustedOrganizationContractUpdated(address);\n\n /// @dev Error of method caller must be Ronin trusted org contract.\n error ErrCallerMustBeRoninTrustedOrgContract();\n\n /**\n * @dev Returns the ronin trusted organization contract.\n */\n function roninTrustedOrganizationContract() external view returns (address);\n\n /**\n * @dev Sets the ronin trusted organization contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\n *\n */\n function setRoninTrustedOrganizationContract(address) external;\n}\n" + }, + "contracts/interfaces/IQuorum.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IQuorum {\n /// @dev Emitted when the threshold is updated\n event ThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n\n /**\n * @dev Returns the threshold.\n */\n function getThreshold() external view returns (uint256 _num, uint256 _denom);\n\n /**\n * @dev Checks whether the `_voteWeight` passes the threshold.\n */\n function checkThreshold(uint256 _voteWeight) external view returns (bool);\n\n /**\n * @dev Returns the minimum vote weight to pass the threshold.\n */\n function minimumVoteWeight() external view returns (uint256);\n\n /**\n * @dev Sets the threshold.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n returns (uint256 _previousNum, uint256 _previousDenom);\n}\n" + }, + "contracts/interfaces/collections/IHasBridgeContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasBridgeContract is IHasContract {\n /// @dev Emitted when the bridge contract is updated.\n event BridgeContractUpdated(address);\n\n /// @dev Error of method caller must be bridge contract.\n error ErrCallerMustBeBridgeContract();\n\n /**\n * @dev Returns the bridge contract.\n */\n function bridgeContract() external view returns (address);\n\n /**\n * @dev Sets the bridge contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `BridgeContractUpdated`.\n *\n */\n function setBridgeContract(address) external;\n}\n" + }, + "contracts/interfaces/IBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBridge {\n /**\n * @dev Replaces the old bridge operator list by the new one.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emitted the event `BridgeOperatorsReplaced`.\n *\n */\n function replaceBridgeOperators(address[] calldata) external;\n\n /**\n * @dev Returns the bridge operator list.\n */\n function getBridgeOperators() external view returns (address[] memory);\n}\n" + }, + "contracts/ronin/validator/EmergencyExit.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\nimport \"../../interfaces/validator/IEmergencyExit.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\nimport \"./CandidateManager.sol\";\n\nabstract contract EmergencyExit is IEmergencyExit, RONTransferHelper, CandidateManager, CommonStorage {\n /**\n * @inheritdoc IEmergencyExit\n */\n function emergencyExitLockedAmount() external view returns (uint256) {\n return _emergencyExitLockedAmount;\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function emergencyExpiryDuration() external view returns (uint256) {\n return _emergencyExpiryDuration;\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function execEmergencyExit(address _consensusAddr, uint256 _secLeftToRevoke) external onlyStakingContract {\n EmergencyExitInfo storage _info = _exitInfo[_consensusAddr];\n if (_info.recyclingAt != 0) revert ErrAlreadyRequestedEmergencyExit();\n\n uint256 _revokingTimestamp = block.timestamp + _secLeftToRevoke;\n _setRevokingTimestamp(_candidateInfo[_consensusAddr], _revokingTimestamp);\n _emergencyExitJailedTimestamp[_consensusAddr] = _revokingTimestamp;\n _bridgeRewardDeprecatedAtPeriod[_consensusAddr][currentPeriod()] = true;\n\n uint256 _deductedAmount = _stakingContract.execDeductStakingAmount(_consensusAddr, _emergencyExitLockedAmount);\n if (_deductedAmount > 0) {\n uint256 _recyclingAt = block.timestamp + _emergencyExpiryDuration;\n _lockedConsensusList.push(_consensusAddr);\n _info.lockedAmount = _deductedAmount;\n _info.recyclingAt = _recyclingAt;\n IRoninGovernanceAdmin(_getAdmin()).createEmergencyExitPoll(\n _consensusAddr,\n _candidateInfo[_consensusAddr].treasuryAddr,\n block.timestamp,\n _recyclingAt\n );\n }\n emit EmergencyExitRequested(_consensusAddr, _deductedAmount);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external onlyAdmin {\n _setEmergencyExitLockedAmount(_emergencyExitLockedAmount);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external onlyAdmin {\n _setEmergencyExpiryDuration(_emergencyExpiryDuration);\n }\n\n /**\n * @inheritdoc IEmergencyExit\n */\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient)\n external\n onlyAdmin\n {\n if (_exitInfo[_consensusAddr].recyclingAt == 0) {\n return;\n }\n\n uint256 _length = _lockedConsensusList.length;\n uint256 _index = _length;\n\n for (uint _i; _i < _length; _i++) {\n if (_lockedConsensusList[_i] == _consensusAddr) {\n _index = _i;\n break;\n }\n }\n\n // The locked amount might be recycled\n if (_index == _length) {\n return;\n }\n\n uint256 _amount = _exitInfo[_consensusAddr].lockedAmount;\n if (_amount > 0) {\n delete _exitInfo[_consensusAddr];\n if (_length > 1) {\n _lockedConsensusList[_index] = _lockedConsensusList[_length - 1];\n }\n _lockedConsensusList.pop();\n\n _lockedFundReleased[_consensusAddr] = true;\n if (_unsafeSendRON(_recipient, _amount, DEFAULT_ADDITION_GAS)) {\n emit EmergencyExitLockedFundReleased(_consensusAddr, _recipient, _amount);\n return;\n }\n\n emit EmergencyExitLockedFundReleasingFailed(_consensusAddr, _recipient, _amount, address(this).balance);\n }\n }\n\n /**\n * @dev Tries to recycle the locked funds from emergency exit requests.\n */\n function _tryRecycleLockedFundsFromEmergencyExits() internal {\n uint256 _length = _lockedConsensusList.length;\n\n uint256 _i;\n address _addr;\n EmergencyExitInfo storage _info;\n\n while (_i < _length) {\n _addr = _lockedConsensusList[_i];\n _info = _exitInfo[_addr];\n\n if (_info.recyclingAt <= block.timestamp) {\n _totalDeprecatedReward += _info.lockedAmount;\n\n delete _exitInfo[_addr];\n if (--_length > 0) {\n _lockedConsensusList[_i] = _lockedConsensusList[_length];\n }\n _lockedConsensusList.pop();\n continue;\n }\n\n _i++;\n }\n }\n\n /**\n * @dev Override `CandidateManager-_emergencyExitLockedFundReleased`.\n */\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {\n return _lockedFundReleased[_consensusAddr];\n }\n\n /**\n * @dev Override `CandidateManager-_removeCandidate`.\n */\n function _removeCandidate(address _consensusAddr) internal override {\n delete _lockedFundReleased[_consensusAddr];\n super._removeCandidate(_consensusAddr);\n }\n\n /**\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\n */\n function _bridgeOperatorOf(address _consensusAddr)\n internal\n view\n virtual\n override(CandidateManager, ValidatorInfoStorage)\n returns (address)\n {\n return CandidateManager._bridgeOperatorOf(_consensusAddr);\n }\n\n /**\n * @dev See `setEmergencyExitLockedAmount.\n */\n function _setEmergencyExitLockedAmount(uint256 _amount) internal {\n _emergencyExitLockedAmount = _amount;\n emit EmergencyExitLockedAmountUpdated(_amount);\n }\n\n /**\n * @dev See `setEmergencyExpiryDuration`.\n */\n function _setEmergencyExpiryDuration(uint256 _duration) internal {\n _emergencyExpiryDuration = _duration;\n emit EmergencyExpiryDurationUpdated(_duration);\n }\n}\n" + }, + "contracts/extensions/RONTransferHelper.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nabstract contract RONTransferHelper {\n /// @dev Error of recipient not accepting RON when transfer RON.\n error ErrRecipientRevert();\n /// @dev Error of sender has insufficient balance.\n error ErrInsufficientBalance();\n\n /**\n * @dev See `_sendRON`.\n * Reverts if the recipient does not receive RON.\n */\n function _transferRON(address payable _recipient, uint256 _amount) internal {\n if (!_sendRON(_recipient, _amount)) revert ErrRecipientRevert();\n }\n\n /**\n * @dev Send `_amount` RON to the address `_recipient`.\n * Returns whether the recipient receives RON or not.\n * Reverts once the contract balance is insufficient.\n *\n * Note: consider using `ReentrancyGuard` before calling this function.\n *\n */\n function _sendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\n if (address(this).balance < _amount) revert ErrInsufficientBalance();\n return _unsafeSendRON(_recipient, _amount);\n }\n\n /**\n * @dev Unsafe send `_amount` RON to the address `_recipient`. If the sender's balance is insufficient,\n * the call does not revert.\n *\n * Note:\n * - Does not assert whether the balance of sender is sufficient.\n * - Does not assert whether the recipient accepts RON.\n * - Consider using `ReentrancyGuard` before calling this function.\n *\n */\n function _unsafeSendRON(address payable _recipient, uint256 _amount) internal returns (bool _success) {\n (_success, ) = _recipient.call{ value: _amount }(\"\");\n }\n\n /**\n * @dev Same purpose with {_unsafeSendRON(address,uin256)} but containing gas limit stipend forwarded in the call.\n */\n function _unsafeSendRON(\n address payable _recipient,\n uint256 _amount,\n uint256 _gas\n ) internal returns (bool _success) {\n (_success, ) = _recipient.call{ value: _amount, gas: _gas }(\"\");\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/CommonStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../interfaces/validator/info-fragments/ICommonInfo.sol\";\nimport \"./JailingStorage.sol\";\nimport \"./TimingStorage.sol\";\nimport \"./ValidatorInfoStorage.sol\";\n\nabstract contract CommonStorage is ICommonInfo, TimingStorage, JailingStorage, ValidatorInfoStorage {\n /// @dev Mapping from consensus address => pending reward from producing block\n mapping(address => uint256) internal _miningReward;\n /// @dev Mapping from consensus address => pending reward from delegating\n mapping(address => uint256) internal _delegatingReward;\n\n /// @dev The total reward for bridge operators\n uint256 internal _totalBridgeReward;\n /// @dev Mapping from consensus address => pending reward for being bridge operator\n mapping(address => uint256) internal _bridgeOperatingReward;\n\n /// @dev The deprecated reward that has not been withdrawn by admin\n uint256 internal _totalDeprecatedReward;\n\n /// @dev The amount of RON to lock from a consensus address.\n uint256 internal _emergencyExitLockedAmount;\n /// @dev The duration that an emergency request is expired and the fund will be recycled.\n uint256 internal _emergencyExpiryDuration;\n /// @dev The address list of consensus addresses that being locked fund.\n address[] internal _lockedConsensusList;\n /// @dev Mapping from consensus => request exist info\n mapping(address => EmergencyExitInfo) internal _exitInfo;\n /// @dev Mapping from consensus => flag indicating whether the locked fund is released\n mapping(address => bool) internal _lockedFundReleased;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[44] private ______gap;\n\n /**\n * @inheritdoc ICommonInfo\n */\n function getEmergencyExitInfo(address _consensusAddr)\n external\n view\n override\n returns (EmergencyExitInfo memory _info)\n {\n _info = _exitInfo[_consensusAddr];\n if (_info.recyclingAt == 0) revert NonExistentRecyclingInfo();\n }\n\n /**\n * @inheritdoc ICommonInfo\n */\n function totalDeprecatedReward() external view override returns (uint256) {\n return _totalDeprecatedReward;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochOf(uint256 _block)\n public\n view\n virtual\n override(ITimingInfo, JailingStorage, TimingStorage)\n returns (uint256)\n {\n return TimingStorage.epochOf(_block);\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriod() public view virtual override(ITimingInfo, JailingStorage, TimingStorage) returns (uint256) {\n return TimingStorage.currentPeriod();\n }\n}\n" + }, + "contracts/ronin/validator/CandidateManager.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasStakingContract.sol\";\nimport \"../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../interfaces/validator/ICandidateManager.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\n\nabstract contract CandidateManager is ICandidateManager, PercentageConsumer, GlobalConfigConsumer, HasStakingContract {\n /// @dev Maximum number of validator candidate\n uint256 private _maxValidatorCandidate;\n\n /// @dev The validator candidate array\n address[] internal _candidates;\n /// @dev Mapping from candidate consensus address => bitwise negation of validator index in `_candidates`\n mapping(address => uint256) internal _candidateIndex;\n /// @dev Mapping from candidate consensus address => their info\n mapping(address => ValidatorCandidate) internal _candidateInfo;\n\n /**\n * @dev The minimum offset in day from current date to the effective date of a new commission schedule.\n * Value of 1 means the change gets affected at the beginning of the following day.\n **/\n uint256 internal _minEffectiveDaysOnwards;\n /// @dev Mapping from candidate consensus address => schedule commission change.\n mapping(address => CommissionSchedule) internal _candidateCommissionChangeSchedule;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc ICandidateManager\n */\n function maxValidatorCandidate() public view override returns (uint256) {\n return _maxValidatorCandidate;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function minEffectiveDaysOnwards() external view override returns (uint256) {\n return _minEffectiveDaysOnwards;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function setMaxValidatorCandidate(uint256 _number) external override onlyAdmin {\n _setMaxValidatorCandidate(_number);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function setMinEffectiveDaysOnwards(uint256 _numOfDays) external override onlyAdmin {\n _setMinEffectiveDaysOnwards(_numOfDays);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function execApplyValidatorCandidate(\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external override onlyStakingContract {\n uint256 _length = _candidates.length;\n if (_length >= maxValidatorCandidate()) revert ErrExceedsMaxNumberOfCandidate();\n if (isValidatorCandidate(_consensusAddr)) revert ErrExistentCandidate();\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\n\n for (uint _i; _i < _candidates.length; _i++) {\n ValidatorCandidate storage existentInfo = _candidateInfo[_candidates[_i]];\n if (_candidateAdmin == existentInfo.admin) revert ErrExistentCandidateAdmin(_candidateAdmin);\n if (_treasuryAddr == existentInfo.treasuryAddr) revert ErrExistentTreasury(_treasuryAddr);\n if (_bridgeOperatorAddr == existentInfo.bridgeOperatorAddr) revert ErrExistentBridgeOperator(_bridgeOperatorAddr);\n }\n\n _candidateIndex[_consensusAddr] = ~_length;\n _candidates.push(_consensusAddr);\n\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\n _info.admin = _candidateAdmin;\n _info.consensusAddr = _consensusAddr;\n _info.treasuryAddr = _treasuryAddr;\n _info.bridgeOperatorAddr = _bridgeOperatorAddr;\n _info.commissionRate = _commissionRate;\n emit CandidateGranted(_consensusAddr, _treasuryAddr, _candidateAdmin, _bridgeOperatorAddr);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function execRequestRenounceCandidate(address _consensusAddr, uint256 _secsLeft)\n external\n override\n onlyStakingContract\n {\n if (_isTrustedOrg(_consensusAddr)) revert ErrTrustedOrgCannotRenounce();\n\n ValidatorCandidate storage _info = _candidateInfo[_consensusAddr];\n if (_info.revokingTimestamp != 0) revert ErrAlreadyRequestedRevokingCandidate();\n _setRevokingTimestamp(_info, block.timestamp + _secsLeft);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function execRequestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveDaysOnwards,\n uint256 _commissionRate\n ) external override onlyStakingContract {\n if (_candidateCommissionChangeSchedule[_consensusAddr].effectiveTimestamp != 0) {\n revert ErrAlreadyRequestedUpdatingCommissionRate();\n }\n if (_commissionRate > _MAX_PERCENTAGE) revert ErrInvalidCommissionRate();\n if (_effectiveDaysOnwards < _minEffectiveDaysOnwards) revert ErrInvalidEffectiveDaysOnwards();\n\n CommissionSchedule storage _schedule = _candidateCommissionChangeSchedule[_consensusAddr];\n uint256 _effectiveTimestamp = ((block.timestamp / PERIOD_DURATION) + _effectiveDaysOnwards) * PERIOD_DURATION;\n _schedule.effectiveTimestamp = _effectiveTimestamp;\n _schedule.commissionRate = _commissionRate;\n\n emit CommissionRateUpdateScheduled(_consensusAddr, _effectiveTimestamp, _commissionRate);\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function isValidatorCandidate(address _addr) public view override returns (bool) {\n return _candidateIndex[_addr] != 0;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCandidateInfos() external view override returns (ValidatorCandidate[] memory _list) {\n _list = new ValidatorCandidate[](_candidates.length);\n for (uint _i; _i < _list.length; _i++) {\n _list[_i] = _candidateInfo[_candidates[_i]];\n }\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCandidateInfo(address _candidate) external view override returns (ValidatorCandidate memory) {\n if (!isValidatorCandidate(_candidate)) revert ErrNonExistentCandidate();\n return _candidateInfo[_candidate];\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getValidatorCandidates() public view override returns (address[] memory) {\n return _candidates;\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function getCommissionChangeSchedule(address _candidate) external view override returns (CommissionSchedule memory) {\n return _candidateCommissionChangeSchedule[_candidate];\n }\n\n /**\n * @dev Removes unsastisfied candidates, the ones who have insufficient minimum candidate staking amount,\n * or the ones who requested to renounce their candidate role.\n *\n * Emits the event `CandidatesRevoked` when a candidate is revoked.\n *\n */\n function _syncCandidateSet(uint256 _nextPeriod) internal returns (address[] memory _unsatisfiedCandidates) {\n IStaking _staking = _stakingContract;\n uint256 _waitingSecsToRevoke = _staking.waitingSecsToRevoke();\n uint256 _minStakingAmount = _staking.minValidatorStakingAmount();\n uint256[] memory _selfStakings = _staking.getManySelfStakings(_candidates);\n\n uint256 _length = _candidates.length;\n uint256 _unsatisfiedCount;\n _unsatisfiedCandidates = new address[](_length);\n\n {\n uint256 _i;\n address _addr;\n ValidatorCandidate storage _info;\n while (_i < _length) {\n _addr = _candidates[_i];\n _info = _candidateInfo[_addr];\n\n // Checks for under-balance status of candidates\n bool _hasTopupDeadline = _info.topupDeadline != 0;\n if (_selfStakings[_i] < _minStakingAmount) {\n // Updates deadline on the first time unsatisfied the staking amount condition\n if (!_hasTopupDeadline) {\n uint256 _topupDeadline = block.timestamp + _waitingSecsToRevoke;\n _info.topupDeadline = _topupDeadline;\n emit CandidateTopupDeadlineUpdated(_addr, _topupDeadline);\n }\n } else if (_hasTopupDeadline) {\n // Removes the deadline if the staking amount condition is satisfied\n delete _info.topupDeadline;\n emit CandidateTopupDeadlineUpdated(_addr, 0);\n }\n\n // Removes unsastisfied candidates\n bool _revokingActivated = (_info.revokingTimestamp != 0 && _info.revokingTimestamp <= block.timestamp) ||\n _emergencyExitLockedFundReleased(_addr);\n bool _topupDeadlineMissed = _info.topupDeadline != 0 && _info.topupDeadline <= block.timestamp;\n if (_revokingActivated || _topupDeadlineMissed) {\n _selfStakings[_i] = _selfStakings[--_length];\n _unsatisfiedCandidates[_unsatisfiedCount++] = _addr;\n _removeCandidate(_addr);\n continue;\n }\n\n // Checks for schedule of commission change and updates commission rate\n uint256 _scheduleTimestamp = _candidateCommissionChangeSchedule[_addr].effectiveTimestamp;\n if (_scheduleTimestamp != 0 && _scheduleTimestamp <= block.timestamp) {\n uint256 _commisionRate = _candidateCommissionChangeSchedule[_addr].commissionRate;\n delete _candidateCommissionChangeSchedule[_addr];\n _info.commissionRate = _commisionRate;\n emit CommissionRateUpdated(_addr, _commisionRate);\n }\n\n _i++;\n }\n }\n\n assembly {\n mstore(_unsatisfiedCandidates, _unsatisfiedCount)\n }\n\n if (_unsatisfiedCount > 0) {\n emit CandidatesRevoked(_unsatisfiedCandidates);\n _staking.execDeprecatePools(_unsatisfiedCandidates, _nextPeriod);\n }\n }\n\n /**\n * @inheritdoc ICandidateManager\n */\n function isCandidateAdmin(address _candidate, address _admin) external view override returns (bool) {\n return _candidateInfo[_candidate].admin == _admin;\n }\n\n /**\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\n */\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address) {\n return _candidateInfo[_consensusAddr].bridgeOperatorAddr;\n }\n\n /**\n * @dev Sets the maximum number of validator candidate.\n *\n * Emits the `MaxValidatorCandidateUpdated` event.\n *\n */\n function _setMaxValidatorCandidate(uint256 _threshold) internal {\n _maxValidatorCandidate = _threshold;\n emit MaxValidatorCandidateUpdated(_threshold);\n }\n\n /**\n * @dev Sets the minimum number of days onwards to the effective date of commission rate change.\n *\n * Emits the `MinEffectiveDaysOnwardsUpdated` event.\n *\n */\n function _setMinEffectiveDaysOnwards(uint256 _numOfDays) internal {\n if (_numOfDays < 1) revert ErrInvalidMinEffectiveDaysOnwards();\n _minEffectiveDaysOnwards = _numOfDays;\n emit MinEffectiveDaysOnwardsUpdated(_numOfDays);\n }\n\n /**\n * @dev Removes the candidate.\n */\n function _removeCandidate(address _addr) internal virtual {\n uint256 _idx = _candidateIndex[_addr];\n if (_idx == 0) {\n return;\n }\n\n delete _candidateInfo[_addr];\n delete _candidateIndex[_addr];\n delete _candidateCommissionChangeSchedule[_addr];\n\n address _lastCandidate = _candidates[_candidates.length - 1];\n if (_lastCandidate != _addr) {\n _candidateIndex[_lastCandidate] = _idx;\n _candidates[~_idx] = _lastCandidate;\n }\n\n _candidates.pop();\n }\n\n /**\n * @dev Sets timestamp to revoke a candidate.\n */\n function _setRevokingTimestamp(ValidatorCandidate storage _candidate, uint256 _timestamp) internal {\n if (!isValidatorCandidate(_candidate.consensusAddr)) revert ErrNonExistentCandidate();\n _candidate.revokingTimestamp = _timestamp;\n emit CandidateRevokingTimestampUpdated(_candidate.consensusAddr, _timestamp);\n }\n\n /**\n * @dev Returns a flag indicating whether the fund is unlocked.\n */\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual returns (bool);\n\n /**\n * @dev Returns whether the consensus address is a trusted org or not.\n */\n function _isTrustedOrg(address _consensusAddr) internal virtual returns (bool);\n}\n" + }, + "contracts/ronin/validator/storage-fragments/JailingStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../interfaces/validator/info-fragments/IJailingInfo.sol\";\nimport \"./TimingStorage.sol\";\n\nabstract contract JailingStorage is IJailingInfo {\n /// @dev Mapping from consensus address => period number => block producer has no pending reward.\n mapping(address => mapping(uint256 => bool)) internal _miningRewardDeprecatedAtPeriod;\n /// @dev Mapping from consensus address => period number => whether the block producer get cut off reward, due to bailout.\n mapping(address => mapping(uint256 => bool)) internal _miningRewardBailoutCutOffAtPeriod;\n /// @dev Mapping from consensus address => period number => block operator has no pending reward.\n mapping(address => mapping(uint256 => bool)) internal _bridgeRewardDeprecatedAtPeriod;\n\n /// @dev Mapping from consensus address => the last block that the block producer is jailed.\n mapping(address => uint256) internal _blockProducerJailedBlock;\n /// @dev Mapping from consensus address => the last timestamp that the bridge operator is jailed.\n mapping(address => uint256) internal _emergencyExitJailedTimestamp;\n /// @dev Mapping from consensus address => the last block that the block producer cannot bailout.\n mapping(address => uint256) internal _cannotBailoutUntilBlock;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkJailed(address _addr) external view override returns (bool) {\n return checkJailedAtBlock(_addr, block.number);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function getJailedTimeLeft(address _addr)\n external\n view\n override\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n )\n {\n return getJailedTimeLeftAtBlock(_addr, block.number);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkJailedAtBlock(address _addr, uint256 _blockNum) public view override returns (bool) {\n return _jailedAtBlock(_addr, _blockNum);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\n public\n view\n override\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n )\n {\n uint256 _jailedBlock = _blockProducerJailedBlock[_addr];\n if (_jailedBlock < _blockNum) {\n return (false, 0, 0);\n }\n\n isJailed_ = true;\n blockLeft_ = _jailedBlock - _blockNum + 1;\n epochLeft_ = epochOf(_jailedBlock) - epochOf(_blockNum) + 1;\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkManyJailed(address[] calldata _addrList) external view override returns (bool[] memory _result) {\n _result = new bool[](_addrList.length);\n for (uint256 _i; _i < _addrList.length; _i++) {\n _result[_i] = _jailed(_addrList[_i]);\n }\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkMiningRewardDeprecated(address _blockProducer) external view override returns (bool _result) {\n uint256 _period = currentPeriod();\n return _miningRewardDeprecated(_blockProducer, _period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkMiningRewardDeprecatedAtPeriod(address _blockProducer, uint256 _period)\n external\n view\n override\n returns (bool _result)\n {\n return _miningRewardDeprecated(_blockProducer, _period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n *\n * @dev Because the information of deprecating bridge reward of a period is only determined at the end of that period, this\n * method will return the deprecating info of the latest period. A method for querying that info of current period is no need.\n */\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr)\n external\n view\n override\n returns (bool _result)\n {\n uint256 _period = currentPeriod() - 1;\n return _bridgeRewardDeprecated(_consensusAddr, _period);\n }\n\n /**\n * @inheritdoc IJailingInfo\n */\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\n external\n view\n override\n returns (bool _result)\n {\n return _bridgeRewardDeprecated(_consensusAddr, _period);\n }\n\n /**\n * @dev See `ITimingInfo-epochOf`\n */\n function epochOf(uint256 _block) public view virtual returns (uint256);\n\n /**\n * @dev See `ITimingInfo-currentPeriod`\n */\n function currentPeriod() public view virtual returns (uint256);\n\n /**\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) during the current period.\n */\n function _jailed(address _validatorAddr) internal view returns (bool) {\n return _jailedAtBlock(_validatorAddr, block.number);\n }\n\n /**\n * @dev Returns whether the reward of the validator is put in jail (cannot join the set of validators) at a specific block.\n */\n function _jailedAtBlock(address _validatorAddr, uint256 _blockNum) internal view returns (bool) {\n return _blockNum <= _blockProducerJailedBlock[_validatorAddr];\n }\n\n /**\n * @dev Returns whether the block producer has no pending reward in that period.\n */\n function _miningRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\n return _miningRewardDeprecatedAtPeriod[_validatorAddr][_period];\n }\n\n /**\n * @dev Returns whether the bridge operator has no pending reward in the period.\n */\n function _bridgeRewardDeprecated(address _validatorAddr, uint256 _period) internal view returns (bool) {\n return _bridgeRewardDeprecatedAtPeriod[_validatorAddr][_period];\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/TimingStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../../interfaces/validator/info-fragments/ITimingInfo.sol\";\n\nabstract contract TimingStorage is ITimingInfo, GlobalConfigConsumer {\n /// @dev The number of blocks in a epoch\n uint256 internal _numberOfBlocksInEpoch;\n /// @dev The last updated block\n uint256 internal _lastUpdatedBlock;\n /// @dev The last updated period\n uint256 internal _lastUpdatedPeriod;\n /// @dev The starting block of the last updated period\n uint256 internal _currentPeriodStartAtBlock;\n\n /// @dev Mapping from epoch index => period index\n mapping(uint256 => uint256) internal _periodOf;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n /**\n * @inheritdoc ITimingInfo\n */\n function getLastUpdatedBlock() external view override returns (uint256) {\n return _lastUpdatedBlock;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochOf(uint256 _block) public view virtual override returns (uint256) {\n return _block / _numberOfBlocksInEpoch + 1;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function tryGetPeriodOfEpoch(uint256 _epoch) external view returns (bool _filled, uint256 _periodNumber) {\n return (_epoch <= epochOf(block.number) || _periodOf[_epoch] > 0, _periodOf[_epoch]);\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function isPeriodEnding() external view override returns (bool) {\n return _isPeriodEnding(_computePeriod(block.timestamp));\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function epochEndingAt(uint256 _block) public view virtual override returns (bool) {\n return _block % _numberOfBlocksInEpoch == _numberOfBlocksInEpoch - 1;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriod() public view virtual override returns (uint256) {\n return _lastUpdatedPeriod;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function currentPeriodStartAtBlock() public view override returns (uint256) {\n return _currentPeriodStartAtBlock;\n }\n\n /**\n * @inheritdoc ITimingInfo\n */\n function numberOfBlocksInEpoch() public view virtual override returns (uint256 _numberOfBlocks) {\n return _numberOfBlocksInEpoch;\n }\n\n /**\n * @dev See `ITimingInfo-isPeriodEnding`\n */\n function _isPeriodEnding(uint256 _newPeriod) internal view virtual returns (bool) {\n return _newPeriod > _lastUpdatedPeriod;\n }\n\n /**\n * @dev Returns the calculated period.\n */\n function _computePeriod(uint256 _timestamp) internal pure returns (uint256) {\n return _timestamp / PERIOD_DURATION;\n }\n}\n" + }, + "contracts/ronin/validator/storage-fragments/ValidatorInfoStorage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../../libraries/EnumFlags.sol\";\nimport \"../../../extensions/collections/HasRoninTrustedOrganizationContract.sol\";\nimport \"../../../interfaces/validator/info-fragments/IValidatorInfo.sol\";\n\nabstract contract ValidatorInfoStorage is IValidatorInfo, HasRoninTrustedOrganizationContract {\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n /// @dev The maximum number of validator.\n uint256 internal _maxValidatorNumber;\n\n /// @dev The total of validators\n uint256 public validatorCount;\n /// @dev Mapping from validator index => validator address\n mapping(uint256 => address) internal _validators;\n /// @dev Mapping from address => flag indicating the validator ability: producing block, operating bridge\n mapping(address => EnumFlags.ValidatorFlag) internal _validatorMap;\n /// @dev The number of slot that is reserved for prioritized validators\n uint256 internal _maxPrioritizedValidatorNumber;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getValidators()\n public\n view\n override\n returns (\n address[] memory _validatorList,\n address[] memory _bridgeOperators,\n EnumFlags.ValidatorFlag[] memory _flags\n )\n {\n _validatorList = new address[](validatorCount);\n _bridgeOperators = new address[](validatorCount);\n _flags = new EnumFlags.ValidatorFlag[](validatorCount);\n for (uint _i; _i < _validatorList.length; _i++) {\n address _validator = _validators[_i];\n _validatorList[_i] = _validator;\n _bridgeOperators[_i] = _bridgeOperatorOf(_validator);\n _flags[_i] = _validatorMap[_validator];\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isValidator(address _addr) public view override returns (bool) {\n return !_validatorMap[_addr].isNone();\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getBlockProducers() public view override returns (address[] memory _result) {\n _result = new address[](validatorCount);\n uint256 _count = 0;\n for (uint _i; _i < _result.length; _i++) {\n if (isBlockProducer(_validators[_i])) {\n _result[_count++] = _validators[_i];\n }\n }\n\n assembly {\n mstore(_result, _count)\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isBlockProducer(address _addr) public view override returns (bool) {\n return _validatorMap[_addr].hasFlag(EnumFlags.ValidatorFlag.BlockProducer);\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function totalBlockProducers() external view returns (uint256 _total) {\n for (uint _i; _i < validatorCount; _i++) {\n if (isBlockProducer(_validators[_i])) {\n _total++;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getBridgeOperators() public view override returns (address[] memory _result) {\n _result = new address[](validatorCount);\n uint256 _count = 0;\n for (uint _i; _i < _result.length; _i++) {\n if (isOperatingBridge(_validators[_i])) {\n _result[_count++] = _bridgeOperatorOf(_validators[_i]);\n }\n }\n\n assembly {\n mstore(_result, _count)\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function getBridgeOperatorsOf(address[] memory _validatorAddrs)\n public\n view\n override\n returns (address[] memory _result)\n {\n _result = new address[](_validatorAddrs.length);\n for (uint _i; _i < _result.length; _i++) {\n _result[_i] = _bridgeOperatorOf(_validatorAddrs[_i]);\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isBridgeOperator(address _bridgeOperatorAddr) external view override returns (bool _isOperator) {\n for (uint _i; _i < validatorCount; _i++) {\n if (_bridgeOperatorOf(_validators[_i]) == _bridgeOperatorAddr && isOperatingBridge(_validators[_i])) {\n _isOperator = true;\n break;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function isOperatingBridge(address _consensusAddr) public view override returns (bool) {\n return _validatorMap[_consensusAddr].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator);\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {\n return _maxValidatorNumber;\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function maxPrioritizedValidatorNumber() external view override returns (uint256 _maximumPrioritizedValidatorNumber) {\n return _maxPrioritizedValidatorNumber;\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function totalBridgeOperators() public view returns (uint256 _total) {\n for (uint _i; _i < validatorCount; _i++) {\n if (isOperatingBridge(_validators[_i])) {\n _total++;\n }\n }\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function setMaxValidatorNumber(uint256 _max) external override onlyAdmin {\n _setMaxValidatorNumber(_max);\n }\n\n /**\n * @inheritdoc IValidatorInfo\n */\n function setMaxPrioritizedValidatorNumber(uint256 _number) external override onlyAdmin {\n _setMaxPrioritizedValidatorNumber(_number);\n }\n\n /**\n * @dev Returns the bridge operator of a consensus address.\n */\n function _bridgeOperatorOf(address _consensusAddr) internal view virtual returns (address);\n\n /**\n * @dev See `IValidatorInfo-setMaxValidatorNumber`\n */\n function _setMaxValidatorNumber(uint256 _number) internal {\n _maxValidatorNumber = _number;\n emit MaxValidatorNumberUpdated(_number);\n }\n\n /**\n * @dev See `IValidatorInfo-setMaxPrioritizedValidatorNumber`\n */\n function _setMaxPrioritizedValidatorNumber(uint256 _number) internal {\n if (_number > _maxValidatorNumber) revert ErrInvalidMaxPrioritizedValidatorNumber();\n _maxPrioritizedValidatorNumber = _number;\n emit MaxPrioritizedValidatorNumberUpdated(_number);\n }\n}\n" + }, + "contracts/extensions/consumers/GlobalConfigConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nabstract contract GlobalConfigConsumer {\n /// @dev The addition amount of gas sending along in external calls. Total gas stipend is added with default 2300 gas.\n uint256 public constant DEFAULT_ADDITION_GAS = 1200;\n /// @dev The length of a period in second.\n uint256 public constant PERIOD_DURATION = 1 days;\n}\n" + }, + "contracts/extensions/collections/HasStakingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasStakingContract.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\n\ncontract HasStakingContract is IHasStakingContract, HasProxyAdmin {\n IStaking internal _stakingContract;\n\n modifier onlyStakingContract() {\n if (stakingContract() != msg.sender) revert ErrCallerMustBeStakingContract();\n _;\n }\n\n /**\n * @inheritdoc IHasStakingContract\n */\n function stakingContract() public view override returns (address) {\n return address(_stakingContract);\n }\n\n /**\n * @inheritdoc IHasStakingContract\n */\n function setStakingContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setStakingContract(_addr);\n }\n\n /**\n * @dev Sets the staking contract.\n *\n * Emits the event `StakingContractUpdated`.\n *\n */\n function _setStakingContract(address _addr) internal {\n _stakingContract = IStaking(_addr);\n emit StakingContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/consumers/PercentageConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nabstract contract PercentageConsumer {\n uint256 internal constant _MAX_PERCENTAGE = 100_00;\n}\n" + }, + "contracts/interfaces/staking/IStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseStaking.sol\";\nimport \"./ICandidateStaking.sol\";\nimport \"./IDelegatorStaking.sol\";\n\ninterface IStaking is IRewardPool, IBaseStaking, ICandidateStaking, IDelegatorStaking {\n /**\n * @dev Records the amount of rewards `_rewards` for the pools `_consensusAddrs`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\n * Emits the event `PoolsUpdateConflicted` when there are some pools which already updated in the period.\n *\n * Note: This method should be called once at the period ending.\n *\n */\n function execRecordRewards(\n address[] calldata _consensusAddrs,\n uint256[] calldata _rewards,\n uint256 _period\n ) external payable;\n\n /**\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller must be validator contract.\n *\n * Emits the event `Unstaked`.\n *\n */\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\n external\n returns (uint256 _actualDeductingAmount);\n}\n" + }, + "contracts/interfaces/collections/IHasStakingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasStakingContract is IHasContract {\n /// @dev Emitted when the staking contract is updated.\n event StakingContractUpdated(address);\n\n /// @dev Error of method caller must be staking contract.\n error ErrCallerMustBeStakingContract();\n\n /**\n * @dev Returns the staking contract.\n */\n function stakingContract() external view returns (address);\n\n /**\n * @dev Sets the staking contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `StakingContractUpdated`.\n *\n */\n function setStakingContract(address) external;\n}\n" + }, + "contracts/interfaces/staking/IBaseStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IBaseStaking {\n struct PoolDetail {\n // Address of the pool i.e. consensus address of the validator\n address addr;\n // Pool admin address\n address admin;\n // Self-staking amount\n uint256 stakingAmount;\n // Total number of RON staking for the pool\n uint256 stakingTotal;\n // Mapping from delegator => delegating amount\n mapping(address => uint256) delegatingAmount;\n // Mapping from delegator => the last timestamp that delegator staked\n mapping(address => uint256) lastDelegatingTimestamp;\n }\n\n /// @dev Emitted when the minium number of seconds to undelegate is updated.\n event CooldownSecsToUndelegateUpdated(uint256 minSecs);\n /// @dev Emitted when the number of seconds that a candidate must wait to be revoked.\n event WaitingSecsToRevokeUpdated(uint256 secs);\n\n /// @dev Error of cannot transfer RON.\n error ErrCannotTransferRON();\n /// @dev Error of receiving zero message value.\n error ErrZeroValue();\n /// @dev Error of pool admin is not allowed to call.\n error ErrPoolAdminForbidden();\n /// @dev Error of no one is allowed to call but the pool's admin.\n error ErrOnlyPoolAdminAllowed();\n /// @dev Error of admin of any active pool cannot delegate.\n error ErrAdminOfAnyActivePoolForbidden(address admin);\n /// @dev Error of querying inactive pool.\n error ErrInactivePool(address poolAddr);\n /// @dev Error of length of input arrays are not of the same.\n error ErrInvalidArrays();\n\n /**\n * @dev Returns whether the `_poolAdminAddr` is currently active.\n */\n function isAdminOfActivePool(address _poolAdminAddr) external view returns (bool);\n\n /**\n * @dev Returns the consensus address corresponding to the pool admin.\n */\n function getPoolAddressOf(address _poolAdminAddr) external view returns (address);\n\n /**\n * @dev Returns the staking pool detail.\n */\n function getPoolDetail(address)\n external\n view\n returns (\n address _admin,\n uint256 _stakingAmount,\n uint256 _stakingTotal\n );\n\n /**\n * @dev Returns the self-staking amounts of the pools.\n */\n function getManySelfStakings(address[] calldata) external view returns (uint256[] memory);\n\n /**\n * @dev Returns The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n */\n function cooldownSecsToUndelegate() external view returns (uint256);\n\n /**\n * @dev Returns the number of seconds that a candidate must wait for the renounce request gets affected.\n */\n function waitingSecsToRevoke() external view returns (uint256);\n\n /**\n * @dev Sets the cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CooldownSecsToUndelegateUpdated`.\n *\n */\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external;\n\n /**\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `WaitingSecsToRevokeUpdated`.\n *\n */\n function setWaitingSecsToRevoke(uint256 _secs) external;\n}\n" + }, + "contracts/interfaces/staking/ICandidateStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface ICandidateStaking is IRewardPool {\n /// @dev Emitted when the minimum staking amount for being a validator is updated.\n event MinValidatorStakingAmountUpdated(uint256 threshold);\n /// @dev Emitted when the commission rate range is updated.\n event CommissionRateRangeUpdated(uint256 minRate, uint256 maxRate);\n\n /// @dev Emitted when the pool admin staked for themself.\n event Staked(address indexed consensuAddr, uint256 amount);\n /// @dev Emitted when the pool admin unstaked the amount of RON from themself.\n event Unstaked(address indexed consensuAddr, uint256 amount);\n\n /// @dev Emitted when the validator pool is approved.\n event PoolApproved(address indexed validator, address indexed admin);\n /// @dev Emitted when the validator pool is deprecated.\n event PoolsDeprecated(address[] validator);\n /// @dev Emitted when the staking amount transfer failed.\n event StakingAmountTransferFailed(\n address indexed validator,\n address indexed admin,\n uint256 amount,\n uint256 contractBalance\n );\n /// @dev Emitted when the staking amount deducted failed, e.g. when the validator gets slashed.\n event StakingAmountDeductFailed(\n address indexed validator,\n address indexed recipient,\n uint256 amount,\n uint256 contractBalance\n );\n\n /// @dev Error of cannot transfer RON to specified target.\n error ErrCannotInitTransferRON(address addr, string extraInfo);\n /// @dev Error of three interaction addresses must be of the same in applying for validator candidate.\n error ErrThreeInteractionAddrsNotEqual();\n /// @dev Error of three operation addresses must be distinct in applying for validator candidate.\n error ErrThreeOperationAddrsNotDistinct();\n /// @dev Error of unstaking zero amount.\n error ErrUnstakeZeroAmount();\n /// @dev Error of invalid staking amount left after deducted.\n error ErrStakingAmountLeft();\n /// @dev Error of insufficient staking amount for unstaking.\n error ErrInsufficientStakingAmount();\n /// @dev Error of unstaking too early.\n error ErrUnstakeTooEarly();\n /// @dev Error of setting commission rate exceeds max allowed.\n error ErrInvalidCommissionRate();\n\n /**\n * @dev Returns the minimum threshold for being a validator candidate.\n */\n function minValidatorStakingAmount() external view returns (uint256);\n\n /**\n * @dev Returns the commission rate range that the candidate can set.\n */\n function getCommissionRateRange() external view returns (uint256 _minRange, uint256 _maxRange);\n\n /**\n * @dev Sets the minimum threshold for being a validator candidate.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `MinValidatorStakingAmountUpdated` event.\n *\n */\n function setMinValidatorStakingAmount(uint256) external;\n\n /**\n * @dev Sets the commission rate range that a candidate can set.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `CommissionRateRangeUpdated` event.\n *\n */\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external;\n\n /**\n * @dev Proposes a candidate to become a validator.\n *\n * Requirements:\n * - The method caller is able to receive RON.\n * - The treasury is able to receive RON.\n * - The amount is larger than or equal to the minimum validator staking amount `minValidatorStakingAmount()`.\n *\n * Emits the event `PoolApproved`.\n *\n * @param _candidateAdmin the candidate admin will be stored in the validator contract, used for calling function that affects\n * to its candidate, e.g. scheduling maintenance.\n *\n */\n function applyValidatorCandidate(\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external payable;\n\n /**\n * @dev Deprecates the pool.\n * - Deduct self-staking amount of the pool admin to zero.\n * - Transfer the deducted amount to the pool admin.\n * - Deactivate the pool admin address in the mapping of active pool admins\n *\n * Requirements:\n * - The method caller is validator contract.\n *\n * Emits the event `PoolsDeprecated` and `Unstaked` events.\n * Emits the event `StakingAmountTransferFailed` if the contract cannot transfer RON back to the pool admin.\n *\n */\n function execDeprecatePools(address[] calldata _pools, uint256 _period) external;\n\n /**\n * @dev Self-delegates to the validator candidate `_consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `msg.value` is larger than 0.\n *\n * Emits the event `Staked`.\n *\n */\n function stake(address _consensusAddr) external payable;\n\n /**\n * @dev Unstakes from the validator candidate `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n * Emits the event `Unstaked`.\n *\n */\n function unstake(address _consensusAddr, uint256 _amount) external;\n\n /**\n * @dev Pool admin requests update validator commission rate. The request will be forwarded to the candidate manager\n * contract, and the value is getting updated in {ICandidateManager-execRequestUpdateCommissionRate}.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n * - The `_effectiveDaysOnwards` must be equal to or larger than the {CandidateManager-_minEffectiveDaysOnwards}.\n * - The `_rate` must be in range of [0_00; 100_00].\n *\n * Emits the event `CommissionRateUpdated`.\n *\n */\n function requestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveDaysOnwards,\n uint256 _commissionRate\n ) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestRenounce(address _consensusAddr) external;\n\n /**\n * @dev Renounces being a validator candidate and takes back the delegating/staking amount.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is the pool admin.\n *\n */\n function requestEmergencyExit(address _consensusAddr) external;\n}\n" + }, + "contracts/interfaces/staking/IDelegatorStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IRewardPool.sol\";\n\ninterface IDelegatorStaking is IRewardPool {\n /// @dev Emitted when the delegator staked for a validator candidate.\n event Delegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\n /// @dev Emitted when the delegator unstaked from a validator candidate.\n event Undelegated(address indexed delegator, address indexed consensuAddr, uint256 amount);\n\n /// @dev Error of undelegating zero amount.\n error ErrUndelegateZeroAmount();\n /// @dev Error of undelegating insufficient amount.\n error ErrInsufficientDelegatingAmount();\n /// @dev Error of undelegating too early.\n error ErrUndelegateTooEarly();\n\n /**\n * @dev Stakes for a validator candidate `_consensusAddr`.\n *\n * Requirements:\n * - The consensus address is a validator candidate.\n * - The method caller is not the pool admin.\n *\n * Emits the `Delegated` event.\n *\n */\n function delegate(address _consensusAddr) external payable;\n\n /**\n * @dev Unstakes from a validator candidate `_consensusAddr` for `_amount`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the `Undelegated` event.\n *\n */\n function undelegate(address _consensusAddr, uint256 _amount) external;\n\n /**\n * @dev Bulk unstakes from a list of candidates.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n *\n * Emits the events `Undelegated`.\n *\n */\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external;\n\n /**\n * @dev Unstakes an amount of RON from the `_consensusAddrSrc` and stake for `_consensusAddrDst`.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `Undelegated` event and the `Delegated` event.\n *\n */\n function redelegate(\n address _consensusAddrSrc,\n address _consensusAddrDst,\n uint256 _amount\n ) external;\n\n /**\n * @dev Returns the claimable reward of the user `_user`.\n */\n function getRewards(address _user, address[] calldata _poolAddrList)\n external\n view\n returns (uint256[] memory _rewards);\n\n /**\n * @dev Claims the reward of method caller.\n *\n * Emits the `RewardClaimed` event.\n *\n */\n function claimRewards(address[] calldata _consensusAddrList) external returns (uint256 _amount);\n\n /**\n * @dev Claims the rewards and delegates them to the consensus address.\n *\n * Requirements:\n * - The method caller is not the pool admin.\n * - The consensus address `_consensusAddrDst` is a validator candidate.\n *\n * Emits the `RewardClaimed` event and the `Delegated` event.\n *\n */\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\n external\n returns (uint256 _amount);\n}\n" + }, + "contracts/interfaces/staking/IRewardPool.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/consumers/PeriodWrapperConsumer.sol\";\n\ninterface IRewardPool is PeriodWrapperConsumer {\n struct UserRewardFields {\n // Recorded reward amount.\n uint256 debited;\n // The last accumulated of the amount rewards per share (one unit staking) that the info updated.\n uint256 aRps;\n // Lowest staking amount in the period.\n uint256 lowestAmount;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n\n struct PoolFields {\n // Accumulated of the amount rewards per share (one unit staking).\n uint256 aRps;\n // The staking total to share reward of the current period.\n PeriodWrapper shares;\n }\n\n /// @dev Emitted when the fields to calculate pending reward for the user is updated.\n event UserRewardUpdated(address indexed poolAddr, address indexed user, uint256 debited);\n /// @dev Emitted when the user claimed their reward\n event RewardClaimed(address indexed poolAddr, address indexed user, uint256 amount);\n\n /// @dev Emitted when the pool shares are updated\n event PoolSharesUpdated(uint256 indexed period, address indexed poolAddr, uint256 shares);\n /// @dev Emitted when the pools are updated\n event PoolsUpdated(uint256 indexed period, address[] poolAddrs, uint256[] aRps, uint256[] shares);\n /// @dev Emitted when the contract fails when updating the pools\n event PoolsUpdateFailed(uint256 indexed period, address[] poolAddrs, uint256[] rewards);\n /// @dev Emitted when the contract fails when updating the pools that already set\n event PoolsUpdateConflicted(uint256 indexed period, address[] poolAddrs);\n\n /// @dev Error of invalid pool share.\n error ErrInvalidPoolShare();\n\n /**\n * @dev Returns the reward amount that user claimable.\n */\n function getReward(address _poolAddr, address _user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amount of an user.\n */\n function getStakingAmount(address _poolAddr, address _user) external view returns (uint256);\n\n /**\n * @dev Returns the staking amounts of the users.\n */\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Returns the total staking amount of all users for a pool.\n */\n function getStakingTotal(address _poolAddr) external view returns (uint256);\n\n /**\n * @dev Returns the total staking amounts of all users for the pools `_poolAddrs`.\n */\n function getManyStakingTotals(address[] calldata _poolAddrs) external view returns (uint256[] memory);\n}\n" + }, + "contracts/interfaces/consumers/PeriodWrapperConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface PeriodWrapperConsumer {\n struct PeriodWrapper {\n // Inner value.\n uint256 inner;\n // Last period number that the info updated.\n uint256 lastPeriod;\n }\n}\n" + }, + "contracts/mocks/validator/MockValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../ronin/validator/CandidateManager.sol\";\n\ncontract MockValidatorSet is IRoninValidatorSet, CandidateManager {\n address public stakingVestingContract;\n address public slashIndicatorContract;\n\n uint256 internal _lastUpdatedPeriod;\n uint256 internal _numberOfBlocksInEpoch;\n /// @dev Mapping from period number => slashed\n mapping(uint256 => bool) internal _periodSlashed;\n\n constructor(\n address __stakingContract,\n address _slashIndicatorContract,\n address _stakingVestingContract,\n uint256 __maxValidatorCandidate,\n uint256 __numberOfBlocksInEpoch,\n uint256 __minEffectiveDaysOnwards\n ) {\n _setStakingContract(__stakingContract);\n _setMaxValidatorCandidate(__maxValidatorCandidate);\n slashIndicatorContract = _slashIndicatorContract;\n stakingVestingContract = _stakingVestingContract;\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\n _minEffectiveDaysOnwards = __minEffectiveDaysOnwards;\n }\n\n function submitBlockReward() external payable override {}\n\n function wrapUpEpoch() external payable override {\n _syncCandidateSet(_lastUpdatedPeriod + 1);\n _lastUpdatedPeriod = currentPeriod();\n }\n\n function getLastUpdatedBlock() external view override returns (uint256) {}\n\n function checkManyJailed(address[] calldata) external view override returns (bool[] memory) {}\n\n function checkMiningRewardDeprecatedAtPeriod(address, uint256 _period) external view override returns (bool) {}\n\n function checkMiningRewardDeprecated(address) external view override returns (bool) {}\n\n function checkBridgeRewardDeprecatedAtLatestPeriod(address _consensusAddr)\n external\n view\n override\n returns (bool _result)\n {}\n\n function checkBridgeRewardDeprecatedAtPeriod(address _consensusAddr, uint256 _period)\n external\n view\n returns (bool _result)\n {}\n\n function epochOf(uint256 _block) external view override returns (uint256) {}\n\n function getValidators()\n external\n view\n override\n returns (\n address[] memory,\n address[] memory,\n EnumFlags.ValidatorFlag[] memory\n )\n {}\n\n function epochEndingAt(uint256 _block) external view override returns (bool) {}\n\n function execSlash(\n address _validatorAddr,\n uint256 _newJailedUntil,\n uint256 _slashAmount,\n bool _cannotBailout\n ) external override {}\n\n function execBailOut(address, uint256) external override {}\n\n function setMaxValidatorNumber(uint256 _maxValidatorNumber) external override {}\n\n function setMaxPrioritizedValidatorNumber(uint256 _maxPrioritizedValidatorNumber) external override {}\n\n function maxValidatorNumber() external view override returns (uint256 _maximumValidatorNumber) {}\n\n function maxPrioritizedValidatorNumber()\n external\n view\n override\n returns (uint256 _maximumPrioritizedValidatorNumber)\n {}\n\n function isValidator(address) external pure override returns (bool) {\n return true;\n }\n\n function numberOfBlocksInEpoch() public view override returns (uint256) {\n return _numberOfBlocksInEpoch;\n }\n\n function getBridgeOperators() external view override returns (address[] memory) {}\n\n function getBridgeOperatorsOf(address[] memory _validatorAddrs) external view override returns (address[] memory) {}\n\n function isBridgeOperator(address) external pure override returns (bool) {\n return true;\n }\n\n function totalBridgeOperators() external view override returns (uint256) {}\n\n function getBlockProducers() external view override returns (address[] memory) {}\n\n function isBlockProducer(address) external pure override returns (bool) {\n return true;\n }\n\n function totalBlockProducers() external view override returns (uint256) {}\n\n function tryGetPeriodOfEpoch(uint256) external view returns (bool, uint256) {}\n\n function isPeriodEnding() public view virtual returns (bool) {\n return currentPeriod() > _lastUpdatedPeriod;\n }\n\n function currentPeriod() public view override returns (uint256) {\n return block.timestamp / 86400;\n }\n\n function checkJailed(address) external view override returns (bool) {}\n\n function getJailedTimeLeft(address)\n external\n view\n override\n returns (\n bool,\n uint256,\n uint256\n )\n {}\n\n function currentPeriodStartAtBlock() external view override returns (uint256) {}\n\n function checkJailedAtBlock(address _addr, uint256 _blockNum) external view override returns (bool) {}\n\n function getJailedTimeLeftAtBlock(address _addr, uint256 _blockNum)\n external\n view\n override\n returns (\n bool isJailed_,\n uint256 blockLeft_,\n uint256 epochLeft_\n )\n {}\n\n function totalDeprecatedReward() external view override returns (uint256) {}\n\n function _bridgeOperatorOf(address _consensusAddr) internal view override returns (address) {\n return super._bridgeOperatorOf(_consensusAddr);\n }\n\n function execReleaseLockedFundForEmergencyExitRequest(address _consensusAddr, address payable _recipient)\n external\n override\n {}\n\n function emergencyExitLockedAmount() external override returns (uint256) {}\n\n function emergencyExpiryDuration() external override returns (uint256) {}\n\n function setEmergencyExitLockedAmount(uint256 _emergencyExitLockedAmount) external override {}\n\n function setEmergencyExpiryDuration(uint256 _emergencyExpiryDuration) external override {}\n\n function getEmergencyExitInfo(address _consensusAddr) external view override returns (EmergencyExitInfo memory) {}\n\n function execEmergencyExit(address, uint256) external {}\n\n function isOperatingBridge(address) external view returns (bool) {}\n\n function _emergencyExitLockedFundReleased(address _consensusAddr) internal virtual override returns (bool) {}\n\n function _isTrustedOrg(address _consensusAddr) internal virtual override returns (bool) {}\n}\n" + }, + "contracts/ronin/staking/Staking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"../../interfaces/staking/IStaking.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"./CandidateStaking.sol\";\nimport \"./DelegatorStaking.sol\";\n\ncontract Staking is IStaking, CandidateStaking, DelegatorStaking, Initializable {\n constructor() {\n _disableInitializers();\n }\n\n receive() external payable onlyValidatorContract {}\n\n fallback() external payable onlyValidatorContract {}\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 __minValidatorStakingAmount,\n uint256 __maxCommissionRate,\n uint256 __cooldownSecsToUndelegate,\n uint256 __waitingSecsToRevoke\n ) external initializer {\n _setValidatorContract(__validatorContract);\n _setMinValidatorStakingAmount(__minValidatorStakingAmount);\n _setCommissionRateRange(0, __maxCommissionRate);\n _setCooldownSecsToUndelegate(__cooldownSecsToUndelegate);\n _setWaitingSecsToRevoke(__waitingSecsToRevoke);\n }\n\n /**\n * @inheritdoc IStaking\n */\n function execRecordRewards(\n address[] calldata _consensusAddrs,\n uint256[] calldata _rewards,\n uint256 _period\n ) external payable override onlyValidatorContract {\n _recordRewards(_consensusAddrs, _rewards, _period);\n }\n\n /**\n * @inheritdoc IStaking\n */\n function execDeductStakingAmount(address _consensusAddr, uint256 _amount)\n external\n override\n onlyValidatorContract\n returns (uint256 _actualDeductingAmount)\n {\n _actualDeductingAmount = _deductStakingAmount(_stakingPool[_consensusAddr], _amount);\n address payable _validatorContractAddr = payable(validatorContract());\n if (!_unsafeSendRON(_validatorContractAddr, _actualDeductingAmount)) {\n emit StakingAmountDeductFailed(\n _consensusAddr,\n _validatorContractAddr,\n _actualDeductingAmount,\n address(this).balance\n );\n }\n }\n\n /**\n * @inheritdoc RewardCalculation\n */\n function _currentPeriod() internal view virtual override returns (uint256) {\n return _validatorContract.currentPeriod();\n }\n\n /**\n * @inheritdoc CandidateStaking\n */\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount)\n internal\n override\n returns (uint256 _actualDeductingAmount)\n {\n _actualDeductingAmount = Math.min(_pool.stakingAmount, _amount);\n\n _pool.stakingAmount -= _actualDeductingAmount;\n _changeDelegatingAmount(\n _pool,\n _pool.admin,\n _pool.stakingAmount,\n Math.subNonNegative(_pool.stakingTotal, _actualDeductingAmount)\n );\n emit Unstaked(_pool.addr, _actualDeductingAmount);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/Address.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "contracts/libraries/Math.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Math {\n /**\n * @dev Returns the largest of two numbers.\n */\n function max(uint256 a, uint256 b) internal pure returns (uint256) {\n return a >= b ? a : b;\n }\n\n /**\n * @dev Returns the smallest of two numbers.\n */\n function min(uint256 a, uint256 b) internal pure returns (uint256) {\n return a < b ? a : b;\n }\n\n /**\n * @dev Returns whether the number `c` is in range of [a; b].\n */\n function inRange(\n uint256 c,\n uint256 a,\n uint256 b\n ) internal pure returns (bool) {\n return a <= c && c <= b;\n }\n\n /**\n * @dev Returns whether two inclusive ranges [x1;x2] and [y1;y2] overlap.\n */\n function twoRangeOverlap(\n uint256 x1,\n uint256 x2,\n uint256 y1,\n uint256 y2\n ) internal pure returns (bool) {\n return x1 <= y2 && y1 <= x2;\n }\n\n /**\n * @dev Returns value of a + b; in case result is larger than upperbound, upperbound is returned.\n */\n function addWithUpperbound(\n uint256 a,\n uint256 b,\n uint256 upperbound\n ) internal pure returns (uint256) {\n return min(a + b, upperbound);\n }\n\n /**\n * @dev Returns value of a - b; in case of negative result, 0 is returned.\n */\n function subNonNegative(uint256 a, uint256 b) internal pure returns (uint256) {\n return a > b ? a - b : 0;\n }\n\n /**\n * @dev Returns value of `a + zeroable` if zerobale is not 0; otherwise, return 0.\n */\n function addIfNonZero(uint256 a, uint256 zeroable) internal pure returns (uint256) {\n return zeroable != 0 ? a + zeroable : 0;\n }\n}\n" + }, + "contracts/ronin/staking/CandidateStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../libraries/AddressArrayUtils.sol\";\nimport \"../../interfaces/staking/ICandidateStaking.sol\";\nimport \"./BaseStaking.sol\";\n\nabstract contract CandidateStaking is BaseStaking, ICandidateStaking, GlobalConfigConsumer, PercentageConsumer {\n /// @dev The minimum threshold for being a validator candidate.\n uint256 internal _minValidatorStakingAmount;\n\n /// @dev The max commission rate that the validator can set (in range of [0;100_00] means [0-100%])\n uint256 internal _maxCommissionRate;\n /// @dev The min commission rate that the validator can set (in range of [0;100_00] means [0-100%])\n uint256 internal _minCommissionRate;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] ______gap;\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function minValidatorStakingAmount() public view override returns (uint256) {\n return _minValidatorStakingAmount;\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function getCommissionRateRange() external view override returns (uint256, uint256) {\n return (_minCommissionRate, _maxCommissionRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function setMinValidatorStakingAmount(uint256 _threshold) external override onlyAdmin {\n _setMinValidatorStakingAmount(_threshold);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function setCommissionRateRange(uint256 _minRate, uint256 _maxRate) external override onlyAdmin {\n _setCommissionRateRange(_minRate, _maxRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function applyValidatorCandidate(\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate\n ) external payable override nonReentrant {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\n\n uint256 _amount = msg.value;\n address payable _poolAdmin = payable(msg.sender);\n _applyValidatorCandidate(\n _poolAdmin,\n _candidateAdmin,\n _consensusAddr,\n _treasuryAddr,\n _bridgeOperatorAddr,\n _commissionRate,\n _amount\n );\n\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\n _pool.admin = _poolAdmin;\n _pool.addr = _consensusAddr;\n _adminOfActivePoolMapping[_poolAdmin] = _consensusAddr;\n\n _stake(_stakingPool[_consensusAddr], _poolAdmin, _amount);\n emit PoolApproved(_consensusAddr, _poolAdmin);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestUpdateCommissionRate(\n address _consensusAddr,\n uint256 _effectiveDaysOnwards,\n uint256 _commissionRate\n ) external override poolIsActive(_consensusAddr) onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender) {\n if (_commissionRate > _maxCommissionRate || _commissionRate < _minCommissionRate) revert ErrInvalidCommissionRate();\n _validatorContract.execRequestUpdateCommissionRate(_consensusAddr, _effectiveDaysOnwards, _commissionRate);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function execDeprecatePools(address[] calldata _pools, uint256 _newPeriod) external override onlyValidatorContract {\n if (_pools.length == 0) {\n return;\n }\n\n for (uint _i = 0; _i < _pools.length; _i++) {\n PoolDetail storage _pool = _stakingPool[_pools[_i]];\n // Deactivate the pool admin in the active mapping.\n delete _adminOfActivePoolMapping[_pool.admin];\n\n // Deduct and transfer the self staking amount to the pool admin.\n uint256 _deductingAmount = _pool.stakingAmount;\n if (_deductingAmount > 0) {\n _deductStakingAmount(_pool, _deductingAmount);\n if (!_unsafeSendRON(payable(_pool.admin), _deductingAmount, DEFAULT_ADDITION_GAS)) {\n emit StakingAmountTransferFailed(_pool.addr, _pool.admin, _deductingAmount, address(this).balance);\n }\n }\n\n // Settle the unclaimed reward and transfer to the pool admin.\n uint256 _lastRewardAmount = _claimReward(_pools[_i], _pool.admin, _newPeriod);\n if (_lastRewardAmount > 0) {\n _unsafeSendRON(payable(_pool.admin), _lastRewardAmount, DEFAULT_ADDITION_GAS);\n }\n }\n\n emit PoolsDeprecated(_pools);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function stake(address _consensusAddr) external payable override noEmptyValue poolIsActive(_consensusAddr) {\n _stake(_stakingPool[_consensusAddr], msg.sender, msg.value);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function unstake(address _consensusAddr, uint256 _amount)\n external\n override\n nonReentrant\n poolIsActive(_consensusAddr)\n {\n if (_amount == 0) revert ErrUnstakeZeroAmount();\n address _requester = msg.sender;\n PoolDetail storage _pool = _stakingPool[_consensusAddr];\n uint256 _remainAmount = _pool.stakingAmount - _amount;\n if (_remainAmount < _minValidatorStakingAmount) revert ErrStakingAmountLeft();\n\n _unstake(_pool, _requester, _amount);\n if (!_unsafeSendRON(payable(_requester), _amount, DEFAULT_ADDITION_GAS)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestRenounce(address _consensusAddr)\n external\n override\n poolIsActive(_consensusAddr)\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\n {\n _validatorContract.execRequestRenounceCandidate(_consensusAddr, _waitingSecsToRevoke);\n }\n\n /**\n * @inheritdoc ICandidateStaking\n */\n function requestEmergencyExit(address _consensusAddr)\n external\n override\n poolIsActive(_consensusAddr)\n onlyPoolAdmin(_stakingPool[_consensusAddr], msg.sender)\n {\n _validatorContract.execEmergencyExit(_consensusAddr, _waitingSecsToRevoke);\n }\n\n /**\n * @dev See `ICandidateStaking-applyValidatorCandidate`\n */\n function _applyValidatorCandidate(\n address payable _poolAdmin,\n address _candidateAdmin,\n address _consensusAddr,\n address payable _treasuryAddr,\n address _bridgeOperatorAddr,\n uint256 _commissionRate,\n uint256 _amount\n ) internal {\n if (!_unsafeSendRON(_poolAdmin, 0)) revert ErrCannotInitTransferRON(_poolAdmin, \"pool admin\");\n if (!_unsafeSendRON(_treasuryAddr, 0)) revert ErrCannotInitTransferRON(_treasuryAddr, \"treasury\");\n if (_amount < _minValidatorStakingAmount) revert ErrInsufficientStakingAmount();\n if (_poolAdmin != _candidateAdmin || _candidateAdmin != _treasuryAddr) revert ErrThreeInteractionAddrsNotEqual();\n\n address[] memory _diffAddrs = new address[](3);\n _diffAddrs[0] = _poolAdmin;\n _diffAddrs[1] = _consensusAddr;\n _diffAddrs[2] = _bridgeOperatorAddr;\n if (AddressArrayUtils.hasDuplicate(_diffAddrs)) revert ErrThreeOperationAddrsNotDistinct();\n\n _validatorContract.execApplyValidatorCandidate(\n _candidateAdmin,\n _consensusAddr,\n _treasuryAddr,\n _bridgeOperatorAddr,\n _commissionRate\n );\n }\n\n /**\n * @dev See `ICandidateStaking-stake`\n */\n function _stake(\n PoolDetail storage _pool,\n address _requester,\n uint256 _amount\n ) internal onlyPoolAdmin(_pool, _requester) {\n _pool.stakingAmount += _amount;\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal + _amount);\n _pool.lastDelegatingTimestamp[_requester] = block.timestamp;\n emit Staked(_pool.addr, _amount);\n }\n\n /**\n * @dev See `ICandidateStaking-unstake`\n */\n function _unstake(\n PoolDetail storage _pool,\n address _requester,\n uint256 _amount\n ) internal onlyPoolAdmin(_pool, _requester) {\n if (_amount > _pool.stakingAmount) revert ErrInsufficientStakingAmount();\n if (_pool.lastDelegatingTimestamp[_requester] + _cooldownSecsToUndelegate > block.timestamp) {\n revert ErrUnstakeTooEarly();\n }\n\n _pool.stakingAmount -= _amount;\n _changeDelegatingAmount(_pool, _requester, _pool.stakingAmount, _pool.stakingTotal - _amount);\n emit Unstaked(_pool.addr, _amount);\n }\n\n /**\n * @dev Deducts from staking amount of the validator `_consensusAddr` for `_amount`.\n *\n * Emits the event `Unstaked`.\n *\n * @return The actual deducted amount\n */\n function _deductStakingAmount(PoolDetail storage _pool, uint256 _amount) internal virtual returns (uint256);\n\n /**\n * @dev Sets the minimum threshold for being a validator candidate.\n *\n * Emits the `MinValidatorStakingAmountUpdated` event.\n *\n */\n function _setMinValidatorStakingAmount(uint256 _threshold) internal {\n _minValidatorStakingAmount = _threshold;\n emit MinValidatorStakingAmountUpdated(_threshold);\n }\n\n /**\n * @dev Sets the max commission rate that a candidate can set.\n *\n * Emits the `MaxCommissionRateUpdated` event.\n *\n */\n function _setCommissionRateRange(uint256 _minRate, uint256 _maxRate) internal {\n if (_maxRate > _MAX_PERCENTAGE || _minRate > _maxRate) revert ErrInvalidCommissionRate();\n _maxCommissionRate = _maxRate;\n _minCommissionRate = _minRate;\n emit CommissionRateRangeUpdated(_minRate, _maxRate);\n }\n}\n" + }, + "contracts/ronin/staking/DelegatorStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/staking/IDelegatorStaking.sol\";\nimport \"./BaseStaking.sol\";\n\nabstract contract DelegatorStaking is BaseStaking, IDelegatorStaking {\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function delegate(address _consensusAddr) external payable noEmptyValue poolIsActive(_consensusAddr) {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n _delegate(_stakingPool[_consensusAddr], msg.sender, msg.value);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function undelegate(address _consensusAddr, uint256 _amount) external nonReentrant {\n address payable _delegator = payable(msg.sender);\n _undelegate(_stakingPool[_consensusAddr], _delegator, _amount);\n if (!_sendRON(_delegator, _amount)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function bulkUndelegate(address[] calldata _consensusAddrs, uint256[] calldata _amounts) external nonReentrant {\n if (_consensusAddrs.length == 0 || _consensusAddrs.length != _amounts.length) revert ErrInvalidArrays();\n\n address payable _delegator = payable(msg.sender);\n uint256 _total;\n\n for (uint _i = 0; _i < _consensusAddrs.length; _i++) {\n _total += _amounts[_i];\n _undelegate(_stakingPool[_consensusAddrs[_i]], _delegator, _amounts[_i]);\n }\n\n if (!_sendRON(_delegator, _total)) revert ErrCannotTransferRON();\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function redelegate(\n address _consensusAddrSrc,\n address _consensusAddrDst,\n uint256 _amount\n ) external nonReentrant poolIsActive(_consensusAddrDst) {\n address _delegator = msg.sender;\n _undelegate(_stakingPool[_consensusAddrSrc], _delegator, _amount);\n _delegate(_stakingPool[_consensusAddrDst], _delegator, _amount);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function claimRewards(address[] calldata _consensusAddrList)\n external\n override\n nonReentrant\n returns (uint256 _amount)\n {\n _amount = _claimRewards(msg.sender, _consensusAddrList);\n _transferRON(payable(msg.sender), _amount);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function delegateRewards(address[] calldata _consensusAddrList, address _consensusAddrDst)\n external\n override\n nonReentrant\n poolIsActive(_consensusAddrDst)\n returns (uint256 _amount)\n {\n if (isAdminOfActivePool(msg.sender)) revert ErrAdminOfAnyActivePoolForbidden(msg.sender);\n return _delegateRewards(msg.sender, _consensusAddrList, _consensusAddrDst);\n }\n\n /**\n * @inheritdoc IDelegatorStaking\n */\n function getRewards(address _user, address[] calldata _poolAddrList)\n external\n view\n returns (uint256[] memory _rewards)\n {\n address _consensusAddr;\n uint256 _period = _validatorContract.currentPeriod();\n _rewards = new uint256[](_poolAddrList.length);\n\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\n _consensusAddr = _poolAddrList[_i];\n _rewards[_i] = _getReward(_consensusAddr, _user, _period, getStakingAmount(_consensusAddr, _user));\n }\n }\n\n /**\n * @dev Delegates from a validator address.\n *\n * Requirements:\n * - The delegator is not the pool admin.\n *\n * Emits the `Delegated` event.\n *\n * Note: This function does not verify the `msg.value` with the amount.\n *\n */\n function _delegate(\n PoolDetail storage _pool,\n address _delegator,\n uint256 _amount\n ) internal notPoolAdmin(_pool, _delegator) {\n _changeDelegatingAmount(\n _pool,\n _delegator,\n _pool.delegatingAmount[_delegator] + _amount,\n _pool.stakingTotal + _amount\n );\n _pool.lastDelegatingTimestamp[_delegator] = block.timestamp;\n emit Delegated(_delegator, _pool.addr, _amount);\n }\n\n /**\n * @dev Undelegates from a validator address.\n *\n * Requirements:\n * - The delegator is not the pool admin.\n * - The amount is larger than 0.\n * - The delegating amount is larger than or equal to the undelegating amount.\n *\n * Emits the `Undelegated` event.\n *\n * Note: Consider transferring back the amount of RON after calling this function.\n *\n */\n function _undelegate(\n PoolDetail storage _pool,\n address _delegator,\n uint256 _amount\n ) private notPoolAdmin(_pool, _delegator) {\n if (_amount == 0) revert ErrUndelegateZeroAmount();\n if (_pool.delegatingAmount[_delegator] < _amount) revert ErrInsufficientDelegatingAmount();\n\n if (\n _validatorContract.isValidatorCandidate(_pool.addr) &&\n _validatorContract.getCandidateInfo(_pool.addr).revokingTimestamp == 0 && // if candidate is not on renunciation\n _pool.lastDelegatingTimestamp[_delegator] + _cooldownSecsToUndelegate >= block.timestamp // delegator is still in cooldown\n ) revert ErrUndelegateTooEarly();\n\n _changeDelegatingAmount(\n _pool,\n _delegator,\n _pool.delegatingAmount[_delegator] - _amount,\n _pool.stakingTotal - _amount\n );\n emit Undelegated(_delegator, _pool.addr, _amount);\n }\n\n /**\n * @dev Claims rewards from the pools `_poolAddrList`.\n * Note: This function does not transfer reward to user.\n */\n function _claimRewards(address _user, address[] memory _poolAddrList) internal returns (uint256 _amount) {\n uint256 _period = _currentPeriod();\n for (uint256 _i = 0; _i < _poolAddrList.length; _i++) {\n _amount += _claimReward(_poolAddrList[_i], _user, _period);\n }\n }\n\n /**\n * @dev Claims the rewards and delegates them to the consensus address.\n */\n function _delegateRewards(\n address _user,\n address[] calldata _poolAddrList,\n address _poolAddrDst\n ) internal returns (uint256 _amount) {\n _amount = _claimRewards(_user, _poolAddrList);\n _delegate(_stakingPool[_poolAddrDst], _user, _amount);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\n }\n\n /**\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n * `recipient`, forwarding all available gas and reverting on errors.\n *\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\n * imposed by `transfer`, making them unable to receive funds via\n * `transfer`. {sendValue} removes this limitation.\n *\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n *\n * IMPORTANT: because control is transferred to `recipient`, care must be\n * taken to not create reentrancy vulnerabilities. Consider using\n * {ReentrancyGuard} or the\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n */\n function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/libraries/AddressArrayUtils.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary AddressArrayUtils {\n /**\n * @dev Returns whether or not there's a duplicate. Runs in O(n^2).\n * @param A Array to search\n * @return Returns true if duplicate, false otherwise\n */\n function hasDuplicate(address[] memory A) internal pure returns (bool) {\n if (A.length == 0) {\n return false;\n }\n for (uint256 i = 0; i < A.length - 1; i++) {\n for (uint256 j = i + 1; j < A.length; j++) {\n if (A[i] == A[j]) {\n return true;\n }\n }\n }\n return false;\n }\n\n /**\n * @dev Returns whether two arrays of addresses are equal or not.\n */\n function isEqual(address[] memory _this, address[] memory _other) internal pure returns (bool) {\n bytes32 _thisHash;\n bytes32 _otherHash;\n\n assembly {\n _thisHash := keccak256(add(_this, 32), mul(mload(_this), 32))\n _otherHash := keccak256(add(_other, 32), mul(mload(_other), 32))\n }\n\n return _thisHash == _otherHash;\n }\n}\n" + }, + "contracts/ronin/staking/BaseStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/security/ReentrancyGuard.sol\";\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\nimport \"../../interfaces/staking/IBaseStaking.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"./RewardCalculation.sol\";\n\nabstract contract BaseStaking is\n RONTransferHelper,\n ReentrancyGuard,\n RewardCalculation,\n HasValidatorContract,\n IBaseStaking\n{\n /// @dev Mapping from pool address => staking pool detail\n mapping(address => PoolDetail) internal _stakingPool;\n\n /// @dev The cooldown time in seconds to undelegate from the last timestamp (s)he delegated.\n uint256 internal _cooldownSecsToUndelegate;\n /// @dev The number of seconds that a candidate must wait to be revoked and take the self-staking amount back.\n uint256 internal _waitingSecsToRevoke;\n\n /// @dev Mapping from admin address of an active pool => consensus address.\n mapping(address => address) internal _adminOfActivePoolMapping;\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n modifier noEmptyValue() {\n if (msg.value == 0) revert ErrZeroValue();\n _;\n }\n\n modifier notPoolAdmin(PoolDetail storage _pool, address _delegator) {\n if (_pool.admin == _delegator) revert ErrPoolAdminForbidden();\n _;\n }\n\n modifier onlyPoolAdmin(PoolDetail storage _pool, address _requester) {\n if (_pool.admin != _requester) revert ErrOnlyPoolAdminAllowed();\n _;\n }\n\n modifier poolIsActive(address _poolAddr) {\n if (!_validatorContract.isValidatorCandidate(_poolAddr)) revert ErrInactivePool(_poolAddr);\n _;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function isAdminOfActivePool(address _poolAdminAddr) public view override returns (bool) {\n return _adminOfActivePoolMapping[_poolAdminAddr] != address(0);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getPoolAddressOf(address _poolAdminAddr) external view override returns (address) {\n return _adminOfActivePoolMapping[_poolAdminAddr];\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getPoolDetail(address _poolAddr)\n external\n view\n returns (\n address _admin,\n uint256 _stakingAmount,\n uint256 _stakingTotal\n )\n {\n PoolDetail storage _pool = _stakingPool[_poolAddr];\n return (_pool.admin, _pool.stakingAmount, _pool.stakingTotal);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function getManySelfStakings(address[] calldata _pools) external view returns (uint256[] memory _selfStakings) {\n _selfStakings = new uint256[](_pools.length);\n for (uint _i = 0; _i < _pools.length; _i++) {\n _selfStakings[_i] = _stakingPool[_pools[_i]].stakingAmount;\n }\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingTotal(address _poolAddr) public view override returns (uint256) {\n return _stakingPool[_poolAddr].stakingTotal;\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getManyStakingTotals(address[] calldata _poolList)\n public\n view\n override\n returns (uint256[] memory _stakingAmounts)\n {\n _stakingAmounts = new uint256[](_poolList.length);\n for (uint _i = 0; _i < _poolList.length; _i++) {\n _stakingAmounts[_i] = getStakingTotal(_poolList[_i]);\n }\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingAmount(address _poolAddr, address _user) public view override returns (uint256) {\n return _stakingPool[_poolAddr].delegatingAmount[_user];\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\n external\n view\n override\n returns (uint256[] memory _stakingAmounts)\n {\n if (_poolAddrs.length != _userList.length) revert ErrInvalidArrays();\n _stakingAmounts = new uint256[](_poolAddrs.length);\n for (uint _i = 0; _i < _stakingAmounts.length; _i++) {\n _stakingAmounts[_i] = _stakingPool[_poolAddrs[_i]].delegatingAmount[_userList[_i]];\n }\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function cooldownSecsToUndelegate() external view returns (uint256) {\n return _cooldownSecsToUndelegate;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function waitingSecsToRevoke() external view returns (uint256) {\n return _waitingSecsToRevoke;\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function setCooldownSecsToUndelegate(uint256 _cooldownSecs) external override onlyAdmin {\n _setCooldownSecsToUndelegate(_cooldownSecs);\n }\n\n /**\n * @inheritdoc IBaseStaking\n */\n function setWaitingSecsToRevoke(uint256 _secs) external override onlyAdmin {\n _setWaitingSecsToRevoke(_secs);\n }\n\n /**\n * @dev Sets the minium number of seconds to undelegate.\n *\n * Emits the event `CooldownSecsToUndelegateUpdated`.\n *\n */\n function _setCooldownSecsToUndelegate(uint256 _cooldownSecs) internal {\n _cooldownSecsToUndelegate = _cooldownSecs;\n emit CooldownSecsToUndelegateUpdated(_cooldownSecs);\n }\n\n /**\n * @dev Sets the number of seconds that a candidate must wait to be revoked.\n *\n * Emits the event `WaitingSecsToRevokeUpdated`.\n *\n */\n function _setWaitingSecsToRevoke(uint256 _secs) internal {\n _waitingSecsToRevoke = _secs;\n emit WaitingSecsToRevokeUpdated(_secs);\n }\n\n /**\n * @dev Changes the delegate amount.\n */\n function _changeDelegatingAmount(\n PoolDetail storage _pool,\n address _delegator,\n uint256 _newDelegatingAmount,\n uint256 _newStakingTotal\n ) internal {\n _syncUserReward(_pool.addr, _delegator, _newDelegatingAmount);\n _pool.stakingTotal = _newStakingTotal;\n _pool.delegatingAmount[_delegator] = _newDelegatingAmount;\n }\n}\n" + }, + "@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Contract module that helps prevent reentrant calls to a function.\n *\n * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier\n * available, which can be applied to functions to make sure there are no nested\n * (reentrant) calls to them.\n *\n * Note that because there is a single `nonReentrant` guard, functions marked as\n * `nonReentrant` may not call one another. This can be worked around by making\n * those functions `private`, and then adding `external` `nonReentrant` entry\n * points to them.\n *\n * TIP: If you would like to learn more about reentrancy and alternative ways\n * to protect against it, check out our blog post\n * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].\n */\nabstract contract ReentrancyGuard {\n // Booleans are more expensive than uint256 or any type that takes up a full\n // word because each write operation emits an extra SLOAD to first read the\n // slot's contents, replace the bits taken up by the boolean, and then write\n // back. This is the compiler's defense against contract upgrades and\n // pointer aliasing, and it cannot be disabled.\n\n // The values being non-zero value makes deployment a bit more expensive,\n // but in exchange the refund on every call to nonReentrant will be lower in\n // amount. Since refunds are capped to a percentage of the total\n // transaction's gas, it is best to keep them low in cases like this one, to\n // increase the likelihood of the full refund coming into effect.\n uint256 private constant _NOT_ENTERED = 1;\n uint256 private constant _ENTERED = 2;\n\n uint256 private _status;\n\n constructor() {\n _status = _NOT_ENTERED;\n }\n\n /**\n * @dev Prevents a contract from calling itself, directly or indirectly.\n * Calling a `nonReentrant` function from another `nonReentrant`\n * function is not supported. It is possible to prevent this from happening\n * by making the `nonReentrant` function external, and making it call a\n * `private` function that does the actual work.\n */\n modifier nonReentrant() {\n // On the first call to nonReentrant, _notEntered will be true\n require(_status != _ENTERED, \"ReentrancyGuard: reentrant call\");\n\n // Any calls to nonReentrant after this point will fail\n _status = _ENTERED;\n\n _;\n\n // By storing the original value once again, a refund is triggered (see\n // https://eips.ethereum.org/EIPS/eip-2200)\n _status = _NOT_ENTERED;\n }\n}\n" + }, + "contracts/ronin/staking/RewardCalculation.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/staking/IRewardPool.sol\";\nimport \"../../libraries/Math.sol\";\n\n/**\n * @title RewardCalculation contract\n * @dev This contract mainly contains the methods to calculate reward for staking contract.\n */\nabstract contract RewardCalculation is IRewardPool {\n /// @dev Mapping from pool address => period number => accumulated rewards per share (one unit staking)\n mapping(address => mapping(uint256 => PeriodWrapper)) private _accumulatedRps;\n /// @dev Mapping from the pool address => user address => the reward info of the user\n mapping(address => mapping(address => UserRewardFields)) private _userReward;\n /// @dev Mapping from the pool address => reward pool fields\n mapping(address => PoolFields) private _stakingPool;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc IRewardPool\n */\n function getReward(address _poolAddr, address _user) external view returns (uint256) {\n return _getReward(_poolAddr, _user, _currentPeriod(), getStakingAmount(_poolAddr, _user));\n }\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingAmount(address _poolAddr, address _user) public view virtual returns (uint256);\n\n /**\n * @inheritdoc IRewardPool\n */\n function getStakingTotal(address _poolAddr) public view virtual returns (uint256);\n\n /**\n * @dev Returns the reward amount that user claimable.\n */\n function _getReward(\n address _poolAddr,\n address _user,\n uint256 _latestPeriod,\n uint256 _latestStakingAmount\n ) internal view returns (uint256) {\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\n\n if (_reward.lastPeriod == _latestPeriod) {\n return _reward.debited;\n }\n\n uint256 _aRps;\n uint256 _lastPeriodReward;\n PoolFields storage _pool = _stakingPool[_poolAddr];\n PeriodWrapper storage _wrappedArps = _accumulatedRps[_poolAddr][_reward.lastPeriod];\n\n if (_wrappedArps.lastPeriod > 0) {\n // Calculates the last period reward if the aRps at the period is set\n _aRps = _wrappedArps.inner;\n _lastPeriodReward = _reward.lowestAmount * (_aRps - _reward.aRps);\n } else {\n // Fallbacks to the previous aRps in case the aRps is not set\n _aRps = _reward.aRps;\n }\n\n uint256 _newPeriodsReward = _latestStakingAmount * (_pool.aRps - _aRps);\n return _reward.debited + (_lastPeriodReward + _newPeriodsReward) / 1e18;\n }\n\n /**\n * @dev Syncs the user reward.\n *\n * Emits the event `UserRewardUpdated` once the debit amount is updated.\n * Emits the event `PoolSharesUpdated` once the pool share is updated.\n *\n * Note: The method should be called whenever the user's staking amount changes.\n *\n */\n function _syncUserReward(\n address _poolAddr,\n address _user,\n uint256 _newStakingAmount\n ) internal {\n uint256 _period = _currentPeriod();\n PoolFields storage _pool = _stakingPool[_poolAddr];\n uint256 _lastShares = _pool.shares.inner;\n\n // Updates the pool shares if it is outdated\n if (_pool.shares.lastPeriod < _period) {\n _pool.shares = PeriodWrapper(getStakingTotal(_poolAddr), _period);\n }\n\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\n uint256 _debited = _getReward(_poolAddr, _user, _period, _currentStakingAmount);\n\n if (_reward.debited != _debited) {\n _reward.debited = _debited;\n emit UserRewardUpdated(_poolAddr, _user, _debited);\n }\n\n _syncMinStakingAmount(_pool, _reward, _period, _newStakingAmount, _currentStakingAmount);\n _reward.aRps = _pool.aRps;\n _reward.lastPeriod = _period;\n\n if (_pool.shares.inner != _lastShares) {\n emit PoolSharesUpdated(_period, _poolAddr, _pool.shares.inner);\n }\n }\n\n /**\n * @dev Syncs the minimum staking amount of an user in the current period.\n */\n function _syncMinStakingAmount(\n PoolFields storage _pool,\n UserRewardFields storage _reward,\n uint256 _latestPeriod,\n uint256 _newStakingAmount,\n uint256 _currentStakingAmount\n ) internal {\n if (_reward.lastPeriod < _latestPeriod) {\n _reward.lowestAmount = _currentStakingAmount;\n }\n\n uint256 _lowestAmount = Math.min(_reward.lowestAmount, _newStakingAmount);\n uint256 _diffAmount = _reward.lowestAmount - _lowestAmount;\n if (_diffAmount > 0) {\n _reward.lowestAmount = _lowestAmount;\n if (_pool.shares.inner < _diffAmount) revert ErrInvalidPoolShare();\n _pool.shares.inner -= _diffAmount;\n }\n }\n\n /**\n * @dev Claims the settled reward for a specific user.\n *\n * @param _lastPeriod Must be in two possible value: `_currentPeriod` in normal calculation, or\n * `_currentPeriod + 1` in case of calculating the reward for revoked validators.\n *\n * Emits the `RewardClaimed` event and the `UserRewardUpdated` event.\n *\n * Note: This method should be called before transferring rewards for the user.\n *\n */\n function _claimReward(\n address _poolAddr,\n address _user,\n uint256 _lastPeriod\n ) internal returns (uint256 _amount) {\n uint256 _currentStakingAmount = getStakingAmount(_poolAddr, _user);\n _amount = _getReward(_poolAddr, _user, _lastPeriod, _currentStakingAmount);\n emit RewardClaimed(_poolAddr, _user, _amount);\n\n UserRewardFields storage _reward = _userReward[_poolAddr][_user];\n _reward.debited = 0;\n _syncMinStakingAmount(_stakingPool[_poolAddr], _reward, _lastPeriod, _currentStakingAmount, _currentStakingAmount);\n _reward.lastPeriod = _lastPeriod;\n _reward.aRps = _stakingPool[_poolAddr].aRps;\n emit UserRewardUpdated(_poolAddr, _user, 0);\n }\n\n /**\n * @dev Records the amount of rewards `_rewards` for the pools `_poolAddrs`.\n *\n * Emits the event `PoolsUpdated` once the contract recorded the rewards successfully.\n * Emits the event `PoolsUpdateFailed` once the input array lengths are not equal.\n * Emits the event `PoolUpdateConflicted` when the pool is already updated in the period.\n *\n * Note: This method should be called once at the period ending.\n *\n */\n function _recordRewards(\n address[] memory _poolAddrs,\n uint256[] calldata _rewards,\n uint256 _period\n ) internal {\n if (_poolAddrs.length != _rewards.length) {\n emit PoolsUpdateFailed(_period, _poolAddrs, _rewards);\n return;\n }\n\n uint256 _rps;\n uint256 _count;\n address _poolAddr;\n uint256 _stakingTotal;\n uint256[] memory _aRps = new uint256[](_poolAddrs.length);\n uint256[] memory _shares = new uint256[](_poolAddrs.length);\n address[] memory _conflicted = new address[](_poolAddrs.length);\n\n for (uint _i = 0; _i < _poolAddrs.length; _i++) {\n _poolAddr = _poolAddrs[_i];\n PoolFields storage _pool = _stakingPool[_poolAddr];\n _stakingTotal = getStakingTotal(_poolAddr);\n\n if (_accumulatedRps[_poolAddr][_period].lastPeriod == _period) {\n _conflicted[_count++] = _poolAddr;\n continue;\n }\n\n // Updates the pool shares if it is outdated\n if (_pool.shares.lastPeriod < _period) {\n _pool.shares = PeriodWrapper(_stakingTotal, _period);\n }\n\n // The rps is 0 if no one stakes for the pool\n _rps = _pool.shares.inner == 0 ? 0 : (_rewards[_i] * 1e18) / _pool.shares.inner;\n _aRps[_i - _count] = _pool.aRps += _rps;\n _accumulatedRps[_poolAddr][_period] = PeriodWrapper(_pool.aRps, _period);\n _pool.shares.inner = _stakingTotal;\n _shares[_i - _count] = _pool.shares.inner;\n _poolAddrs[_i - _count] = _poolAddr;\n }\n\n if (_count > 0) {\n assembly {\n mstore(_conflicted, _count)\n mstore(_poolAddrs, sub(mload(_poolAddrs), _count))\n }\n emit PoolsUpdateConflicted(_period, _conflicted);\n }\n\n if (_poolAddrs.length > 0) {\n emit PoolsUpdated(_period, _poolAddrs, _aRps, _shares);\n }\n }\n\n /**\n * @dev Returns the current period.\n */\n function _currentPeriod() internal view virtual returns (uint256);\n}\n" + }, + "contracts/ronin/Maintenance.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../interfaces/IMaintenance.sol\";\nimport \"../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../extensions/collections/HasValidatorContract.sol\";\nimport \"../libraries/Math.sol\";\n\ncontract Maintenance is IMaintenance, HasValidatorContract, Initializable {\n using Math for uint256;\n\n /// @dev Mapping from consensus address => maintenance schedule.\n mapping(address => Schedule) internal _schedule;\n\n /// @dev The min duration to maintenance in blocks.\n uint256 public minMaintenanceDurationInBlock;\n /// @dev The max duration to maintenance in blocks.\n uint256 public maxMaintenanceDurationInBlock;\n /// @dev The offset to the min block number that the schedule can start.\n uint256 public minOffsetToStartSchedule;\n /// @dev The offset to the max block number that the schedule can start.\n uint256 public maxOffsetToStartSchedule;\n /// @dev The max number of scheduled maintenances.\n uint256 public maxSchedules;\n /// @dev The cooldown time to request new schedule.\n uint256 public cooldownSecsToMaintain;\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) external initializer {\n _setValidatorContract(__validatorContract);\n _setMaintenanceConfig(\n _minMaintenanceDurationInBlock,\n _maxMaintenanceDurationInBlock,\n _minOffsetToStartSchedule,\n _maxOffsetToStartSchedule,\n _maxSchedules,\n _cooldownSecsToMaintain\n );\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function setMaintenanceConfig(\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) external onlyAdmin {\n _setMaintenanceConfig(\n _minMaintenanceDurationInBlock,\n _maxMaintenanceDurationInBlock,\n _minOffsetToStartSchedule,\n _maxOffsetToStartSchedule,\n _maxSchedules,\n _cooldownSecsToMaintain\n );\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function schedule(\n address _consensusAddr,\n uint256 _startedAtBlock,\n uint256 _endedAtBlock\n ) external override {\n IRoninValidatorSet _validator = _validatorContract;\n\n require(_validator.isBlockProducer(_consensusAddr), \"Maintenance: consensus address must be a block producer\");\n require(\n _validator.isCandidateAdmin(_consensusAddr, msg.sender),\n \"Maintenance: method caller must be a candidate admin\"\n );\n require(!checkScheduled(_consensusAddr), \"Maintenance: already scheduled\");\n require(checkCooldownEnds(_consensusAddr), \"Maintainance: cooldown time not end\");\n require(totalSchedules() < maxSchedules, \"Maintenance: exceeds total of schedules\");\n require(\n _startedAtBlock.inRange(block.number + minOffsetToStartSchedule, block.number + maxOffsetToStartSchedule),\n \"Maintenance: start block is out of offset\"\n );\n require(_startedAtBlock < _endedAtBlock, \"Maintenance: start block must be less than end block\");\n uint256 _maintenanceElapsed = _endedAtBlock - _startedAtBlock + 1;\n require(\n _maintenanceElapsed.inRange(minMaintenanceDurationInBlock, maxMaintenanceDurationInBlock),\n \"Maintenance: invalid maintenance duration\"\n );\n require(_validator.epochEndingAt(_startedAtBlock - 1), \"Maintenance: start block is not at the start of an epoch\");\n require(_validator.epochEndingAt(_endedAtBlock), \"Maintenance: end block is not at the end of an epoch\");\n\n Schedule storage _sSchedule = _schedule[_consensusAddr];\n _sSchedule.from = _startedAtBlock;\n _sSchedule.to = _endedAtBlock;\n _sSchedule.lastUpdatedBlock = block.number;\n _sSchedule.requestTimestamp = block.timestamp;\n emit MaintenanceScheduled(_consensusAddr, _sSchedule);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function cancelSchedule(address _consensusAddr) external override {\n require(\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\n \"Maintenance: method caller must be the candidate admin\"\n );\n require(checkScheduled(_consensusAddr), \"Maintenance: no schedule exists\");\n require(!checkMaintained(_consensusAddr, block.number), \"Maintenance: already on maintenance\");\n Schedule storage _sSchedule = _schedule[_consensusAddr];\n delete _sSchedule.from;\n delete _sSchedule.to;\n _sSchedule.lastUpdatedBlock = block.number;\n emit MaintenanceScheduleCancelled(_consensusAddr);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function getSchedule(address _consensusAddr) external view override returns (Schedule memory) {\n return _schedule[_consensusAddr];\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkManyMaintained(address[] calldata _addrList, uint256 _block)\n external\n view\n override\n returns (bool[] memory _resList)\n {\n _resList = new bool[](_addrList.length);\n for (uint _i = 0; _i < _addrList.length; _i++) {\n _resList[_i] = checkMaintained(_addrList[_i], _block);\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkManyMaintainedInBlockRange(\n address[] calldata _addrList,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view override returns (bool[] memory _resList) {\n _resList = new bool[](_addrList.length);\n for (uint _i = 0; _i < _addrList.length; _i++) {\n _resList[_i] = _maintainingInBlockRange(_addrList[_i], _fromBlock, _toBlock);\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function totalSchedules() public view override returns (uint256 _count) {\n (address[] memory _validators, , ) = _validatorContract.getValidators();\n for (uint _i = 0; _i < _validators.length; _i++) {\n if (checkScheduled(_validators[_i])) {\n _count++;\n }\n }\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkMaintained(address _consensusAddr, uint256 _block) public view override returns (bool) {\n Schedule storage _s = _schedule[_consensusAddr];\n return _s.from <= _block && _block <= _s.to;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkMaintainedInBlockRange(\n address _consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) public view override returns (bool) {\n return _maintainingInBlockRange(_consensusAddr, _fromBlock, _toBlock);\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkScheduled(address _consensusAddr) public view override returns (bool) {\n return block.number <= _schedule[_consensusAddr].to;\n }\n\n /**\n * @inheritdoc IMaintenance\n */\n function checkCooldownEnds(address _consensusAddr) public view override returns (bool) {\n return block.timestamp > _schedule[_consensusAddr].requestTimestamp + cooldownSecsToMaintain;\n }\n\n /**\n * @dev Sets the min block period and max block period to maintenance.\n *\n * Requirements:\n * - The max period is larger than the min period.\n *\n * Emits the event `MaintenanceConfigUpdated`.\n *\n */\n function _setMaintenanceConfig(\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) internal {\n require(\n _minMaintenanceDurationInBlock < _maxMaintenanceDurationInBlock,\n \"Maintenance: invalid maintenance duration configs\"\n );\n require(\n _minOffsetToStartSchedule < _maxOffsetToStartSchedule,\n \"Maintenance: invalid offset to start schedule configs\"\n );\n minMaintenanceDurationInBlock = _minMaintenanceDurationInBlock;\n maxMaintenanceDurationInBlock = _maxMaintenanceDurationInBlock;\n minOffsetToStartSchedule = _minOffsetToStartSchedule;\n maxOffsetToStartSchedule = _maxOffsetToStartSchedule;\n maxSchedules = _maxSchedules;\n cooldownSecsToMaintain = _cooldownSecsToMaintain;\n emit MaintenanceConfigUpdated(\n _minMaintenanceDurationInBlock,\n _maxMaintenanceDurationInBlock,\n _minOffsetToStartSchedule,\n _maxOffsetToStartSchedule,\n _maxSchedules,\n _cooldownSecsToMaintain\n );\n }\n\n /**\n * @dev Check if the validator was maintaining in the current period.\n *\n * Note: This method should be called at the end of the period.\n */\n function _maintainingInBlockRange(\n address _consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) private view returns (bool) {\n Schedule storage _s = _schedule[_consensusAddr];\n return Math.twoRangeOverlap(_fromBlock, _toBlock, _s.from, _s.to);\n }\n}\n" + }, + "contracts/interfaces/IMaintenance.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IMaintenance {\n struct Schedule {\n uint256 from;\n uint256 to;\n uint256 lastUpdatedBlock;\n uint256 requestTimestamp;\n }\n\n /// @dev Emitted when a maintenance is scheduled.\n event MaintenanceScheduled(address indexed consensusAddr, Schedule);\n /// @dev Emitted when a schedule of maintenance is cancelled.\n event MaintenanceScheduleCancelled(address indexed consensusAddr);\n /// @dev Emitted when the maintenance config is updated.\n event MaintenanceConfigUpdated(\n uint256 minMaintenanceDurationInBlock,\n uint256 maxMaintenanceDurationInBlock,\n uint256 minOffsetToStartSchedule,\n uint256 maxOffsetToStartSchedule,\n uint256 maxSchedules,\n uint256 cooldownSecsToMaintain\n );\n\n /**\n * @dev Returns whether the validator `_consensusAddr` maintained at the block number `_block`.\n */\n function checkMaintained(address _consensusAddr, uint256 _block) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `_consensusAddr` maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks.\n */\n function checkMaintainedInBlockRange(\n address _consensusAddr,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool);\n\n /**\n * @dev Returns the bool array indicating the validators maintained at block number `_block` or not.\n */\n function checkManyMaintained(address[] calldata _addrList, uint256 _block) external view returns (bool[] memory);\n\n /**\n * @dev Returns a bool array indicating the validators maintained in the inclusive range [`_fromBlock`, `_toBlock`] of blocks or not.\n */\n function checkManyMaintainedInBlockRange(\n address[] calldata _addrList,\n uint256 _fromBlock,\n uint256 _toBlock\n ) external view returns (bool[] memory);\n\n /**\n * @dev Returns whether the validator `_consensusAddr` has scheduled.\n */\n function checkScheduled(address _consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns whether the validator `_consensusAddr`\n */\n function checkCooldownEnds(address _consensusAddr) external view returns (bool);\n\n /**\n * @dev Returns the detailed schedule of the validator `_consensusAddr`.\n */\n function getSchedule(address _consensusAddr) external view returns (Schedule memory);\n\n /**\n * @dev Returns the total of current schedules.\n */\n function totalSchedules() external view returns (uint256 _count);\n\n /**\n * @dev Sets the duration restriction, start time restriction, and max allowed for maintenance.\n *\n * Requirements:\n * - The method caller is admin.\n * - The max duration is larger than the min duration.\n * - The max offset is larger than the min offset.\n *\n * Emits the event `MaintenanceConfigUpdated`.\n *\n */\n function setMaintenanceConfig(\n uint256 _minMaintenanceDurationInBlock,\n uint256 _maxMaintenanceDurationInBlock,\n uint256 _minOffsetToStartSchedule,\n uint256 _maxOffsetToStartSchedule,\n uint256 _maxSchedules,\n uint256 _cooldownSecsToMaintain\n ) external;\n\n /**\n * @dev Returns the min duration for maintenance in block.\n */\n function minMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev Returns the max duration for maintenance in block.\n */\n function maxMaintenanceDurationInBlock() external view returns (uint256);\n\n /**\n * @dev The offset to the min block number that the schedule can start\n */\n function minOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev The offset to the max block number that the schedule can start\n */\n function maxOffsetToStartSchedule() external view returns (uint256);\n\n /**\n * @dev Returns the max number of scheduled maintenances.\n */\n function maxSchedules() external view returns (uint256);\n\n /**\n * @dev Schedules for maintenance from `_startedAtBlock` to `_startedAtBlock`.\n *\n * Requirements:\n * - The candidate `_consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\n * - The candidate `_consensusAddr` has no schedule yet or the previous is done.\n * - The total number of schedules is not larger than `maxSchedules()`.\n * - The start block must be at least `minOffsetToStartSchedule()` and at most `maxOffsetToStartSchedule()` blocks from the current block.\n * - The end block is larger than the start block.\n * - The scheduled duration is larger than the `minMaintenanceDurationInBlock()` and less than the `maxMaintenanceDurationInBlock()`.\n * - The start block is at the start of an epoch.\n * - The end block is at the end of an epoch.\n *\n * Emits the event `MaintenanceScheduled`.\n *\n */\n function schedule(\n address _consensusAddr,\n uint256 _startedAtBlock,\n uint256 _endedAtBlock\n ) external;\n\n /**\n * @dev Cancel the schedule of maintenance for the `_consensusAddr`.\n *\n * Requirements:\n * - The candidate `_consensusAddr` is the block producer.\n * - The method caller is candidate admin of the candidate `_consensusAddr`.\n * - A schedule for the `_consensusAddr` must be existent and not executed yet.\n *\n * Emits the event `MaintenanceScheduleCancelled`.\n */\n function cancelSchedule(address _consensusAddr) external;\n}\n" + }, + "contracts/ronin/StakingVesting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../interfaces/IStakingVesting.sol\";\nimport \"../extensions/collections/HasValidatorContract.sol\";\nimport \"../extensions/RONTransferHelper.sol\";\n\ncontract StakingVesting is IStakingVesting, HasValidatorContract, RONTransferHelper, Initializable {\n /// @dev The block bonus for the block producer whenever a new block is mined.\n uint256 internal _blockProducerBonusPerBlock;\n /// @dev The block bonus for the bridge operator whenever a new block is mined.\n uint256 internal _bridgeOperatorBonusPerBlock;\n /// @dev The last block number that the staking vesting sent.\n uint256 public lastBlockSendingBonus;\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n uint256 __blockProducerBonusPerBlock,\n uint256 __bridgeOperatorBonusPerBlock\n ) external payable initializer {\n _setValidatorContract(__validatorContract);\n _setBlockProducerBonusPerBlock(__blockProducerBonusPerBlock);\n _setBridgeOperatorBonusPerBlock(__bridgeOperatorBonusPerBlock);\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function receiveRON() external payable {}\n\n /**\n * @inheritdoc IStakingVesting\n */\n function blockProducerBlockBonus(\n uint256 /* _block */\n ) public view override returns (uint256) {\n return _blockProducerBonusPerBlock;\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function bridgeOperatorBlockBonus(\n uint256 /* _block */\n ) public view override returns (uint256) {\n return _bridgeOperatorBonusPerBlock;\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\n external\n override\n onlyValidatorContract\n returns (\n bool _success,\n uint256 _blockProducerBonus,\n uint256 _bridgeOperatorBonus\n )\n {\n require(block.number > lastBlockSendingBonus, \"StakingVesting: bonus for already sent\");\n lastBlockSendingBonus = block.number;\n\n _blockProducerBonus = _forBlockProducer ? blockProducerBlockBonus(block.number) : 0;\n _bridgeOperatorBonus = _forBridgeOperator ? bridgeOperatorBlockBonus(block.number) : 0;\n\n uint256 _totalAmount = _blockProducerBonus + _bridgeOperatorBonus;\n\n if (_totalAmount > 0) {\n address payable _validatorContractAddr = payable(validatorContract());\n\n _success = _unsafeSendRON(_validatorContractAddr, _totalAmount);\n\n if (!_success) {\n emit BonusTransferFailed(\n block.number,\n _validatorContractAddr,\n _blockProducerBonus,\n _bridgeOperatorBonus,\n address(this).balance\n );\n return (_success, 0, 0);\n }\n\n emit BonusTransferred(block.number, _validatorContractAddr, _blockProducerBonus, _bridgeOperatorBonus);\n }\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function setBlockProducerBonusPerBlock(uint256 _amount) external override onlyAdmin {\n _setBlockProducerBonusPerBlock(_amount);\n }\n\n /**\n * @inheritdoc IStakingVesting\n */\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external override onlyAdmin {\n _setBridgeOperatorBonusPerBlock(_amount);\n }\n\n /**\n * @dev Sets the bonus amount per block for block producer.\n *\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\n *\n */\n function _setBlockProducerBonusPerBlock(uint256 _amount) internal {\n _blockProducerBonusPerBlock = _amount;\n emit BlockProducerBonusPerBlockUpdated(_amount);\n }\n\n /**\n * @dev Sets the bonus amount per block for bridge operator.\n *\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\n *\n */\n function _setBridgeOperatorBonusPerBlock(uint256 _amount) internal {\n _bridgeOperatorBonusPerBlock = _amount;\n emit BridgeOperatorBonusPerBlockUpdated(_amount);\n }\n}\n" + }, + "contracts/interfaces/IStakingVesting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IStakingVesting {\n /// @dev Emitted when the block bonus for block producer is transferred.\n event BonusTransferred(\n uint256 indexed blockNumber,\n address indexed recipient,\n uint256 blockProducerAmount,\n uint256 bridgeOperatorAmount\n );\n /// @dev Emitted when the transfer of block bonus for block producer is failed.\n event BonusTransferFailed(\n uint256 indexed blockNumber,\n address indexed recipient,\n uint256 blockProducerAmount,\n uint256 bridgeOperatorAmount,\n uint256 contractBalance\n );\n /// @dev Emitted when the block bonus for block producer is updated\n event BlockProducerBonusPerBlockUpdated(uint256);\n /// @dev Emitted when the block bonus for bridge operator is updated\n event BridgeOperatorBonusPerBlockUpdated(uint256);\n\n /**\n * @dev Returns the bonus amount for the block producer at `_block`.\n */\n function blockProducerBlockBonus(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Returns the bonus amount for the bridge validator at `_block`.\n */\n function bridgeOperatorBlockBonus(uint256 _block) external view returns (uint256);\n\n /**\n * @dev Receives RON from any address.\n */\n function receiveRON() external payable;\n\n /**\n * @dev Returns the last block number that the staking vesting is sent.\n */\n function lastBlockSendingBonus() external view returns (uint256);\n\n /**\n * @dev Transfers the staking vesting for the block producer and the bridge operator whenever a new block is mined.\n *\n * Requirements:\n * - The method caller must be validator contract.\n * - The method must be called only once per block.\n *\n * Emits the event `BonusTransferred` or `BonusTransferFailed`.\n *\n * Notes:\n * - The method does not revert when the contract balance is insufficient to send bonus. This assure the submit reward method\n * will not be reverted, and the underlying nodes does not hang.\n *\n * @param _forBlockProducer Indicates whether requesting the bonus for the block procucer, in case of being in jail or relevance.\n * @param _forBridgeOperator Indicates whether requesting the bonus for the bridge operator.\n *\n * @return _success Whether the transfer is successfully. This returns false mostly because this contract is out of balance.\n * @return _blockProducerBonus The amount of bonus actually sent for the block producer, returns 0 when the transfer is failed.\n * @return _bridgeOperatorBonus The amount of bonus actually sent for the bridge operator, returns 0 when the transfer is failed.\n *\n */\n function requestBonus(bool _forBlockProducer, bool _forBridgeOperator)\n external\n returns (\n bool _success,\n uint256 _blockProducerBonus,\n uint256 _bridgeOperatorBonus\n );\n\n /**\n * @dev Sets the bonus amount per block for block producer.\n *\n * Emits the event `BlockProducerBonusPerBlockUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setBlockProducerBonusPerBlock(uint256 _amount) external;\n\n /**\n * @dev Sets the bonus amount per block for bridge operator.\n *\n * Emits the event `BridgeOperatorBonusPerBlockUpdated`.\n *\n * Requirements:\n * - The method caller is admin.\n *\n */\n function setBridgeOperatorBonusPerBlock(uint256 _amount) external;\n}\n" + }, + "contracts/ronin/VaultForwarder.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../extensions/forwarder/Forwarder.sol\";\nimport \"../extensions/RONTransferHelper.sol\";\n\n/**\n * @title A vault contract that keeps RON, and behaves as an EOA account to interact with a target contract.\n * @dev There are three roles of interaction:\n * - Admin: top-up and withdraw RON to the vault, cannot forward call to the target.\n * - Moderator: forward all calls to the target, can top-up RON, cannot withdraw RON.\n * - Others: can top-up RON, cannot execute any other actions.\n */\ncontract VaultForwarder is Forwarder, RONTransferHelper {\n /// @dev Emitted when the admin withdraws all RON from the forwarder contract.\n event ForwarderRONWithdrawn(address indexed _recipient, uint256 _value);\n\n constructor(\n address[] memory _targets,\n address _admin,\n address _mod\n ) Forwarder(_targets, _admin, _mod) {}\n\n /**\n * @dev Withdraws all balance from the transfer to the admin.\n *\n * Requirements:\n * - Only the admin can call this method.\n */\n function withdrawAll() external onlyRole(DEFAULT_ADMIN_ROLE) {\n uint256 _value = address(this).balance;\n emit ForwarderRONWithdrawn(msg.sender, _value);\n _transferRON(payable(msg.sender), _value);\n }\n}\n" + }, + "contracts/extensions/forwarder/Forwarder.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\n\ncontract Forwarder is AccessControlEnumerable {\n /// @dev Only user with moderator role can invoke {functionCall} method to forward the call to the target.\n bytes32 public constant MODERATOR_ROLE = keccak256(\"MODERATOR_ROLE\");\n\n /**\n * @dev The target contracts must be registerred by the admin before called to. The admin can register the targets at\n * the contract construction or by assigning {TARGET_ROLE} to the target addresses.\n */\n bytes32 public constant TARGET_ROLE = keccak256(\"TARGET_ROLE\");\n\n /**\n * @dev Initializes the forwarder with an initial target address and a contract admin.\n */\n constructor(\n address[] memory _targets,\n address _admin,\n address _moderator\n ) payable {\n for (uint _i = 0; _i < _targets.length; _i++) {\n _setupRole(TARGET_ROLE, _targets[_i]);\n }\n _setupRole(DEFAULT_ADMIN_ROLE, _admin);\n _setupRole(MODERATOR_ROLE, _moderator);\n }\n\n modifier validTarget(address _target) {\n _checkRole(TARGET_ROLE, _target);\n _;\n }\n\n /**\n * @dev Receives RON transfer from all addresses.\n */\n fallback() external payable {}\n\n /**\n * @dev Receives RON transfer from all addresses.\n */\n receive() external payable {}\n\n /**\n * @dev Forwards the encoded call specified by `_data` to the target. The forwarder attachs `_val` value\n * from the forwarder contract and sends along with the call.\n *\n * Requirements:\n * - Only target with {TARGET_ROLE} can be called to.\n * - Only user with {MODERATOR_ROLE} can call this method.\n */\n function functionCall(\n address _target,\n bytes memory _data,\n uint256 _val\n ) external payable validTarget(_target) onlyRole(MODERATOR_ROLE) {\n require(_val <= address(this).balance, \"Forwarder: invalid forwarding value\");\n _call(_target, _data, _val);\n }\n\n /**\n * @dev Forwards the current call to `target`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _call(\n address _target,\n bytes memory _data,\n uint256 _value\n ) internal {\n (bool _success, bytes memory _res) = _target.call{ value: _value }(_data);\n if (!_success) {\n uint _size = _res.length;\n require(_size >= 4, \"Forwarder: target reverts silently\");\n assembly {\n _res := add(_res, 0x20)\n revert(_res, _size)\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/access/AccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlEnumerable.sol\";\nimport \"./AccessControl.sol\";\nimport \"../utils/structs/EnumerableSet.sol\";\n\n/**\n * @dev Extension of {AccessControl} that allows enumerating the members of each role.\n */\nabstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl {\n using EnumerableSet for EnumerableSet.AddressSet;\n\n mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers;\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) {\n return _roleMembers[role].at(index);\n }\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) {\n return _roleMembers[role].length();\n }\n\n /**\n * @dev Overload {_grantRole} to track enumerable memberships\n */\n function _grantRole(bytes32 role, address account) internal virtual override {\n super._grantRole(role, account);\n _roleMembers[role].add(account);\n }\n\n /**\n * @dev Overload {_revokeRole} to track enumerable memberships\n */\n function _revokeRole(bytes32 role, address account) internal virtual override {\n super._revokeRole(role, account);\n _roleMembers[role].remove(account);\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControlEnumerable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\n\n/**\n * @dev External interface of AccessControlEnumerable declared to support ERC165 detection.\n */\ninterface IAccessControlEnumerable is IAccessControl {\n /**\n * @dev Returns one of the accounts that have `role`. `index` must be a\n * value between 0 and {getRoleMemberCount}, non-inclusive.\n *\n * Role bearers are not sorted in any particular way, and their ordering may\n * change at any point.\n *\n * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure\n * you perform all queries on the same block. See the following\n * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post]\n * for more information.\n */\n function getRoleMember(bytes32 role, uint256 index) external view returns (address);\n\n /**\n * @dev Returns the number of accounts that have `role`. Can be used\n * together with {getRoleMember} to enumerate all bearers of a role.\n */\n function getRoleMemberCount(bytes32 role) external view returns (uint256);\n}\n" + }, + "@openzeppelin/contracts/access/AccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControl.sol\";\nimport \"../utils/Context.sol\";\nimport \"../utils/Strings.sol\";\nimport \"../utils/introspection/ERC165.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n * require(hasRole(MY_ROLE, msg.sender));\n * ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControl is Context, IAccessControl, ERC165 {\n struct RoleData {\n mapping(address => bool) members;\n bytes32 adminRole;\n }\n\n mapping(bytes32 => RoleData) private _roles;\n\n bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n /**\n * @dev Modifier that checks that an account has a specific role. Reverts\n * with a standardized message including the required role.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n *\n * _Available since v4.1._\n */\n modifier onlyRole(bytes32 role) {\n _checkRole(role);\n _;\n }\n\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);\n }\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n return _roles[role].members[account];\n }\n\n /**\n * @dev Revert with a standard message if `_msgSender()` is missing `role`.\n * Overriding this function changes the behavior of the {onlyRole} modifier.\n *\n * Format of the revert message is described in {_checkRole}.\n *\n * _Available since v4.6._\n */\n function _checkRole(bytes32 role) internal view virtual {\n _checkRole(role, _msgSender());\n }\n\n /**\n * @dev Revert with a standard message if `account` is missing `role`.\n *\n * The format of the revert reason is given by the following regular expression:\n *\n * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n */\n function _checkRole(bytes32 role, address account) internal view virtual {\n if (!hasRole(role, account)) {\n revert(\n string(\n abi.encodePacked(\n \"AccessControl: account \",\n Strings.toHexString(uint160(account), 20),\n \" is missing role \",\n Strings.toHexString(uint256(role), 32)\n )\n )\n );\n }\n }\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n return _roles[role].adminRole;\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleGranted} event.\n */\n function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _grantRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n *\n * May emit a {RoleRevoked} event.\n */\n function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n _revokeRole(role, account);\n }\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been revoked `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n *\n * May emit a {RoleRevoked} event.\n */\n function renounceRole(bytes32 role, address account) public virtual override {\n require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n _revokeRole(role, account);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event. Note that unlike {grantRole}, this function doesn't perform any\n * checks on the calling account.\n *\n * May emit a {RoleGranted} event.\n *\n * [WARNING]\n * ====\n * This function should only be called from the constructor when setting\n * up the initial roles for the system.\n *\n * Using this function in any other way is effectively circumventing the admin\n * system imposed by {AccessControl}.\n * ====\n *\n * NOTE: This function is deprecated in favor of {_grantRole}.\n */\n function _setupRole(bytes32 role, address account) internal virtual {\n _grantRole(role, account);\n }\n\n /**\n * @dev Sets `adminRole` as ``role``'s admin role.\n *\n * Emits a {RoleAdminChanged} event.\n */\n function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n bytes32 previousAdminRole = getRoleAdmin(role);\n _roles[role].adminRole = adminRole;\n emit RoleAdminChanged(role, previousAdminRole, adminRole);\n }\n\n /**\n * @dev Grants `role` to `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleGranted} event.\n */\n function _grantRole(bytes32 role, address account) internal virtual {\n if (!hasRole(role, account)) {\n _roles[role].members[account] = true;\n emit RoleGranted(role, account, _msgSender());\n }\n }\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * Internal function without access restriction.\n *\n * May emit a {RoleRevoked} event.\n */\n function _revokeRole(bytes32 role, address account) internal virtual {\n if (hasRole(role, account)) {\n _roles[role].members[account] = false;\n emit RoleRevoked(role, account, _msgSender());\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/structs/EnumerableSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for managing\n * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive\n * types.\n *\n * Sets have the following properties:\n *\n * - Elements are added, removed, and checked for existence in constant time\n * (O(1)).\n * - Elements are enumerated in O(n). No guarantees are made on the ordering.\n *\n * ```\n * contract Example {\n * // Add the library methods\n * using EnumerableSet for EnumerableSet.AddressSet;\n *\n * // Declare a set state variable\n * EnumerableSet.AddressSet private mySet;\n * }\n * ```\n *\n * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)\n * and `uint256` (`UintSet`) are supported.\n *\n * [WARNING]\n * ====\n * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable.\n * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.\n *\n * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet.\n * ====\n */\nlibrary EnumerableSet {\n // To implement this library for multiple types with as little code\n // repetition as possible, we write it in terms of a generic Set type with\n // bytes32 values.\n // The Set implementation uses private functions, and user-facing\n // implementations (such as AddressSet) are just wrappers around the\n // underlying Set.\n // This means that we can only create new EnumerableSets for types that fit\n // in bytes32.\n\n struct Set {\n // Storage of set values\n bytes32[] _values;\n // Position of the value in the `values` array, plus 1 because index 0\n // means a value is not in the set.\n mapping(bytes32 => uint256) _indexes;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function _add(Set storage set, bytes32 value) private returns (bool) {\n if (!_contains(set, value)) {\n set._values.push(value);\n // The value is stored at length-1, but we add 1 to all indexes\n // and use 0 as a sentinel value\n set._indexes[value] = set._values.length;\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function _remove(Set storage set, bytes32 value) private returns (bool) {\n // We read and store the value's index to prevent multiple reads from the same storage slot\n uint256 valueIndex = set._indexes[value];\n\n if (valueIndex != 0) {\n // Equivalent to contains(set, value)\n // To delete an element from the _values array in O(1), we swap the element to delete with the last one in\n // the array, and then remove the last element (sometimes called as 'swap and pop').\n // This modifies the order of the array, as noted in {at}.\n\n uint256 toDeleteIndex = valueIndex - 1;\n uint256 lastIndex = set._values.length - 1;\n\n if (lastIndex != toDeleteIndex) {\n bytes32 lastValue = set._values[lastIndex];\n\n // Move the last value to the index where the value to delete is\n set._values[toDeleteIndex] = lastValue;\n // Update the index for the moved value\n set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex\n }\n\n // Delete the slot where the moved value was stored\n set._values.pop();\n\n // Delete the index for the deleted slot\n delete set._indexes[value];\n\n return true;\n } else {\n return false;\n }\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function _contains(Set storage set, bytes32 value) private view returns (bool) {\n return set._indexes[value] != 0;\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function _length(Set storage set) private view returns (uint256) {\n return set._values.length;\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function _at(Set storage set, uint256 index) private view returns (bytes32) {\n return set._values[index];\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function _values(Set storage set) private view returns (bytes32[] memory) {\n return set._values;\n }\n\n // Bytes32Set\n\n struct Bytes32Set {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _add(set._inner, value);\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {\n return _remove(set._inner, value);\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {\n return _contains(set._inner, value);\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(Bytes32Set storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {\n return _at(set._inner, index);\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {\n return _values(set._inner);\n }\n\n // AddressSet\n\n struct AddressSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(AddressSet storage set, address value) internal returns (bool) {\n return _add(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(AddressSet storage set, address value) internal returns (bool) {\n return _remove(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(AddressSet storage set, address value) internal view returns (bool) {\n return _contains(set._inner, bytes32(uint256(uint160(value))));\n }\n\n /**\n * @dev Returns the number of values in the set. O(1).\n */\n function length(AddressSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(AddressSet storage set, uint256 index) internal view returns (address) {\n return address(uint160(uint256(_at(set._inner, index))));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(AddressSet storage set) internal view returns (address[] memory) {\n bytes32[] memory store = _values(set._inner);\n address[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n\n // UintSet\n\n struct UintSet {\n Set _inner;\n }\n\n /**\n * @dev Add a value to a set. O(1).\n *\n * Returns true if the value was added to the set, that is if it was not\n * already present.\n */\n function add(UintSet storage set, uint256 value) internal returns (bool) {\n return _add(set._inner, bytes32(value));\n }\n\n /**\n * @dev Removes a value from a set. O(1).\n *\n * Returns true if the value was removed from the set, that is if it was\n * present.\n */\n function remove(UintSet storage set, uint256 value) internal returns (bool) {\n return _remove(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns true if the value is in the set. O(1).\n */\n function contains(UintSet storage set, uint256 value) internal view returns (bool) {\n return _contains(set._inner, bytes32(value));\n }\n\n /**\n * @dev Returns the number of values on the set. O(1).\n */\n function length(UintSet storage set) internal view returns (uint256) {\n return _length(set._inner);\n }\n\n /**\n * @dev Returns the value stored at position `index` in the set. O(1).\n *\n * Note that there are no guarantees on the ordering of values inside the\n * array, and it may change when more values are added or removed.\n *\n * Requirements:\n *\n * - `index` must be strictly less than {length}.\n */\n function at(UintSet storage set, uint256 index) internal view returns (uint256) {\n return uint256(_at(set._inner, index));\n }\n\n /**\n * @dev Return the entire set in an array\n *\n * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed\n * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that\n * this function has an unbounded cost, and using it as part of a state-changing function may render the function\n * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.\n */\n function values(UintSet storage set) internal view returns (uint256[] memory) {\n bytes32[] memory store = _values(set._inner);\n uint256[] memory result;\n\n /// @solidity memory-safe-assembly\n assembly {\n result := store\n }\n\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts/access/IAccessControl.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControl {\n /**\n * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n *\n * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n * {RoleAdminChanged} not being emitted signaling this.\n *\n * _Available since v3.1._\n */\n event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n /**\n * @dev Emitted when `account` is granted `role`.\n *\n * `sender` is the account that originated the contract call, an admin role\n * bearer except when using {AccessControl-_setupRole}.\n */\n event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Emitted when `account` is revoked `role`.\n *\n * `sender` is the account that originated the contract call:\n * - if using `revokeRole`, it is the admin role bearer\n * - if using `renounceRole`, it is the role bearer (i.e. `account`)\n */\n event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n /**\n * @dev Returns `true` if `account` has been granted `role`.\n */\n function hasRole(bytes32 role, address account) external view returns (bool);\n\n /**\n * @dev Returns the admin role that controls `role`. See {grantRole} and\n * {revokeRole}.\n *\n * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n */\n function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n /**\n * @dev Grants `role` to `account`.\n *\n * If `account` had not been already granted `role`, emits a {RoleGranted}\n * event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function grantRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from `account`.\n *\n * If `account` had been granted `role`, emits a {RoleRevoked} event.\n *\n * Requirements:\n *\n * - the caller must have ``role``'s admin role.\n */\n function revokeRole(bytes32 role, address account) external;\n\n /**\n * @dev Revokes `role` from the calling account.\n *\n * Roles are often managed via {grantRole} and {revokeRole}: this function's\n * purpose is to provide a mechanism for accounts to lose their privileges\n * if they are compromised (such as when a trusted device is misplaced).\n *\n * If the calling account had been granted `role`, emits a {RoleRevoked}\n * event.\n *\n * Requirements:\n *\n * - the caller must be `account`.\n */\n function renounceRole(bytes32 role, address account) external;\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/ERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n /**\n * @dev See {IERC165-supportsInterface}.\n */\n function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n return interfaceId == type(IERC165).interfaceId;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/introspection/IERC165.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n /**\n * @dev Returns true if this contract implements the interface defined by\n * `interfaceId`. See the corresponding\n * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n * to learn more about how these ids are created.\n *\n * This function call must use less than 30 000 gas.\n */\n function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n" + }, + "contracts/ronin/gateway/PauseEnforcer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"../../interfaces/IPauseTarget.sol\";\n\ncontract PauseEnforcer is AccessControlEnumerable {\n bytes32 public constant SENTRY_ROLE = keccak256(\"SENTRY_ROLE\");\n\n /// @dev The contract that can be paused or unpaused by the SENTRY_ROLE.\n IPauseTarget public target;\n /// @dev Indicating whether or not the target contract is paused in emergency mode.\n bool public emergency;\n\n /// @dev Emitted when the emergency ppause is triggered by `account`.\n event EmergencyPaused(address account);\n /// @dev Emitted when the emergency unpause is triggered by `account`.\n event EmergencyUnpaused(address account);\n /// @dev Emitted when the target is changed.\n event TargetChanged(IPauseTarget target);\n\n modifier onEmergency() {\n require(emergency, \"PauseEnforcer: not on emergency pause\");\n _;\n }\n\n modifier targetPaused() {\n require(target.paused(), \"PauseEnforcer: target is on pause\");\n _;\n }\n\n modifier targetNotPaused() {\n require(!target.paused(), \"PauseEnforcer: target is not on pause\");\n _;\n }\n\n constructor(\n IPauseTarget _target,\n address _admin,\n address[] memory _sentries\n ) {\n _changeTarget(_target);\n _setupRole(DEFAULT_ADMIN_ROLE, _admin);\n for (uint _i; _i < _sentries.length; _i++) {\n _grantRole(SENTRY_ROLE, _sentries[_i]);\n }\n }\n\n /**\n * @dev Grants the SENTRY_ROLE to the specified address.\n */\n function grantSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _grantRole(SENTRY_ROLE, _sentry);\n }\n\n /**\n * @dev Revokes the SENTRY_ROLE from the specified address.\n */\n function revokeSentry(address _sentry) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _revokeRole(SENTRY_ROLE, _sentry);\n }\n\n /**\n * @dev Triggers a pause on the target contract.\n *\n * Requirements:\n * - Only be called by accounts with the SENTRY_ROLE,\n * - The target contract is not already paused.\n */\n function triggerPause() external onlyRole(SENTRY_ROLE) targetNotPaused {\n emergency = true;\n target.pause();\n emit EmergencyPaused(msg.sender);\n }\n\n /**\n * @dev Triggers an unpause on the target contract.\n *\n * Requirements:\n * - Only be called by accounts with the SENTRY_ROLE,\n * - The target contract is already paused.\n * - The target contract is paused in emergency mode.\n */\n function triggerUnpause() external onlyRole(SENTRY_ROLE) onEmergency targetPaused {\n emergency = false;\n target.unpause();\n emit EmergencyUnpaused(msg.sender);\n }\n\n /**\n * @dev Setter for `target`.\n *\n * Requirements:\n * - Only admin can call this method.\n */\n function changeTarget(IPauseTarget _target) external onlyRole(DEFAULT_ADMIN_ROLE) {\n _changeTarget(_target);\n }\n\n /**\n * @dev Internal helper for setting value to `target`.\n */\n function _changeTarget(IPauseTarget _target) internal {\n target = _target;\n emit TargetChanged(_target);\n }\n}\n" + }, + "contracts/interfaces/IPauseTarget.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IPauseTarget {\n function pause() external;\n\n function unpause() external;\n\n function paused() external returns (bool);\n}\n" + }, + "contracts/ronin/gateway/RoninGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../extensions/GatewayV2.sol\";\nimport \"../../extensions/MinimumWithdrawal.sol\";\nimport \"../../interfaces/IERC20Mintable.sol\";\nimport \"../../interfaces/IERC721Mintable.sol\";\nimport \"../../interfaces/IBridgeTracking.sol\";\nimport \"../../interfaces/IRoninGatewayV2.sol\";\nimport \"../../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"../../interfaces/collections/IHasValidatorContract.sol\";\nimport \"../../interfaces/collections/IHasBridgeTrackingContract.sol\";\nimport \"../../interfaces/collections/IHasRoninTrustedOrganizationContract.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\n\ncontract RoninGatewayV2 is\n GatewayV2,\n Initializable,\n MinimumWithdrawal,\n AccessControlEnumerable,\n VoteStatusConsumer,\n IRoninGatewayV2,\n IHasValidatorContract,\n IHasBridgeTrackingContract,\n IHasRoninTrustedOrganizationContract\n{\n using Token for Token.Info;\n using Transfer for Transfer.Request;\n using Transfer for Transfer.Receipt;\n using IsolatedGovernance for IsolatedGovernance.Vote;\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n /// @dev Withdrawal unlocker role hash\n bytes32 public constant WITHDRAWAL_MIGRATOR = keccak256(\"WITHDRAWAL_MIGRATOR\");\n\n /// @dev Flag indicating whether the withdrawal migrate progress is done\n bool public withdrawalMigrated;\n /// @dev Total withdrawal\n uint256 public withdrawalCount;\n /// @dev Mapping from chain id => deposit id => deposit vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) public depositVote;\n /// @dev Mapping from withdrawal id => mainchain withdrew vote\n mapping(uint256 => IsolatedGovernance.Vote) public mainchainWithdrewVote;\n /// @dev Mapping from withdrawal id => withdrawal receipt\n mapping(uint256 => Transfer.Receipt) public withdrawal;\n /// @dev Mapping from withdrawal id => validator address => signatures\n mapping(uint256 => mapping(address => bytes)) internal _withdrawalSig;\n /// @dev Mapping from token address => chain id => mainchain token address\n mapping(address => mapping(uint256 => MappedToken)) internal _mainchainToken;\n\n /// @dev The ronin validator contract\n IRoninValidatorSet internal _validatorContract;\n /// @dev The bridge tracking contract\n IBridgeTracking internal _bridgeTrackingContract;\n\n /// @dev Mapping from withdrawal id => vote for recording withdrawal stats\n mapping(uint256 => IsolatedGovernance.Vote) public withdrawalStatVote;\n\n /// @dev The trusted organization contract\n IRoninTrustedOrganization internal _trustedOrgContract;\n\n uint256 internal _trustedNum;\n uint256 internal _trustedDenom;\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n modifier onlyBridgeOperator() {\n require(_validatorContract.isBridgeOperator(msg.sender), \"RoninGatewayV2: unauthorized sender\");\n _;\n }\n\n /**\n * @dev Initializes contract storage.\n */\n function initialize(\n address _roleSetter,\n uint256 _numerator,\n uint256 _denominator,\n uint256 _trustedNumerator,\n uint256 _trustedDenominator,\n address[] calldata _withdrawalMigrators,\n // _packedAddresses[0]: roninTokens\n // _packedAddresses[1]: mainchainTokens\n address[][2] calldata _packedAddresses,\n // _packedNumbers[0]: chainIds\n // _packedNumbers[1]: minimumThresholds\n uint256[][2] calldata _packedNumbers,\n Token.Standard[] calldata _standards\n ) external virtual initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n _setThreshold(_numerator, _denominator);\n _setTrustedThreshold(_trustedNumerator, _trustedDenominator);\n if (_packedAddresses[0].length > 0) {\n _mapTokens(_packedAddresses[0], _packedAddresses[1], _packedNumbers[0], _standards);\n _setMinimumThresholds(_packedAddresses[0], _packedNumbers[1]);\n }\n\n for (uint256 _i; _i < _withdrawalMigrators.length; _i++) {\n _grantRole(WITHDRAWAL_MIGRATOR, _withdrawalMigrators[_i]);\n }\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function validatorContract() external view returns (address) {\n return address(_validatorContract);\n }\n\n /**\n * @inheritdoc IHasValidatorContract\n */\n function setValidatorContract(address _addr) external override onlyAdmin {\n require(_addr.code.length > 0, \"RoninGatewayV2: set to non-contract\");\n _setValidatorContract(_addr);\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function bridgeTrackingContract() external view override returns (address) {\n return address(_bridgeTrackingContract);\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function setBridgeTrackingContract(address _addr) external override onlyAdmin {\n require(_addr.code.length > 0, \"RoninGatewayV2: set to non-contract\");\n _setBridgeTrackingContract(_addr);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function roninTrustedOrganizationContract() external view override returns (address) {\n return address(_trustedOrgContract);\n }\n\n /**\n * @inheritdoc IHasRoninTrustedOrganizationContract\n */\n function setRoninTrustedOrganizationContract(address _addr) external override onlyAdmin {\n require(_addr.code.length > 0, \"RoninGatewayV2: set to non-contract\");\n _setRoninTrustedOrganizationContract(_addr);\n }\n\n /**\n * @dev Migrates withdrawals.\n *\n * Requirements:\n * - The method caller is the migrator.\n * - The arrays have the same length and its length larger than 0.\n *\n */\n function migrateWithdrawals(Transfer.Request[] calldata _requests, address[] calldata _requesters)\n external\n onlyRole(WITHDRAWAL_MIGRATOR)\n {\n require(!withdrawalMigrated, \"RoninGatewayV2: withdrawals migrated\");\n require(_requesters.length == _requests.length && _requests.length > 0, \"RoninGatewayV2: invalid array lengths\");\n for (uint256 _i; _i < _requests.length; _i++) {\n MappedToken memory _token = getMainchainToken(_requests[_i].tokenAddr, 1);\n require(_requests[_i].info.erc == _token.erc, \"RoninGatewayV2: invalid token standard\");\n _storeAsReceipt(_requests[_i], 1, _requesters[_i], _token.tokenAddr);\n }\n }\n\n /**\n * @dev Mark the migration as done.\n */\n function markWithdrawalMigrated() external {\n require(\n hasRole(DEFAULT_ADMIN_ROLE, msg.sender) || hasRole(WITHDRAWAL_MIGRATOR, msg.sender),\n \"RoninGatewayV2: unauthorized sender\"\n );\n require(!withdrawalMigrated, \"RoninGatewayV2: withdrawals migrated\");\n withdrawalMigrated = true;\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function getWithdrawalSignatures(uint256 _withdrawalId, address[] calldata _validators)\n external\n view\n returns (bytes[] memory _signatures)\n {\n _signatures = new bytes[](_validators.length);\n for (uint256 _i = 0; _i < _validators.length; _i++) {\n _signatures[_i] = _withdrawalSig[_withdrawalId][_validators[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function depositFor(Transfer.Receipt calldata _receipt) external whenNotPaused onlyBridgeOperator {\n address _sender = msg.sender;\n _depositFor(_receipt, _sender, minimumVoteWeight(), minimumTrustedVoteWeight());\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds)\n external\n onlyBridgeOperator\n returns (bool[] memory _executedReceipts)\n {\n address _governor = msg.sender;\n uint256 _minVoteWeight = minimumVoteWeight();\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\n\n uint256 _withdrawalId;\n _executedReceipts = new bool[](_withdrawalIds.length);\n for (uint256 _i; _i < _withdrawalIds.length; _i++) {\n _withdrawalId = _withdrawalIds[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId, _governor);\n if (mainchainWithdrew(_withdrawalId)) {\n _executedReceipts[_i] = true;\n } else {\n IsolatedGovernance.Vote storage _vote = mainchainWithdrewVote[_withdrawalId];\n Transfer.Receipt memory _withdrawal = withdrawal[_withdrawalId];\n bytes32 _hash = _withdrawal.hash();\n VoteStatus _status = _castIsolatedVote(_vote, _governor, _minVoteWeight, _minTrustedVoteWeight, _hash);\n if (_status == VoteStatus.Approved) {\n _vote.status = VoteStatus.Executed;\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.MainchainWithdrawal, _withdrawalId);\n emit MainchainWithdrew(_hash, _withdrawal);\n }\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts)\n external\n whenNotPaused\n onlyBridgeOperator\n returns (bool[] memory _executedReceipts)\n {\n address _sender = msg.sender;\n\n Transfer.Receipt memory _receipt;\n _executedReceipts = new bool[](_receipts.length);\n uint256 _minVoteWeight = minimumVoteWeight();\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\n for (uint256 _i; _i < _receipts.length; _i++) {\n _receipt = _receipts[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Deposit, _receipt.id, _sender);\n if (depositVote[_receipt.mainchain.chainId][_receipt.id].status == VoteStatus.Executed) {\n _executedReceipts[_i] = true;\n } else {\n _depositFor(_receipt, _sender, _minVoteWeight, _minTrustedVoteWeight);\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external whenNotPaused {\n _requestWithdrawalFor(_request, msg.sender, _chainId);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external whenNotPaused {\n require(_requests.length > 0, \"RoninGatewayV2: empty array\");\n for (uint256 _i; _i < _requests.length; _i++) {\n _requestWithdrawalFor(_requests[_i], msg.sender, _chainId);\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function requestWithdrawalSignatures(uint256 _withdrawalId) external whenNotPaused {\n require(!mainchainWithdrew(_withdrawalId), \"RoninGatewayV2: withdrew on mainchain already\");\n Transfer.Receipt memory _receipt = withdrawal[_withdrawalId];\n require(_receipt.ronin.chainId == block.chainid, \"RoninGatewayV2: query for invalid withdrawal\");\n emit WithdrawalSignaturesRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures)\n external\n whenNotPaused\n onlyBridgeOperator\n {\n address _validator = msg.sender;\n\n require(\n _withdrawals.length > 0 && _withdrawals.length == _signatures.length,\n \"RoninGatewayV2: invalid array length\"\n );\n\n uint256 _minVoteWeight = minimumVoteWeight();\n uint256 _minTrustedVoteWeight = minimumTrustedVoteWeight();\n\n uint256 _id;\n for (uint256 _i; _i < _withdrawals.length; _i++) {\n _id = _withdrawals[_i];\n _withdrawalSig[_id][_validator] = _signatures[_i];\n _bridgeTrackingContract.recordVote(IBridgeTracking.VoteKind.Withdrawal, _id, _validator);\n\n IsolatedGovernance.Vote storage _proposal = withdrawalStatVote[_id];\n VoteStatus _status = _castIsolatedVote(\n _proposal,\n _validator,\n _minVoteWeight,\n _minTrustedVoteWeight,\n bytes32(_id)\n );\n if (_status == VoteStatus.Approved) {\n _proposal.status = VoteStatus.Executed;\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Withdrawal, _id);\n }\n }\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata _chainIds,\n Token.Standard[] calldata _standards\n ) external onlyAdmin {\n require(_roninTokens.length > 0, \"RoninGatewayV2: invalid array length\");\n _mapTokens(_roninTokens, _mainchainTokens, _chainIds, _standards);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function depositVoted(\n uint256 _chainId,\n uint256 _depositId,\n address _voter\n ) external view returns (bool) {\n return depositVote[_chainId][_depositId].voted(_voter);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool) {\n return mainchainWithdrewVote[_withdrawalId].voted(_voter);\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function mainchainWithdrew(uint256 _withdrawalId) public view returns (bool) {\n return mainchainWithdrewVote[_withdrawalId].status == VoteStatus.Executed;\n }\n\n /**\n * @inheritdoc IRoninGatewayV2\n */\n function getMainchainToken(address _roninToken, uint256 _chainId) public view returns (MappedToken memory _token) {\n _token = _mainchainToken[_roninToken][_chainId];\n require(_token.tokenAddr != address(0), \"RoninGatewayV2: unsupported token\");\n }\n\n /**\n * @dev Maps Ronin tokens to mainchain networks.\n *\n * Requirement:\n * - The arrays have the same length.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function _mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata _chainIds,\n Token.Standard[] calldata _standards\n ) internal {\n require(\n _roninTokens.length == _mainchainTokens.length && _roninTokens.length == _chainIds.length,\n \"RoninGatewayV2: invalid array length\"\n );\n\n for (uint256 _i; _i < _roninTokens.length; _i++) {\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].tokenAddr = _mainchainTokens[_i];\n _mainchainToken[_roninTokens[_i]][_chainIds[_i]].erc = _standards[_i];\n }\n\n emit TokenMapped(_roninTokens, _mainchainTokens, _chainIds, _standards);\n }\n\n /**\n * @dev Deposits based on the receipt.\n *\n * Emits the `Deposited` once the assets are released.\n *\n */\n function _depositFor(\n Transfer.Receipt memory _receipt,\n address _validator,\n uint256 _minVoteWeight,\n uint256 _minTrustedVoteWeight\n ) internal {\n uint256 _id = _receipt.id;\n _receipt.info.validate();\n require(_receipt.kind == Transfer.Kind.Deposit, \"RoninGatewayV2: invalid receipt kind\");\n require(_receipt.ronin.chainId == block.chainid, \"RoninGatewayV2: invalid chain id\");\n MappedToken memory _token = getMainchainToken(_receipt.ronin.tokenAddr, _receipt.mainchain.chainId);\n require(\n _token.erc == _receipt.info.erc && _token.tokenAddr == _receipt.mainchain.tokenAddr,\n \"RoninGatewayV2: invalid receipt\"\n );\n\n IsolatedGovernance.Vote storage _proposal = depositVote[_receipt.mainchain.chainId][_id];\n bytes32 _receiptHash = _receipt.hash();\n VoteStatus _status = _castIsolatedVote(_proposal, _validator, _minVoteWeight, _minTrustedVoteWeight, _receiptHash);\n emit DepositVoted(_validator, _id, _receipt.mainchain.chainId, _receiptHash);\n if (_status == VoteStatus.Approved) {\n _proposal.status = VoteStatus.Executed;\n _receipt.info.handleAssetTransfer(payable(_receipt.ronin.addr), _receipt.ronin.tokenAddr, IWETH(address(0)));\n _bridgeTrackingContract.handleVoteApproved(IBridgeTracking.VoteKind.Deposit, _receipt.id);\n emit Deposited(_receiptHash, _receipt);\n }\n }\n\n /**\n * @dev Locks the assets and request withdrawal.\n *\n * Requirements:\n * - The token info is valid.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function _requestWithdrawalFor(\n Transfer.Request calldata _request,\n address _requester,\n uint256 _chainId\n ) internal {\n _request.info.validate();\n _checkWithdrawal(_request);\n MappedToken memory _token = getMainchainToken(_request.tokenAddr, _chainId);\n require(_request.info.erc == _token.erc, \"RoninGatewayV2: invalid token standard\");\n _request.info.transferFrom(_requester, address(this), _request.tokenAddr);\n _storeAsReceipt(_request, _chainId, _requester, _token.tokenAddr);\n }\n\n /**\n * @dev Stores the withdrawal request as a receipt.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function _storeAsReceipt(\n Transfer.Request calldata _request,\n uint256 _chainId,\n address _requester,\n address _mainchainTokenAddr\n ) internal returns (uint256 _withdrawalId) {\n _withdrawalId = withdrawalCount++;\n Transfer.Receipt memory _receipt = _request.into_withdrawal_receipt(\n _requester,\n _withdrawalId,\n _mainchainTokenAddr,\n _chainId\n );\n withdrawal[_withdrawalId] = _receipt;\n emit WithdrawalRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @dev Don't send me RON.\n */\n function _fallback() internal virtual {\n revert(\"RoninGatewayV2: invalid request\");\n }\n\n /**\n * @inheritdoc GatewayV2\n */\n function _getTotalWeight() internal view virtual override returns (uint256) {\n return _validatorContract.totalBridgeOperators();\n }\n\n /**\n * @dev Returns the total trusted weight.\n */\n function _getTotalTrustedWeight() internal view virtual returns (uint256) {\n return _trustedOrgContract.countTrustedOrganizations();\n }\n\n /**\n * @dev Sets the validator contract.\n *\n * Emits the event `ValidatorContractUpdated`.\n *\n */\n function _setValidatorContract(address _addr) internal {\n _validatorContract = IRoninValidatorSet(_addr);\n emit ValidatorContractUpdated(_addr);\n }\n\n /**\n * @dev Sets the bridge tracking contract.\n *\n * Emits the event `BridgeTrackingContractUpdated`.\n *\n */\n function _setBridgeTrackingContract(address _addr) internal {\n _bridgeTrackingContract = IBridgeTracking(_addr);\n emit BridgeTrackingContractUpdated(_addr);\n }\n\n /**\n * @dev Sets the ronin trusted organization contract.\n *\n * Emits the event `RoninTrustedOrganizationContractUpdated`.\n *\n */\n function _setRoninTrustedOrganizationContract(address _addr) internal {\n _trustedOrgContract = IRoninTrustedOrganization(_addr);\n emit RoninTrustedOrganizationContractUpdated(_addr);\n }\n\n /**\n * @dev Casts and updates the vote result.\n *\n * Requirements:\n * - The vote is not finalized.\n * - The voter has not voted for the round.\n *\n */\n function _castIsolatedVote(\n IsolatedGovernance.Vote storage _v,\n address _voter,\n uint256 _minVoteWeight,\n uint256 _minTrustedVoteWeight,\n bytes32 _hash\n ) internal virtual returns (VoteStatus _status) {\n _v.castVote(_voter, _hash);\n (uint256 _totalWeight, uint256 _trustedWeight) = _getVoteWeight(_v, _hash);\n return _v.syncVoteStatus(_minVoteWeight, _totalWeight, _minTrustedVoteWeight, _trustedWeight, _hash);\n }\n\n /**\n * @dev Returns the vote weight for a specified hash.\n */\n function _getVoteWeight(IsolatedGovernance.Vote storage _v, bytes32 _hash)\n internal\n view\n returns (uint256 _totalWeight, uint256 _trustedWeight)\n {\n (\n address[] memory _consensusList,\n address[] memory _bridgeOperators,\n EnumFlags.ValidatorFlag[] memory _flags\n ) = _validatorContract.getValidators();\n uint256[] memory _trustedWeights = _trustedOrgContract.getConsensusWeights(_consensusList);\n\n for (uint _i; _i < _bridgeOperators.length; _i++) {\n if (_flags[_i].hasFlag(EnumFlags.ValidatorFlag.BridgeOperator) && _v.voteHashOf[_bridgeOperators[_i]] == _hash) {\n _totalWeight++;\n if (_trustedWeights[_i] > 0) {\n _trustedWeight++;\n }\n }\n }\n }\n\n function setTrustedThreshold(uint256 _trustedNumerator, uint256 _trustedDenominator)\n external\n virtual\n onlyAdmin\n returns (uint256, uint256)\n {\n return _setTrustedThreshold(_trustedNumerator, _trustedDenominator);\n }\n\n /**\n * @dev Returns the minimum trusted vote weight to pass the threshold.\n */\n function minimumTrustedVoteWeight() public view virtual returns (uint256) {\n return _minimumTrustedVoteWeight(_getTotalTrustedWeight());\n }\n\n /**\n * @dev Returns the threshold about trusted org.\n */\n function getTrustedThreshold() external view virtual returns (uint256 trustedNum_, uint256 trustedDenom_) {\n return (_trustedNum, _trustedDenom);\n }\n\n /**\n * @dev Sets trusted threshold and returns the old one.\n *\n * Emits the `TrustedThresholdUpdated` event.\n *\n */\n function _setTrustedThreshold(uint256 _trustedNumerator, uint256 _trustedDenominator)\n internal\n virtual\n returns (uint256 _previousTrustedNum, uint256 _previousTrustedDenom)\n {\n require(_trustedNumerator <= _trustedDenominator, \"GatewayV2: invalid trusted threshold\");\n _previousTrustedNum = _num;\n _previousTrustedDenom = _denom;\n _trustedNum = _trustedNumerator;\n _trustedDenom = _trustedDenominator;\n emit TrustedThresholdUpdated(\n nonce++,\n _trustedNumerator,\n _trustedDenominator,\n _previousTrustedNum,\n _previousTrustedDenom\n );\n }\n\n /**\n * @dev Returns minimum trusted vote weight.\n */\n function _minimumTrustedVoteWeight(uint256 _totalTrustedWeight) internal view virtual returns (uint256) {\n return (_trustedNum * _totalTrustedWeight + _trustedDenom - 1) / _trustedDenom;\n }\n}\n" + }, + "contracts/extensions/GatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/security/Pausable.sol\";\nimport \"../interfaces/IQuorum.sol\";\nimport \"./collections/HasProxyAdmin.sol\";\n\nabstract contract GatewayV2 is HasProxyAdmin, Pausable, IQuorum {\n uint256 internal _num;\n uint256 internal _denom;\n\n address private ______deprecated;\n uint256 public nonce;\n\n address public emergencyPauser;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[49] private ______gap;\n\n /**\n * @dev Grant emergency pauser role for `_addr`.\n */\n function setEmergencyPauser(address _addr) external onlyAdmin {\n emergencyPauser = _addr;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\n return (_num, _denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _denom >= _num * _getTotalWeight();\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n virtual\n onlyAdmin\n returns (uint256, uint256)\n {\n return _setThreshold(_numerator, _denominator);\n }\n\n /**\n * @dev Triggers paused state.\n */\n function pause() external {\n require(msg.sender == _getAdmin() || msg.sender == emergencyPauser, \"GatewayV2: not authorized pauser\");\n _pause();\n }\n\n /**\n * @dev Triggers unpaused state.\n */\n function unpause() external {\n require(msg.sender == _getAdmin() || msg.sender == emergencyPauser, \"GatewayV2: not authorized pauser\");\n _unpause();\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function minimumVoteWeight() public view virtual returns (uint256) {\n return _minimumVoteWeight(_getTotalWeight());\n }\n\n /**\n * @dev Sets threshold and returns the old one.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function _setThreshold(uint256 _numerator, uint256 _denominator)\n internal\n virtual\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n require(_numerator <= _denominator, \"GatewayV2: invalid threshold\");\n _previousNum = _num;\n _previousDenom = _denom;\n _num = _numerator;\n _denom = _denominator;\n emit ThresholdUpdated(nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n\n /**\n * @dev Returns minimum vote weight.\n */\n function _minimumVoteWeight(uint256 _totalWeight) internal view virtual returns (uint256) {\n return (_num * _totalWeight + _denom - 1) / _denom;\n }\n\n /**\n * @dev Returns the total weight.\n */\n function _getTotalWeight() internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/MinimumWithdrawal.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./collections/HasProxyAdmin.sol\";\nimport \"../libraries/Transfer.sol\";\n\nabstract contract MinimumWithdrawal is HasProxyAdmin {\n /// @dev Emitted when the minimum thresholds are updated\n event MinimumThresholdsUpdated(address[] tokens, uint256[] threshold);\n\n /// @dev Mapping from token address => minimum thresholds\n mapping(address => uint256) public minimumThreshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @dev Sets the minimum thresholds to withdraw.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `MinimumThresholdsUpdated` event.\n *\n */\n function setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) external virtual onlyAdmin {\n require(_tokens.length > 0, \"MinimumWithdrawal: invalid array length\");\n _setMinimumThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets minimum thresholds.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `MinimumThresholdsUpdated` event.\n *\n */\n function _setMinimumThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n require(_tokens.length == _thresholds.length, \"MinimumWithdrawal: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n minimumThreshold[_tokens[_i]] = _thresholds[_i];\n }\n emit MinimumThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Checks whether the request is larger than or equal to the minimum threshold.\n */\n function _checkWithdrawal(Transfer.Request calldata _request) internal view {\n require(\n _request.info.erc != Token.Standard.ERC20 || _request.info.quantity >= minimumThreshold[_request.tokenAddr],\n \"MinimumWithdrawal: query for too small quantity\"\n );\n }\n}\n" + }, + "contracts/interfaces/IERC20Mintable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.2;\n\ninterface IERC20Mintable {\n function mint(address _to, uint256 _value) external returns (bool _success);\n}\n" + }, + "contracts/interfaces/IERC721Mintable.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IERC721Mintable {\n function mint(address _to, uint256 _tokenId) external returns (bool);\n}\n" + }, + "contracts/interfaces/IBridgeTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IBridgeTracking {\n struct Request {\n VoteKind kind;\n uint256 id;\n }\n\n enum VoteKind {\n Deposit,\n Withdrawal,\n MainchainWithdrawal\n }\n\n /**\n * @dev Returns the total number of votes at the specific period `_period`.\n */\n function totalVotes(uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the total number of ballots at the specific period `_period`.\n */\n function totalBallots(uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the total number of ballots of bridge operators at the specific period `_period`.\n */\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\n external\n view\n returns (uint256[] memory);\n\n /**\n * @dev Returns the total number of ballots of a bridge operator at the specific period `_period`.\n */\n function totalBallotsOf(uint256 _period, address _bridgeOperator) external view returns (uint256);\n\n /**\n * @dev Handles the request once it is approved.\n *\n * Requirements:\n * - The method caller is the bridge contract.\n *\n */\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external;\n\n /**\n * @dev Records vote for a receipt and a operator.\n *\n * Requirements:\n * - The method caller is the bridge contract.\n *\n */\n function recordVote(\n VoteKind _kind,\n uint256 _requestId,\n address _operator\n ) external;\n}\n" + }, + "contracts/interfaces/IRoninGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../libraries/Transfer.sol\";\nimport \"./consumers/MappedTokenConsumer.sol\";\n\ninterface IRoninGatewayV2 is MappedTokenConsumer {\n /// @dev Emitted when the assets are depositted\n event Deposited(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal is requested\n event WithdrawalRequested(bytes32 receiptHash, Transfer.Receipt);\n /// @dev Emitted when the assets are withdrawn on mainchain\n event MainchainWithdrew(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal signatures is requested\n event WithdrawalSignaturesRequested(bytes32 receiptHash, Transfer.Receipt);\n /// @dev Emitted when the tokens are mapped\n event TokenMapped(address[] roninTokens, address[] mainchainTokens, uint256[] chainIds, Token.Standard[] standards);\n /// @dev Emitted when the threshold is updated\n event TrustedThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n /// @dev Emitted when a deposit is voted\n event DepositVoted(address indexed bridgeOperator, uint256 indexed id, uint256 indexed chainId, bytes32 receiptHash);\n\n /**\n * @dev Returns withdrawal count.\n */\n function withdrawalCount() external view returns (uint256);\n\n /**\n * @dev Returns withdrawal signatures.\n */\n function getWithdrawalSignatures(uint256 _withdrawalId, address[] calldata _validators)\n external\n view\n returns (bytes[] memory);\n\n /**\n * @dev Deposits based on the receipt.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Deposited` once the assets are released.\n *\n * @notice The assets will be transferred whenever the valid call passes the quorum threshold.\n *\n */\n function depositFor(Transfer.Receipt calldata _receipt) external;\n\n /**\n * @dev Marks the withdrawals are done on mainchain and returns the boolean array indicating whether the withdrawal\n * vote is already done before.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `MainchainWithdrew` once the valid call passes the quorum threshold.\n *\n * @notice Not reverting to avoid unnecessary failed transactions because the validators can send transactions at the\n * same time.\n *\n */\n function tryBulkAcknowledgeMainchainWithdrew(uint256[] calldata _withdrawalIds) external returns (bool[] memory);\n\n /**\n * @dev Tries bulk deposits based on the receipts and returns the boolean array indicating whether the deposit vote\n * is already done before. Reverts if the deposit is invalid or is voted by the validator again.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Deposited` once the assets are released.\n *\n * @notice The assets will be transferred whenever the valid call for the receipt passes the quorum threshold. Not\n * reverting to avoid unnecessary failed transactions because the validators can send transactions at the same time.\n *\n */\n function tryBulkDepositFor(Transfer.Receipt[] calldata _receipts) external returns (bool[] memory);\n\n /**\n * @dev Locks the assets and request withdrawal.\n *\n * Emits the `WithdrawalRequested` event.\n *\n */\n function requestWithdrawalFor(Transfer.Request calldata _request, uint256 _chainId) external;\n\n /**\n * @dev Bulk requests withdrawals.\n *\n * Emits the `WithdrawalRequested` events.\n *\n */\n function bulkRequestWithdrawalFor(Transfer.Request[] calldata _requests, uint256 _chainId) external;\n\n /**\n * @dev Requests withdrawal signatures for a specific withdrawal.\n *\n * Emits the `WithdrawalSignaturesRequested` event.\n *\n */\n function requestWithdrawalSignatures(uint256 _withdrawalId) external;\n\n /**\n * @dev Submits withdrawal signatures.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n */\n function bulkSubmitWithdrawalSignatures(uint256[] calldata _withdrawals, bytes[] calldata _signatures) external;\n\n /**\n * @dev Maps Ronin tokens to mainchain networks.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokens(\n address[] calldata _roninTokens,\n address[] calldata _mainchainTokens,\n uint256[] calldata chainIds,\n Token.Standard[] calldata _standards\n ) external;\n\n /**\n * @dev Returns whether the deposit is casted by the voter.\n */\n function depositVoted(\n uint256 _chainId,\n uint256 _depositId,\n address _voter\n ) external view returns (bool);\n\n /**\n * @dev Returns whether the mainchain withdrew is casted by the voter.\n */\n function mainchainWithdrewVoted(uint256 _withdrawalId, address _voter) external view returns (bool);\n\n /**\n * @dev Returns whether the withdrawal is done on mainchain.\n */\n function mainchainWithdrew(uint256 _withdrawalId) external view returns (bool);\n\n /**\n * @dev Returns mainchain token address.\n * Reverts for unsupported token.\n */\n function getMainchainToken(address _roninToken, uint256 _chainId) external view returns (MappedToken memory _token);\n}\n" + }, + "contracts/interfaces/collections/IHasBridgeTrackingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasBridgeTrackingContract is IHasContract {\n /// @dev Emitted when the bridge tracking contract is updated.\n event BridgeTrackingContractUpdated(address);\n\n /// @dev Error of method caller must be bridge tracking contract.\n error ErrCallerMustBeBridgeTrackingContract();\n\n /**\n * @dev Returns the bridge tracking contract.\n */\n function bridgeTrackingContract() external view returns (address);\n\n /**\n * @dev Sets the bridge tracking contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `BridgeTrackingContractUpdated`.\n *\n */\n function setBridgeTrackingContract(address) external;\n}\n" + }, + "@openzeppelin/contracts/security/Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which allows children to implement an emergency stop\n * mechanism that can be triggered by an authorized account.\n *\n * This module is used through inheritance. It will make available the\n * modifiers `whenNotPaused` and `whenPaused`, which can be applied to\n * the functions of your contract. Note that they will not be pausable by\n * simply including this module, only once the modifiers are put in place.\n */\nabstract contract Pausable is Context {\n /**\n * @dev Emitted when the pause is triggered by `account`.\n */\n event Paused(address account);\n\n /**\n * @dev Emitted when the pause is lifted by `account`.\n */\n event Unpaused(address account);\n\n bool private _paused;\n\n /**\n * @dev Initializes the contract in unpaused state.\n */\n constructor() {\n _paused = false;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is not paused.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n modifier whenNotPaused() {\n _requireNotPaused();\n _;\n }\n\n /**\n * @dev Modifier to make a function callable only when the contract is paused.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n modifier whenPaused() {\n _requirePaused();\n _;\n }\n\n /**\n * @dev Returns true if the contract is paused, and false otherwise.\n */\n function paused() public view virtual returns (bool) {\n return _paused;\n }\n\n /**\n * @dev Throws if the contract is paused.\n */\n function _requireNotPaused() internal view virtual {\n require(!paused(), \"Pausable: paused\");\n }\n\n /**\n * @dev Throws if the contract is not paused.\n */\n function _requirePaused() internal view virtual {\n require(paused(), \"Pausable: not paused\");\n }\n\n /**\n * @dev Triggers stopped state.\n *\n * Requirements:\n *\n * - The contract must not be paused.\n */\n function _pause() internal virtual whenNotPaused {\n _paused = true;\n emit Paused(_msgSender());\n }\n\n /**\n * @dev Returns to normal state.\n *\n * Requirements:\n *\n * - The contract must be paused.\n */\n function _unpause() internal virtual whenPaused {\n _paused = false;\n emit Unpaused(_msgSender());\n }\n}\n" + }, + "contracts/libraries/Transfer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/utils/cryptography/ECDSA.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"./Token.sol\";\n\nlibrary Transfer {\n using ECDSA for bytes32;\n\n enum Kind {\n Deposit,\n Withdrawal\n }\n\n struct Request {\n // For deposit request: Recipient address on Ronin network\n // For withdrawal request: Recipient address on mainchain network\n address recipientAddr;\n // Token address to deposit/withdraw\n // Value 0: native token\n address tokenAddr;\n Token.Info info;\n }\n\n /**\n * @dev Converts the transfer request into the deposit receipt.\n */\n function into_deposit_receipt(\n Request memory _request,\n address _requester,\n uint256 _id,\n address _roninTokenAddr,\n uint256 _roninChainId\n ) internal view returns (Receipt memory _receipt) {\n _receipt.id = _id;\n _receipt.kind = Kind.Deposit;\n _receipt.mainchain.addr = _requester;\n _receipt.mainchain.tokenAddr = _request.tokenAddr;\n _receipt.mainchain.chainId = block.chainid;\n _receipt.ronin.addr = _request.recipientAddr;\n _receipt.ronin.tokenAddr = _roninTokenAddr;\n _receipt.ronin.chainId = _roninChainId;\n _receipt.info = _request.info;\n }\n\n /**\n * @dev Converts the transfer request into the withdrawal receipt.\n */\n function into_withdrawal_receipt(\n Request memory _request,\n address _requester,\n uint256 _id,\n address _mainchainTokenAddr,\n uint256 _mainchainId\n ) internal view returns (Receipt memory _receipt) {\n _receipt.id = _id;\n _receipt.kind = Kind.Withdrawal;\n _receipt.ronin.addr = _requester;\n _receipt.ronin.tokenAddr = _request.tokenAddr;\n _receipt.ronin.chainId = block.chainid;\n _receipt.mainchain.addr = _request.recipientAddr;\n _receipt.mainchain.tokenAddr = _mainchainTokenAddr;\n _receipt.mainchain.chainId = _mainchainId;\n _receipt.info = _request.info;\n }\n\n struct Receipt {\n uint256 id;\n Kind kind;\n Token.Owner mainchain;\n Token.Owner ronin;\n Token.Info info;\n }\n\n // keccak256(\"Receipt(uint256 id,uint8 kind,TokenOwner mainchain,TokenOwner ronin,TokenInfo info)TokenInfo(uint8 erc,uint256 id,uint256 quantity)TokenOwner(address addr,address tokenAddr,uint256 chainId)\");\n bytes32 public constant TYPE_HASH = 0xb9d1fe7c9deeec5dc90a2f47ff1684239519f2545b2228d3d91fb27df3189eea;\n\n /**\n * @dev Returns token info struct hash.\n */\n function hash(Receipt memory _receipt) internal pure returns (bytes32) {\n return\n keccak256(\n abi.encode(\n TYPE_HASH,\n _receipt.id,\n _receipt.kind,\n Token.hash(_receipt.mainchain),\n Token.hash(_receipt.ronin),\n Token.hash(_receipt.info)\n )\n );\n }\n\n /**\n * @dev Returns the receipt digest.\n */\n function receiptDigest(bytes32 _domainSeparator, bytes32 _receiptHash) internal pure returns (bytes32) {\n return _domainSeparator.toTypedDataHash(_receiptHash);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n /**\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\n * another (`to`).\n *\n * Note that `value` may be zero.\n */\n event Transfer(address indexed from, address indexed to, uint256 value);\n\n /**\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n * a call to {approve}. `value` is the new allowance.\n */\n event Approval(address indexed owner, address indexed spender, uint256 value);\n\n /**\n * @dev Returns the amount of tokens in existence.\n */\n function totalSupply() external view returns (uint256);\n\n /**\n * @dev Returns the amount of tokens owned by `account`.\n */\n function balanceOf(address account) external view returns (uint256);\n\n /**\n * @dev Moves `amount` tokens from the caller's account to `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, uint256 amount) external returns (bool);\n\n /**\n * @dev Returns the remaining number of tokens that `spender` will be\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\n * zero by default.\n *\n * This value changes when {approve} or {transferFrom} are called.\n */\n function allowance(address owner, address spender) external view returns (uint256);\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\n * that someone may use both the old and the new allowance by unfortunate\n * transaction ordering. One possible solution to mitigate this race\n * condition is to first reduce the spender's allowance to 0 and set the\n * desired value afterwards:\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n *\n * Emits an {Approval} event.\n */\n function approve(address spender, uint256 amount) external returns (bool);\n\n /**\n * @dev Moves `amount` tokens from `from` to `to` using the\n * allowance mechanism. `amount` is then deducted from the caller's\n * allowance.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "contracts/libraries/Token.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC721/IERC721.sol\";\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"../interfaces/IWETH.sol\";\n\nlibrary Token {\n enum Standard {\n ERC20,\n ERC721\n }\n struct Info {\n Standard erc;\n // For ERC20: the id must be 0 and the quantity is larger than 0.\n // For ERC721: the quantity must be 0.\n uint256 id;\n uint256 quantity;\n }\n\n // keccak256(\"TokenInfo(uint8 erc,uint256 id,uint256 quantity)\");\n bytes32 public constant INFO_TYPE_HASH = 0x1e2b74b2a792d5c0f0b6e59b037fa9d43d84fbb759337f0112fcc15ca414fc8d;\n\n /**\n * @dev Returns token info struct hash.\n */\n function hash(Info memory _info) internal pure returns (bytes32) {\n return keccak256(abi.encode(INFO_TYPE_HASH, _info.erc, _info.id, _info.quantity));\n }\n\n /**\n * @dev Validates the token info.\n */\n function validate(Info memory _info) internal pure {\n require(\n (_info.erc == Standard.ERC20 && _info.quantity > 0 && _info.id == 0) ||\n (_info.erc == Standard.ERC721 && _info.quantity == 0),\n \"Token: invalid info\"\n );\n }\n\n /**\n * @dev Transfer asset from.\n *\n * Requirements:\n * - The `_from` address must approve for the contract using this library.\n *\n */\n function transferFrom(\n Info memory _info,\n address _from,\n address _to,\n address _token\n ) internal {\n bool _success;\n bytes memory _data;\n if (_info.erc == Standard.ERC20) {\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transferFrom.selector, _from, _to, _info.quantity));\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\n } else if (_info.erc == Standard.ERC721) {\n // bytes4(keccak256(\"transferFrom(address,address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x23b872dd, _from, _to, _info.id));\n } else {\n revert(\"Token: unsupported token standard\");\n }\n\n if (!_success) {\n revert(\n string(\n abi.encodePacked(\n \"Token: could not transfer \",\n toString(_info),\n \" from \",\n Strings.toHexString(uint160(_from), 20),\n \" to \",\n Strings.toHexString(uint160(_to), 20),\n \" token \",\n Strings.toHexString(uint160(_token), 20)\n )\n )\n );\n }\n }\n\n /**\n * @dev Transfers ERC721 token and returns the result.\n */\n function tryTransferERC721(\n address _token,\n address _to,\n uint256 _id\n ) internal returns (bool _success) {\n (_success, ) = _token.call(abi.encodeWithSelector(IERC721.transferFrom.selector, address(this), _to, _id));\n }\n\n /**\n * @dev Transfers ERC20 token and returns the result.\n */\n function tryTransferERC20(\n address _token,\n address _to,\n uint256 _quantity\n ) internal returns (bool _success) {\n bytes memory _data;\n (_success, _data) = _token.call(abi.encodeWithSelector(IERC20.transfer.selector, _to, _quantity));\n _success = _success && (_data.length == 0 || abi.decode(_data, (bool)));\n }\n\n /**\n * @dev Transfer assets from current address to `_to` address.\n */\n function transfer(\n Info memory _info,\n address _to,\n address _token\n ) internal {\n bool _success;\n if (_info.erc == Standard.ERC20) {\n _success = tryTransferERC20(_token, _to, _info.quantity);\n } else if (_info.erc == Standard.ERC721) {\n _success = tryTransferERC721(_token, _to, _info.id);\n } else {\n revert(\"Token: unsupported token standard\");\n }\n\n if (!_success) {\n revert(\n string(\n abi.encodePacked(\n \"Token: could not transfer \",\n toString(_info),\n \" to \",\n Strings.toHexString(uint160(_to), 20),\n \" token \",\n Strings.toHexString(uint160(_token), 20)\n )\n )\n );\n }\n }\n\n /**\n * @dev Tries minting and transfering assets.\n *\n * @notice Prioritizes transfer native token if the token is wrapped.\n *\n */\n function handleAssetTransfer(\n Info memory _info,\n address payable _to,\n address _token,\n IWETH _wrappedNativeToken\n ) internal {\n bool _success;\n if (_token == address(_wrappedNativeToken)) {\n // Try sending the native token before transferring the wrapped token\n if (!_to.send(_info.quantity)) {\n _wrappedNativeToken.deposit{ value: _info.quantity }();\n transfer(_info, _to, _token);\n }\n } else if (_info.erc == Token.Standard.ERC20) {\n uint256 _balance = IERC20(_token).balanceOf(address(this));\n\n if (_balance < _info.quantity) {\n // bytes4(keccak256(\"mint(address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, address(this), _info.quantity - _balance));\n require(_success, \"Token: ERC20 minting failed\");\n }\n\n transfer(_info, _to, _token);\n } else if (_info.erc == Token.Standard.ERC721) {\n if (!tryTransferERC721(_token, _to, _info.id)) {\n // bytes4(keccak256(\"mint(address,uint256)\"))\n (_success, ) = _token.call(abi.encodeWithSelector(0x40c10f19, _to, _info.id));\n require(_success, \"Token: ERC721 minting failed\");\n }\n } else {\n revert(\"Token: unsupported token standard\");\n }\n }\n\n /**\n * @dev Returns readable string.\n */\n function toString(Info memory _info) internal pure returns (string memory) {\n return\n string(\n abi.encodePacked(\n \"TokenInfo(\",\n Strings.toHexString(uint160(_info.erc), 1),\n \",\",\n Strings.toHexString(_info.id),\n \",\",\n Strings.toHexString(_info.quantity),\n \")\"\n )\n );\n }\n\n struct Owner {\n address addr;\n address tokenAddr;\n uint256 chainId;\n }\n\n // keccak256(\"TokenOwner(address addr,address tokenAddr,uint256 chainId)\");\n bytes32 public constant OWNER_TYPE_HASH = 0x353bdd8d69b9e3185b3972e08b03845c0c14a21a390215302776a7a34b0e8764;\n\n /**\n * @dev Returns ownership struct hash.\n */\n function hash(Owner memory _owner) internal pure returns (bytes32) {\n return keccak256(abi.encode(OWNER_TYPE_HASH, _owner.addr, _owner.tokenAddr, _owner.chainId));\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC721/IERC721.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/introspection/IERC165.sol\";\n\n/**\n * @dev Required interface of an ERC721 compliant contract.\n */\ninterface IERC721 is IERC165 {\n /**\n * @dev Emitted when `tokenId` token is transferred from `from` to `to`.\n */\n event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.\n */\n event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);\n\n /**\n * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.\n */\n event ApprovalForAll(address indexed owner, address indexed operator, bool approved);\n\n /**\n * @dev Returns the number of tokens in ``owner``'s account.\n */\n function balanceOf(address owner) external view returns (uint256 balance);\n\n /**\n * @dev Returns the owner of the `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function ownerOf(uint256 tokenId) external view returns (address owner);\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId,\n bytes calldata data\n ) external;\n\n /**\n * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients\n * are aware of the ERC721 protocol to prevent tokens from being forever locked.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must exist and be owned by `from`.\n * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.\n * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.\n *\n * Emits a {Transfer} event.\n */\n function safeTransferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Transfers `tokenId` token from `from` to `to`.\n *\n * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `tokenId` token must be owned by `from`.\n * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.\n *\n * Emits a {Transfer} event.\n */\n function transferFrom(\n address from,\n address to,\n uint256 tokenId\n ) external;\n\n /**\n * @dev Gives permission to `to` to transfer `tokenId` token to another account.\n * The approval is cleared when the token is transferred.\n *\n * Only a single account can be approved at a time, so approving the zero address clears previous approvals.\n *\n * Requirements:\n *\n * - The caller must own the token or be an approved operator.\n * - `tokenId` must exist.\n *\n * Emits an {Approval} event.\n */\n function approve(address to, uint256 tokenId) external;\n\n /**\n * @dev Approve or remove `operator` as an operator for the caller.\n * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.\n *\n * Requirements:\n *\n * - The `operator` cannot be the caller.\n *\n * Emits an {ApprovalForAll} event.\n */\n function setApprovalForAll(address operator, bool _approved) external;\n\n /**\n * @dev Returns the account approved for `tokenId` token.\n *\n * Requirements:\n *\n * - `tokenId` must exist.\n */\n function getApproved(uint256 tokenId) external view returns (address operator);\n\n /**\n * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.\n *\n * See {setApprovalForAll}\n */\n function isApprovedForAll(address owner, address operator) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IWETH.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface IWETH {\n function deposit() external payable;\n\n function withdraw(uint256 _wad) external;\n\n function balanceOf(address) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/consumers/MappedTokenConsumer.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../libraries/Token.sol\";\n\ninterface MappedTokenConsumer {\n struct MappedToken {\n Token.Standard erc;\n address tokenAddr;\n }\n}\n" + }, + "contracts/extensions/bridge-operator-governance/BOsGovernanceRelay.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../interfaces/consumers/SignatureConsumer.sol\";\nimport \"../../interfaces/consumers/VoteStatusConsumer.sol\";\nimport \"../../libraries/BridgeOperatorsBallot.sol\";\nimport \"../../libraries/AddressArrayUtils.sol\";\nimport \"../../libraries/IsolatedGovernance.sol\";\n\nabstract contract BOsGovernanceRelay is SignatureConsumer, VoteStatusConsumer {\n /// @dev The last the brige operator set info.\n BridgeOperatorsBallot.BridgeOperatorSet internal _lastSyncedBridgeOperatorSetInfo;\n /// @dev Mapping from period index => epoch index => bridge operators vote\n mapping(uint256 => mapping(uint256 => IsolatedGovernance.Vote)) internal _vote;\n\n /**\n * @dev Returns the synced bridge operator set info.\n */\n function lastSyncedBridgeOperatorSetInfo() external view returns (BridgeOperatorsBallot.BridgeOperatorSet memory) {\n return _lastSyncedBridgeOperatorSetInfo;\n }\n\n /**\n * @dev Relays votes by signatures.\n *\n * Requirements:\n * - The period of voting is larger than the last synced period.\n * - The arrays are not empty.\n * - The signature signers are in order.\n *\n * @notice Does not store the voter signature into storage.\n *\n */\n function _relayVotesBySignatures(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures,\n uint256 _minimumVoteWeight,\n bytes32 _domainSeperator\n ) internal {\n require(\n (_ballot.period >= _lastSyncedBridgeOperatorSetInfo.period &&\n _ballot.epoch > _lastSyncedBridgeOperatorSetInfo.epoch),\n \"BOsGovernanceRelay: query for outdated bridge operator set\"\n );\n BridgeOperatorsBallot.verifyBallot(_ballot);\n require(\n !AddressArrayUtils.isEqual(_ballot.operators, _lastSyncedBridgeOperatorSetInfo.operators),\n \"BOsGovernanceRelay: bridge operator set is already voted\"\n );\n require(_signatures.length > 0, \"BOsGovernanceRelay: invalid array length\");\n\n Signature calldata _sig;\n address[] memory _signers = new address[](_signatures.length);\n address _lastSigner;\n bytes32 _hash = BridgeOperatorsBallot.hash(_ballot);\n bytes32 _digest = ECDSA.toTypedDataHash(_domainSeperator, _hash);\n\n for (uint256 _i = 0; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n _signers[_i] = ECDSA.recover(_digest, _sig.v, _sig.r, _sig.s);\n require(_lastSigner < _signers[_i], \"BOsGovernanceRelay: invalid order\");\n _lastSigner = _signers[_i];\n }\n\n IsolatedGovernance.Vote storage _v = _vote[_ballot.period][_ballot.epoch];\n uint256 _totalVoteWeight = _sumBridgeVoterWeights(_signers);\n if (_totalVoteWeight >= _minimumVoteWeight) {\n require(_totalVoteWeight > 0, \"BOsGovernanceRelay: invalid vote weight\");\n _v.status = VoteStatus.Approved;\n _lastSyncedBridgeOperatorSetInfo = _ballot;\n return;\n }\n\n revert(\"BOsGovernanceRelay: relay failed\");\n }\n\n /**\n * @dev Returns the weight of the governor list.\n */\n function _sumBridgeVoterWeights(address[] memory _bridgeVoters) internal view virtual returns (uint256);\n}\n" + }, + "contracts/mainchain/MainchainGovernanceAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"../extensions/bridge-operator-governance/BOsGovernanceRelay.sol\";\nimport \"../extensions/sequential-governance/GovernanceRelay.sol\";\nimport \"../extensions/TransparentUpgradeableProxyV2.sol\";\nimport \"../extensions/GovernanceAdmin.sol\";\nimport \"../interfaces/IBridge.sol\";\n\ncontract MainchainGovernanceAdmin is AccessControlEnumerable, GovernanceRelay, GovernanceAdmin, BOsGovernanceRelay {\n bytes32 public constant RELAYER_ROLE = keccak256(\"RELAYER_ROLE\");\n uint256 private constant DEFAULT_EXPIRY_DURATION = 1 << 255;\n\n constructor(\n uint256 _roninChainId,\n address _roleSetter,\n address _roninTrustedOrganizationContract,\n address _bridgeContract,\n address[] memory _relayers\n ) GovernanceAdmin(_roninChainId, _roninTrustedOrganizationContract, _bridgeContract, DEFAULT_EXPIRY_DURATION) {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n for (uint256 _i; _i < _relayers.length; _i++) {\n _grantRole(RELAYER_ROLE, _relayers[_i]);\n }\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for the proposal.\n */\n function proposalRelayed(uint256 _chainId, uint256 _round) external view returns (bool) {\n return vote[_chainId][_round].status != VoteStatus.Pending;\n }\n\n /**\n * @dev Returns whether the voter `_voter` casted vote for bridge operators at a specific period.\n */\n function bridgeOperatorsRelayed(uint256 _period, uint256 _epoch) external view returns (bool) {\n return _vote[_period][_epoch].status != VoteStatus.Pending;\n }\n\n /**\n * @dev See `GovernanceRelay-_relayProposal`.\n *\n * Requirements:\n * - The method caller is relayer.\n *\n */\n function relayProposal(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyRole(RELAYER_ROLE) {\n _relayProposal(_proposal, _supports, _signatures, DOMAIN_SEPARATOR, msg.sender);\n }\n\n /**\n * @dev See `GovernanceRelay-_relayGlobalProposal`.\n *\n * Requirements:\n * - The method caller is relayer.\n *\n */\n function relayGlobalProposal(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures\n ) external onlyRole(RELAYER_ROLE) {\n _relayGlobalProposal(\n _globalProposal,\n _supports,\n _signatures,\n DOMAIN_SEPARATOR,\n roninTrustedOrganizationContract(),\n bridgeContract(),\n msg.sender\n );\n }\n\n /**\n * @dev See `BOsGovernanceRelay-_relayVotesBySignatures`.\n *\n * Requirements:\n * - The method caller is relayer.\n *\n */\n function relayBridgeOperators(\n BridgeOperatorsBallot.BridgeOperatorSet calldata _ballot,\n Signature[] calldata _signatures\n ) external onlyRole(RELAYER_ROLE) {\n _relayVotesBySignatures(_ballot, _signatures, _getMinimumVoteWeight(), DOMAIN_SEPARATOR);\n TransparentUpgradeableProxyV2(payable(bridgeContract())).functionDelegateCall(\n abi.encodeWithSelector(_bridgeContract.replaceBridgeOperators.selector, _ballot.operators)\n );\n }\n\n /**\n * @inheritdoc GovernanceRelay\n */\n function _sumWeights(address[] memory _governors) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumGovernorWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governors)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @inheritdoc BOsGovernanceRelay\n */\n function _sumBridgeVoterWeights(address[] memory _governors) internal view virtual override returns (uint256) {\n bytes4 _selector = IRoninTrustedOrganization.sumBridgeVoterWeights.selector;\n (bool _success, bytes memory _returndata) = roninTrustedOrganizationContract().staticcall(\n abi.encodeWithSelector(\n // TransparentUpgradeableProxyV2.functionDelegateCall.selector,\n 0x4bb5274a,\n abi.encodeWithSelector(_selector, _governors)\n )\n );\n if (!_success) revert ErrProxyCallFailed(_selector);\n return abi.decode(_returndata, (uint256));\n }\n\n /**\n * @dev See {CoreGovernance-_getChainType}\n */\n function _getChainType() internal pure override returns (ChainType) {\n return ChainType.Mainchain;\n }\n}\n" + }, + "contracts/extensions/sequential-governance/GovernanceRelay.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./CoreGovernance.sol\";\n\nabstract contract GovernanceRelay is CoreGovernance {\n using Proposal for Proposal.ProposalDetail;\n using GlobalProposal for GlobalProposal.GlobalProposalDetail;\n\n /**\n * @dev Relays votes by signatures.\n *\n * @notice Does not store the voter signature into storage.\n *\n */\n function _relayVotesBySignatures(\n Proposal.ProposalDetail memory _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _forDigest,\n bytes32 _againstDigest\n ) internal {\n require(_supports.length > 0 && _supports.length == _signatures.length, \"GovernanceRelay: invalid array length\");\n uint256 _forVoteCount;\n uint256 _againstVoteCount;\n address[] memory _forVoteSigners = new address[](_signatures.length);\n address[] memory _againstVoteSigners = new address[](_signatures.length);\n\n {\n address _signer;\n address _lastSigner;\n Ballot.VoteType _support;\n Signature calldata _sig;\n\n for (uint256 _i; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n _support = _supports[_i];\n\n if (_support == Ballot.VoteType.For) {\n _signer = ECDSA.recover(_forDigest, _sig.v, _sig.r, _sig.s);\n _forVoteSigners[_forVoteCount++] = _signer;\n } else if (_support == Ballot.VoteType.Against) {\n _signer = ECDSA.recover(_againstDigest, _sig.v, _sig.r, _sig.s);\n _againstVoteSigners[_againstVoteCount++] = _signer;\n } else {\n revert(\"GovernanceRelay: query for unsupported vote type\");\n }\n\n require(_lastSigner < _signer, \"GovernanceRelay: invalid order\");\n _lastSigner = _signer;\n }\n }\n\n assembly {\n mstore(_forVoteSigners, _forVoteCount)\n mstore(_againstVoteSigners, _againstVoteCount)\n }\n\n ProposalVote storage _vote = vote[_proposal.chainId][_proposal.nonce];\n uint256 _minimumForVoteWeight = _getMinimumVoteWeight();\n uint256 _totalForVoteWeight = _sumWeights(_forVoteSigners);\n if (_totalForVoteWeight >= _minimumForVoteWeight) {\n require(_totalForVoteWeight > 0, \"GovernanceRelay: invalid vote weight\");\n _vote.status = VoteStatus.Approved;\n emit ProposalApproved(_vote.hash);\n _tryExecute(_vote, _proposal);\n return;\n }\n\n uint256 _minimumAgainstVoteWeight = _getTotalWeights() - _minimumForVoteWeight + 1;\n uint256 _totalAgainstVoteWeight = _sumWeights(_againstVoteSigners);\n if (_totalAgainstVoteWeight >= _minimumAgainstVoteWeight) {\n require(_totalAgainstVoteWeight > 0, \"GovernanceRelay: invalid vote weight\");\n _vote.status = VoteStatus.Rejected;\n emit ProposalRejected(_vote.hash);\n return;\n }\n\n revert(\"GovernanceRelay: relay failed\");\n }\n\n /**\n * @dev Relays voted proposal.\n *\n * Requirements:\n * - The relay proposal is finalized.\n *\n */\n function _relayProposal(\n Proposal.ProposalDetail calldata _proposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _creator\n ) internal {\n _proposeProposalStruct(_proposal, _creator);\n bytes32 _proposalHash = _proposal.hash();\n _relayVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_proposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Relays voted global proposal.\n *\n * Requirements:\n * - The relay proposal is finalized.\n *\n */\n function _relayGlobalProposal(\n GlobalProposal.GlobalProposalDetail calldata _globalProposal,\n Ballot.VoteType[] calldata _supports,\n Signature[] calldata _signatures,\n bytes32 _domainSeparator,\n address _roninTrustedOrganizationContract,\n address _gatewayContract,\n address _creator\n ) internal {\n Proposal.ProposalDetail memory _proposal = _proposeGlobalStruct(\n _globalProposal,\n _roninTrustedOrganizationContract,\n _gatewayContract,\n _creator\n );\n bytes32 _globalProposalHash = _globalProposal.hash();\n _relayVotesBySignatures(\n _proposal,\n _supports,\n _signatures,\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.For)),\n ECDSA.toTypedDataHash(_domainSeparator, Ballot.hash(_globalProposalHash, Ballot.VoteType.Against))\n );\n }\n\n /**\n * @dev Returns the weight of the governor list.\n */\n function _sumWeights(address[] memory _governors) internal view virtual returns (uint256);\n}\n" + }, + "contracts/extensions/TransparentUpgradeableProxyV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol\";\n\ncontract TransparentUpgradeableProxyV2 is TransparentUpgradeableProxy {\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable TransparentUpgradeableProxy(_logic, admin_, _data) {}\n\n /**\n * @dev Calls a function from the current implementation as specified by `_data`, which should be an encoded function call.\n *\n * Requirements:\n * - Only the admin can call this function.\n *\n * Note: The proxy admin is not allowed to interact with the proxy logic through the fallback function to avoid\n * triggering some unexpected logic. This is to allow the administrator to explicitly call the proxy, please consider\n * reviewing the encoded data `_data` and the method which is called before using this.\n *\n */\n function functionDelegateCall(bytes memory _data) public payable ifAdmin {\n address _addr = _implementation();\n assembly {\n let _result := delegatecall(gas(), _addr, add(_data, 32), mload(_data), 0, 0)\n returndatacopy(0, 0, returndatasize())\n switch _result\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/transparent/TransparentUpgradeableProxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin.\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "contracts/mocks/MockBridge.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol\";\nimport \"../interfaces/IBridge.sol\";\n\ncontract MockBridge is IBridge {\n /// @dev Mapping from validator address => last block that the bridge operator is added\n mapping(address => uint256) public bridgeOperatorAddedBlock;\n /// @dev Bridge operators array\n address[] public bridgeOperators;\n\n function replaceBridgeOperators(address[] calldata _list) external {\n address _addr;\n for (uint256 _i = 0; _i < _list.length; _i++) {\n _addr = _list[_i];\n if (bridgeOperatorAddedBlock[_addr] == 0) {\n bridgeOperators.push(_addr);\n }\n bridgeOperatorAddedBlock[_addr] = block.number;\n }\n\n {\n uint256 _i;\n while (_i < bridgeOperators.length) {\n _addr = bridgeOperators[_i];\n if (bridgeOperatorAddedBlock[_addr] < block.number) {\n delete bridgeOperatorAddedBlock[_addr];\n bridgeOperators[_i] = bridgeOperators[bridgeOperators.length - 1];\n bridgeOperators.pop();\n continue;\n }\n _i++;\n }\n }\n }\n\n function getBridgeOperators() external view override returns (address[] memory) {\n return bridgeOperators;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/presets/ERC20PresetMinterPauser.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../extensions/ERC20Burnable.sol\";\nimport \"../extensions/ERC20Pausable.sol\";\nimport \"../../../access/AccessControlEnumerable.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev {ERC20} token, including:\n *\n * - ability for holders to burn (destroy) their tokens\n * - a minter role that allows for token minting (creation)\n * - a pauser role that allows to stop all token transfers\n *\n * This contract uses {AccessControl} to lock permissioned functions using the\n * different roles - head to its documentation for details.\n *\n * The account that deploys the contract will be granted the minter and pauser\n * roles, as well as the default admin role, which will let it grant both minter\n * and pauser roles to other accounts.\n *\n * _Deprecated in favor of https://wizard.openzeppelin.com/[Contracts Wizard]._\n */\ncontract ERC20PresetMinterPauser is Context, AccessControlEnumerable, ERC20Burnable, ERC20Pausable {\n bytes32 public constant MINTER_ROLE = keccak256(\"MINTER_ROLE\");\n bytes32 public constant PAUSER_ROLE = keccak256(\"PAUSER_ROLE\");\n\n /**\n * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the\n * account that deploys the contract.\n *\n * See {ERC20-constructor}.\n */\n constructor(string memory name, string memory symbol) ERC20(name, symbol) {\n _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());\n\n _setupRole(MINTER_ROLE, _msgSender());\n _setupRole(PAUSER_ROLE, _msgSender());\n }\n\n /**\n * @dev Creates `amount` new tokens for `to`.\n *\n * See {ERC20-_mint}.\n *\n * Requirements:\n *\n * - the caller must have the `MINTER_ROLE`.\n */\n function mint(address to, uint256 amount) public virtual {\n require(hasRole(MINTER_ROLE, _msgSender()), \"ERC20PresetMinterPauser: must have minter role to mint\");\n _mint(to, amount);\n }\n\n /**\n * @dev Pauses all token transfers.\n *\n * See {ERC20Pausable} and {Pausable-_pause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function pause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC20PresetMinterPauser: must have pauser role to pause\");\n _pause();\n }\n\n /**\n * @dev Unpauses all token transfers.\n *\n * See {ERC20Pausable} and {Pausable-_unpause}.\n *\n * Requirements:\n *\n * - the caller must have the `PAUSER_ROLE`.\n */\n function unpause() public virtual {\n require(hasRole(PAUSER_ROLE, _msgSender()), \"ERC20PresetMinterPauser: must have pauser role to unpause\");\n _unpause();\n }\n\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override(ERC20, ERC20Pausable) {\n super._beforeTokenTransfer(from, to, amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../utils/Context.sol\";\n\n/**\n * @dev Extension of {ERC20} that allows token holders to destroy both their own\n * tokens and those that they have an allowance for, in a way that can be\n * recognized off-chain (via event analysis).\n */\nabstract contract ERC20Burnable is Context, ERC20 {\n /**\n * @dev Destroys `amount` tokens from the caller.\n *\n * See {ERC20-_burn}.\n */\n function burn(uint256 amount) public virtual {\n _burn(_msgSender(), amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, deducting from the caller's\n * allowance.\n *\n * See {ERC20-_burn} and {ERC20-allowance}.\n *\n * Requirements:\n *\n * - the caller must have allowance for ``accounts``'s tokens of at least\n * `amount`.\n */\n function burnFrom(address account, uint256 amount) public virtual {\n _spendAllowance(account, _msgSender(), amount);\n _burn(account, amount);\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../../../security/Pausable.sol\";\n\n/**\n * @dev ERC20 token with pausable token transfers, minting and burning.\n *\n * Useful for scenarios such as preventing trades until the end of an evaluation\n * period, or having an emergency switch for freezing all token transfers in the\n * event of a large bug.\n */\nabstract contract ERC20Pausable is ERC20, Pausable {\n /**\n * @dev See {ERC20-_beforeTokenTransfer}.\n *\n * Requirements:\n *\n * - the contract must not be paused.\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual override {\n super._beforeTokenTransfer(from, to, amount);\n\n require(!paused(), \"ERC20Pausable: token transfer while paused\");\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n }\n\n /**\n * @dev Leaves the contract without owner. It will not be possible to call\n * `onlyOwner` functions anymore. Can only be called by the current owner.\n *\n * NOTE: Renouncing ownership will leave the contract without an owner,\n * thereby removing any functionality that is only available to the owner.\n */\n function renounceOwnership() public virtual onlyOwner {\n _transferOwnership(address(0));\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Can only be called by the current owner.\n */\n function transferOwnership(address newOwner) public virtual onlyOwner {\n require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/transparent/ProxyAdmin.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"../../access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{value: msg.value}(implementation, data);\n }\n}\n" + }, + "contracts/multi-chains/RoninTrustedOrganization.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/utils/Strings.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../libraries/AddressArrayUtils.sol\";\nimport \"../interfaces/IRoninTrustedOrganization.sol\";\nimport \"../extensions/collections/HasProxyAdmin.sol\";\n\ncontract RoninTrustedOrganization is IRoninTrustedOrganization, HasProxyAdmin, Initializable {\n uint256 internal _num;\n uint256 internal _denom;\n uint256 internal _totalWeight;\n uint256 internal _nonce;\n\n /// @dev Mapping from consensus address => weight\n mapping(address => uint256) internal _consensusWeight;\n /// @dev Mapping from governor address => weight\n mapping(address => uint256) internal _governorWeight;\n /// @dev Mapping from bridge voter address => weight\n mapping(address => uint256) internal _bridgeVoterWeight;\n\n /// @dev Mapping from consensus address => added block\n mapping(address => uint256) internal _addedBlock;\n\n /// @dev Consensus array\n address[] internal _consensusList;\n /// @dev Governors array\n address[] internal _governorList;\n /// @dev Bridge voters array\n address[] internal _bridgeVoterList;\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n TrustedOrganization[] calldata _trustedOrgs,\n uint256 __num,\n uint256 __denom\n ) external initializer {\n if (_trustedOrgs.length > 0) {\n _addTrustedOrganizations(_trustedOrgs);\n }\n _setThreshold(__num, __denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function getThreshold() external view virtual returns (uint256 num_, uint256 denom_) {\n return (_num, _denom);\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function checkThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _denom >= _num * _totalWeight;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function minimumVoteWeight() external view virtual returns (uint256) {\n return (_num * _totalWeight + _denom - 1) / _denom;\n }\n\n /**\n * @inheritdoc IQuorum\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n override\n onlyAdmin\n returns (uint256, uint256)\n {\n return _setThreshold(_numerator, _denominator);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function addTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\n _addTrustedOrganizations(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function updateTrustedOrganizations(TrustedOrganization[] calldata _list) external override onlyAdmin {\n require(_list.length > 0, \"RoninTrustedOrganization: invalid array length\");\n for (uint256 _i; _i < _list.length; _i++) {\n _updateTrustedOrganization(_list[_i]);\n }\n emit TrustedOrganizationsUpdated(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function removeTrustedOrganizations(address[] calldata _list) external override onlyAdmin {\n require(_list.length > 0, \"RoninTrustedOrganization: invalid array length\");\n for (uint _i = 0; _i < _list.length; _i++) {\n _removeTrustedOrganization(_list[_i]);\n }\n emit TrustedOrganizationsRemoved(_list);\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function totalWeights() external view virtual returns (uint256) {\n return _totalWeight;\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getConsensusWeight(address _consensusAddr) external view returns (uint256) {\n return _consensusWeight[_consensusAddr];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getGovernorWeight(address _governor) external view returns (uint256) {\n return _governorWeight[_governor];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getBridgeVoterWeight(address _addr) external view returns (uint256) {\n return _bridgeVoterWeight[_addr];\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getConsensusWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; _i++) {\n _res[_i] = _consensusWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getGovernorWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; _i++) {\n _res[_i] = _governorWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getBridgeVoterWeights(address[] calldata _list) external view returns (uint256[] memory _res) {\n _res = new uint256[](_list.length);\n for (uint _i = 0; _i < _res.length; _i++) {\n _res[_i] = _bridgeVoterWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumConsensusWeights(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; _i++) {\n _res += _consensusWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumGovernorWeights(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; _i++) {\n _res += _governorWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function sumBridgeVoterWeights(address[] calldata _list) external view returns (uint256 _res) {\n for (uint _i = 0; _i < _list.length; _i++) {\n _res += _bridgeVoterWeight[_list[_i]];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function countTrustedOrganizations() external view override returns (uint256) {\n return _consensusList.length;\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getAllTrustedOrganizations() external view override returns (TrustedOrganization[] memory _list) {\n _list = new TrustedOrganization[](_consensusList.length);\n address _addr;\n for (uint256 _i; _i < _list.length; _i++) {\n _addr = _consensusList[_i];\n _list[_i].consensusAddr = _addr;\n _list[_i].governor = _governorList[_i];\n _list[_i].bridgeVoter = _bridgeVoterList[_i];\n _list[_i].weight = _consensusWeight[_addr];\n }\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getTrustedOrganization(address _consensusAddr) external view returns (TrustedOrganization memory) {\n for (uint _i = 0; _i < _consensusList.length; _i++) {\n if (_consensusList[_i] == _consensusAddr) {\n return getTrustedOrganizationAt(_i);\n }\n }\n revert(\"RoninTrustedOrganization: query for non-existent consensus address\");\n }\n\n /**\n * @inheritdoc IRoninTrustedOrganization\n */\n function getTrustedOrganizationAt(uint256 _idx) public view override returns (TrustedOrganization memory) {\n address _addr = _consensusList[_idx];\n return\n TrustedOrganization(\n _addr,\n _governorList[_idx],\n _bridgeVoterList[_idx],\n _consensusWeight[_addr],\n _addedBlock[_addr]\n );\n }\n\n /**\n * @dev Adds a list of trusted organizations.\n */\n function _addTrustedOrganizations(TrustedOrganization[] calldata _list) internal virtual {\n for (uint256 _i; _i < _list.length; _i++) {\n _addTrustedOrganization(_list[_i]);\n }\n emit TrustedOrganizationsAdded(_list);\n }\n\n /**\n * @dev Adds a trusted organization.\n *\n * Requirements:\n * - The weight is larger than 0.\n * - The consensus address is not added.\n * - The govenor address is not added.\n * - The bridge voter address is not added.\n *\n */\n function _addTrustedOrganization(TrustedOrganization memory _v) internal virtual {\n require(_v.addedBlock == 0, \"RoninTrustedOrganization: invalid request\");\n _sanityCheckTrustedOrganizationData(_v);\n\n if (_consensusWeight[_v.consensusAddr] > 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: consensus address \",\n Strings.toHexString(uint160(_v.consensusAddr), 20),\n \" is added already\"\n )\n )\n );\n }\n\n if (_governorWeight[_v.governor] > 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: govenor address \",\n Strings.toHexString(uint160(_v.governor), 20),\n \" is added already\"\n )\n )\n );\n }\n\n if (_bridgeVoterWeight[_v.bridgeVoter] > 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: bridge voter address \",\n Strings.toHexString(uint160(_v.bridgeVoter), 20),\n \" is added already\"\n )\n )\n );\n }\n\n _consensusList.push(_v.consensusAddr);\n _consensusWeight[_v.consensusAddr] = _v.weight;\n\n _governorList.push(_v.governor);\n _governorWeight[_v.governor] = _v.weight;\n\n _bridgeVoterList.push(_v.bridgeVoter);\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\n\n _addedBlock[_v.consensusAddr] = block.number;\n\n _totalWeight += _v.weight;\n }\n\n /**\n * @dev Updates a trusted organization.\n *\n * Requirements:\n * - The weight is larger than 0.\n * - The consensus address is already added.\n *\n */\n function _updateTrustedOrganization(TrustedOrganization memory _v) internal virtual {\n _sanityCheckTrustedOrganizationData(_v);\n\n uint256 _weight = _consensusWeight[_v.consensusAddr];\n if (_weight == 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: consensus address \",\n Strings.toHexString(uint160(_v.consensusAddr), 20),\n \" is not added\"\n )\n )\n );\n }\n\n uint256 _count = _consensusList.length;\n for (uint256 _i = 0; _i < _count; _i++) {\n if (_consensusList[_i] == _v.consensusAddr) {\n _totalWeight -= _weight;\n _totalWeight += _v.weight;\n\n if (_governorList[_i] != _v.governor) {\n require(_governorWeight[_v.governor] == 0, \"RoninTrustedOrganization: query for duplicated governor\");\n delete _governorWeight[_governorList[_i]];\n _governorList[_i] = _v.governor;\n }\n\n if (_bridgeVoterList[_i] != _v.bridgeVoter) {\n require(\n _bridgeVoterWeight[_v.bridgeVoter] == 0,\n \"RoninTrustedOrganization: query for duplicated bridge voter\"\n );\n delete _bridgeVoterWeight[_bridgeVoterList[_i]];\n _bridgeVoterList[_i] = _v.bridgeVoter;\n }\n\n _consensusWeight[_v.consensusAddr] = _v.weight;\n _governorWeight[_v.governor] = _v.weight;\n _bridgeVoterWeight[_v.bridgeVoter] = _v.weight;\n return;\n }\n }\n }\n\n /**\n * @dev Removes a trusted organization.\n *\n * Requirements:\n * - The consensus address is added.\n *\n */\n function _removeTrustedOrganization(address _addr) internal virtual {\n uint256 _weight = _consensusWeight[_addr];\n if (_weight == 0) {\n revert(\n string(\n abi.encodePacked(\n \"RoninTrustedOrganization: consensus address \",\n Strings.toHexString(uint160(_addr), 20),\n \" is not added\"\n )\n )\n );\n }\n\n uint256 _index;\n uint256 _count = _consensusList.length;\n for (uint256 _i = 0; _i < _count; _i++) {\n if (_consensusList[_i] == _addr) {\n _index = _i;\n break;\n }\n }\n\n _totalWeight -= _weight;\n\n delete _addedBlock[_addr];\n delete _consensusWeight[_addr];\n _consensusList[_index] = _consensusList[_count - 1];\n _consensusList.pop();\n\n delete _governorWeight[_governorList[_index]];\n _governorList[_index] = _governorList[_count - 1];\n _governorList.pop();\n\n delete _bridgeVoterWeight[_bridgeVoterList[_index]];\n _bridgeVoterList[_index] = _bridgeVoterList[_count - 1];\n _bridgeVoterList.pop();\n }\n\n /**\n * @dev Sets threshold and returns the old one.\n *\n * Emits the `ThresholdUpdated` event.\n *\n */\n function _setThreshold(uint256 _numerator, uint256 _denominator)\n internal\n virtual\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n require(_numerator <= _denominator, \"RoninTrustedOrganization: invalid threshold\");\n _previousNum = _num;\n _previousDenom = _denom;\n _num = _numerator;\n _denom = _denominator;\n emit ThresholdUpdated(_nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n\n /**\n * @dev Hook that checks trusted organization's data. Reverts if the requirements are not met.\n *\n * Requirements:\n * - The weight must be larger than 0.\n * - The consensus address, governor address, and bridge voter address are different.\n */\n function _sanityCheckTrustedOrganizationData(TrustedOrganization memory _v) private pure {\n require(_v.weight > 0, \"RoninTrustedOrganization: invalid weight\");\n\n address[] memory _addresses = new address[](3);\n _addresses[0] = _v.consensusAddr;\n _addresses[1] = _v.governor;\n _addresses[2] = _v.bridgeVoter;\n require(!AddressArrayUtils.hasDuplicate(_addresses), \"RoninTrustedOrganization: three addresses must be distinct\");\n }\n}\n" + }, + "contracts/ronin/gateway/BridgeTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../extensions/collections/HasBridgeContract.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\nimport \"../../interfaces/IBridgeTracking.sol\";\n\ncontract BridgeTracking is HasBridgeContract, HasValidatorContract, Initializable, IBridgeTracking {\n struct PeriodVotingMetric {\n /// @dev Total requests that are tracked in the period. This value is 0 until the {_bufferMetric.requests[]} gets added into a period metric.\n uint256 totalRequests;\n uint256 totalBallots;\n mapping(address => uint256) totalBallotsOf;\n address[] voters;\n }\n\n struct PeriodVotingMetricTimeWrapper {\n uint256 lastEpoch;\n Request[] requests;\n PeriodVotingMetric data;\n }\n\n struct ReceiptTrackingInfo {\n /// @dev The period that the receipt is approved. Value 0 means the receipt is not approved yet.\n uint256 approvedPeriod;\n /// @dev The address list of voters\n address[] voters;\n /// @dev Mapping from voter => flag indicating the voter casts vote for this receipt\n mapping(address => bool) voted;\n /// @dev The period that the receipt is tracked, i.e. the metric is transferred from buffer to the period. Value 0 means the receipt is currently in buffer or not tracked yet.\n uint256 trackedPeriod;\n }\n\n /// @dev The block that the contract allows incoming mutable calls.\n uint256 public startedAtBlock;\n\n /// @dev The temporary info of votes and ballots\n PeriodVotingMetricTimeWrapper internal _bufferMetric;\n /// @dev Mapping from period number => vote stats based on period\n mapping(uint256 => PeriodVotingMetric) internal _periodMetric;\n /// @dev Mapping from vote kind => receipt id => receipt stats\n mapping(VoteKind => mapping(uint256 => ReceiptTrackingInfo)) internal _receiptTrackingInfo;\n\n modifier skipOnUnstarted() {\n if (block.number < startedAtBlock) {\n return;\n }\n _;\n }\n\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address _bridgeContract,\n address _validatorContract,\n uint256 _startedAtBlock\n ) external initializer {\n _setBridgeContract(_bridgeContract);\n _setValidatorContract(_validatorContract);\n startedAtBlock = _startedAtBlock;\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalVotes(uint256 _period) external view override returns (uint256 _totalVotes) {\n _totalVotes = _periodMetric[_period].totalRequests;\n if (_isBufferCountedForPeriod(_period)) {\n _totalVotes += _bufferMetric.requests.length;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalBallots(uint256 _period) external view override returns (uint256 _totalBallots) {\n _totalBallots = _periodMetric[_period].totalBallots;\n if (_isBufferCountedForPeriod(_period)) {\n _totalBallots += _bufferMetric.data.totalBallots;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function getManyTotalBallots(uint256 _period, address[] calldata _bridgeOperators)\n external\n view\n override\n returns (uint256[] memory _res)\n {\n _res = new uint256[](_bridgeOperators.length);\n bool _isBufferCounted = _isBufferCountedForPeriod(_period);\n for (uint _i = 0; _i < _bridgeOperators.length; _i++) {\n _res[_i] = _totalBallotsOf(_period, _bridgeOperators[_i], _isBufferCounted);\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function totalBallotsOf(uint256 _period, address _bridgeOperator) public view override returns (uint256) {\n return _totalBallotsOf(_period, _bridgeOperator, _isBufferCountedForPeriod(_period));\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function handleVoteApproved(VoteKind _kind, uint256 _requestId) external override onlyBridgeContract skipOnUnstarted {\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\n\n // Only records for the receipt which not approved\n if (_receiptInfo.approvedPeriod == 0) {\n _trySyncBuffer();\n uint256 _currentPeriod = _validatorContract.currentPeriod();\n _receiptInfo.approvedPeriod = _currentPeriod;\n\n Request storage _bufferRequest = _bufferMetric.requests.push();\n _bufferRequest.kind = _kind;\n _bufferRequest.id = _requestId;\n\n address[] storage _voters = _receiptInfo.voters;\n for (uint _i = 0; _i < _voters.length; _i++) {\n _increaseBallot(_kind, _requestId, _voters[_i], _currentPeriod);\n }\n\n delete _receiptInfo.voters;\n }\n }\n\n /**\n * @inheritdoc IBridgeTracking\n */\n function recordVote(\n VoteKind _kind,\n uint256 _requestId,\n address _operator\n ) external override onlyBridgeContract skipOnUnstarted {\n uint256 _period = _validatorContract.currentPeriod();\n _trySyncBuffer();\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\n\n // When the vote is not approved yet, the voters are saved in the receipt info, and not increase ballot metric.\n // The ballot metric will be increased later in the {handleVoteApproved} method.\n if (_receiptInfo.approvedPeriod == 0) {\n _receiptInfo.voters.push(_operator);\n return;\n }\n\n _increaseBallot(_kind, _requestId, _operator, _period);\n }\n\n /**\n * @dev Increases the ballot for the operator at a period.\n */\n function _increaseBallot(\n VoteKind _kind,\n uint256 _requestId,\n address _operator,\n uint256 _currentPeriod\n ) internal {\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_kind][_requestId];\n if (_receiptInfo.voted[_operator]) {\n return;\n }\n\n _receiptInfo.voted[_operator] = true;\n\n uint256 _trackedPeriod = _receiptInfo.trackedPeriod;\n\n // Do not increase ballot for receipt that is neither in the buffer, nor in the most current tracked period.\n // If the receipt is not tracked in a period, increase metric in buffer.\n if (_trackedPeriod == 0) {\n if (_bufferMetric.data.totalBallotsOf[_operator] == 0) {\n _bufferMetric.data.voters.push(_operator);\n }\n _bufferMetric.data.totalBallots++;\n _bufferMetric.data.totalBallotsOf[_operator]++;\n }\n // If the receipt is tracked in the most current tracked period, increase metric in the period.\n else if (_trackedPeriod == _currentPeriod) {\n PeriodVotingMetric storage _metric = _periodMetric[_trackedPeriod];\n _metric.totalBallots++;\n _metric.totalBallotsOf[_operator]++;\n }\n }\n\n /**\n * @dev See `totalBallotsOf`.\n */\n function _totalBallotsOf(\n uint256 _period,\n address _bridgeOperator,\n bool _mustCountLastStats\n ) internal view returns (uint256 _totalBallots) {\n _totalBallots = _periodMetric[_period].totalBallotsOf[_bridgeOperator];\n if (_mustCountLastStats) {\n _totalBallots += _bufferMetric.data.totalBallotsOf[_bridgeOperator];\n }\n }\n\n /**\n * @dev Syncs period stats. Move all data from the buffer metric to the period metric.\n *\n * Requirements:\n * - The epoch after the buffer epoch is wrapped up.\n */\n function _trySyncBuffer() internal {\n uint256 _currentEpoch = _validatorContract.epochOf(block.number);\n if (_bufferMetric.lastEpoch < _currentEpoch) {\n (, uint256 _trackedPeriod) = _validatorContract.tryGetPeriodOfEpoch(_bufferMetric.lastEpoch + 1);\n _bufferMetric.lastEpoch = _currentEpoch;\n\n // Copy numbers of totals\n PeriodVotingMetric storage _metric = _periodMetric[_trackedPeriod];\n _metric.totalRequests += _bufferMetric.requests.length;\n _metric.totalBallots += _bufferMetric.data.totalBallots;\n\n // Copy voters info and voters' ballot\n for (uint _i = 0; _i < _bufferMetric.data.voters.length; _i++) {\n address _voter = _bufferMetric.data.voters[_i];\n _metric.totalBallotsOf[_voter] += _bufferMetric.data.totalBallotsOf[_voter];\n delete _bufferMetric.data.totalBallotsOf[_voter]; // need to manually delete each element, due to mapping\n }\n\n // Mark all receipts in the buffer as tracked. Keep total number of receipts and delete receipt details.\n for (uint _i = 0; _i < _bufferMetric.requests.length; _i++) {\n Request storage _bufferRequest = _bufferMetric.requests[_i];\n ReceiptTrackingInfo storage _receiptInfo = _receiptTrackingInfo[_bufferRequest.kind][_bufferRequest.id];\n _receiptInfo.trackedPeriod = _trackedPeriod;\n }\n\n delete _bufferMetric.requests;\n delete _bufferMetric.data;\n }\n }\n\n /**\n * @dev Returns whether the buffer stats must be counted or not.\n */\n function _isBufferCountedForPeriod(uint256 _queriedPeriod) internal view returns (bool) {\n uint256 _currentEpoch = _validatorContract.epochOf(block.number);\n (bool _filled, uint256 _periodOfNextTemporaryEpoch) = _validatorContract.tryGetPeriodOfEpoch(\n _bufferMetric.lastEpoch + 1\n );\n return _filled && _queriedPeriod == _periodOfNextTemporaryEpoch && _bufferMetric.lastEpoch < _currentEpoch;\n }\n}\n" + }, + "contracts/mocks/MockGatewayForTracking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../interfaces/IBridgeTracking.sol\";\nimport \"../extensions/collections/HasBridgeTrackingContract.sol\";\n\ncontract MockGatewayForTracking is HasBridgeTrackingContract {\n constructor(address _bridgeTrackingContract) {\n _setBridgeTrackingContract(_bridgeTrackingContract);\n }\n\n function sendBallot(\n IBridgeTracking.VoteKind _kind,\n uint256 _id,\n address[] memory _voters\n ) external {\n for (uint256 _i; _i < _voters.length; _i++) {\n _bridgeTrackingContract.recordVote(_kind, _id, _voters[_i]);\n }\n }\n\n function sendApprovedVote(IBridgeTracking.VoteKind _kind, uint256 _id) external {\n _bridgeTrackingContract.handleVoteApproved(_kind, _id);\n }\n}\n" + }, + "contracts/extensions/collections/HasBridgeTrackingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasBridgeTrackingContract.sol\";\nimport \"../../interfaces/IBridgeTracking.sol\";\n\ncontract HasBridgeTrackingContract is IHasBridgeTrackingContract, HasProxyAdmin {\n IBridgeTracking internal _bridgeTrackingContract;\n\n modifier onlyBridgeTrackingContract() {\n if (bridgeTrackingContract() != msg.sender) revert ErrCallerMustBeBridgeTrackingContract();\n _;\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function bridgeTrackingContract() public view override returns (address) {\n return address(_bridgeTrackingContract);\n }\n\n /**\n * @inheritdoc IHasBridgeTrackingContract\n */\n function setBridgeTrackingContract(address _addr) external virtual override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setBridgeTrackingContract(_addr);\n }\n\n /**\n * @dev Sets the bridge tracking contract.\n *\n * Emits the event `BridgeTrackingContractUpdated`.\n *\n */\n function _setBridgeTrackingContract(address _addr) internal {\n _bridgeTrackingContract = IBridgeTracking(_addr);\n emit BridgeTrackingContractUpdated(_addr);\n }\n}\n" + }, + "contracts/ronin/validator/CoinbaseExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasBridgeTrackingContract.sol\";\nimport \"../../extensions/collections/HasMaintenanceContract.sol\";\nimport \"../../extensions/collections/HasSlashIndicatorContract.sol\";\nimport \"../../extensions/collections/HasStakingVestingContract.sol\";\nimport \"../../extensions/RONTransferHelper.sol\";\nimport \"../../interfaces/validator/ICoinbaseExecution.sol\";\nimport \"../../libraries/EnumFlags.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"../../precompile-usages/PCUSortValidators.sol\";\nimport \"../../precompile-usages/PCUPickValidatorSet.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\nimport \"./CandidateManager.sol\";\nimport \"./EmergencyExit.sol\";\n\nabstract contract CoinbaseExecution is\n ICoinbaseExecution,\n RONTransferHelper,\n PCUSortValidators,\n PCUPickValidatorSet,\n HasStakingVestingContract,\n HasBridgeTrackingContract,\n HasMaintenanceContract,\n HasSlashIndicatorContract,\n EmergencyExit\n{\n using EnumFlags for EnumFlags.ValidatorFlag;\n\n modifier onlyCoinbase() {\n if (msg.sender != block.coinbase) revert ErrCallerMustBeCoinbase();\n _;\n }\n\n modifier whenEpochEnding() {\n if (!epochEndingAt(block.number)) revert ErrAtEndOfEpochOnly();\n _;\n }\n\n modifier oncePerEpoch() {\n if (epochOf(_lastUpdatedBlock) >= epochOf(block.number)) revert ErrAlreadyWrappedEpoch();\n _lastUpdatedBlock = block.number;\n _;\n }\n\n /**\n * @inheritdoc ICoinbaseExecution\n */\n function submitBlockReward() external payable override onlyCoinbase {\n bool _requestForBlockProducer = isBlockProducer(msg.sender) &&\n !_jailed(msg.sender) &&\n !_miningRewardDeprecated(msg.sender, currentPeriod());\n\n (, uint256 _blockProducerBonus, uint256 _bridgeOperatorBonus) = _stakingVestingContract.requestBonus(\n _requestForBlockProducer,\n true // _requestForBridgeOperator\n );\n\n _totalBridgeReward += _bridgeOperatorBonus;\n\n // Deprecates reward for non-validator or slashed validator\n if (!_requestForBlockProducer) {\n _totalDeprecatedReward += msg.value;\n emit BlockRewardDeprecated(msg.sender, msg.value, BlockRewardDeprecatedType.UNAVAILABILITY);\n return;\n }\n\n emit BlockRewardSubmitted(msg.sender, msg.value, _blockProducerBonus);\n\n uint256 _period = currentPeriod();\n uint256 _reward = msg.value + _blockProducerBonus;\n uint256 _cutOffReward;\n if (_miningRewardBailoutCutOffAtPeriod[msg.sender][_period]) {\n (, , , uint256 _cutOffPercentage) = _slashIndicatorContract.getCreditScoreConfigs();\n _cutOffReward = (_reward * _cutOffPercentage) / _MAX_PERCENTAGE;\n _totalDeprecatedReward += _cutOffReward;\n emit BlockRewardDeprecated(msg.sender, _cutOffReward, BlockRewardDeprecatedType.AFTER_BAILOUT);\n }\n\n _reward -= _cutOffReward;\n (uint256 _minRate, uint256 _maxRate) = _stakingContract.getCommissionRateRange();\n uint256 _rate = Math.max(Math.min(_candidateInfo[msg.sender].commissionRate, _maxRate), _minRate);\n uint256 _miningAmount = (_rate * _reward) / _MAX_PERCENTAGE;\n _miningReward[msg.sender] += _miningAmount;\n\n uint256 _delegatingAmount = _reward - _miningAmount;\n _delegatingReward[msg.sender] += _delegatingAmount;\n }\n\n /**\n * @inheritdoc ICoinbaseExecution\n */\n function wrapUpEpoch() external payable virtual override onlyCoinbase whenEpochEnding oncePerEpoch {\n uint256 _newPeriod = _computePeriod(block.timestamp);\n bool _periodEnding = _isPeriodEnding(_newPeriod);\n\n (address[] memory _currentValidators, , ) = getValidators();\n address[] memory _revokedCandidates;\n uint256 _epoch = epochOf(block.number);\n uint256 _nextEpoch = _epoch + 1;\n uint256 _lastPeriod = currentPeriod();\n\n if (_periodEnding) {\n _syncBridgeOperatingReward(_lastPeriod, _currentValidators);\n (\n uint256 _totalDelegatingReward,\n uint256[] memory _delegatingRewards\n ) = _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(_lastPeriod, _currentValidators);\n _settleAndTransferDelegatingRewards(_lastPeriod, _currentValidators, _totalDelegatingReward, _delegatingRewards);\n _tryRecycleLockedFundsFromEmergencyExits();\n _recycleDeprecatedRewards();\n _slashIndicatorContract.updateCreditScores(_currentValidators, _lastPeriod);\n (_currentValidators, _revokedCandidates) = _syncValidatorSet(_newPeriod);\n if (_revokedCandidates.length > 0) {\n _slashIndicatorContract.execResetCreditScores(_revokedCandidates);\n }\n _currentPeriodStartAtBlock = block.number + 1;\n }\n _revampRoles(_newPeriod, _nextEpoch, _currentValidators);\n emit WrappedUpEpoch(_lastPeriod, _epoch, _periodEnding);\n _periodOf[_nextEpoch] = _newPeriod;\n _lastUpdatedPeriod = _newPeriod;\n }\n\n /**\n * @dev This loop over the all current validators to sync the bridge operating reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _syncBridgeOperatingReward(uint256 _lastPeriod, address[] memory _currentValidators) internal {\n uint256 _totalBridgeBallots = _bridgeTrackingContract.totalBallots(_lastPeriod);\n uint256 _totalBridgeVotes = _bridgeTrackingContract.totalVotes(_lastPeriod);\n uint256[] memory _bridgeBallots = _bridgeTrackingContract.getManyTotalBallots(\n _lastPeriod,\n getBridgeOperatorsOf(_currentValidators)\n );\n\n if (\n !_validateBridgeTrackingResponse(_totalBridgeBallots, _totalBridgeVotes, _bridgeBallots) || _totalBridgeVotes == 0\n ) {\n // Shares equally in case the bridge has nothing to vote or bridge tracking response is incorrect\n for (uint256 _i; _i < _currentValidators.length; _i++) {\n _bridgeOperatingReward[_currentValidators[_i]] = _totalBridgeReward / _currentValidators.length;\n }\n return;\n }\n\n (\n uint256 _missingVotesRatioTier1,\n uint256 _missingVotesRatioTier2,\n uint256 _jailDurationForMissingVotesRatioTier2,\n uint256 _skipBridgeOperatorSlashingThreshold\n ) = _slashIndicatorContract.getBridgeOperatorSlashingConfigs();\n\n // Slashes the bridge reward if the total of votes exceeds the slashing threshold.\n bool _shouldSlash = _totalBridgeVotes > _skipBridgeOperatorSlashingThreshold;\n for (uint256 _i; _i < _currentValidators.length; _i++) {\n // Shares the bridge operators reward proportionally.\n _bridgeOperatingReward[_currentValidators[_i]] = (_totalBridgeReward * _bridgeBallots[_i]) / _totalBridgeBallots;\n if (_shouldSlash) {\n _slashBridgeOperatorBasedOnPerformance(\n _lastPeriod,\n _currentValidators[_i],\n _MAX_PERCENTAGE - (_bridgeBallots[_i] * _MAX_PERCENTAGE) / _totalBridgeVotes,\n _jailDurationForMissingVotesRatioTier2,\n _missingVotesRatioTier1,\n _missingVotesRatioTier2\n );\n }\n }\n }\n\n /**\n * @dev Returns whether the responses from bridge tracking are correct.\n */\n function _validateBridgeTrackingResponse(\n uint256 _totalBridgeBallots,\n uint256 _totalBridgeVotes,\n uint256[] memory _bridgeBallots\n ) private returns (bool _valid) {\n _valid = true;\n uint256 _sumBallots;\n for (uint _i; _i < _bridgeBallots.length; _i++) {\n if (_bridgeBallots[_i] > _totalBridgeVotes) {\n _valid = false;\n break;\n }\n _sumBallots += _bridgeBallots[_i];\n }\n _valid = _valid && (_sumBallots <= _totalBridgeBallots);\n if (!_valid) {\n emit BridgeTrackingIncorrectlyResponded();\n }\n }\n\n /**\n * @dev Slashes the validator on the corresponding bridge operator performance. Updates the status of the deprecated reward. Not update the reward amount.\n *\n * Consider validating the bridge tracking response by using the method `_validateBridgeTrackingResponse` before calling this function.\n */\n function _slashBridgeOperatorBasedOnPerformance(\n uint256 _period,\n address _validator,\n uint256 _missedRatio,\n uint256 _jailDurationTier2,\n uint256 _ratioTier1,\n uint256 _ratioTier2\n ) internal {\n if (_missedRatio >= _ratioTier2) {\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\n _miningRewardDeprecatedAtPeriod[_validator][_period] = true;\n\n uint256 _newJailUntilBlock = Math.addIfNonZero(block.number, _jailDurationTier2);\n _blockProducerJailedBlock[_validator] = Math.max(_newJailUntilBlock, _blockProducerJailedBlock[_validator]);\n _cannotBailoutUntilBlock[_validator] = Math.max(_newJailUntilBlock, _cannotBailoutUntilBlock[_validator]);\n\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 2, _period);\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, true, true);\n } else if (_missedRatio >= _ratioTier1) {\n _bridgeRewardDeprecatedAtPeriod[_validator][_period] = true;\n _slashIndicatorContract.execSlashBridgeOperator(_validator, 1, _period);\n emit ValidatorPunished(_validator, _period, _blockProducerJailedBlock[_validator], 0, false, true);\n }\n }\n\n /**\n * @dev This loops over all current validators to:\n * - Update delegating reward for and calculate total delegating rewards to be sent to the staking contract,\n * - Distribute the reward of block producers and bridge operators to their treasury addresses,\n * - Update the total deprecated reward if the two previous conditions do not sastify.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeRewardToTreasuriesAndCalculateTotalDelegatingReward(\n uint256 _lastPeriod,\n address[] memory _currentValidators\n ) private returns (uint256 _totalDelegatingReward, uint256[] memory _delegatingRewards) {\n address _consensusAddr;\n address payable _treasury;\n _delegatingRewards = new uint256[](_currentValidators.length);\n for (uint _i; _i < _currentValidators.length; _i++) {\n _consensusAddr = _currentValidators[_i];\n _treasury = _candidateInfo[_consensusAddr].treasuryAddr;\n\n if (!_bridgeRewardDeprecated(_consensusAddr, _lastPeriod)) {\n _distributeBridgeOperatingReward(_consensusAddr, _candidateInfo[_consensusAddr].bridgeOperatorAddr, _treasury);\n } else {\n _totalDeprecatedReward += _bridgeOperatingReward[_consensusAddr];\n }\n\n if (!_jailed(_consensusAddr) && !_miningRewardDeprecated(_consensusAddr, _lastPeriod)) {\n _totalDelegatingReward += _delegatingReward[_consensusAddr];\n _delegatingRewards[_i] = _delegatingReward[_consensusAddr];\n _distributeMiningReward(_consensusAddr, _treasury);\n } else {\n _totalDeprecatedReward += _miningReward[_consensusAddr] + _delegatingReward[_consensusAddr];\n }\n\n delete _delegatingReward[_consensusAddr];\n delete _miningReward[_consensusAddr];\n delete _bridgeOperatingReward[_consensusAddr];\n }\n delete _totalBridgeReward;\n }\n\n /**\n * @dev Distributes bonus of staking vesting and mining fee for the block producer.\n *\n * Emits the `MiningRewardDistributed` once the reward is distributed successfully.\n * Emits the `MiningRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeMiningReward(address _consensusAddr, address payable _treasury) private {\n uint256 _amount = _miningReward[_consensusAddr];\n if (_amount > 0) {\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\n emit MiningRewardDistributed(_consensusAddr, _treasury, _amount);\n return;\n }\n\n emit MiningRewardDistributionFailed(_consensusAddr, _treasury, _amount, address(this).balance);\n }\n }\n\n /**\n * @dev Distribute bonus of staking vesting for the bridge operator.\n *\n * Emits the `BridgeOperatorRewardDistributed` once the reward is distributed successfully.\n * Emits the `BridgeOperatorRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _distributeBridgeOperatingReward(\n address _consensusAddr,\n address _bridgeOperator,\n address payable _treasury\n ) private {\n uint256 _amount = _bridgeOperatingReward[_consensusAddr];\n if (_amount > 0) {\n if (_unsafeSendRON(_treasury, _amount, DEFAULT_ADDITION_GAS)) {\n emit BridgeOperatorRewardDistributed(_consensusAddr, _bridgeOperator, _treasury, _amount);\n return;\n }\n\n emit BridgeOperatorRewardDistributionFailed(\n _consensusAddr,\n _bridgeOperator,\n _treasury,\n _amount,\n address(this).balance\n );\n }\n }\n\n /**\n * @dev Helper function to settle rewards for delegators of `_currentValidators` at the end of each period,\n * then transfer the rewards from this contract to the staking contract, in order to finalize a period.\n *\n * Emits the `StakingRewardDistributed` once the reward is distributed successfully.\n * Emits the `StakingRewardDistributionFailed` once the contract fails to distribute reward.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _settleAndTransferDelegatingRewards(\n uint256 _period,\n address[] memory _currentValidators,\n uint256 _totalDelegatingReward,\n uint256[] memory _delegatingRewards\n ) private {\n IStaking _staking = _stakingContract;\n if (_totalDelegatingReward > 0) {\n if (_unsafeSendRON(payable(address(_staking)), _totalDelegatingReward)) {\n _staking.execRecordRewards(_currentValidators, _delegatingRewards, _period);\n emit StakingRewardDistributed(_totalDelegatingReward, _currentValidators, _delegatingRewards);\n return;\n }\n\n emit StakingRewardDistributionFailed(\n _totalDelegatingReward,\n _currentValidators,\n _delegatingRewards,\n address(this).balance\n );\n }\n }\n\n /**\n * @dev Transfer the deprecated rewards e.g. the rewards that get deprecated when validator is slashed/maintained,\n * to the staking vesting contract\n *\n * Note: This method should be called once in the end of each period.\n */\n function _recycleDeprecatedRewards() private {\n uint256 _withdrawAmount = _totalDeprecatedReward;\n\n if (_withdrawAmount != 0) {\n address _withdrawTarget = stakingVestingContract();\n\n delete _totalDeprecatedReward;\n\n (bool _success, ) = _withdrawTarget.call{ value: _withdrawAmount }(\n abi.encodeWithSelector(IStakingVesting.receiveRON.selector)\n );\n\n if (_success) {\n emit DeprecatedRewardRecycled(_withdrawTarget, _withdrawAmount);\n } else {\n emit DeprecatedRewardRecycleFailed(_withdrawTarget, _withdrawAmount, address(this).balance);\n }\n }\n }\n\n /**\n * @dev Updates the validator set based on the validator candidates from the Staking contract.\n *\n * Emits the `ValidatorSetUpdated` event.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _syncValidatorSet(uint256 _newPeriod)\n private\n returns (address[] memory _newValidators, address[] memory _unsastifiedCandidates)\n {\n _unsastifiedCandidates = _syncCandidateSet(_newPeriod);\n uint256[] memory _weights = _stakingContract.getManyStakingTotals(_candidates);\n uint256[] memory _trustedWeights = _roninTrustedOrganizationContract.getConsensusWeights(_candidates);\n uint256 _newValidatorCount;\n (_newValidators, _newValidatorCount) = _pcPickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n _setNewValidatorSet(_newValidators, _newValidatorCount, _newPeriod);\n }\n\n /**\n * @dev Private helper function helps writing the new validator set into the contract storage.\n *\n * Emits the `ValidatorSetUpdated` event.\n *\n * Note: This method should be called once in the end of each period.\n *\n */\n function _setNewValidatorSet(\n address[] memory _newValidators,\n uint256 _newValidatorCount,\n uint256 _newPeriod\n ) private {\n // Remove exceeding validators in the current set\n for (uint256 _i = _newValidatorCount; _i < validatorCount; _i++) {\n delete _validatorMap[_validators[_i]];\n delete _validators[_i];\n }\n\n // Remove flag for all validator in the current set\n for (uint _i; _i < _newValidatorCount; _i++) {\n delete _validatorMap[_validators[_i]];\n }\n\n // Update new validator set and set flag correspondingly.\n for (uint256 _i; _i < _newValidatorCount; _i++) {\n address _newValidator = _newValidators[_i];\n _validatorMap[_newValidator] = EnumFlags.ValidatorFlag.Both;\n _validators[_i] = _newValidator;\n }\n\n validatorCount = _newValidatorCount;\n emit ValidatorSetUpdated(_newPeriod, _newValidators);\n }\n\n /**\n * @dev Activate/Deactivate the validators from producing blocks, based on their in jail status and maintenance status.\n *\n * Requirements:\n * - This method is called at the end of each epoch\n *\n * Emits the `BlockProducerSetUpdated` event.\n * Emits the `BridgeOperatorSetUpdated` event.\n *\n */\n function _revampRoles(\n uint256 _newPeriod,\n uint256 _nextEpoch,\n address[] memory _currentValidators\n ) private {\n bool[] memory _maintainedList = _maintenanceContract.checkManyMaintained(_currentValidators, block.number + 1);\n\n for (uint _i; _i < _currentValidators.length; _i++) {\n address _validator = _currentValidators[_i];\n bool _emergencyExitRequested = block.timestamp <= _emergencyExitJailedTimestamp[_validator];\n bool _isProducerBefore = isBlockProducer(_validator);\n bool _isProducerAfter = !(_jailedAtBlock(_validator, block.number + 1) ||\n _maintainedList[_i] ||\n _emergencyExitRequested);\n\n if (!_isProducerBefore && _isProducerAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BlockProducer);\n } else if (_isProducerBefore && !_isProducerAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BlockProducer);\n }\n\n bool _isBridgeOperatorBefore = isOperatingBridge(_validator);\n bool _isBridgeOperatorAfter = !_emergencyExitRequested;\n if (!_isBridgeOperatorBefore && _isBridgeOperatorAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].addFlag(EnumFlags.ValidatorFlag.BridgeOperator);\n } else if (_isBridgeOperatorBefore && !_isBridgeOperatorAfter) {\n _validatorMap[_validator] = _validatorMap[_validator].removeFlag(EnumFlags.ValidatorFlag.BridgeOperator);\n }\n }\n\n emit BlockProducerSetUpdated(_newPeriod, _nextEpoch, getBlockProducers());\n emit BridgeOperatorSetUpdated(_newPeriod, _nextEpoch, getBridgeOperators());\n }\n\n /**\n * @dev Override `CandidateManager-_isTrustedOrg`.\n */\n function _isTrustedOrg(address _consensusAddr) internal view override returns (bool) {\n return _roninTrustedOrganizationContract.getConsensusWeight(_consensusAddr) > 0;\n }\n}\n" + }, + "contracts/extensions/collections/HasMaintenanceContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasMaintenanceContract.sol\";\nimport \"../../interfaces/IMaintenance.sol\";\n\ncontract HasMaintenanceContract is IHasMaintenanceContract, HasProxyAdmin {\n IMaintenance internal _maintenanceContract;\n\n modifier onlyMaintenanceContract() {\n if (maintenanceContract() != msg.sender) revert ErrCallerMustBeMaintenanceContract();\n _;\n }\n\n /**\n * @inheritdoc IHasMaintenanceContract\n */\n function maintenanceContract() public view override returns (address) {\n return address(_maintenanceContract);\n }\n\n /**\n * @inheritdoc IHasMaintenanceContract\n */\n function setMaintenanceContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setMaintenanceContract(_addr);\n }\n\n /**\n * @dev Sets the scheduled maintenance contract.\n *\n * Emits the event `MaintenanceContractUpdated`.\n *\n */\n function _setMaintenanceContract(address _addr) internal {\n _maintenanceContract = IMaintenance(_addr);\n emit MaintenanceContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/collections/HasSlashIndicatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasSlashIndicatorContract.sol\";\nimport \"../../interfaces/slash-indicator/ISlashIndicator.sol\";\n\ncontract HasSlashIndicatorContract is IHasSlashIndicatorContract, HasProxyAdmin {\n ISlashIndicator internal _slashIndicatorContract;\n\n modifier onlySlashIndicatorContract() {\n if (slashIndicatorContract() != msg.sender) revert ErrCallerMustBeSlashIndicatorContract();\n _;\n }\n\n /**\n * @inheritdoc IHasSlashIndicatorContract\n */\n function slashIndicatorContract() public view override returns (address) {\n return address(_slashIndicatorContract);\n }\n\n /**\n * @inheritdoc IHasSlashIndicatorContract\n */\n function setSlashIndicatorContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setSlashIndicatorContract(_addr);\n }\n\n /**\n * @dev Sets the slash indicator contract.\n *\n * Emits the event `SlashIndicatorContractUpdated`.\n *\n */\n function _setSlashIndicatorContract(address _addr) internal {\n _slashIndicatorContract = ISlashIndicator(_addr);\n emit SlashIndicatorContractUpdated(_addr);\n }\n}\n" + }, + "contracts/extensions/collections/HasStakingVestingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasStakingVestingContract.sol\";\nimport \"../../interfaces/IStakingVesting.sol\";\n\ncontract HasStakingVestingContract is IHasStakingVestingContract, HasProxyAdmin {\n IStakingVesting internal _stakingVestingContract;\n\n modifier onlyStakingVestingContract() {\n if (stakingVestingContract() != msg.sender) revert ErrCallerMustBeStakingVestingContract();\n _;\n }\n\n /**\n * @inheritdoc IHasStakingVestingContract\n */\n function stakingVestingContract() public view override returns (address) {\n return address(_stakingVestingContract);\n }\n\n /**\n * @inheritdoc IHasStakingVestingContract\n */\n function setStakingVestingContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setStakingVestingContract(_addr);\n }\n\n /**\n * @dev Sets the staking vesting contract.\n *\n * Emits the event `StakingVestingContractUpdated`.\n *\n */\n function _setStakingVestingContract(address _addr) internal {\n _stakingVestingContract = IStakingVesting(_addr);\n emit StakingVestingContractUpdated(_addr);\n }\n}\n" + }, + "contracts/precompile-usages/PCUSortValidators.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUSortValidators is PrecompiledUsage {\n /// @dev Gets the address of the precompile of sorting validators\n function precompileSortValidatorsAddress() public view virtual returns (address) {\n return address(0x66);\n }\n\n /**\n * @dev Sorts candidates descending by their weights by calling precompile contract.\n *\n * Note: This function is marked as virtual for being wrapping in mock contract for testing purpose.\n */\n function _pcSortCandidates(address[] memory _candidates, uint256[] memory _weights)\n internal\n view\n virtual\n returns (address[] memory _result)\n {\n address _smc = precompileSortValidatorsAddress();\n bool _success = true;\n\n bytes memory _payload = abi.encodeWithSignature(\"sortValidators(address[],uint256[])\", _candidates, _weights);\n uint256 _payloadLength = _payload.length;\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n\n _result := add(_result, 0x20)\n }\n\n if (!_success) revert ErrCallPrecompiled();\n }\n}\n" + }, + "contracts/precompile-usages/PCUPickValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUPickValidatorSet is PrecompiledUsage {\n /// @dev Gets the address of the precompile of picking validator set\n function precompilePickValidatorSetAddress() public view virtual returns (address) {\n return address(0x68);\n }\n\n /**\n * @dev Sorts and arranges to return a new validator set.\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcPickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) internal view virtual returns (address[] memory _result, uint256 _newValidatorCount) {\n address _smc = precompilePickValidatorSetAddress();\n bytes memory _payload = abi.encodeWithSignature(\n \"pickValidatorSet(address[],uint256[],uint256[],uint256,uint256)\",\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n bool _success = true;\n\n uint256 _payloadLength = _payload.length;\n uint256 _resultLength = 0x20 * _candidates.length + 0x40;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _result, _resultLength)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n\n _result := add(_result, 0x20)\n }\n\n if (!_success) revert ErrCallPrecompiled();\n\n _newValidatorCount = _result.length;\n }\n}\n" + }, + "contracts/interfaces/collections/IHasMaintenanceContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasMaintenanceContract is IHasContract {\n /// @dev Emitted when the maintenance contract is updated.\n event MaintenanceContractUpdated(address);\n\n /// @dev Error of method caller must be maintenance contract.\n error ErrCallerMustBeMaintenanceContract();\n\n /**\n * @dev Returns the maintenance contract.\n */\n function maintenanceContract() external view returns (address);\n\n /**\n * @dev Sets the maintenance contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `MaintenanceContractUpdated`.\n *\n */\n function setMaintenanceContract(address) external;\n}\n" + }, + "contracts/interfaces/collections/IHasSlashIndicatorContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasSlashIndicatorContract is IHasContract {\n /// @dev Emitted when the slash indicator contract is updated.\n event SlashIndicatorContractUpdated(address);\n\n /// @dev Error of method caller must be slash indicator contract.\n error ErrCallerMustBeSlashIndicatorContract();\n\n /**\n * @dev Returns the slash indicator contract.\n */\n function slashIndicatorContract() external view returns (address);\n\n /**\n * @dev Sets the slash indicator contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `SlashIndicatorContractUpdated`.\n *\n */\n function setSlashIndicatorContract(address) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./ISlashDoubleSign.sol\";\nimport \"./ISlashBridgeVoting.sol\";\nimport \"./ISlashBridgeOperator.sol\";\nimport \"./ISlashUnavailability.sol\";\nimport \"./ICreditScore.sol\";\n\ninterface ISlashIndicator is\n ISlashDoubleSign,\n ISlashBridgeVoting,\n ISlashBridgeOperator,\n ISlashUnavailability,\n ICreditScore\n{}\n" + }, + "contracts/interfaces/slash-indicator/ISlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashDoubleSign is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash double sign is updated. See the method `getDoubleSignSlashingConfigs`\n * for param details.\n */\n event DoubleSignSlashingConfigsUpdated(\n uint256 slashDoubleSignAmount,\n uint256 doubleSigningJailUntilBlock,\n uint256 doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Slashes for double signing.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` if the double signing evidence of the two headers valid.\n */\n function slashDoubleSign(\n address _validatorAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) external;\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return _slashDoubleSignAmount The amount of RON to slash double sign.\n * @return _doubleSigningJailUntilBlock The block number that the punished validator will be jailed until, due to\n * double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n returns (\n uint256 _slashDoubleSignAmount,\n uint256 _doubleSigningJailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `DoubleSignSlashingConfigsUpdated`.\n *\n * @param _slashAmount The amount of RON to slash double sign.\n * @param _jailUntilBlock The block number that the punished validator will be jailed until, due to double signing.\n * @param _doubleSigningOffsetLimitBlock The number of block that the current block is at most far from the double\n * signing block.\n *\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _doubleSigningOffsetLimitBlock\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashBridgeVoting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashBridgeVoting is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash bridge voting is updated. See the method `getBridgeVotingSlashingConfigs` for param\n * details.\n */\n event BridgeVotingSlashingConfigsUpdated(uint256 bridgeVotingThreshold, uint256 bridgeVotingSlashAmount);\n\n /**\n * @dev Slashes for bridge voter governance.\n *\n * Emits the event `Slashed`.\n */\n function slashBridgeVoting(address _consensusAddr) external;\n\n /**\n * @dev Returns the configs related to bridge voting slashing.\n *\n * @return _bridgeVotingThreshold The threshold to slash when a trusted organization does not vote for bridge\n * operators.\n * @return _bridgeVotingSlashAmount The amount of RON to slash bridge voting.\n *\n */\n function getBridgeVotingSlashingConfigs()\n external\n view\n returns (uint256 _bridgeVotingThreshold, uint256 _bridgeVotingSlashAmount);\n\n /**\n * @dev Sets the configs to slash bridge voting.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeVotingSlashingConfigsUpdated`.\n *\n * @param _threshold The threshold to slash when a trusted organization does not vote for bridge operators.\n * @param _slashAmount The amount of RON to slash bridge voting.\n *\n */\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashBridgeOperator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashBridgeOperator is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash bridge operator is updated. See the method\n * `getBridgeOperatorSlashingConfigs` for param details.\n */\n event BridgeOperatorSlashingConfigsUpdated(\n uint256 missingVotesRatioTier1,\n uint256 missingVotesRatioTier2,\n uint256 jailDurationForMissingVotesRatioTier2,\n uint256 skipBridgeOperatorSlashingThreshold\n );\n\n /**\n * @dev Acknowledges bridge operator slash and emit `Slashed` event correspondingly.\n * @param _tier The tier of the slash, in value of {1, 2}, corresponding to `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1`\n * and `SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2`\n *\n * Requirements:\n * - Only validator contract can invoke this method.\n * - Should be called only at the end of period.\n * - Should be called only when there is slash of bridge operator.\n *\n * Emits the event `Slashed`.\n */\n function execSlashBridgeOperator(\n address _consensusAddr,\n uint256 _tier,\n uint256 _period\n ) external;\n\n /**\n * @dev Returns the configs related to bridge operator slashing.\n *\n * @return _missingVotesRatioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio.\n * @return _missingVotesRatioTier2 The bridge reward and mining reward will be deprecated and the corresponding\n * block producer will be put in jail if (s)he misses more than this ratio.\n * @return _jailDurationForMissingVotesRatioTier2 The number of blocks to jail the corresponding block producer when\n * its bridge operator is slashed tier-2.\n * @return _skipBridgeOperatorSlashingThreshold The threshold to skip slashing the bridge operator in case the total\n * number of votes in the bridge is too small.\n *\n */\n function getBridgeOperatorSlashingConfigs()\n external\n view\n returns (\n uint256 _missingVotesRatioTier1,\n uint256 _missingVotesRatioTier2,\n uint256 _jailDurationForMissingVotesRatioTier2,\n uint256 _skipBridgeOperatorSlashingThreshold\n );\n\n /**\n * @dev Sets the configs to slash bridge operators.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\n *\n * @param _ratioTier1 The bridge reward will be deprecated if (s)he missed more than this ratio. Values 0-10,000 map\n * to 0%-100%.\n * @param _ratioTier2 The bridge reward and mining reward will be deprecated and the corresponding block producer will\n * be put in jail if (s)he misses more than this ratio. Values 0-10,000 map to 0%-100%.\n * @param _jailDurationTier2 The number of blocks to jail the corresponding block producer when its bridge operator is\n * slashed tier-2.\n * @param _skipSlashingThreshold The threshold to skip slashing the bridge operator in case the total number of votes\n * in the bridge is too small.\n *\n */\n function setBridgeOperatorSlashingConfigs(\n uint256 _ratioTier1,\n uint256 _ratioTier2,\n uint256 _jailDurationTier2,\n uint256 _skipSlashingThreshold\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ISlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IBaseSlash.sol\";\n\ninterface ISlashUnavailability is IBaseSlash {\n /**\n * @dev Emitted when the configs to slash bridge operator is updated. See the method `getUnavailabilitySlashingConfigs`\n * for param details.\n */\n event UnavailabilitySlashingConfigsUpdated(\n uint256 unavailabilityTier1Threshold,\n uint256 unavailabilityTier2Threshold,\n uint256 slashAmountForUnavailabilityTier2Threshold,\n uint256 jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Returns the last block that a block producer is slashed for unavailability.\n */\n function lastUnavailabilitySlashedBlock() external view returns (uint256);\n\n /**\n * @dev Slashes for unavailability by increasing the counter of block producer `_consensusAddr`.\n *\n * Requirements:\n * - The method caller is coinbase.\n *\n * Emits the event `Slashed` when the threshold is reached.\n *\n */\n function slashUnavailability(address _consensusAddr) external;\n\n /**\n * @dev Returns the current unavailability indicator of a block producer.\n */\n function currentUnavailabilityIndicator(address _validator) external view returns (uint256);\n\n /**\n * @dev Returns the unavailability indicator in the period `_period` of a block producer.\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period) external view returns (uint256);\n\n /**\n * @dev Returns the configs related to block producer slashing.\n *\n * @return _unavailabilityTier1Threshold The mining reward will be deprecated, if (s)he missed more than this\n * threshold. This threshold is applied for tier-1 and tier-3 slash.\n * @return _unavailabilityTier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will\n * be deducted self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n * @return _slashAmountForUnavailabilityTier2Threshold The amount of RON to deduct from self-staking of a block\n * producer when (s)he is slashed with tier-2 or tier-3.\n * @return _jailDurationForUnavailabilityTier2Threshold The number of blocks to jail a block producer when (s)he is\n * slashed with tier-2 or tier-3.\n *\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n returns (\n uint256 _unavailabilityTier1Threshold,\n uint256 _unavailabilityTier2Threshold,\n uint256 _slashAmountForUnavailabilityTier2Threshold,\n uint256 _jailDurationForUnavailabilityTier2Threshold\n );\n\n /**\n * @dev Sets the configs to slash block producers.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `BridgeOperatorSlashingConfigsUpdated`.\n *\n * @param _tier1Threshold The mining reward will be deprecated, if (s)he missed more than this threshold.\n * @param _tier2Threshold The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold.\n * @param _slashAmountForTier2Threshold The amount of RON to deduct from self-staking of a block producer when (s)he\n * is slashed tier-2.\n * @param _jailDurationForTier2Threshold The number of blocks to jail a block producer when (s)he is slashed tier-2.\n *\n */\n function setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) external;\n}\n" + }, + "contracts/interfaces/slash-indicator/ICreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface ICreditScore {\n /// @dev Emitted when the configs to credit score is updated. See the method `setCreditScoreConfigs` for param details.\n event CreditScoreConfigsUpdated(\n uint256 gainCreditScore,\n uint256 maxCreditScore,\n uint256 bailOutCostMultiplier,\n uint256 cutOffPercentageAfterBailout\n );\n /// @dev Emitted the credit score of validators is updated.\n event CreditScoresUpdated(address[] validators, uint256[] creditScores);\n /// @dev Emitted when a validator bailed out of jail.\n event BailedOut(address indexed validator, uint256 period, uint256 usedCreditScore);\n\n /**\n * @dev Updates the credit score for the validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function updateCreditScores(address[] calldata _validators, uint256 _period) external;\n\n /**\n * @dev Resets the credit score for the revoked validators.\n *\n * Requirements:\n * - Only validator contract can call this method.\n * - This method is only called at the end of each period.\n *\n * Emits the event `CreditScoresUpdated`.\n *\n */\n function execResetCreditScores(address[] calldata _validators) external;\n\n /**\n * @dev A slashed validator use this method to get out of jail.\n *\n * Requirements:\n * - The `_consensusAddr` must be a validator.\n * - Only validator's admin can call this method.\n *\n * Emits the event `BailedOut`.\n *\n */\n function bailOut(address _consensusAddr) external;\n\n /**\n * @dev Sets the configs to credit score.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the event `CreditScoreConfigsUpdated`.\n *\n * @param _gainScore The score to gain per period.\n * @param _maxScore The max number of credit score that a validator can hold.\n * @param _bailOutMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @param _cutOffPercentage The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external;\n\n /**\n * @dev Returns the configs related to credit score.\n *\n * @return _gainCreditScore The score to gain per period.\n * @return _maxCreditScore The max number of credit score that a validator can hold.\n * @return _bailOutCostMultiplier The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n * @return _cutOffPercentageAfterBailout The percentage of reward that the block producer will be cut off from until the end of the period after bailing out.\n *\n */\n function getCreditScoreConfigs()\n external\n view\n returns (\n uint256 _gainCreditScore,\n uint256 _maxCreditScore,\n uint256 _bailOutCostMultiplier,\n uint256 _cutOffPercentageAfterBailout\n );\n\n /**\n * @dev Returns the current credit score of the validator.\n */\n function getCreditScore(address _validator) external view returns (uint256);\n\n /**\n * @dev Returns the current credit score of a list of validators.\n */\n function getManyCreditScores(address[] calldata _validators) external view returns (uint256[] memory _resultList);\n\n /**\n * @dev Returns the whether the `_validator` has been bailed out at the `_period`.\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period) external view returns (bool);\n}\n" + }, + "contracts/interfaces/slash-indicator/IBaseSlash.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\ninterface IBaseSlash {\n enum SlashType {\n UNKNOWN,\n UNAVAILABILITY_TIER_1,\n UNAVAILABILITY_TIER_2,\n DOUBLE_SIGNING,\n BRIDGE_VOTING,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_1,\n BRIDGE_OPERATOR_MISSING_VOTE_TIER_2,\n UNAVAILABILITY_TIER_3\n }\n\n /// @dev Emitted when the validator is slashed.\n event Slashed(address indexed validator, SlashType slashType, uint256 period);\n}\n" + }, + "contracts/interfaces/collections/IHasStakingVestingContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasStakingVestingContract is IHasContract {\n /// @dev Emitted when the staking vesting contract is updated.\n event StakingVestingContractUpdated(address);\n\n /// @dev Error of method caller must be staking vesting contract.\n error ErrCallerMustBeStakingVestingContract();\n\n /**\n * @dev Returns the staking vesting contract.\n */\n function stakingVestingContract() external view returns (address);\n\n /**\n * @dev Sets the staking vesting contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `StakingVestingContractUpdated`.\n *\n */\n function setStakingVestingContract(address) external;\n}\n" + }, + "contracts/precompile-usages/PrecompiledUsage.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PrecompiledUsage {\n /// @dev Error of call to precompile fails.\n error ErrCallPrecompiled();\n}\n" + }, + "contracts/ronin/validator/SlashingExecution.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/collections/HasSlashIndicatorContract.sol\";\nimport \"../../extensions/collections/HasStakingContract.sol\";\nimport \"../../interfaces/validator/ISlashingExecution.sol\";\nimport \"../../libraries/Math.sol\";\nimport \"./storage-fragments/CommonStorage.sol\";\n\nabstract contract SlashingExecution is\n ISlashingExecution,\n HasSlashIndicatorContract,\n HasStakingContract,\n CommonStorage\n{\n /**\n * @inheritdoc ISlashingExecution\n */\n function execSlash(\n address _validatorAddr,\n uint256 _newJailedUntil,\n uint256 _slashAmount,\n bool _cannotBailout\n ) external override onlySlashIndicatorContract {\n uint256 _period = currentPeriod();\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = true;\n\n _totalDeprecatedReward += _miningReward[_validatorAddr] + _delegatingReward[_validatorAddr];\n\n delete _miningReward[_validatorAddr];\n delete _delegatingReward[_validatorAddr];\n\n _blockProducerJailedBlock[_validatorAddr] = Math.max(_newJailedUntil, _blockProducerJailedBlock[_validatorAddr]);\n\n if (_slashAmount > 0) {\n uint256 _actualAmount = _stakingContract.execDeductStakingAmount(_validatorAddr, _slashAmount);\n _totalDeprecatedReward += _actualAmount;\n }\n\n if (_cannotBailout) {\n _cannotBailoutUntilBlock[_validatorAddr] = Math.max(_newJailedUntil, _cannotBailoutUntilBlock[_validatorAddr]);\n }\n\n emit ValidatorPunished(\n _validatorAddr,\n _period,\n _blockProducerJailedBlock[_validatorAddr],\n _slashAmount,\n true,\n false\n );\n }\n\n /**\n * @inheritdoc ISlashingExecution\n */\n function execBailOut(address _validatorAddr, uint256 _period) external override onlySlashIndicatorContract {\n if (block.number <= _cannotBailoutUntilBlock[_validatorAddr]) revert ErrCannotBailout(_validatorAddr);\n\n // Note: Removing rewards of validator in `bailOut` function is not needed, since the rewards have been\n // removed previously in the `slash` function.\n _miningRewardBailoutCutOffAtPeriod[_validatorAddr][_period] = true;\n _miningRewardDeprecatedAtPeriod[_validatorAddr][_period] = false;\n _blockProducerJailedBlock[_validatorAddr] = block.number - 1;\n\n emit ValidatorUnjailed(_validatorAddr, _period);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashIndicator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/slash-indicator/ISlashIndicator.sol\";\nimport \"./SlashDoubleSign.sol\";\nimport \"./SlashBridgeVoting.sol\";\nimport \"./SlashBridgeOperator.sol\";\nimport \"./SlashUnavailability.sol\";\nimport \"./CreditScore.sol\";\n\ncontract SlashIndicator is\n ISlashIndicator,\n SlashDoubleSign,\n SlashBridgeVoting,\n SlashBridgeOperator,\n SlashUnavailability,\n CreditScore,\n Initializable\n{\n constructor() {\n _disableInitializers();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __validatorContract,\n address __maintenanceContract,\n address __roninTrustedOrganizationContract,\n address __roninGovernanceAdminContract,\n // _bridgeOperatorSlashingConfigs[0]: _missingVotesRatioTier1\n // _bridgeOperatorSlashingConfigs[1]: _missingVotesRatioTier2\n // _bridgeOperatorSlashingConfigs[2]: _jailDurationForMissingVotesRatioTier2\n // _bridgeOperatorSlashingConfigs[3]: _skipBridgeOperatorSlashingThreshold\n uint256[4] calldata _bridgeOperatorSlashingConfigs,\n // _bridgeVotingSlashingConfigs[0]: _bridgeVotingThreshold\n // _bridgeVotingSlashingConfigs[1]: _bridgeVotingSlashAmount\n uint256[2] calldata _bridgeVotingSlashingConfigs,\n // _doubleSignSlashingConfigs[0]: _slashDoubleSignAmount\n // _doubleSignSlashingConfigs[1]: _doubleSigningJailUntilBlock\n // _doubleSignSlashingConfigs[2]: _doubleSigningOffsetLimitBlock\n uint256[3] calldata _doubleSignSlashingConfigs,\n // _unavailabilitySlashingConfigs[0]: _unavailabilityTier1Threshold\n // _unavailabilitySlashingConfigs[1]: _unavailabilityTier2Threshold\n // _unavailabilitySlashingConfigs[2]: _slashAmountForUnavailabilityTier2Threshold\n // _unavailabilitySlashingConfigs[3]: _jailDurationForUnavailabilityTier2Threshold\n uint256[4] calldata _unavailabilitySlashingConfigs,\n // _creditScoreConfigs[0]: _gainCreditScore\n // _creditScoreConfigs[1]: _maxCreditScore\n // _creditScoreConfigs[2]: _bailOutCostMultiplier\n // _creditScoreConfigs[3]: _cutOffPercentageAfterBailout\n uint256[4] calldata _creditScoreConfigs\n ) external initializer {\n _setValidatorContract(__validatorContract);\n _setMaintenanceContract(__maintenanceContract);\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\n _setRoninGovernanceAdminContract(__roninGovernanceAdminContract);\n _setBridgeOperatorSlashingConfigs(\n _bridgeOperatorSlashingConfigs[0],\n _bridgeOperatorSlashingConfigs[1],\n _bridgeOperatorSlashingConfigs[2],\n _bridgeOperatorSlashingConfigs[3]\n );\n _setBridgeVotingSlashingConfigs(_bridgeVotingSlashingConfigs[0], _bridgeVotingSlashingConfigs[1]);\n _setDoubleSignSlashingConfigs(\n _doubleSignSlashingConfigs[0],\n _doubleSignSlashingConfigs[1],\n _doubleSignSlashingConfigs[2]\n );\n _setUnavailabilitySlashingConfigs(\n _unavailabilitySlashingConfigs[0],\n _unavailabilitySlashingConfigs[1],\n _unavailabilitySlashingConfigs[2],\n _unavailabilitySlashingConfigs[3]\n );\n _setCreditScoreConfigs(\n _creditScoreConfigs[0],\n _creditScoreConfigs[1],\n _creditScoreConfigs[2],\n _creditScoreConfigs[3]\n );\n }\n\n /**\n * @dev Helper for CreditScore contract to reset the indicator of the validator after bailing out.\n */\n function _setUnavailabilityIndicator(\n address _validator,\n uint256 _period,\n uint256 _indicator\n ) internal override(CreditScore, SlashUnavailability) {\n SlashUnavailability._setUnavailabilityIndicator(_validator, _period, _indicator);\n }\n\n /**\n * @dev Helper for CreditScore contract to query indicator of the validator.\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period)\n public\n view\n override(CreditScore, ISlashUnavailability, SlashUnavailability)\n returns (uint256)\n {\n return SlashUnavailability.getUnavailabilityIndicator(_validator, _period);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period)\n public\n view\n override(CreditScore, ICreditScore, SlashUnavailability)\n returns (bool)\n {\n return CreditScore.checkBailedOutAtPeriod(_validator, _period);\n }\n\n /**\n * @dev Sanity check the address to be slashed\n */\n function _shouldSlash(address _addr) internal view override(SlashDoubleSign, SlashUnavailability) returns (bool) {\n return\n (msg.sender != _addr) &&\n _validatorContract.isBlockProducer(_addr) &&\n !_maintenanceContract.checkMaintained(_addr, block.number);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/slash-indicator/ISlashDoubleSign.sol\";\nimport \"../../precompile-usages/PCUValidateDoubleSign.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashDoubleSign is ISlashDoubleSign, HasValidatorContract, PCUValidateDoubleSign {\n /// @dev The amount of RON to slash double sign.\n uint256 internal _slashDoubleSignAmount;\n /// @dev The block number that the punished validator will be jailed until, due to double signing.\n uint256 internal _doubleSigningJailUntilBlock;\n /** @dev The offset from the submitted block to the current block, from which double signing will be invalidated.\n * This parameter is exposed for system transaction.\n **/\n uint256 internal _doubleSigningOffsetLimitBlock;\n /// @dev Recording of submitted proof to prevent relay attack.\n mapping(bytes32 => bool) _submittedEvidence;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[48] private ______gap;\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function slashDoubleSign(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) external override onlyAdmin {\n bytes32 _header1Checksum = keccak256(_header1);\n bytes32 _header2Checksum = keccak256(_header2);\n\n require(\n !_submittedEvidence[_header1Checksum] && !_submittedEvidence[_header2Checksum],\n \"SlashDoubleSign: evidence already submitted\"\n );\n\n if (_pcValidateEvidence(_consensusAddr, _header1, _header2)) {\n uint256 _period = _validatorContract.currentPeriod();\n _submittedEvidence[_header1Checksum] = true;\n _submittedEvidence[_header2Checksum] = true;\n emit Slashed(_consensusAddr, SlashType.DOUBLE_SIGNING, _period);\n _validatorContract.execSlash(_consensusAddr, _doubleSigningJailUntilBlock, _slashDoubleSignAmount, true);\n }\n }\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function getDoubleSignSlashingConfigs()\n external\n view\n override\n returns (\n uint256 slashDoubleSignAmount_,\n uint256 doubleSigningJailUntilBlock_,\n uint256 doubleSigningOffsetLimitBlock_\n )\n {\n return (_slashDoubleSignAmount, _doubleSigningJailUntilBlock, _doubleSigningOffsetLimitBlock);\n }\n\n /**\n * @inheritdoc ISlashDoubleSign\n */\n function setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _offsetLimitBlock\n ) external override onlyAdmin {\n _setDoubleSignSlashingConfigs(_slashAmount, _jailUntilBlock, _offsetLimitBlock);\n }\n\n /**\n * @dev See `ISlashDoubleSign-setDoubleSignSlashingConfigs`.\n */\n function _setDoubleSignSlashingConfigs(\n uint256 _slashAmount,\n uint256 _jailUntilBlock,\n uint256 _offsetLimitBlock\n ) internal {\n _slashDoubleSignAmount = _slashAmount;\n _doubleSigningJailUntilBlock = _jailUntilBlock;\n _doubleSigningOffsetLimitBlock = _offsetLimitBlock;\n emit DoubleSignSlashingConfigsUpdated(_slashAmount, _jailUntilBlock, _doubleSigningOffsetLimitBlock);\n }\n\n /**\n * @dev Returns whether the account `_addr` should be slashed or not.\n */\n function _shouldSlash(address _addr) internal view virtual returns (bool);\n}\n" + }, + "contracts/ronin/slash-indicator/SlashBridgeVoting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../libraries/Math.sol\";\nimport \"../../interfaces/slash-indicator/ISlashBridgeVoting.sol\";\nimport \"../../extensions/collections/HasRoninTrustedOrganizationContract.sol\";\nimport \"../../extensions/collections/HasRoninGovernanceAdminContract.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashBridgeVoting is\n ISlashBridgeVoting,\n HasValidatorContract,\n HasRoninTrustedOrganizationContract,\n HasRoninGovernanceAdminContract\n{\n /// @dev Mapping from validator address => period index => bridge voting slashed\n mapping(address => mapping(uint256 => bool)) internal _bridgeVotingSlashed;\n /// @dev The threshold to slash when a trusted organization does not vote for bridge operators.\n uint256 internal _bridgeVotingThreshold;\n /// @dev The amount of RON to slash bridge voting.\n uint256 internal _bridgeVotingSlashAmount;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ISlashBridgeVoting\n */\n function slashBridgeVoting(address _consensusAddr) external onlyAdmin {\n IRoninTrustedOrganization.TrustedOrganization memory _org = _roninTrustedOrganizationContract\n .getTrustedOrganization(_consensusAddr);\n uint256 _lastVotedBlock = Math.max(_roninGovernanceAdminContract.lastVotedBlock(_org.bridgeVoter), _org.addedBlock);\n uint256 _period = _validatorContract.currentPeriod();\n\n require(\n block.number - _lastVotedBlock > _bridgeVotingThreshold && !_bridgeVotingSlashed[_consensusAddr][_period],\n \"SlashBridgeVoting: invalid slash\"\n );\n\n _bridgeVotingSlashed[_consensusAddr][_period] = true;\n emit Slashed(_consensusAddr, SlashType.BRIDGE_VOTING, _period);\n _validatorContract.execSlash(_consensusAddr, 0, _bridgeVotingSlashAmount, false);\n }\n\n /**\n * @inheritdoc ISlashBridgeVoting\n */\n function getBridgeVotingSlashingConfigs()\n external\n view\n override\n returns (uint256 bridgeVotingThreshold_, uint256 bridgeVotingSlashAmount_)\n {\n return (_bridgeVotingThreshold, _bridgeVotingSlashAmount);\n }\n\n /**\n * @inheritdoc ISlashBridgeVoting\n */\n function setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) external override onlyAdmin {\n _setBridgeVotingSlashingConfigs(_threshold, _slashAmount);\n }\n\n /**\n * @dev See `ISlashBridgeVoting-setBridgeVotingSlashingConfigs`.\n */\n function _setBridgeVotingSlashingConfigs(uint256 _threshold, uint256 _slashAmount) internal {\n _bridgeVotingThreshold = _threshold;\n _bridgeVotingSlashAmount = _slashAmount;\n emit BridgeVotingSlashingConfigsUpdated(_threshold, _slashAmount);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashBridgeOperator.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../extensions/collections/HasProxyAdmin.sol\";\nimport \"../../interfaces/slash-indicator/ISlashBridgeOperator.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashBridgeOperator is ISlashBridgeOperator, HasProxyAdmin, HasValidatorContract, PercentageConsumer {\n /**\n * @dev The bridge operators will be deprecated reward if (s)he missed more than the ratio.\n * Values 0-10,000 map to 0%-100%.\n */\n uint256 internal _missingVotesRatioTier1;\n /**\n * @dev The bridge operators will be deprecated all rewards including bridge reward and mining reward if (s)he missed\n * more than the ratio. Values 0-10,000 map to 0%-100%.\n */\n uint256 internal _missingVotesRatioTier2;\n /// @dev The number of blocks to jail the corresponding block producer when its bridge operator is slashed tier-2.\n uint256 internal _jailDurationForMissingVotesRatioTier2;\n /// @dev The threshold to skip slashing the bridge operator in case the total number of votes in the bridge is too small.\n uint256 internal _skipBridgeOperatorSlashingThreshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ISlashBridgeOperator\n */\n function getBridgeOperatorSlashingConfigs()\n external\n view\n override\n returns (\n uint256 missingVotesRatioTier1_,\n uint256 missingVotesRatioTier2_,\n uint256 jailDurationForMissingVotesRatioTier2_,\n uint256 skipBridgeOperatorSlashingThreshold_\n )\n {\n return (\n _missingVotesRatioTier1,\n _missingVotesRatioTier2,\n _jailDurationForMissingVotesRatioTier2,\n _skipBridgeOperatorSlashingThreshold\n );\n }\n\n /**\n * @inheritdoc ISlashBridgeOperator\n */\n function setBridgeOperatorSlashingConfigs(\n uint256 _ratioTier1,\n uint256 _ratioTier2,\n uint256 _jailDurationTier2,\n uint256 _skipSlashingThreshold\n ) external override onlyAdmin {\n _setBridgeOperatorSlashingConfigs(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\n }\n\n /**\n * @inheritdoc ISlashBridgeOperator\n */\n function execSlashBridgeOperator(\n address _consensusAddr,\n uint256 _tier,\n uint256 _period\n ) external onlyValidatorContract {\n if (_tier == 1) {\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_1, _period);\n } else if (_tier == 2) {\n emit Slashed(_consensusAddr, SlashType.BRIDGE_OPERATOR_MISSING_VOTE_TIER_2, _period);\n }\n }\n\n /**\n * @dev See `ISlashBridgeOperator-setBridgeOperatorSlashingConfigs`.\n */\n function _setBridgeOperatorSlashingConfigs(\n uint256 _ratioTier1,\n uint256 _ratioTier2,\n uint256 _jailDurationTier2,\n uint256 _skipSlashingThreshold\n ) internal {\n require(\n _ratioTier1 <= _ratioTier2 && _ratioTier1 <= _MAX_PERCENTAGE && _ratioTier2 <= _MAX_PERCENTAGE,\n \"SlashIndicator: invalid ratios\"\n );\n _missingVotesRatioTier1 = _ratioTier1;\n _missingVotesRatioTier2 = _ratioTier2;\n _jailDurationForMissingVotesRatioTier2 = _jailDurationTier2;\n _skipBridgeOperatorSlashingThreshold = _skipSlashingThreshold;\n emit BridgeOperatorSlashingConfigsUpdated(_ratioTier1, _ratioTier2, _jailDurationTier2, _skipSlashingThreshold);\n }\n}\n" + }, + "contracts/ronin/slash-indicator/SlashUnavailability.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./CreditScore.sol\";\nimport \"../../interfaces/slash-indicator/ISlashUnavailability.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\n\nabstract contract SlashUnavailability is ISlashUnavailability, HasValidatorContract {\n /// @dev The last block that a validator is slashed for unavailability.\n uint256 public lastUnavailabilitySlashedBlock;\n /// @dev Mapping from validator address => period index => unavailability indicator.\n mapping(address => mapping(uint256 => uint256)) internal _unavailabilityIndicator;\n\n /**\n * @dev The mining reward will be deprecated, if (s)he missed more than this threshold.\n * This threshold is applied for tier-1 and tier-3 of unavailability slash.\n */\n uint256 internal _unavailabilityTier1Threshold;\n /**\n * @dev The mining reward will be deprecated, (s)he will be put in jailed, and will be deducted\n * self-staking if (s)he misses more than this threshold. This threshold is applied for tier-2 slash.\n */\n uint256 internal _unavailabilityTier2Threshold;\n /**\n * @dev The amount of RON to deduct from self-staking of a block producer when (s)he is slashed with\n * tier-2 or tier-3.\n **/\n uint256 internal _slashAmountForUnavailabilityTier2Threshold;\n /// @dev The number of blocks to jail a block producer when (s)he is slashed with tier-2 or tier-3.\n uint256 internal _jailDurationForUnavailabilityTier2Threshold;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n modifier oncePerBlock() {\n require(\n block.number > lastUnavailabilitySlashedBlock,\n \"SlashIndicator: cannot slash a validator twice or slash more than one validator in one block\"\n );\n lastUnavailabilitySlashedBlock = block.number;\n _;\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function slashUnavailability(address _validatorAddr) external override oncePerBlock {\n require(msg.sender == block.coinbase, \"SlashUnavailability: method caller must be coinbase\");\n if (!_shouldSlash(_validatorAddr)) {\n // Should return instead of throwing error since this is a part of system transaction.\n return;\n }\n\n uint256 _period = _validatorContract.currentPeriod();\n uint256 _count = ++_unavailabilityIndicator[_validatorAddr][_period];\n uint256 _newJailedUntilBlock = Math.addIfNonZero(block.number, _jailDurationForUnavailabilityTier2Threshold);\n\n if (_count == _unavailabilityTier2Threshold) {\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_2, _period);\n _validatorContract.execSlash(\n _validatorAddr,\n _newJailedUntilBlock,\n _slashAmountForUnavailabilityTier2Threshold,\n false\n );\n } else if (_count == _unavailabilityTier1Threshold) {\n bool _tier1SecondTime = checkBailedOutAtPeriod(_validatorAddr, _period);\n if (!_tier1SecondTime) {\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_1, _period);\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\n } else {\n /// Handles tier-3\n emit Slashed(_validatorAddr, SlashType.UNAVAILABILITY_TIER_3, _period);\n _validatorContract.execSlash(\n _validatorAddr,\n _newJailedUntilBlock,\n _slashAmountForUnavailabilityTier2Threshold,\n true\n );\n }\n }\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) external override onlyAdmin {\n _setUnavailabilitySlashingConfigs(\n _tier1Threshold,\n _tier2Threshold,\n _slashAmountForTier2Threshold,\n _jailDurationForTier2Threshold\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function getUnavailabilitySlashingConfigs()\n external\n view\n override\n returns (\n uint256 unavailabilityTier1Threshold_,\n uint256 unavailabilityTier2Threshold_,\n uint256 slashAmountForUnavailabilityTier2Threshold_,\n uint256 jailDurationForUnavailabilityTier2Threshold_\n )\n {\n return (\n _unavailabilityTier1Threshold,\n _unavailabilityTier2Threshold,\n _slashAmountForUnavailabilityTier2Threshold,\n _jailDurationForUnavailabilityTier2Threshold\n );\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function currentUnavailabilityIndicator(address _validator) external view override returns (uint256) {\n return getUnavailabilityIndicator(_validator, _validatorContract.currentPeriod());\n }\n\n /**\n * @inheritdoc ISlashUnavailability\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period)\n public\n view\n virtual\n override\n returns (uint256)\n {\n return _unavailabilityIndicator[_validator][_period];\n }\n\n /**\n * @dev Sets the unavailability indicator of the `_validator` at `_period`.\n */\n function _setUnavailabilityIndicator(\n address _validator,\n uint256 _period,\n uint256 _indicator\n ) internal virtual {\n _unavailabilityIndicator[_validator][_period] = _indicator;\n }\n\n /**\n * @dev See `ISlashUnavailability-setUnavailabilitySlashingConfigs`.\n */\n function _setUnavailabilitySlashingConfigs(\n uint256 _tier1Threshold,\n uint256 _tier2Threshold,\n uint256 _slashAmountForTier2Threshold,\n uint256 _jailDurationForTier2Threshold\n ) internal {\n require(_unavailabilityTier1Threshold <= _unavailabilityTier2Threshold, \"SlashUnavailability: invalid threshold\");\n _unavailabilityTier1Threshold = _tier1Threshold;\n _unavailabilityTier2Threshold = _tier2Threshold;\n _slashAmountForUnavailabilityTier2Threshold = _slashAmountForTier2Threshold;\n _jailDurationForUnavailabilityTier2Threshold = _jailDurationForTier2Threshold;\n emit UnavailabilitySlashingConfigsUpdated(\n _tier1Threshold,\n _tier2Threshold,\n _slashAmountForTier2Threshold,\n _jailDurationForTier2Threshold\n );\n }\n\n /**\n * @dev Returns whether the account `_addr` should be slashed or not.\n */\n function _shouldSlash(address _addr) internal view virtual returns (bool);\n\n /**\n * @dev See `ICreditScore-checkBailedOutAtPeriod`\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual returns (bool);\n}\n" + }, + "contracts/ronin/slash-indicator/CreditScore.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../interfaces/slash-indicator/ICreditScore.sol\";\nimport \"../../extensions/collections/HasMaintenanceContract.sol\";\nimport \"../../extensions/collections/HasValidatorContract.sol\";\nimport \"../../extensions/consumers/PercentageConsumer.sol\";\nimport \"../../libraries/Math.sol\";\n\nabstract contract CreditScore is ICreditScore, HasValidatorContract, HasMaintenanceContract, PercentageConsumer {\n /// @dev Mapping from validator address => period index => whether bailed out before\n mapping(address => mapping(uint256 => bool)) internal _checkBailedOutAtPeriod;\n /// @dev Mapping from validator address => credit score\n mapping(address => uint256) internal _creditScore;\n\n /// @dev The max gained number of credit score per period.\n uint256 internal _gainCreditScore;\n /// @dev The max number of credit score that a validator can hold.\n uint256 internal _maxCreditScore;\n /// @dev The number that will be multiplied with the remaining jailed time to get the cost of bailing out.\n uint256 internal _bailOutCostMultiplier;\n /// @dev The percentage of reward to be cut off from the validator in the rest of the period after bailed out.\n uint256 internal _cutOffPercentageAfterBailout;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @inheritdoc ICreditScore\n */\n function updateCreditScores(address[] calldata _validators, uint256 _period) external override onlyValidatorContract {\n uint256 _periodStartAtBlock = _validatorContract.currentPeriodStartAtBlock();\n\n bool[] memory _jaileds = _validatorContract.checkManyJailed(_validators);\n bool[] memory _maintaineds = _maintenanceContract.checkManyMaintainedInBlockRange(\n _validators,\n _periodStartAtBlock,\n block.number\n );\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\n\n for (uint _i = 0; _i < _validators.length; _i++) {\n address _validator = _validators[_i];\n\n uint256 _indicator = getUnavailabilityIndicator(_validator, _period);\n bool _isJailedInPeriod = _jaileds[_i];\n bool _isMaintainingInPeriod = _maintaineds[_i];\n\n uint256 _actualGain = (_isJailedInPeriod || _isMaintainingInPeriod)\n ? 0\n : Math.subNonNegative(_gainCreditScore, _indicator);\n\n _creditScore[_validator] = Math.addWithUpperbound(_creditScore[_validator], _actualGain, _maxCreditScore);\n _updatedCreditScores[_i] = _creditScore[_validator];\n }\n\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\n }\n\n function execResetCreditScores(address[] calldata _validators) external override onlyValidatorContract {\n uint256[] memory _updatedCreditScores = new uint256[](_validators.length);\n for (uint _i = 0; _i < _validators.length; _i++) {\n address _validator = _validators[_i];\n delete _creditScore[_validator];\n delete _updatedCreditScores[_i];\n }\n emit CreditScoresUpdated(_validators, _updatedCreditScores);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function bailOut(address _consensusAddr) external override {\n require(\n _validatorContract.isValidatorCandidate(_consensusAddr),\n \"SlashIndicator: consensus address must be a validator candidate\"\n );\n require(\n _validatorContract.isCandidateAdmin(_consensusAddr, msg.sender),\n \"SlashIndicator: method caller must be a candidate admin\"\n );\n\n (bool _isJailed, , uint256 _jailedEpochLeft) = _validatorContract.getJailedTimeLeft(_consensusAddr);\n require(_isJailed, \"SlashIndicator: caller must be jailed in the current period\");\n\n uint256 _period = _validatorContract.currentPeriod();\n require(!_checkBailedOutAtPeriod[_consensusAddr][_period], \"SlashIndicator: validator has bailed out previously\");\n\n uint256 _score = _creditScore[_consensusAddr];\n uint256 _cost = _jailedEpochLeft * _bailOutCostMultiplier;\n require(_score >= _cost, \"SlashIndicator: insufficient credit score to bail out\");\n\n _validatorContract.execBailOut(_consensusAddr, _period);\n\n _creditScore[_consensusAddr] -= _cost;\n _setUnavailabilityIndicator(_consensusAddr, _period, 0);\n _checkBailedOutAtPeriod[_consensusAddr][_period] = true;\n emit BailedOut(_consensusAddr, _period, _cost);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) external override onlyAdmin {\n _setCreditScoreConfigs(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\n }\n\n /**\n * @dev See `ISlashUnavailability`\n */\n function getUnavailabilityIndicator(address _validator, uint256 _period) public view virtual returns (uint256);\n\n /**\n * @inheritdoc ICreditScore\n */\n function getCreditScoreConfigs()\n external\n view\n override\n returns (\n uint256 gainCreditScore_,\n uint256 maxCreditScore_,\n uint256 bailOutCostMultiplier_,\n uint256 cutOffPercentageAfterBailout_\n )\n {\n return (_gainCreditScore, _maxCreditScore, _bailOutCostMultiplier, _cutOffPercentageAfterBailout);\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function getCreditScore(address _validator) external view override returns (uint256) {\n return _creditScore[_validator];\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function getManyCreditScores(address[] calldata _validators)\n public\n view\n override\n returns (uint256[] memory _resultList)\n {\n _resultList = new uint256[](_validators.length);\n\n for (uint _i = 0; _i < _resultList.length; _i++) {\n _resultList[_i] = _creditScore[_validators[_i]];\n }\n }\n\n /**\n * @inheritdoc ICreditScore\n */\n function checkBailedOutAtPeriod(address _validator, uint256 _period) public view virtual override returns (bool) {\n return _checkBailedOutAtPeriod[_validator][_period];\n }\n\n /**\n * @dev See `SlashUnavailability`.\n */\n function _setUnavailabilityIndicator(\n address _validator,\n uint256 _period,\n uint256 _indicator\n ) internal virtual;\n\n /**\n * @dev See `ICreditScore-setCreditScoreConfigs`.\n */\n function _setCreditScoreConfigs(\n uint256 _gainScore,\n uint256 _maxScore,\n uint256 _bailOutMultiplier,\n uint256 _cutOffPercentage\n ) internal {\n require(_gainScore <= _maxScore, \"CreditScore: invalid credit score config\");\n require(_cutOffPercentage <= _MAX_PERCENTAGE, \"CreditScore: invalid cut off percentage config\");\n\n _gainCreditScore = _gainScore;\n _maxCreditScore = _maxScore;\n _bailOutCostMultiplier = _bailOutMultiplier;\n _cutOffPercentageAfterBailout = _cutOffPercentage;\n emit CreditScoreConfigsUpdated(_gainScore, _maxScore, _bailOutMultiplier, _cutOffPercentage);\n }\n}\n" + }, + "contracts/precompile-usages/PCUValidateDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./PrecompiledUsage.sol\";\n\nabstract contract PCUValidateDoubleSign is PrecompiledUsage {\n /// @dev Gets the address of the precompile of validating double sign evidence\n function precompileValidateDoubleSignAddress() public view virtual returns (address) {\n return address(0x67);\n }\n\n /**\n * @dev Validates the two submitted block header if they are produced by the same address\n *\n * Note: The recover process is done by pre-compiled contract. This function is marked as\n * virtual for implementing mocking contract for testing purpose.\n */\n function _pcValidateEvidence(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) internal view virtual returns (bool _validEvidence) {\n address _smc = precompileValidateDoubleSignAddress();\n bool _success = true;\n\n bytes memory _payload = abi.encodeWithSignature(\n \"validatingDoubleSignProof(address,bytes,bytes)\",\n _consensusAddr,\n _header1,\n _header2\n );\n uint _payloadLength = _payload.length;\n uint[1] memory _output;\n\n assembly {\n let _payloadStart := add(_payload, 0x20)\n if iszero(staticcall(gas(), _smc, _payloadStart, _payloadLength, _output, 0x20)) {\n _success := 0\n }\n\n if iszero(returndatasize()) {\n _success := 0\n }\n }\n\n if (!_success) revert ErrCallPrecompiled();\n return (_output[0] != 0);\n }\n}\n" + }, + "contracts/extensions/collections/HasRoninGovernanceAdminContract.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./HasProxyAdmin.sol\";\nimport \"../../interfaces/collections/IHasRoninGovernanceAdminContract.sol\";\nimport \"../../interfaces/IRoninGovernanceAdmin.sol\";\n\ncontract HasRoninGovernanceAdminContract is IHasRoninGovernanceAdminContract, HasProxyAdmin {\n IRoninGovernanceAdmin internal _roninGovernanceAdminContract;\n\n modifier onlyRoninGovernanceAdminContract() {\n if (roninGovernanceAdminContract() != msg.sender) revert ErrCallerMustBeGovernanceAdminContract();\n _;\n }\n\n /**\n * @inheritdoc IHasRoninGovernanceAdminContract\n */\n function roninGovernanceAdminContract() public view override returns (address) {\n return address(_roninGovernanceAdminContract);\n }\n\n /**\n * @inheritdoc IHasRoninGovernanceAdminContract\n */\n function setRoninGovernanceAdminContract(address _addr) external override onlyAdmin {\n if (_addr.code.length == 0) revert ErrZeroCodeContract();\n _setRoninGovernanceAdminContract(_addr);\n }\n\n /**\n * @dev Sets the ronin governance admin contract.\n *\n * Emits the event `RoninGovernanceAdminContractUpdated`.\n *\n */\n function _setRoninGovernanceAdminContract(address _addr) internal {\n _roninGovernanceAdminContract = IRoninGovernanceAdmin(_addr);\n emit RoninGovernanceAdminContractUpdated(_addr);\n }\n}\n" + }, + "contracts/interfaces/collections/IHasRoninGovernanceAdminContract.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./IHasContract.sol\";\n\ninterface IHasRoninGovernanceAdminContract is IHasContract {\n /// @dev Emitted when the ronin governance admin contract is updated.\n event RoninGovernanceAdminContractUpdated(address);\n\n /// @dev Error of method caller must be goverance admin contract.\n error ErrCallerMustBeGovernanceAdminContract();\n\n /**\n * @dev Returns the ronin governance admin contract.\n */\n function roninGovernanceAdminContract() external view returns (address);\n\n /**\n * @dev Sets the ronin governance admin contract.\n *\n * Requirements:\n * - The method caller is admin.\n * - The new address is a contract.\n *\n * Emits the event `RoninGovernanceAdminContractUpdated`.\n *\n */\n function setRoninGovernanceAdminContract(address) external;\n}\n" + }, + "contracts/mocks/validator/MockRoninValidatorSetExtended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./MockRoninValidatorSetOverridePrecompile.sol\";\nimport \"../../libraries/EnumFlags.sol\";\n\ncontract MockRoninValidatorSetExtended is MockRoninValidatorSetOverridePrecompile {\n bool private _initialized;\n uint256[] internal _epochs;\n\n constructor() {}\n\n function initEpoch() public {\n if (!_initialized) {\n _epochs.push(0);\n _initialized = true;\n }\n }\n\n function endEpoch() external {\n _epochs.push(block.number);\n }\n\n function epochOf(uint256 _block) public view override returns (uint256 _epoch) {\n for (uint256 _i = _epochs.length; _i > 0; _i--) {\n if (_block > _epochs[_i - 1]) {\n return _i;\n }\n }\n }\n\n function epochEndingAt(uint256 _block) public view override(ITimingInfo, TimingStorage) returns (bool) {\n for (uint _i = 0; _i < _epochs.length; _i++) {\n if (_block == _epochs[_i]) {\n return true;\n }\n }\n return false;\n }\n\n function getJailUntils(address[] calldata _addrs) public view returns (uint256[] memory jailUntils_) {\n jailUntils_ = new uint256[](_addrs.length);\n for (uint _i = 0; _i < _addrs.length; _i++) {\n jailUntils_[_i] = _blockProducerJailedBlock[_addrs[_i]];\n }\n }\n\n function addValidators(address[] calldata _addrs) public {\n for (uint _i = 0; _i < _addrs.length; _i++) {\n _validators[_i] = _addrs[_i];\n _validatorMap[_addrs[_i]] = EnumFlags.ValidatorFlag.Both;\n }\n }\n}\n" + }, + "contracts/mocks/validator/MockRoninValidatorSetOverridePrecompile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../MockPrecompile.sol\";\nimport \"../../ronin/validator/RoninValidatorSet.sol\";\n\ncontract MockRoninValidatorSetOverridePrecompile is RoninValidatorSet, MockPrecompile {\n constructor() {}\n\n function arrangeValidatorCandidates(\n address[] memory _candidates,\n uint256[] memory _trustedWeights,\n uint _newValidatorCount,\n uint _maxPrioritizedValidatorNumber\n ) external pure returns (address[] memory) {\n _arrangeValidatorCandidates(_candidates, _trustedWeights, _newValidatorCount, _maxPrioritizedValidatorNumber);\n return _candidates;\n }\n\n function _pcSortCandidates(address[] memory _candidates, uint256[] memory _weights)\n internal\n pure\n override\n returns (address[] memory _result)\n {\n return sortValidators(_candidates, _weights);\n }\n\n function _pcPickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) internal pure override returns (address[] memory _result, uint256 _newValidatorCount) {\n _result = pickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n\n _newValidatorCount = _result.length;\n }\n}\n" + }, + "contracts/mocks/MockPrecompile.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./libraries/Sorting.sol\";\nimport \"../libraries/Math.sol\";\n\ncontract MockPrecompile {\n function sortValidators(address[] memory _validators, uint256[] memory _weights)\n public\n pure\n returns (address[] memory)\n {\n return Sorting.sort(_validators, _weights);\n }\n\n function validatingDoubleSignProof(\n address, /*consensusAddr*/\n bytes calldata, /*_header1*/\n bytes calldata /*_header2*/\n ) public pure returns (bool _validEvidence) {\n return true;\n }\n\n function pickValidatorSet(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) public pure returns (address[] memory _result) {\n (_result, _trustedWeights) = Sorting.sortWithExternalKeys(_candidates, _weights, _trustedWeights);\n uint256 _newValidatorCount = Math.min(_maxValidatorNumber, _result.length);\n _arrangeValidatorCandidates(_result, _trustedWeights, _newValidatorCount, _maxPrioritizedValidatorNumber);\n }\n\n /**\n * @dev Arranges the sorted candidates to list of validators, by asserting prioritized and non-prioritized candidates\n *\n * @param _candidates A sorted list of candidates\n */\n function _arrangeValidatorCandidates(\n address[] memory _candidates,\n uint256[] memory _trustedWeights,\n uint _newValidatorCount,\n uint _maxPrioritizedValidatorNumber\n ) internal pure {\n address[] memory _waitingCandidates = new address[](_candidates.length);\n uint _waitingCounter;\n uint _prioritySlotCounter;\n\n for (uint _i = 0; _i < _candidates.length; _i++) {\n if (_trustedWeights[_i] > 0 && _prioritySlotCounter < _maxPrioritizedValidatorNumber) {\n _candidates[_prioritySlotCounter++] = _candidates[_i];\n continue;\n }\n _waitingCandidates[_waitingCounter++] = _candidates[_i];\n }\n\n _waitingCounter = 0;\n for (uint _i = _prioritySlotCounter; _i < _newValidatorCount; _i++) {\n _candidates[_i] = _waitingCandidates[_waitingCounter++];\n }\n\n assembly {\n mstore(_candidates, _newValidatorCount)\n }\n }\n}\n" + }, + "contracts/ronin/validator/RoninValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../../interfaces/validator/IRoninValidatorSet.sol\";\nimport \"./CoinbaseExecution.sol\";\nimport \"./SlashingExecution.sol\";\n\ncontract RoninValidatorSet is Initializable, CoinbaseExecution, SlashingExecution {\n constructor() {\n _disableInitializers();\n }\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n /**\n * @dev Initializes the contract storage.\n */\n function initialize(\n address __slashIndicatorContract,\n address __stakingContract,\n address __stakingVestingContract,\n address __maintenanceContract,\n address __roninTrustedOrganizationContract,\n address __bridgeTrackingContract,\n uint256 __maxValidatorNumber,\n uint256 __maxValidatorCandidate,\n uint256 __maxPrioritizedValidatorNumber,\n uint256 __minEffectiveDaysOnwards,\n uint256 __numberOfBlocksInEpoch,\n // __emergencyExitConfigs[0]: emergencyExitLockedAmount\n // __emergencyExitConfigs[1]: emergencyExpiryDuration\n uint256[2] calldata __emergencyExitConfigs\n ) external initializer {\n _setSlashIndicatorContract(__slashIndicatorContract);\n _setStakingContract(__stakingContract);\n _setStakingVestingContract(__stakingVestingContract);\n _setMaintenanceContract(__maintenanceContract);\n _setBridgeTrackingContract(__bridgeTrackingContract);\n _setRoninTrustedOrganizationContract(__roninTrustedOrganizationContract);\n _setMaxValidatorNumber(__maxValidatorNumber);\n _setMaxValidatorCandidate(__maxValidatorCandidate);\n _setMaxPrioritizedValidatorNumber(__maxPrioritizedValidatorNumber);\n _setMinEffectiveDaysOnwards(__minEffectiveDaysOnwards);\n _setEmergencyExitLockedAmount(__emergencyExitConfigs[0]);\n _setEmergencyExpiryDuration(__emergencyExitConfigs[1]);\n _numberOfBlocksInEpoch = __numberOfBlocksInEpoch;\n }\n\n /**\n * @dev Only receives RON from staking vesting contract (for topping up bonus), and from staking contract (for transferring\n * deducting amount on slashing).\n */\n function _fallback() internal view {\n if (msg.sender != stakingVestingContract() && msg.sender != stakingContract()) revert ErrUnauthorizedReceiveRON();\n }\n\n /**\n * @dev Override `ValidatorInfoStorage-_bridgeOperatorOf`.\n */\n function _bridgeOperatorOf(address _consensusAddr)\n internal\n view\n override(EmergencyExit, ValidatorInfoStorage)\n returns (address)\n {\n return super._bridgeOperatorOf(_consensusAddr);\n }\n}\n" + }, + "contracts/mocks/libraries/Sorting.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\n\npragma solidity ^0.8.0;\n\nlibrary Sorting {\n struct Node {\n uint key;\n uint value;\n }\n\n struct Node3 {\n uint key;\n uint value;\n uint otherKey;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // VALUE SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sort(uint[] memory data) internal pure returns (uint[] memory) {\n return _quickSort(data, int(0), int(data.length - 1));\n }\n\n function _quickSort(\n uint[] memory arr,\n int left,\n int right\n ) private pure returns (uint[] memory) {\n int i = left;\n int j = right;\n if (i == j) return arr;\n uint pivot = arr[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (arr[uint(i)] > pivot) i++;\n while (pivot > arr[uint(j)]) j--;\n if (i <= j) {\n (arr[uint(i)], arr[uint(j)]) = (arr[uint(j)], arr[uint(i)]);\n i++;\n j--;\n }\n }\n if (left < j) arr = _quickSort(arr, left, j);\n if (i < right) arr = _quickSort(arr, i, right);\n\n return arr;\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // NODE SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sort(address[] memory _keys, uint256[] memory _values) internal pure returns (address[] memory) {\n require(_values.length == _keys.length, \"Sorting: invalid array length\");\n if (_keys.length == 0) {\n return _keys;\n }\n\n Node[] memory _nodes = new Node[](_keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node(uint256(uint160(_keys[_i])), _values[_i]);\n }\n _quickSortNodes(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n _keys[_i] = address(uint160(_nodes[_i].key)); // Casting?\n }\n\n return _keys;\n }\n\n function sortNodes(Node[] memory nodes) internal pure returns (Node[] memory) {\n return _quickSortNodes(nodes, int(0), int(nodes.length - 1));\n }\n\n function _quickSortNodes(\n Node[] memory nodes,\n int left,\n int right\n ) private pure returns (Node[] memory) {\n int i = left;\n int j = right;\n if (i == j) return nodes;\n Node memory pivot = nodes[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (nodes[uint(i)].value > pivot.value) i++;\n while (pivot.value > nodes[uint(j)].value) j--;\n if (i <= j) {\n (nodes[uint(i)], nodes[uint(j)]) = __swapNodes(nodes[uint(i)], nodes[uint(j)]);\n i++;\n j--;\n }\n }\n if (left < j) nodes = _quickSortNodes(nodes, left, j);\n if (i < right) nodes = _quickSortNodes(nodes, i, right);\n\n return nodes;\n }\n\n function _bubbleSortNodes(Node[] memory nodes) private pure returns (Node[] memory) {\n uint length = nodes.length;\n for (uint i = 0; i < length - 1; i++) {\n for (uint j = i + 1; j < length; j++) {\n if (nodes[j].value > nodes[i].value) {\n (nodes[i], nodes[j]) = __swapNodes(nodes[i], nodes[j]);\n }\n }\n }\n return nodes;\n }\n\n function __swapNodes(Node memory x, Node memory y) private pure returns (Node memory, Node memory) {\n Node memory tmp = x;\n (x, y) = (y, tmp);\n return (x, y);\n }\n\n ///////////////////////////////////////////////////////////////////////////////////////\n // NODE3 SORTING //\n ///////////////////////////////////////////////////////////////////////////////////////\n\n function sortWithExternalKeys(\n address[] memory _keys,\n uint256[] memory _values,\n uint256[] memory _otherKeys\n ) internal pure returns (address[] memory keys_, uint256[] memory otherKeys_) {\n require((_values.length == _keys.length) && (_otherKeys.length == _keys.length), \"Sorting: invalid array length\");\n if (_keys.length == 0) {\n return (_keys, _otherKeys);\n }\n\n Node3[] memory _nodes = new Node3[](_keys.length);\n for (uint256 _i; _i < _nodes.length; _i++) {\n _nodes[_i] = Node3(uint256(uint160(_keys[_i])), _values[_i], _otherKeys[_i]);\n }\n _quickSortNode3s(_nodes, int(0), int(_nodes.length - 1));\n\n for (uint256 _i; _i < _nodes.length; _i++) {\n _keys[_i] = address(uint160(_nodes[_i].key)); // Casting?\n }\n\n return (_keys, _otherKeys);\n }\n\n function sortNode3s(Node3[] memory nodes) internal pure returns (Node3[] memory) {\n return _quickSortNode3s(nodes, int(0), int(nodes.length - 1));\n }\n\n function _quickSortNode3s(\n Node3[] memory nodes,\n int left,\n int right\n ) private pure returns (Node3[] memory) {\n int i = left;\n int j = right;\n if (i == j) return nodes;\n Node3 memory pivot = nodes[uint(left + (right - left) / 2)];\n while (i <= j) {\n while (nodes[uint(i)].value > pivot.value) i++;\n while (pivot.value > nodes[uint(j)].value) j--;\n if (i <= j) {\n (nodes[uint(i)], nodes[uint(j)]) = __swapNode3s(nodes[uint(i)], nodes[uint(j)]);\n i++;\n j--;\n }\n }\n if (left < j) nodes = _quickSortNode3s(nodes, left, j);\n if (i < right) nodes = _quickSortNode3s(nodes, i, right);\n\n return nodes;\n }\n\n function _bubbleSortNode3s(Node3[] memory nodes) private pure returns (Node3[] memory) {\n uint length = nodes.length;\n for (uint i = 0; i < length - 1; i++) {\n for (uint j = i + 1; j < length; j++) {\n if (nodes[j].value > nodes[i].value) {\n (nodes[i], nodes[j]) = __swapNode3s(nodes[i], nodes[j]);\n }\n }\n }\n return nodes;\n }\n\n function __swapNode3s(Node3 memory x, Node3 memory y) private pure returns (Node3 memory, Node3 memory) {\n Node3 memory tmp = x;\n (x, y) = (y, tmp);\n return (x, y);\n }\n}\n" + }, + "contracts/mainchain/MainchainGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"@openzeppelin/contracts/access/AccessControlEnumerable.sol\";\nimport \"@openzeppelin/contracts/proxy/utils/Initializable.sol\";\nimport \"../extensions/GatewayV2.sol\";\nimport \"../extensions/WithdrawalLimitation.sol\";\nimport \"../libraries/Transfer.sol\";\nimport \"../interfaces/IMainchainGatewayV2.sol\";\n\ncontract MainchainGatewayV2 is WithdrawalLimitation, Initializable, AccessControlEnumerable, IMainchainGatewayV2 {\n using Token for Token.Info;\n using Transfer for Transfer.Request;\n using Transfer for Transfer.Receipt;\n\n /// @dev Emitted when the bridge operators are replaced\n event BridgeOperatorsReplaced(address[] operators);\n\n /// @dev Withdrawal unlocker role hash\n bytes32 public constant WITHDRAWAL_UNLOCKER_ROLE = keccak256(\"WITHDRAWAL_UNLOCKER_ROLE\");\n\n /// @dev Wrapped native token address\n IWETH public wrappedNativeToken;\n /// @dev Ronin network id\n uint256 public roninChainId;\n /// @dev Total deposit\n uint256 public depositCount;\n /// @dev Domain seperator\n bytes32 internal _domainSeparator;\n /// @dev Mapping from mainchain token => token address on Ronin network\n mapping(address => MappedToken) internal _roninToken;\n /// @dev Mapping from withdrawal id => withdrawal hash\n mapping(uint256 => bytes32) public withdrawalHash;\n /// @dev Mapping from withdrawal id => locked\n mapping(uint256 => bool) public withdrawalLocked;\n\n /// @dev Mapping from validator address => last block that the bridge operator is added\n mapping(address => uint256) internal _bridgeOperatorAddedBlock;\n /// @dev Bridge operators array\n address[] internal _bridgeOperators;\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n /**\n * @dev Initializes contract storage.\n */\n function initialize(\n address _roleSetter,\n IWETH _wrappedToken,\n uint256 _roninChainId,\n uint256 _numerator,\n uint256 _highTierVWNumerator,\n uint256 _denominator,\n // _addresses[0]: mainchainTokens\n // _addresses[1]: roninTokens\n // _addresses[2]: withdrawalUnlockers\n address[][3] calldata _addresses,\n // _thresholds[0]: highTierThreshold\n // _thresholds[1]: lockedThreshold\n // _thresholds[2]: unlockFeePercentages\n // _thresholds[3]: dailyWithdrawalLimit\n uint256[][4] calldata _thresholds,\n Token.Standard[] calldata _standards\n ) external payable virtual initializer {\n _setupRole(DEFAULT_ADMIN_ROLE, _roleSetter);\n roninChainId = _roninChainId;\n\n _setWrappedNativeTokenContract(_wrappedToken);\n _updateDomainSeparator();\n _setThreshold(_numerator, _denominator);\n _setHighTierVoteWeightThreshold(_highTierVWNumerator, _denominator);\n _verifyThresholds();\n\n if (_addresses[0].length > 0) {\n // Map mainchain tokens to ronin tokens\n _mapTokens(_addresses[0], _addresses[1], _standards);\n // Sets thresholds based on the mainchain tokens\n _setHighTierThresholds(_addresses[0], _thresholds[0]);\n _setLockedThresholds(_addresses[0], _thresholds[1]);\n _setUnlockFeePercentages(_addresses[0], _thresholds[2]);\n _setDailyWithdrawalLimits(_addresses[0], _thresholds[3]);\n }\n\n // Grant role for withdrawal unlocker\n for (uint256 _i; _i < _addresses[2].length; _i++) {\n _grantRole(WITHDRAWAL_UNLOCKER_ROLE, _addresses[2][_i]);\n }\n }\n\n /**\n * @inheritdoc IBridge\n */\n function replaceBridgeOperators(address[] calldata _list) external onlyAdmin {\n address _addr;\n for (uint256 _i = 0; _i < _list.length; _i++) {\n _addr = _list[_i];\n if (_bridgeOperatorAddedBlock[_addr] == 0) {\n _bridgeOperators.push(_addr);\n }\n _bridgeOperatorAddedBlock[_addr] = block.number;\n }\n\n {\n uint256 _i;\n while (_i < _bridgeOperators.length) {\n _addr = _bridgeOperators[_i];\n if (_bridgeOperatorAddedBlock[_addr] < block.number) {\n delete _bridgeOperatorAddedBlock[_addr];\n _bridgeOperators[_i] = _bridgeOperators[_bridgeOperators.length - 1];\n _bridgeOperators.pop();\n continue;\n }\n _i++;\n }\n }\n\n emit BridgeOperatorsReplaced(_list);\n }\n\n /**\n * @inheritdoc IBridge\n */\n function getBridgeOperators() external view returns (address[] memory) {\n return _bridgeOperators;\n }\n\n /**\n * @dev Receives ether without doing anything. Use this function to topup native token.\n */\n function receiveEther() external payable {}\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function DOMAIN_SEPARATOR() external view virtual returns (bytes32) {\n return _domainSeparator;\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function setWrappedNativeTokenContract(IWETH _wrappedToken) external virtual onlyAdmin {\n _setWrappedNativeTokenContract(_wrappedToken);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function requestDepositFor(Transfer.Request calldata _request) external payable virtual whenNotPaused {\n _requestDepositFor(_request, msg.sender);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function submitWithdrawal(Transfer.Receipt calldata _receipt, Signature[] calldata _signatures)\n external\n virtual\n whenNotPaused\n returns (bool _locked)\n {\n return _submitWithdrawal(_receipt, _signatures);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function unlockWithdrawal(Transfer.Receipt calldata _receipt) external onlyRole(WITHDRAWAL_UNLOCKER_ROLE) {\n bytes32 _receiptHash = _receipt.hash();\n require(withdrawalHash[_receipt.id] == _receipt.hash(), \"MainchainGatewayV2: invalid receipt\");\n require(withdrawalLocked[_receipt.id], \"MainchainGatewayV2: query for approved withdrawal\");\n delete withdrawalLocked[_receipt.id];\n emit WithdrawalUnlocked(_receiptHash, _receipt);\n\n address _token = _receipt.mainchain.tokenAddr;\n if (_receipt.info.erc == Token.Standard.ERC20) {\n Token.Info memory _feeInfo = _receipt.info;\n _feeInfo.quantity = _computeFeePercentage(_receipt.info.quantity, unlockFeePercentages[_token]);\n Token.Info memory _withdrawInfo = _receipt.info;\n _withdrawInfo.quantity = _receipt.info.quantity - _feeInfo.quantity;\n\n _feeInfo.handleAssetTransfer(payable(msg.sender), _token, wrappedNativeToken);\n _withdrawInfo.handleAssetTransfer(payable(_receipt.mainchain.addr), _token, wrappedNativeToken);\n } else {\n _receipt.info.handleAssetTransfer(payable(_receipt.mainchain.addr), _token, wrappedNativeToken);\n }\n\n emit Withdrew(_receiptHash, _receipt);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function mapTokens(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards\n ) external virtual onlyAdmin {\n require(_mainchainTokens.length > 0, \"MainchainGatewayV2: query for empty array\");\n _mapTokens(_mainchainTokens, _roninTokens, _standards);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function mapTokensAndThresholds(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards,\n // _thresholds[0]: highTierThreshold\n // _thresholds[1]: lockedThreshold\n // _thresholds[2]: unlockFeePercentages\n // _thresholds[3]: dailyWithdrawalLimit\n uint256[][4] calldata _thresholds\n ) external virtual onlyAdmin {\n require(_mainchainTokens.length > 0, \"MainchainGatewayV2: query for empty array\");\n _mapTokens(_mainchainTokens, _roninTokens, _standards);\n _setHighTierThresholds(_mainchainTokens, _thresholds[0]);\n _setLockedThresholds(_mainchainTokens, _thresholds[1]);\n _setUnlockFeePercentages(_mainchainTokens, _thresholds[2]);\n _setDailyWithdrawalLimits(_mainchainTokens, _thresholds[3]);\n }\n\n /**\n * @inheritdoc IMainchainGatewayV2\n */\n function getRoninToken(address _mainchainToken) public view returns (MappedToken memory _token) {\n _token = _roninToken[_mainchainToken];\n require(_token.tokenAddr != address(0), \"MainchainGatewayV2: unsupported token\");\n }\n\n /**\n * @dev Maps mainchain tokens to Ronin network.\n *\n * Requirement:\n * - The arrays have the same length.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function _mapTokens(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards\n ) internal virtual {\n require(\n _mainchainTokens.length == _roninTokens.length && _mainchainTokens.length == _standards.length,\n \"MainchainGatewayV2: invalid array length\"\n );\n\n for (uint256 _i; _i < _mainchainTokens.length; _i++) {\n _roninToken[_mainchainTokens[_i]].tokenAddr = _roninTokens[_i];\n _roninToken[_mainchainTokens[_i]].erc = _standards[_i];\n }\n\n emit TokenMapped(_mainchainTokens, _roninTokens, _standards);\n }\n\n /**\n * @dev Submits withdrawal receipt.\n *\n * Requirements:\n * - The receipt kind is withdrawal.\n * - The receipt is to withdraw on this chain.\n * - The receipt is not used to withdraw before.\n * - The withdrawal is not reached the limit threshold.\n * - The signer weight total is larger than or equal to the minimum threshold.\n * - The signature signers are in order.\n *\n * Emits the `Withdrew` once the assets are released.\n *\n */\n function _submitWithdrawal(Transfer.Receipt calldata _receipt, Signature[] memory _signatures)\n internal\n virtual\n returns (bool _locked)\n {\n uint256 _id = _receipt.id;\n uint256 _quantity = _receipt.info.quantity;\n address _tokenAddr = _receipt.mainchain.tokenAddr;\n\n _receipt.info.validate();\n require(_receipt.kind == Transfer.Kind.Withdrawal, \"MainchainGatewayV2: invalid receipt kind\");\n require(_receipt.mainchain.chainId == block.chainid, \"MainchainGatewayV2: invalid chain id\");\n MappedToken memory _token = getRoninToken(_receipt.mainchain.tokenAddr);\n require(\n _token.erc == _receipt.info.erc && _token.tokenAddr == _receipt.ronin.tokenAddr,\n \"MainchainGatewayV2: invalid receipt\"\n );\n require(withdrawalHash[_id] == bytes32(0), \"MainchainGatewayV2: query for processed withdrawal\");\n require(\n _receipt.info.erc == Token.Standard.ERC721 || !_reachedWithdrawalLimit(_tokenAddr, _quantity),\n \"MainchainGatewayV2: reached daily withdrawal limit\"\n );\n\n bytes32 _receiptHash = _receipt.hash();\n bytes32 _receiptDigest = Transfer.receiptDigest(_domainSeparator, _receiptHash);\n\n uint256 _minimumVoteWeight;\n (_minimumVoteWeight, _locked) = _computeMinVoteWeight(_receipt.info.erc, _tokenAddr, _quantity);\n\n {\n bool _passed;\n address _signer;\n address _lastSigner;\n Signature memory _sig;\n uint256 _weight;\n for (uint256 _i; _i < _signatures.length; _i++) {\n _sig = _signatures[_i];\n _signer = ecrecover(_receiptDigest, _sig.v, _sig.r, _sig.s);\n require(_lastSigner < _signer, \"MainchainGatewayV2: invalid order\");\n _lastSigner = _signer;\n\n _weight += _getWeight(_signer);\n if (_weight >= _minimumVoteWeight) {\n _passed = true;\n break;\n }\n }\n require(_passed, \"MainchainGatewayV2: query for insufficient vote weight\");\n withdrawalHash[_id] = _receiptHash;\n }\n\n if (_locked) {\n withdrawalLocked[_id] = true;\n emit WithdrawalLocked(_receiptHash, _receipt);\n return _locked;\n }\n\n _recordWithdrawal(_tokenAddr, _quantity);\n _receipt.info.handleAssetTransfer(payable(_receipt.mainchain.addr), _tokenAddr, wrappedNativeToken);\n emit Withdrew(_receiptHash, _receipt);\n }\n\n /**\n * @dev Requests deposit made by `_requester` address.\n *\n * Requirements:\n * - The token info is valid.\n * - The `msg.value` is 0 while depositing ERC20 token.\n * - The `msg.value` is equal to deposit quantity while depositing native token.\n *\n * Emits the `DepositRequested` event.\n *\n */\n function _requestDepositFor(Transfer.Request memory _request, address _requester) internal virtual {\n MappedToken memory _token;\n address _weth = address(wrappedNativeToken);\n\n _request.info.validate();\n if (_request.tokenAddr == address(0)) {\n require(_request.info.quantity == msg.value, \"MainchainGatewayV2: invalid request\");\n _token = getRoninToken(_weth);\n require(_token.erc == _request.info.erc, \"MainchainGatewayV2: invalid token standard\");\n _request.tokenAddr = _weth;\n } else {\n require(msg.value == 0, \"MainchainGatewayV2: invalid request\");\n _token = getRoninToken(_request.tokenAddr);\n require(_token.erc == _request.info.erc, \"MainchainGatewayV2: invalid token standard\");\n _request.info.transferFrom(_requester, address(this), _request.tokenAddr);\n // Withdraw if token is WETH\n if (_weth == _request.tokenAddr) {\n IWETH(_weth).withdraw(_request.info.quantity);\n }\n }\n\n uint256 _depositId = depositCount++;\n Transfer.Receipt memory _receipt = _request.into_deposit_receipt(\n _requester,\n _depositId,\n _token.tokenAddr,\n roninChainId\n );\n\n emit DepositRequested(_receipt.hash(), _receipt);\n }\n\n /**\n * @dev Returns the minimum vote weight for the token.\n */\n function _computeMinVoteWeight(\n Token.Standard _erc,\n address _token,\n uint256 _quantity\n ) internal virtual returns (uint256 _weight, bool _locked) {\n uint256 _totalWeight = _getTotalWeight();\n _weight = _minimumVoteWeight(_totalWeight);\n if (_erc == Token.Standard.ERC20) {\n if (highTierThreshold[_token] <= _quantity) {\n _weight = _highTierVoteWeight(_totalWeight);\n }\n _locked = _lockedWithdrawalRequest(_token, _quantity);\n }\n }\n\n /**\n * @dev Update domain seperator.\n */\n function _updateDomainSeparator() internal {\n _domainSeparator = keccak256(\n abi.encode(\n keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"),\n keccak256(\"MainchainGatewayV2\"),\n keccak256(\"2\"),\n block.chainid,\n address(this)\n )\n );\n }\n\n /**\n * @dev Sets the WETH contract.\n *\n * Emits the `WrappedNativeTokenContractUpdated` event.\n *\n */\n function _setWrappedNativeTokenContract(IWETH _wrapedToken) internal {\n wrappedNativeToken = _wrapedToken;\n emit WrappedNativeTokenContractUpdated(_wrapedToken);\n }\n\n /**\n * @dev Receives ETH from WETH or creates deposit request.\n */\n function _fallback() internal virtual whenNotPaused {\n if (msg.sender != address(wrappedNativeToken)) {\n Transfer.Request memory _request;\n _request.recipientAddr = msg.sender;\n _request.info.quantity = msg.value;\n _requestDepositFor(_request, _request.recipientAddr);\n }\n }\n\n /**\n * @inheritdoc GatewayV2\n */\n function _getTotalWeight() internal view override returns (uint256) {\n return _bridgeOperators.length;\n }\n\n /**\n * @dev Returns the weight of an address.\n */\n function _getWeight(address _addr) internal view returns (uint256) {\n return _bridgeOperatorAddedBlock[_addr] > 0 ? 1 : 0;\n }\n}\n" + }, + "contracts/extensions/WithdrawalLimitation.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./GatewayV2.sol\";\n\nabstract contract WithdrawalLimitation is GatewayV2 {\n /// @dev Emitted when the high-tier vote weight threshold is updated\n event HighTierVoteWeightThresholdUpdated(\n uint256 indexed nonce,\n uint256 indexed numerator,\n uint256 indexed denominator,\n uint256 previousNumerator,\n uint256 previousDenominator\n );\n /// @dev Emitted when the thresholds for high-tier withdrawals that requires high-tier vote weights are updated\n event HighTierThresholdsUpdated(address[] tokens, uint256[] thresholds);\n /// @dev Emitted when the thresholds for locked withdrawals are updated\n event LockedThresholdsUpdated(address[] tokens, uint256[] thresholds);\n /// @dev Emitted when the fee percentages to unlock withdraw are updated\n event UnlockFeePercentagesUpdated(address[] tokens, uint256[] percentages);\n /// @dev Emitted when the daily limit thresholds are updated\n event DailyWithdrawalLimitsUpdated(address[] tokens, uint256[] limits);\n\n uint256 public constant _MAX_PERCENTAGE = 1_000_000;\n\n uint256 internal _highTierVWNum;\n uint256 internal _highTierVWDenom;\n\n /// @dev Mapping from mainchain token => the amount thresholds for high-tier withdrawals that requires high-tier vote weights\n mapping(address => uint256) public highTierThreshold;\n /// @dev Mapping from mainchain token => the amount thresholds to lock withdrawal\n mapping(address => uint256) public lockedThreshold;\n /// @dev Mapping from mainchain token => unlock fee percentages for unlocker\n /// @notice Values 0-1,000,000 map to 0%-100%\n mapping(address => uint256) public unlockFeePercentages;\n /// @dev Mapping from mainchain token => daily limit amount for withdrawal\n mapping(address => uint256) public dailyWithdrawalLimit;\n /// @dev Mapping from token address => today withdrawal amount\n mapping(address => uint256) public lastSyncedWithdrawal;\n /// @dev Mapping from token address => last date synced to record the `lastSyncedWithdrawal`\n mapping(address => uint256) public lastDateSynced;\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n */\n uint256[50] private ______gap;\n\n /**\n * @dev Override `GatewayV2-setThreshold`.\n *\n * Requirements:\n * - The high-tier vote weight threshold must equal to or larger than the normal threshold.\n *\n */\n function setThreshold(uint256 _numerator, uint256 _denominator)\n external\n virtual\n override\n onlyAdmin\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n (_previousNum, _previousDenom) = _setThreshold(_numerator, _denominator);\n _verifyThresholds();\n }\n\n /**\n * @dev Returns the high-tier vote weight threshold.\n */\n function getHighTierVoteWeightThreshold() external view virtual returns (uint256, uint256) {\n return (_highTierVWNum, _highTierVWDenom);\n }\n\n /**\n * @dev Checks whether the `_voteWeight` passes the high-tier vote weight threshold.\n */\n function checkHighTierVoteWeightThreshold(uint256 _voteWeight) external view virtual returns (bool) {\n return _voteWeight * _highTierVWDenom >= _highTierVWNum * _getTotalWeight();\n }\n\n /**\n * @dev Sets high-tier vote weight threshold and returns the old one.\n *\n * Requirements:\n * - The method caller is admin.\n * - The high-tier vote weight threshold must equal to or larger than the normal threshold.\n *\n * Emits the `HighTierVoteWeightThresholdUpdated` event.\n *\n */\n function setHighTierVoteWeightThreshold(uint256 _numerator, uint256 _denominator)\n external\n virtual\n onlyAdmin\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n (_previousNum, _previousDenom) = _setHighTierVoteWeightThreshold(_numerator, _denominator);\n _verifyThresholds();\n }\n\n /**\n * @dev Sets the thresholds for high-tier withdrawals that requires high-tier vote weights.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `HighTierThresholdsUpdated` event.\n *\n */\n function setHighTierThresholds(address[] calldata _tokens, uint256[] calldata _thresholds)\n external\n virtual\n onlyAdmin\n {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setHighTierThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets the amount thresholds to lock withdrawal.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `LockedThresholdsUpdated` event.\n *\n */\n function setLockedThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) external virtual onlyAdmin {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setLockedThresholds(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets fee percentages to unlock withdrawal.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `UnlockFeePercentagesUpdated` event.\n *\n */\n function setUnlockFeePercentages(address[] calldata _tokens, uint256[] calldata _percentages)\n external\n virtual\n onlyAdmin\n {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setUnlockFeePercentages(_tokens, _percentages);\n }\n\n /**\n * @dev Sets daily limit amounts for the withdrawals.\n *\n * Requirements:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `DailyWithdrawalLimitsUpdated` event.\n *\n */\n function setDailyWithdrawalLimits(address[] calldata _tokens, uint256[] calldata _limits) external virtual onlyAdmin {\n require(_tokens.length > 0, \"WithdrawalLimitation: invalid array length\");\n _setDailyWithdrawalLimits(_tokens, _limits);\n }\n\n /**\n * @dev Checks whether the withdrawal reaches the limitation.\n */\n function reachedWithdrawalLimit(address _token, uint256 _quantity) external view virtual returns (bool) {\n return _reachedWithdrawalLimit(_token, _quantity);\n }\n\n /**\n * @dev Sets high-tier vote weight threshold and returns the old one.\n *\n * Emits the `HighTierVoteWeightThresholdUpdated` event.\n *\n */\n function _setHighTierVoteWeightThreshold(uint256 _numerator, uint256 _denominator)\n internal\n returns (uint256 _previousNum, uint256 _previousDenom)\n {\n require(_numerator <= _denominator, \"WithdrawalLimitation: invalid threshold\");\n _previousNum = _highTierVWNum;\n _previousDenom = _highTierVWDenom;\n _highTierVWNum = _numerator;\n _highTierVWDenom = _denominator;\n emit HighTierVoteWeightThresholdUpdated(nonce++, _numerator, _denominator, _previousNum, _previousDenom);\n }\n\n /**\n * @dev Sets the thresholds for high-tier withdrawals that requires high-tier vote weights.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `HighTierThresholdsUpdated` event.\n *\n */\n function _setHighTierThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n require(_tokens.length == _thresholds.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n highTierThreshold[_tokens[_i]] = _thresholds[_i];\n }\n emit HighTierThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets the amount thresholds to lock withdrawal.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `LockedThresholdsUpdated` event.\n *\n */\n function _setLockedThresholds(address[] calldata _tokens, uint256[] calldata _thresholds) internal virtual {\n require(_tokens.length == _thresholds.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n lockedThreshold[_tokens[_i]] = _thresholds[_i];\n }\n emit LockedThresholdsUpdated(_tokens, _thresholds);\n }\n\n /**\n * @dev Sets fee percentages to unlock withdrawal.\n *\n * Requirements:\n * - The array lengths are equal.\n * - The percentage is equal to or less than 100_000.\n *\n * Emits the `UnlockFeePercentagesUpdated` event.\n *\n */\n function _setUnlockFeePercentages(address[] calldata _tokens, uint256[] calldata _percentages) internal virtual {\n require(_tokens.length == _percentages.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n require(_percentages[_i] <= _MAX_PERCENTAGE, \"WithdrawalLimitation: invalid percentage\");\n unlockFeePercentages[_tokens[_i]] = _percentages[_i];\n }\n emit UnlockFeePercentagesUpdated(_tokens, _percentages);\n }\n\n /**\n * @dev Sets daily limit amounts for the withdrawals.\n *\n * Requirements:\n * - The array lengths are equal.\n *\n * Emits the `DailyWithdrawalLimitsUpdated` event.\n *\n */\n function _setDailyWithdrawalLimits(address[] calldata _tokens, uint256[] calldata _limits) internal virtual {\n require(_tokens.length == _limits.length, \"WithdrawalLimitation: invalid array length\");\n for (uint256 _i; _i < _tokens.length; _i++) {\n dailyWithdrawalLimit[_tokens[_i]] = _limits[_i];\n }\n emit DailyWithdrawalLimitsUpdated(_tokens, _limits);\n }\n\n /**\n * @dev Checks whether the withdrawal reaches the daily limitation.\n *\n * Requirements:\n * - The daily withdrawal threshold should not apply for locked withdrawals.\n *\n */\n function _reachedWithdrawalLimit(address _token, uint256 _quantity) internal view virtual returns (bool) {\n if (_lockedWithdrawalRequest(_token, _quantity)) {\n return false;\n }\n\n uint256 _currentDate = block.timestamp / 1 days;\n if (_currentDate > lastDateSynced[_token]) {\n return dailyWithdrawalLimit[_token] <= _quantity;\n } else {\n return dailyWithdrawalLimit[_token] <= lastSyncedWithdrawal[_token] + _quantity;\n }\n }\n\n /**\n * @dev Record withdrawal token.\n */\n function _recordWithdrawal(address _token, uint256 _quantity) internal virtual {\n uint256 _currentDate = block.timestamp / 1 days;\n if (_currentDate > lastDateSynced[_token]) {\n lastDateSynced[_token] = _currentDate;\n lastSyncedWithdrawal[_token] = _quantity;\n } else {\n lastSyncedWithdrawal[_token] += _quantity;\n }\n }\n\n /**\n * @dev Returns whether the withdrawal request is locked or not.\n */\n function _lockedWithdrawalRequest(address _token, uint256 _quantity) internal view virtual returns (bool) {\n return lockedThreshold[_token] <= _quantity;\n }\n\n /**\n * @dev Computes fee percentage.\n */\n function _computeFeePercentage(uint256 _amount, uint256 _percentage) internal view virtual returns (uint256) {\n return (_amount * _percentage) / _MAX_PERCENTAGE;\n }\n\n /**\n * @dev Returns high-tier vote weight.\n */\n function _highTierVoteWeight(uint256 _totalWeight) internal view virtual returns (uint256) {\n return (_highTierVWNum * _totalWeight + _highTierVWDenom - 1) / _highTierVWDenom;\n }\n\n /**\n * @dev Validates whether the high-tier vote weight threshold is larger than the normal threshold.\n */\n function _verifyThresholds() internal view {\n require(_num * _highTierVWDenom <= _highTierVWNum * _denom, \"WithdrawalLimitation: invalid thresholds\");\n }\n}\n" + }, + "contracts/interfaces/IMainchainGatewayV2.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"./IBridge.sol\";\nimport \"./IWETH.sol\";\nimport \"./consumers/SignatureConsumer.sol\";\nimport \"./consumers/MappedTokenConsumer.sol\";\nimport \"../libraries/Transfer.sol\";\n\ninterface IMainchainGatewayV2 is SignatureConsumer, MappedTokenConsumer, IBridge {\n /// @dev Emitted when the deposit is requested\n event DepositRequested(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the assets are withdrawn\n event Withdrew(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the tokens are mapped\n event TokenMapped(address[] mainchainTokens, address[] roninTokens, Token.Standard[] standards);\n /// @dev Emitted when the wrapped native token contract is updated\n event WrappedNativeTokenContractUpdated(IWETH weth);\n /// @dev Emitted when the withdrawal is locked\n event WithdrawalLocked(bytes32 receiptHash, Transfer.Receipt receipt);\n /// @dev Emitted when the withdrawal is unlocked\n event WithdrawalUnlocked(bytes32 receiptHash, Transfer.Receipt receipt);\n\n /**\n * @dev Returns the domain seperator.\n */\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n\n /**\n * @dev Returns deposit count.\n */\n function depositCount() external view returns (uint256);\n\n /**\n * @dev Sets the wrapped native token contract.\n *\n * Requirements:\n * - The method caller is admin.\n *\n * Emits the `WrappedNativeTokenContractUpdated` event.\n *\n */\n function setWrappedNativeTokenContract(IWETH _wrappedToken) external;\n\n /**\n * @dev Returns whether the withdrawal is locked.\n */\n function withdrawalLocked(uint256 withdrawalId) external view returns (bool);\n\n /**\n * @dev Returns the withdrawal hash.\n */\n function withdrawalHash(uint256 withdrawalId) external view returns (bytes32);\n\n /**\n * @dev Locks the assets and request deposit.\n */\n function requestDepositFor(Transfer.Request calldata _request) external payable;\n\n /**\n * @dev Withdraws based on the receipt and the validator signatures.\n * Returns whether the withdrawal is locked.\n *\n * Emits the `Withdrew` once the assets are released.\n *\n */\n function submitWithdrawal(Transfer.Receipt memory _receipt, Signature[] memory _signatures)\n external\n returns (bool _locked);\n\n /**\n * @dev Approves a specific withdrawal.\n *\n * Requirements:\n * - The method caller is a validator.\n *\n * Emits the `Withdrew` once the assets are released.\n *\n */\n function unlockWithdrawal(Transfer.Receipt calldata _receipt) external;\n\n /**\n * @dev Maps mainchain tokens to Ronin network.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokens(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards\n ) external;\n\n /**\n * @dev Maps mainchain tokens to Ronin network and sets thresholds.\n *\n * Requirement:\n * - The method caller is admin.\n * - The arrays have the same length and its length larger than 0.\n *\n * Emits the `TokenMapped` event.\n *\n */\n function mapTokensAndThresholds(\n address[] calldata _mainchainTokens,\n address[] calldata _roninTokens,\n Token.Standard[] calldata _standards,\n uint256[][4] calldata _thresholds\n ) external;\n\n /**\n * @dev Returns token address on Ronin network.\n * Note: Reverts for unsupported token.\n */\n function getRoninToken(address _mainchainToken) external view returns (MappedToken memory _token);\n}\n" + }, + "contracts/mocks/MockSlashIndicatorExtended.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"./MockPrecompile.sol\";\nimport \"../ronin/slash-indicator/SlashIndicator.sol\";\n\ncontract MockSlashIndicatorExtended is SlashIndicator, MockPrecompile {\n function slashFelony(address _validatorAddr) external {\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\n }\n\n function slashMisdemeanor(address _validatorAddr) external {\n _validatorContract.execSlash(_validatorAddr, 0, 0, false);\n }\n\n function _pcValidateEvidence(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) internal pure override returns (bool _validEvidence) {\n return validatingDoubleSignProof(_consensusAddr, _header1, _header2);\n }\n}\n" + }, + "contracts/mocks/sorting/MockSorting.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol\";\nimport \"../libraries/Sorting.sol\";\n\ncontract MockSorting {\n uint256[] public data;\n\n function addData(uint256[] memory _data) public {\n for (uint256 i; i < _data.length; i++) {\n data.push(_data[i]);\n }\n }\n\n function sort(uint256[] memory _data) public pure returns (uint256[] memory) {\n return Sorting.sort(_data);\n }\n\n function sortOnStorage() public returns (uint256[] memory, uint256) {\n uint256[] memory _tmpData = data;\n data = Sorting.sort(_tmpData);\n\n return (data, data.length);\n }\n\n function sortAddressesAndValues(address[] calldata _addrs, uint256[] calldata _values)\n public\n pure\n returns (address[] memory)\n {\n return Sorting.sort(_addrs, _values);\n }\n}\n" + }, + "contracts/mocks/MockStaking.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../extensions/consumers/GlobalConfigConsumer.sol\";\nimport \"../ronin/staking/RewardCalculation.sol\";\n\ncontract MockStaking is RewardCalculation, GlobalConfigConsumer {\n /// @dev Mapping from user => staking balance\n mapping(address => uint256) internal _stakingAmount;\n /// @dev Mapping from period number => slashed\n mapping(uint256 => bool) internal _periodSlashed;\n\n uint256 internal _stakingTotal;\n\n uint256 public lastUpdatedPeriod;\n uint256 public pendingReward;\n address public poolAddr;\n\n constructor(address _poolAddr) {\n poolAddr = _poolAddr;\n }\n\n function firstEverWrapup() external {\n delete pendingReward;\n lastUpdatedPeriod = block.timestamp / PERIOD_DURATION + 1;\n }\n\n function endPeriod() external {\n address[] memory _addrs = new address[](1);\n uint256[] memory _rewards = new uint256[](1);\n _addrs[0] = poolAddr;\n _rewards[0] = pendingReward;\n this.execRecordRewards(_addrs, _rewards);\n\n pendingReward = 0;\n lastUpdatedPeriod++;\n }\n\n function increasePeriod() external {\n lastUpdatedPeriod++;\n }\n\n function stake(address _user, uint256 _amount) external {\n uint256 _lastStakingAmount = _stakingAmount[_user];\n uint256 _newStakingAmount = _lastStakingAmount + _amount;\n _syncUserReward(poolAddr, _user, _newStakingAmount);\n _stakingAmount[_user] = _newStakingAmount;\n _stakingTotal += _amount;\n }\n\n function unstake(address _user, uint256 _amount) external {\n uint256 _lastStakingAmount = _stakingAmount[_user];\n uint256 _newStakingAmount = _lastStakingAmount - _amount;\n _syncUserReward(poolAddr, _user, _newStakingAmount);\n _stakingAmount[_user] = _newStakingAmount;\n _stakingTotal -= _amount;\n }\n\n function increaseReward(uint256 _amount) external {\n pendingReward += _amount;\n }\n\n function decreaseReward(uint256 _amount) external {\n pendingReward -= _amount;\n }\n\n function execRecordRewards(address[] calldata _addrList, uint256[] calldata _rewards) external {\n _recordRewards(_addrList, _rewards, _currentPeriod());\n }\n\n function getPeriod() public view returns (uint256) {\n return _currentPeriod();\n }\n\n function claimReward(address _user) external returns (uint256 _amount) {\n _amount = _claimReward(poolAddr, _user, getPeriod());\n }\n\n function getStakingAmount(address, address _user) public view override returns (uint256) {\n return _stakingAmount[_user];\n }\n\n function getManyStakingAmounts(address[] calldata _poolAddrs, address[] calldata _userList)\n external\n view\n override\n returns (uint256[] memory)\n {}\n\n function getStakingTotal(address _addr) public view virtual override returns (uint256) {\n return _addr == poolAddr ? _stakingTotal : 0;\n }\n\n function _currentPeriod() internal view override returns (uint256 _period) {\n return lastUpdatedPeriod;\n }\n\n function getManyStakingTotals(address[] calldata _poolAddr) external view override returns (uint256[] memory) {}\n}\n" + }, + "contracts/mocks/precompile-usages/MockPCUValidateDoubleSign.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../precompile-usages/PCUValidateDoubleSign.sol\";\n\ncontract MockPCUValidateDoubleSign is PCUValidateDoubleSign {\n address internal _precompileValidateDoubleSignAddress;\n\n constructor(address _precompile) {\n setPrecompileValidateDoubleSignAddress(_precompile);\n }\n\n function setPrecompileValidateDoubleSignAddress(address _addr) public {\n _precompileValidateDoubleSignAddress = _addr;\n }\n\n function precompileValidateDoubleSignAddress() public view override returns (address) {\n return _precompileValidateDoubleSignAddress;\n }\n\n function callPrecompile(\n address _consensusAddr,\n bytes calldata _header1,\n bytes calldata _header2\n ) public view returns (bool) {\n return _pcValidateEvidence(_consensusAddr, _header1, _header2);\n }\n}\n" + }, + "contracts/mocks/precompile-usages/MockPCUSortValidators.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../precompile-usages/PCUSortValidators.sol\";\n\ncontract MockPCUSortValidators is PCUSortValidators {\n address internal _precompileSortValidatorAddress;\n\n constructor(address _precompile) {\n setPrecompileSortValidatorAddress(_precompile);\n }\n\n function setPrecompileSortValidatorAddress(address _addr) public {\n _precompileSortValidatorAddress = _addr;\n }\n\n function precompileSortValidatorsAddress() public view override returns (address) {\n return _precompileSortValidatorAddress;\n }\n\n function callPrecompile(address[] calldata _validators, uint256[] calldata _weights)\n public\n view\n returns (address[] memory _result)\n {\n return _pcSortCandidates(_validators, _weights);\n }\n}\n" + }, + "contracts/mocks/precompile-usages/MockPCUPickValidatorSet.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../precompile-usages/PCUPickValidatorSet.sol\";\n\ncontract MockPCUPickValidatorSet is PCUPickValidatorSet {\n address internal _precompileSortValidatorAddress;\n\n constructor(address _precompile) {\n setPrecompileSortValidatorAddress(_precompile);\n }\n\n function setPrecompileSortValidatorAddress(address _addr) public {\n _precompileSortValidatorAddress = _addr;\n }\n\n function precompilePickValidatorSetAddress() public view override returns (address) {\n return _precompileSortValidatorAddress;\n }\n\n function callPrecompile(\n address[] memory _candidates,\n uint256[] memory _weights,\n uint256[] memory _trustedWeights,\n uint256 _maxValidatorNumber,\n uint256 _maxPrioritizedValidatorNumber\n ) public view returns (address[] memory _result) {\n (_result, ) = _pcPickValidatorSet(\n _candidates,\n _weights,\n _trustedWeights,\n _maxValidatorNumber,\n _maxPrioritizedValidatorNumber\n );\n }\n}\n" + }, + "contracts/mocks/ronin/MockRoninGatewayV2Extended.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\nimport \"../../ronin/gateway/RoninGatewayV2.sol\";\n\ncontract MockRoninGatewayV2Extended is RoninGatewayV2 {\n /*\n * @dev Returns the vote weight for a deposit based on its corressponding hash.\n */\n function getDepositVoteWeight(\n uint256 _chainId,\n uint256 _depositId,\n bytes32 _hash\n ) external view returns (uint256, uint256) {\n return _getVoteWeight(depositVote[_chainId][_depositId], _hash);\n }\n\n /**\n * @dev Returns the vote weight for a mainchain withdrew acknowledgement based on its corressponding hash.\n */\n function getMainchainWithdrewVoteWeight(uint256 _withdrawalId, bytes32 _hash)\n external\n view\n returns (uint256, uint256)\n {\n return _getVoteWeight(mainchainWithdrewVote[_withdrawalId], _hash);\n }\n\n /**\n * @dev Returns the vote weight for a withdraw stats based on its corressponding hash.\n */\n function getWithdrawalStatVoteWeight(uint256 _withdrawalId, bytes32 _hash) external view returns (uint256, uint256) {\n return _getVoteWeight(withdrawalStatVote[_withdrawalId], _hash);\n }\n}\n" + }, + "contracts/mocks/MockTransferFallback.sol": { + "content": "// SPDX-License-Identifier: MIT\npragma solidity ^0.8.9;\n\nimport \"../extensions/RONTransferHelper.sol\";\n\ncontract MockPaymentFallback {\n event SafeReceived(address indexed sender, uint256 value);\n\n /// @dev Fallback function accepts ether transactions.\n receive() external payable {\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n\ncontract MockPaymentFallbackExpensive {\n uint[] public array;\n event SafeReceived(address indexed sender, uint256 value);\n\n constructor() {\n array.push(0);\n }\n\n /// @dev Fallback function accepts ether transactions and set non-zero value to a zero value slot.\n receive() external payable {\n array.push(block.number);\n emit SafeReceived(msg.sender, msg.value);\n }\n}\n\ncontract MockTransfer is RONTransferHelper {\n uint256 public track;\n\n constructor() payable {}\n\n function fooTransfer(\n address payable _recipient,\n uint256 _amount,\n uint256 _gas\n ) external {\n if (_unsafeSendRON(_recipient, _amount, _gas)) {\n track++;\n }\n }\n}\n" + }, + "contracts/mocks/forwarder/MockForwarderTarget.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.9;\n\nimport \"../../extensions/RONTransferHelper.sol\";\n\ncontract MockForwarderTarget is RONTransferHelper {\n address public owner;\n uint256 public data;\n\n event TargetWithdrawn(address indexed _origin, address indexed _caller, address indexed _recipient);\n\n error ErrIntentionally();\n\n modifier onlyOwner() {\n require(msg.sender == owner, \"MockForwarderContract: only owner can call method\");\n _;\n }\n\n fallback() external payable {\n _fallback();\n }\n\n receive() external payable {\n _fallback();\n }\n\n constructor(address _owner, uint256 _data) payable {\n owner = _owner;\n data = _data;\n }\n\n function foo(uint256 _data) external onlyOwner {\n data = _data;\n }\n\n function fooPayable(uint256 _data) external payable onlyOwner {\n data = _data;\n }\n\n function fooSilentRevert() external view onlyOwner {\n revert();\n }\n\n function fooCustomErrorRevert() external view onlyOwner {\n revert ErrIntentionally();\n }\n\n function fooRevert() external view onlyOwner {\n revert(\"MockForwarderContract: revert intentionally\");\n }\n\n function getBalance() external view returns (uint256) {\n return address(this).balance;\n }\n\n function withdrawAll() external onlyOwner {\n emit TargetWithdrawn(tx.origin, msg.sender, msg.sender);\n _transferRON(payable(msg.sender), address(this).balance);\n }\n\n function _fallback() private pure {\n revert(\"MockForwardTarget: hello from fallback\");\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 10 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "storageLayout" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/src/deploy/proxy/ronin-validator-proxy.ts b/src/deploy/proxy/validator-set-proxy.ts similarity index 100% rename from src/deploy/proxy/ronin-validator-proxy.ts rename to src/deploy/proxy/validator-set-proxy.ts diff --git a/src/upgrades/230515-change-min-commission-rate-5-percent.ts b/src/upgrades/230515-change-min-commission-rate-5-percent.ts new file mode 100644 index 000000000..0f27a1c72 --- /dev/null +++ b/src/upgrades/230515-change-min-commission-rate-5-percent.ts @@ -0,0 +1,91 @@ +/// npx hardhat deploy --tags 230515ChangeMinCommissionRate5Percent --network ronin-mainnet + +/// This script does the following: +/// - Upgrade Maintenance, Staking, Validator contract +/// - Set `minCommissionRate` +/// - Set new enforcer for gateway + +import { BigNumber } from 'ethers'; +import { HardhatRuntimeEnvironment } from 'hardhat/types'; +import { VoteType } from '../script/proposal'; +import { GatewayV2__factory, Staking__factory } from '../types'; +import { StakingArguments } from '../utils'; +import { proxyCall, proxyInterface } from './upgradeUtils'; + +const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => { + const { execute } = deployments; + let { governor } = await getNamedAccounts(); // NOTE: Should double check the `governor` account in the `hardhat.config.ts` file + console.log('Governor:', governor); + + /// Upgrade contracts + + const newMaintenanceLogic = '0xB6a13e481f060c6a9130238EEb84a3c98A0A5FEa'; + const newValidatorSetLogic = '0xaB2985fa821CAae0524f6C5657aE40DaBDf2Eae0'; + const newStakingLogic = '0x9B0E61e629EB44875CFf534DE0c176078CaC502f'; + const newRoninPauseEnforcerLogic = '0x2367cD5468c2b3cD18aA74AdB7e14E43426aF837'; + + const maintenanceProxy = await deployments.get('MaintenanceProxy'); + const validatorSetProxy = await deployments.get('ValidatorSetProxy'); + const stakingProxy = await deployments.get('StakingProxy'); + const roninGatewayProxy = await deployments.get('RoninGatewayV2Proxy'); + + const maintenanceInstructions = [proxyInterface.encodeFunctionData('upgradeTo', [newMaintenanceLogic])]; + const validatorSetInstructions = [proxyInterface.encodeFunctionData('upgradeTo', [newValidatorSetLogic])]; + + /// Set `minCommissionRate` + + const StakingInterface = new Staking__factory().interface; + const newStakingConfig: StakingArguments = { + minCommissionRate: BigNumber.from(5_00), + maxCommissionRate: BigNumber.from(20_00), + }; + + const stakingInstructions = [ + proxyInterface.encodeFunctionData('upgradeTo', [newStakingLogic]), + proxyCall( + StakingInterface.encodeFunctionData('setCommissionRateRange', [ + newStakingConfig.minCommissionRate, + newStakingConfig.maxCommissionRate, + ]) + ), + ]; + + /// Set new enforcer for gateway + const GatewayInterface = GatewayV2__factory.createInterface(); + const gatewayInstructions = [ + proxyCall(GatewayInterface.encodeFunctionData('setEmergencyPauser', [newRoninPauseEnforcerLogic])), + ]; + + const blockNumBefore = await ethers.provider.getBlockNumber(); + const blockBefore = await ethers.provider.getBlock(blockNumBefore); + const timestampBefore = blockBefore.timestamp; + const proposalExpiryTimestamp = timestampBefore + 3600 * 24 * 10; // expired in 10 days + + // NOTE: Should double check the RoninGovernanceAdmin address in `deployments` folder is 0x946397deDFd2f79b75a72B322944a21C3240c9c3 + const tx = await execute( + 'RoninGovernanceAdmin', + { from: governor, log: true }, + 'proposeProposalForCurrentNetwork', + proposalExpiryTimestamp, // expiryTimestamp + [ + ...maintenanceInstructions.map(() => maintenanceProxy.address), + ...validatorSetInstructions.map(() => validatorSetProxy.address), + ...stakingInstructions.map(() => stakingProxy.address), + ...gatewayInstructions.map(() => roninGatewayProxy.address), + ], // targets + [...maintenanceInstructions, ...validatorSetInstructions, ...stakingInstructions, ...gatewayInstructions].map( + () => 0 + ), // values + [...maintenanceInstructions, ...validatorSetInstructions, ...stakingInstructions, ...gatewayInstructions], // datas + [...maintenanceInstructions, ...validatorSetInstructions, ...stakingInstructions, ...gatewayInstructions].map( + () => 1_000_000 + ), // gasAmounts + VoteType.For // ballot type + ); + + console.log(`https://explorer.roninchain.com/tx/${tx.transactionHash}`); +}; + +deploy.tags = ['230515ChangeMinCommissionRate5Percent']; + +export default deploy; diff --git a/src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts b/src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts new file mode 100644 index 000000000..b51788b80 --- /dev/null +++ b/src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts @@ -0,0 +1,65 @@ +/// npx hardhat deploy --tags 230516SetNewEnforcerMainchainGateway --network ronin-mainnet + +/// This script does the following: +/// - Set new enforcer for mainchain gateway + +/// Governor who proposes this proposal must manually vote it after running this script. + +import { HardhatRuntimeEnvironment } from 'hardhat/types'; +import { GatewayV2__factory } from '../types'; +import { proxyCall } from './upgradeUtils'; + +const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => { + const { execute } = deployments; + let { governor } = await getNamedAccounts(); // NOTE: Should double check the `governor` account in the `hardhat.config.ts` file + console.log('Governor:', governor); + + const newMainchainPauseEnforcerLogic = ''; // TODO: Should input new pause enforcer here + const mainchainGatewayProxy = await deployments.get('MainchainGatewayV2Proxy'); + + if (newMainchainPauseEnforcerLogic == '') { + console.log('Error: Address of new enforcer not set.'); + return; + } + + /// Set new enforcer for gateway + const GatewayInterface = GatewayV2__factory.createInterface(); + const gatewayInstructions = [ + proxyCall(GatewayInterface.encodeFunctionData('setEmergencyPauser', [newMainchainPauseEnforcerLogic])), + ]; + + const blockNumBefore = await ethers.provider.getBlockNumber(); + const blockBefore = await ethers.provider.getBlock(blockNumBefore); + const timestampBefore = blockBefore.timestamp; + const proposalExpiryTimestamp = timestampBefore + 3600 * 24 * 10; // expired in 10 days + const proposalChainId = 1; + + // NOTE: Should double check the RoninGovernanceAdmin address in `deployments` folder is 0x946397deDFd2f79b75a72B322944a21C3240c9c3 + const tx = await execute( + 'RoninGovernanceAdmin', + { from: governor, log: true }, + 'propose', + + // function propose( + // uint256 _chainId, + // uint256 _expiryTimestamp, + // address[] calldata _targets, + // uint256[] calldata _values, + // bytes[] calldata _calldatas, + // uint256[] calldata _gasAmounts + // ) + + proposalChainId, + proposalExpiryTimestamp, // expiryTimestamp + gatewayInstructions.map(() => mainchainGatewayProxy.address), // targets + gatewayInstructions.map(() => 0), // values + gatewayInstructions, // datas + gatewayInstructions.map(() => 1_000_000) // gasAmounts + ); + + console.log(`https://explorer.roninchain.com/tx/${tx.transactionHash}`); +}; + +deploy.tags = ['230516SetNewEnforcerMainchainGateway']; + +export default deploy; diff --git a/src/utils.ts b/src/utils.ts index 6d49af7c7..a55a3d260 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -92,6 +92,7 @@ export interface MaintenanceConfig { export interface StakingArguments { minValidatorStakingAmount?: BigNumberish; + minCommissionRate?: BigNumberish; maxCommissionRate?: BigNumberish; cooldownSecsToUndelegate?: BigNumberish; waitingSecsToRevoke?: BigNumberish; From 8134c49356ff14a2a10c4bd6a50c36f5e2470b1c Mon Sep 17 00:00:00 2001 From: Bao Date: Wed, 17 May 2023 11:24:47 +0700 Subject: [PATCH 10/10] [Upgrade] Fix set commission rate script (#225) * fix script * fix explorer url * fix mainchain script --- src/upgrades/230406-update-slash-conditions.ts | 4 ++-- src/upgrades/230411-add-GVs.ts | 4 ++-- .../230515-change-min-commission-rate-5-percent.ts | 10 +++++----- .../230516-set-pause-enforcer-mainchain-gateway.ts | 8 ++++---- src/upgrades/upgradeUtils.ts | 2 ++ 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/upgrades/230406-update-slash-conditions.ts b/src/upgrades/230406-update-slash-conditions.ts index 3979bb5c2..f7d7f879d 100644 --- a/src/upgrades/230406-update-slash-conditions.ts +++ b/src/upgrades/230406-update-slash-conditions.ts @@ -5,7 +5,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { VoteType } from '../script/proposal'; import { RoninValidatorSet__factory, SlashIndicator__factory } from '../types'; import { SlashIndicatorArguments } from '../utils'; -import { proxyCall, proxyInterface } from './upgradeUtils'; +import { EXPLORER_URL, proxyCall, proxyInterface } from './upgradeUtils'; const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => { const { execute } = deployments; @@ -91,7 +91,7 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE VoteType.For // ballot type ); - console.log(`https://explorer.roninchain.com/tx/${tx.transactionHash}`); + console.log(`${EXPLORER_URL}/tx/${tx.transactionHash}`); }; deploy.tags = ['230406UpdateSlashConditions']; diff --git a/src/upgrades/230411-add-GVs.ts b/src/upgrades/230411-add-GVs.ts index 984e4ba5e..869f3a1f6 100644 --- a/src/upgrades/230411-add-GVs.ts +++ b/src/upgrades/230411-add-GVs.ts @@ -3,7 +3,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { VoteType } from '../script/proposal'; import { RoninTrustedOrganization__factory } from '../types'; -import { proxyCall } from './upgradeUtils'; +import { EXPLORER_URL, proxyCall } from './upgradeUtils'; const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => { const { execute } = deployments; @@ -124,7 +124,7 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE trustedOrgInstructions.map(() => 2_000_000) // gasAmounts ); - console.log(`https://explorer.roninchain.com/tx/${tx.transactionHash}`); + console.log(`${EXPLORER_URL}/tx/${tx.transactionHash}`); }; deploy.tags = ['230411AddGVs']; diff --git a/src/upgrades/230515-change-min-commission-rate-5-percent.ts b/src/upgrades/230515-change-min-commission-rate-5-percent.ts index 0f27a1c72..25cece198 100644 --- a/src/upgrades/230515-change-min-commission-rate-5-percent.ts +++ b/src/upgrades/230515-change-min-commission-rate-5-percent.ts @@ -10,7 +10,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { VoteType } from '../script/proposal'; import { GatewayV2__factory, Staking__factory } from '../types'; import { StakingArguments } from '../utils'; -import { proxyCall, proxyInterface } from './upgradeUtils'; +import { EXPLORER_URL, proxyCall, proxyInterface } from './upgradeUtils'; const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => { const { execute } = deployments; @@ -25,9 +25,9 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE const newRoninPauseEnforcerLogic = '0x2367cD5468c2b3cD18aA74AdB7e14E43426aF837'; const maintenanceProxy = await deployments.get('MaintenanceProxy'); - const validatorSetProxy = await deployments.get('ValidatorSetProxy'); + const validatorSetProxy = await deployments.get('RoninValidatorSetProxy'); const stakingProxy = await deployments.get('StakingProxy'); - const roninGatewayProxy = await deployments.get('RoninGatewayV2Proxy'); + const roninGatewayAddress = '0x0cf8ff40a508bdbc39fbe1bb679dcba64e65c7df'; const maintenanceInstructions = [proxyInterface.encodeFunctionData('upgradeTo', [newMaintenanceLogic])]; const validatorSetInstructions = [proxyInterface.encodeFunctionData('upgradeTo', [newValidatorSetLogic])]; @@ -71,7 +71,7 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE ...maintenanceInstructions.map(() => maintenanceProxy.address), ...validatorSetInstructions.map(() => validatorSetProxy.address), ...stakingInstructions.map(() => stakingProxy.address), - ...gatewayInstructions.map(() => roninGatewayProxy.address), + ...gatewayInstructions.map(() => roninGatewayAddress), ], // targets [...maintenanceInstructions, ...validatorSetInstructions, ...stakingInstructions, ...gatewayInstructions].map( () => 0 @@ -83,7 +83,7 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE VoteType.For // ballot type ); - console.log(`https://explorer.roninchain.com/tx/${tx.transactionHash}`); + console.log(`${EXPLORER_URL}/tx/${tx.transactionHash}`); }; deploy.tags = ['230515ChangeMinCommissionRate5Percent']; diff --git a/src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts b/src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts index b51788b80..bb75ae2f7 100644 --- a/src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts +++ b/src/upgrades/230516-set-pause-enforcer-mainchain-gateway.ts @@ -7,7 +7,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types'; import { GatewayV2__factory } from '../types'; -import { proxyCall } from './upgradeUtils'; +import { EXPLORER_URL, proxyCall } from './upgradeUtils'; const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeEnvironment) => { const { execute } = deployments; @@ -15,7 +15,7 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE console.log('Governor:', governor); const newMainchainPauseEnforcerLogic = ''; // TODO: Should input new pause enforcer here - const mainchainGatewayProxy = await deployments.get('MainchainGatewayV2Proxy'); + const mainchainGatewayProxyAddress = '0x1A2a1c938CE3eC39b6D47113c7955bAa9DD454F2'; // NOTE: Please double check this address if (newMainchainPauseEnforcerLogic == '') { console.log('Error: Address of new enforcer not set.'); @@ -51,13 +51,13 @@ const deploy = async ({ getNamedAccounts, deployments, ethers }: HardhatRuntimeE proposalChainId, proposalExpiryTimestamp, // expiryTimestamp - gatewayInstructions.map(() => mainchainGatewayProxy.address), // targets + gatewayInstructions.map(() => mainchainGatewayProxyAddress), // targets gatewayInstructions.map(() => 0), // values gatewayInstructions, // datas gatewayInstructions.map(() => 1_000_000) // gasAmounts ); - console.log(`https://explorer.roninchain.com/tx/${tx.transactionHash}`); + console.log(`${EXPLORER_URL}/tx/${tx.transactionHash}`); }; deploy.tags = ['230516SetNewEnforcerMainchainGateway']; diff --git a/src/upgrades/upgradeUtils.ts b/src/upgrades/upgradeUtils.ts index 833ec28bf..25e5dbef0 100644 --- a/src/upgrades/upgradeUtils.ts +++ b/src/upgrades/upgradeUtils.ts @@ -4,3 +4,5 @@ import { TransparentUpgradeableProxyV2__factory } from '../types'; export const proxyInterface = new TransparentUpgradeableProxyV2__factory().interface; export const proxyCall = (calldata: BytesLike) => proxyInterface.encodeFunctionData('functionDelegateCall', [calldata]); + +export const EXPLORER_URL = 'https://app.roninchain.com';